Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+74 -75
View File
@@ -42,7 +42,7 @@
#endif
#ifdef JA2BETAVERSION
#define VIEWER_LEFT 15
#define VIEWER_TOP 15
#define VIEWER_WIDTH 417
@@ -183,9 +183,9 @@ BOOLEAN gfRenderMap;
BOOLEAN gfViewEnemies = TRUE;
INT8 gbViewLevel = 0;
UINT16 gusBlue;
UINT16 gusLtBlue;
UINT16 gusDkBlue;
UINT16 gusBlue;
UINT16 gusLtBlue;
UINT16 gusDkBlue;
INT16 gsAINumAdmins = -1;
INT16 gsAINumTroops = -1;
@@ -241,7 +241,7 @@ void StringFromValue( STR16 str, INT32 iValue, UINT32 uiMax )
BOOLEAN CreateAIViewer()
{
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
CHAR16 str[6];
//Kaiden: Loading INI file to read Values...
@@ -251,11 +251,11 @@ BOOLEAN CreateAIViewer()
//INT32 iMaxEnemyGroupSize = iniReader.ReadInteger("Options","MAX_STRATEGIC_TEAM_SIZE",20);
//Check to see if data exists.
if( !FileExists( "DevTools\\arulco.sti" ) ||
if( !FileExists( "DevTools\\arulco.sti" ) ||
!FileExists( "DevTools\\icons.sti" ) ||
!FileExists( "DevTools\\SmCheckbox.sti" ) )
{
ScreenMsg( FONT_WHITE, MSG_BETAVERSION, L"AIViewer missing data. Aborted." );
ScreenMsg( FONT_WHITE, MSG_BETAVERSION, L"AIViewer missing data. Aborted." );
gfExitViewer = FALSE;
gfViewerEntry = TRUE;
return FALSE;
@@ -275,106 +275,106 @@ BOOLEAN CreateAIViewer()
gfRenderViewer = TRUE;
//Create all of the buttons here
iViewerButton[ VIEWER_EXIT ] =
iViewerButton[ VIEWER_EXIT ] =
CreateTextButton(L"Exit", BLOCKFONT2, FONT_RED, FONT_BLACK, BUTTON_USE_DEFAULT,
585, 425, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
585, 425, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
ViewerExitCallback );
iViewerButton[ VIEWER_TIMEPANEL ] =
iViewerButton[ VIEWER_TIMEPANEL ] =
CreateTextButton( WORLDTIMESTR, FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 3, 0, 88, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, BUTTON_NO_CALLBACK,
BUTTON_NO_CALLBACK );
DisableButton( iViewerButton[ VIEWER_TIMEPANEL ] );
SpecifyDisabledButtonStyle( iViewerButton[ VIEWER_TIMEPANEL ], DISABLED_STYLE_NONE );
iViewerButton[ COMPRESSION0 ] =
iViewerButton[ COMPRESSION0 ] =
CreateTextButton( L"0", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 3, 20, 17, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
Compression0Callback );
iViewerButton[ COMPRESSION5 ] =
iViewerButton[ COMPRESSION5 ] =
CreateTextButton( L"5", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 20, 20, 17, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
Compression5Callback );
iViewerButton[ COMPRESSION15 ] =
iViewerButton[ COMPRESSION15 ] =
CreateTextButton( L"15", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 37, 20, 18, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
Compression15Callback );
iViewerButton[ COMPRESSION60 ] =
iViewerButton[ COMPRESSION60 ] =
CreateTextButton( L"60", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 55, 20, 18, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
Compression60Callback );
/*
iViewerButton[ COMPRESSION6H ] =
iViewerButton[ COMPRESSION6H ] =
CreateTextButton( L"6H", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 73, 20, 18, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
Compression6HCallback );
*/
iViewerButton[ VIEWER_RESET ] =
iViewerButton[ VIEWER_RESET ] =
CreateTextButton( L"Reset Enemies", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
526, 0, 114, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, BUTTON_NO_CALLBACK,
BUTTON_NO_CALLBACK );
DisableButton( iViewerButton[ VIEWER_RESET ] );
SpecifyDisabledButtonStyle( iViewerButton[ VIEWER_RESET ], DISABLED_STYLE_NONE );
iViewerButton[ RESET_EASY ] =
iViewerButton[ RESET_EASY ] =
CreateTextButton( L"Easy", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
526, 20, 35, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
EasyCallback );
iViewerButton[ RESET_NORMAL ] =
iViewerButton[ RESET_NORMAL ] =
CreateTextButton( L"Normal", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
561, 20, 44, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
NormalCallback );
iViewerButton[ RESET_HARD ] =
iViewerButton[ RESET_HARD ] =
CreateTextButton( L"Hard", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
605, 20, 35, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
HardCallback );
iViewerButton[ TEST_INCOMING_4SIDES ] =
iViewerButton[ TEST_INCOMING_4SIDES ] =
CreateTextButton( L"Incoming 4 Sides", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 20, 100, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
TestIncoming4SidesCallback );
iViewerButton[ START_CREATURE_QUEST ] =
iViewerButton[ START_CREATURE_QUEST ] =
CreateTextButton( L"Start Creature Quest", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 20, 125, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
StartCreatureQuestCallback );
iViewerButton[ SPREAD_CREATURES ] =
iViewerButton[ SPREAD_CREATURES ] =
CreateTextButton( L"Spread Creatures", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 20, 150, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
SpreadCreaturesCallback );
iViewerButton[ CREATURE_ATTACK ] =
iViewerButton[ CREATURE_ATTACK ] =
CreateTextButton( L"Creature Attack", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 20, 175, 120, 18, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
CreatureAttackCallback );
iViewerButton[ QUEEN_AWAKE_TOGGLE ] =
iViewerButton[ QUEEN_AWAKE_TOGGLE ] =
CreateCheckBoxButton( 104, VIEWER_BOTTOM + 22, "DevTools//SmCheckbox.sti", MSYS_PRIORITY_HIGH, ToggleQueenAwake );
if( gfQueenAIAwake )
{
ButtonList[ iViewerButton[ QUEEN_AWAKE_TOGGLE ] ]->uiFlags |= BUTTON_CLICKED_ON;
}
iViewerButton[ RELOAD_SECTOR ] =
iViewerButton[ RELOAD_SECTOR ] =
CreateTextButton( L"Override Sector", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
10, VIEWER_BOTTOM + 5, 90, 18, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
ReloadSectorCallback );
iViewerButton[ VIEW_ENEMIES ] =
iViewerButton[ VIEW_ENEMIES ] =
CreateTextButton( L"View Enemies", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 13, 40, 90, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
ViewEnemiesCallback );
iViewerButton[ VIEW_CREATURES ] =
iViewerButton[ VIEW_CREATURES ] =
CreateTextButton( L"View Creatures", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 103, 40, 90, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
ViewCreaturesCallback );
iViewerButton[ BASEMENT1_BTN ] =
iViewerButton[ BASEMENT1_BTN ] =
CreateTextButton( L"B1", FONT16ARIAL, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 58, 60, 30, 24, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
B1Callback );
iViewerButton[ BASEMENT2_BTN ] =
iViewerButton[ BASEMENT2_BTN ] =
CreateTextButton( L"B2", FONT16ARIAL, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 88, 60, 30, 24, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
B2Callback );
iViewerButton[ BASEMENT3_BTN ] =
iViewerButton[ BASEMENT3_BTN ] =
CreateTextButton( L"B3", FONT16ARIAL, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
VIEWER_RIGHT + 118, 60, 30, 24, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
B3Callback );
@@ -402,7 +402,7 @@ BOOLEAN CreateAIViewer()
ButtonList[ iViewerButton[ RESET_EASY + gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY ] ]->uiFlags |= BUTTON_CLICKED_ON;
ButtonList[ iViewerButton[ COMPRESSION0 ] ]->uiFlags |= BUTTON_CLICKED_ON;
if( !GamePaused() )
SetGameMinutesPerSecond( 0 );
SetGameMinutesPerSecond( 0 );
ClearViewerRegion( 0, 0, 640, 480 );
return TRUE;
@@ -540,7 +540,6 @@ void RenderMovingGroupsAndMercs()
UINT8 ubNumTroops, ubNumAdmins, ubNumElites;
float ratio;
INT32 minX, maxX, minY, maxY;
//INT32 iSector = 0;
UINT8 ubIconType;
UINT8 ubIconColor;
UINT8 ubFontColor;
@@ -633,7 +632,7 @@ void RenderMovingGroupsAndMercs()
if( !pGroup->pWaypoints )
{
if( GetJA2Clock() % 1000 < 750 )
{
{
SetFontForeground( FONT_WHITE );
}
}
@@ -665,8 +664,8 @@ void RenderInfoInSector()
mprintf( 105, VIEWER_BOTTOM + 10, L"GLOBAL INFO" );
SetFontForeground( FONT_GRAY2 );
mprintf( 118, VIEWER_BOTTOM + 24, L"Strategic AI Awake" );
mprintf( 105, VIEWER_BOTTOM + 36, L"Total Request Points: %d", giRequestPoints );
mprintf( 105, VIEWER_BOTTOM + 46, L"Total Reinforcement Points: %d", giReinforcementPoints );
mprintf( 105, VIEWER_BOTTOM + 36, L"Total Request Points: %d", giRequestPoints );
mprintf( 105, VIEWER_BOTTOM + 46, L"Total Reinforcement Points: %d", giReinforcementPoints );
mprintf( 105, VIEWER_BOTTOM + 56, L"Progress (Current/Highest): %d%%/%d%%", CurrentPlayerProgressPercentage(), HighestPlayerProgressPercentage() );
PrintEnemyPopTable();
@@ -686,7 +685,7 @@ void RenderInfoInSector()
ubSectorY = (UINT8)gsSelSectorY;
}
else
{
{
return;
}
@@ -699,14 +698,14 @@ void RenderInfoInSector()
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->sSectorX == ubSectorX && pSoldier->sSectorY == ubSectorY && pSoldier->bSectorZ == gbViewLevel )
{
if( pSoldier->bLife )
if( pSoldier->stats.bLife )
{
ubMercs++;
if( pSoldier->bLife >= OKLIFE )
if( pSoldier->stats.bLife >= OKLIFE )
{
if( pSoldier->bBreath < OKBREATH )
ubCollapsed++;
else
else
ubActive++;
}
else
@@ -741,25 +740,25 @@ void RenderInfoInSector()
pGroup = pGroup->next;
}
ClearViewerRegion( 280, 375, 640, 480 );
mprintf( 280, yp, L"SECTOR INFO: %c%d (ID: %d)", ubSectorY + 'A' - 1, ubSectorX, SECTOR( ubSectorX, ubSectorY ) );
mprintf( 280, yp, L"SECTOR INFO: %c%d (ID: %d)", ubSectorY + 'A' - 1, ubSectorX, SECTOR( ubSectorX, ubSectorY ) );
yp += 10;
SetFontForeground( FONT_LTGREEN );
mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)",
mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)",
ubMercs, ubActive, ubUnconcious, ubCollapsed );
yp += 10;
SetFontForeground( FONT_LTBLUE );
mprintf( 280, yp, L"Militia: (%d Green, %d Regular, %d Elite)",
mprintf( 280, yp, L"Militia: (%d Green, %d Regular, %d Elite)",
pSector->ubNumberOfCivsAtLevel[0], pSector->ubNumberOfCivsAtLevel[1], pSector->ubNumberOfCivsAtLevel[2] );
yp += 10;
SetFontForeground( FONT_ORANGE );
mprintf( 280, yp, L"Garrison: (%d:%d Admins, %d:%d Troops, %d:%d Elites)",
pSector->ubAdminsInBattle, pSector->ubNumAdmins,
pSector->ubTroopsInBattle, pSector->ubNumTroops,
mprintf( 280, yp, L"Garrison: (%d:%d Admins, %d:%d Troops, %d:%d Elites)",
pSector->ubAdminsInBattle, pSector->ubNumAdmins,
pSector->ubTroopsInBattle, pSector->ubNumTroops,
pSector->ubElitesInBattle, pSector->ubNumElites );
yp += 10;
mprintf( 280, yp, L"%d Groups: (%d:%d Admins, %d:%d Troops, %d:%d Elites)", ubNumGroups,
ubAdminsInBattle, ubNumAdmins,
ubTroopsInBattle, ubNumTroops,
mprintf( 280, yp, L"%d Groups: (%d:%d Admins, %d:%d Troops, %d:%d Elites)", ubNumGroups,
ubAdminsInBattle, ubNumAdmins,
ubTroopsInBattle, ubNumTroops,
ubElitesInBattle, ubNumElites );
yp += 10;
SetFontForeground( FONT_WHITE );
@@ -772,7 +771,7 @@ void RenderInfoInSector()
else
{
SetFontForeground( FONT_YELLOW );
mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures );
mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures );
yp += 10;
}
}
@@ -785,14 +784,14 @@ void RenderInfoInSector()
{
return;
}
mprintf( 280, yp, L"SECTOR INFO: %c%d_b%d", ubSectorY + 'A' - 1, ubSectorX, gbViewLevel );
mprintf( 280, yp, L"SECTOR INFO: %c%d_b%d", ubSectorY + 'A' - 1, ubSectorX, gbViewLevel );
yp += 10;
SetFontForeground( FONT_LTGREEN );
mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)",
mprintf( 280, yp, L"%d Player Mercs: (%d Active, %d Unconcious, %d Collapsed)",
ubMercs, ubActive, ubUnconcious, ubCollapsed );
yp += 10;
SetFontForeground( FONT_YELLOW );
mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures );
mprintf( 280, yp, L"Monsters: (%d:%d)", pSector->ubCreaturesInBattle, pSector->ubNumCreatures );
yp += 10;
if( pSector->uiFlags & SF_PENDING_ALTERNATE_MAP )
{
@@ -805,7 +804,7 @@ void RenderInfoInSector()
yp += 10;
}
}
}
void RenderViewer()
@@ -1121,16 +1120,16 @@ void ViewerMapClickCallback( MOUSE_REGION *reg, INT32 reason )
UINT32 AIViewerScreenInit()
UINT32 AIViewerScreenInit()
{
gfViewerEntry = TRUE;
gusBlue = Get16BPPColor( FROMRGB( 65, 79, 94 ) );
gusBlue = Get16BPPColor( FROMRGB( 65, 79, 94 ) );
gusLtBlue = Get16BPPColor( FROMRGB( 122, 124, 121 ) );
gusDkBlue = Get16BPPColor( FROMRGB( 22, 55, 73 ) );
gusDkBlue = Get16BPPColor( FROMRGB( 22, 55, 73 ) );
return TRUE;
}
UINT32 AIViewerScreenHandle()
UINT32 AIViewerScreenHandle()
{
StartFrameBufferRender();
@@ -1151,7 +1150,7 @@ UINT32 AIViewerScreenHandle()
gfRenderViewer = TRUE;
SpecifyButtonText( iViewerButton[ VIEWER_TIMEPANEL ], WORLDTIMESTR );
}
HandleViewerInput();
RenderViewer();
@@ -1173,7 +1172,7 @@ UINT32 AIViewerScreenHandle()
return AIVIEWER_SCREEN;
}
UINT32 AIViewerScreenShutdown()
UINT32 AIViewerScreenShutdown()
{
return TRUE;
}
@@ -1316,7 +1315,7 @@ void StartCreatureQuestCallback( GUI_BUTTON *btn, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
//Madd: wtf? gGameOptions.ubGameStyle == STYLE_PLATINUM;
//Madd: wtf? gGameOptions.ubGameStyle == STYLE_PLATINUM;
gfRenderMap = TRUE;
ClearCreatureQuest();
InitCreatureQuest();
@@ -1440,7 +1439,7 @@ void ExtractAndUpdatePopulations()
//Kaiden: Loading INI file to read Values...
//Tag for later - this is one of the reasons the
//Tag for later - this is one of the reasons the
// Map Editor won't compile. And I feel stupid about it.
// Pointing to a static location for the INI file.
// Not only bad, the file is no longer there.
@@ -1518,7 +1517,7 @@ CHAR16 EnemyTypeString[ POP_TABLE_ENEMY_TYPES ][ 10 ] =
L"Stag",
L"Rtrt",
L" TOT",
L" %%",
L" %%",
};
@@ -1612,14 +1611,14 @@ void PrintEnemyPopTable()
for ( ubEnemyRank = 0; ubEnemyRank < ENEMY_RANK_PERCENT; ubEnemyRank++ )
{
usEnemyPopTable[ ubEnemyRank ][ ENEMY_TYPE_PERCENT ] = ( ( 100 * usEnemyPopTable[ ubEnemyRank ][ ENEMY_TYPE_TOTAL ] ) /
usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] );
usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] );
}
// calculate type percentages
for ( ubEnemyType = 0; ubEnemyType < ENEMY_TYPE_PERCENT; ubEnemyType++ )
{
usEnemyPopTable[ ENEMY_RANK_PERCENT ][ ubEnemyType ] = ( ( 100 * usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ubEnemyType ] ) /
usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] );
usEnemyPopTable[ ENEMY_RANK_TOTAL ][ ENEMY_TYPE_TOTAL ] );
}
}
@@ -1658,7 +1657,7 @@ void PrintEnemyPopTable()
{
for ( ubEnemyType = 0; ubEnemyType < POP_TABLE_ENEMY_TYPES; ubEnemyType++ )
{
// an exclusive OR operator, how often do ya see that, huh? :-)
// an exclusive OR operator, how often do ya see that, huh? :-)
if ( ( ubEnemyRank == ENEMY_RANK_PERCENT ) ^ ( ubEnemyType == ENEMY_TYPE_PERCENT ) )
{
wcscpy( wPrintSpec, L"%3d%%%%" );
@@ -1695,7 +1694,7 @@ CHAR16 EnemiesKilledString[ KILLED_TABLE_ROWS ][ 10 ] =
L"Tact",
L"Auto",
L" TOT",
L" %%",
L" %%",
};
@@ -1751,14 +1750,14 @@ void PrintEnemiesKilledTable()
for ( ubEnemyRank = 0; ubEnemyRank < ENEMY_RANK_PERCENT; ubEnemyRank++ )
{
usEnemiesKilledTable[ ubEnemyRank ][ ENEMIES_KILLED_PERCENT ] = ( ( 100 * usEnemiesKilledTable[ ubEnemyRank ][ ENEMIES_KILLED_TOTAL ] ) /
usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] );
usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] );
}
// calculate kill type percentages
for ( ubKillType = 0; ubKillType < ENEMIES_KILLED_PERCENT; ubKillType++ )
{
usEnemiesKilledTable[ ENEMY_RANK_PERCENT ][ ubKillType ] = ( ( 100 * usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ubKillType ] ) /
usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] );
usEnemiesKilledTable[ ENEMY_RANK_TOTAL ][ ENEMIES_KILLED_TOTAL ] );
}
}
@@ -1797,7 +1796,7 @@ void PrintEnemiesKilledTable()
{
for ( ubKillType = 0; ubKillType < KILLED_TABLE_ROWS; ubKillType++ )
{
// an exclusive OR operator, how often do ya see that, huh? :-)
// an exclusive OR operator, how often do ya see that, huh? :-)
if ( ( ubEnemyRank == ENEMY_RANK_PERCENT ) ^ ( ubKillType == ENEMIES_KILLED_PERCENT ) )
{
wcscpy( wPrintSpec, L"%3d%%%%" );
@@ -1887,12 +1886,12 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS
pSector = &SectorInfo[ SECTOR( ubSectorX, ubSectorY ) ];
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
// handle garrisoned enemies
if( pSector->ubGarrisonID != NO_GARRISON )
{
iDesired = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation;
iDesired = gArmyComp[ gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bDesiredPopulation;
iSurplus = pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumElites - iDesired;
SetFontForeground( FONT_WHITE );
@@ -1905,7 +1904,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS
}
else
{
swprintf( wSubString, L"%d reinforcements requested", -iSurplus );
swprintf( wSubString, L"%d reinforcements requested", -iSurplus );
wcscat( wString, wSubString );
}
mprintf( iScreenX, iScreenY, wString );
@@ -1920,7 +1919,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS
pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX );
}
else
{ //ERROR! Should be a valid group...
{ //ERROR! Should be a valid group...
}
}
else
@@ -2039,7 +2038,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS
mprintf( iScreenX, iScreenY, wString );
iScreenY += 10;
ubGroupCnt++;
// no room on screen to display info for more than 3 groups in one sector!
@@ -2055,4 +2054,4 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS
}
#endif
#endif
+1354 -1286
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -15,7 +15,7 @@
#define HEALABLE_THIS_HOUR 1
// merc collapses from fatigue if max breath drops to this. Can't go any lower!
// merc collapses from fatigue if max breath drops to this. Can't go any lower!
#define BREATHMAX_ABSOLUTE_MINIMUM 10
#define BREATHMAX_GOTTA_STOP_MOVING 30
#define BREATHMAX_PRETTY_TIRED 50
@@ -71,9 +71,9 @@ enum{
// Train stats defines (must match ATTRIB_MENU_ defines, and pAttributeMenuStrings )
enum{
STRENGTH = 0,
DEXTERITY,
DEXTERITY,
AGILITY,
HEALTH,
HEALTH,
MARKSMANSHIP,
MEDICAL,
MECHANICAL,
@@ -210,15 +210,15 @@ extern INT32 ghMoveBox;
//extern INT32 ghUpdateBox;
extern MOUSE_REGION gAssignmentScreenMaskRegion;
extern MOUSE_REGION gAssignmentScreenMaskRegion;
extern MOUSE_REGION gAssignmentMenuRegion[ ];
extern MOUSE_REGION gTrainingMenuRegion[ ];
extern MOUSE_REGION gAttributeMenuRegion[ ];
extern MOUSE_REGION gSquadMenuRegion[ ];
extern MOUSE_REGION gContractMenuRegion[ ];
extern MOUSE_REGION gRemoveMercAssignRegion[ ];
extern MOUSE_REGION gVehicleMenuRegion[];
extern MOUSE_REGION gAssignmentMenuRegion[ ];
extern MOUSE_REGION gTrainingMenuRegion[ ];
extern MOUSE_REGION gAttributeMenuRegion[ ];
extern MOUSE_REGION gSquadMenuRegion[ ];
extern MOUSE_REGION gContractMenuRegion[ ];
extern MOUSE_REGION gRemoveMercAssignRegion[ ];
extern MOUSE_REGION gVehicleMenuRegion[];
extern BOOLEAN fShownContractMenu;
extern BOOLEAN fShownAssignmentMenu;
+327 -345
View File
File diff suppressed because it is too large Load Diff
+34 -35
View File
@@ -27,10 +27,10 @@ UNDERGROUND_SECTORINFO* gpUndergroundSectorInfoTail = NULL;
// Lesh: this array controls randomization of sectors
// Note that some sectors in game already using alternative map
// It is Skyrider quest: B15, E14, D12, C16
// weapon caches: E11, H5, H10, J12, M9
// Madlab quest: H7, H16, I11, E4
// weapon caches: E11, H5, H10, J12, M9
// Madlab quest: H7, H16, I11, E4
// Do not enable randomization of this sectors until you are know what you're doing
BOOLEAN RandomSector[256] =
BOOLEAN RandomSector[256] =
{
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* A */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -62,7 +62,7 @@ typedef struct
ALTSECTORS_PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
UINT32 uiRowNumber;
UINT32 currentDepth;
UINT32 maxReadDepth;
} altSectorsParseData;
@@ -152,14 +152,14 @@ BOOLEAN ReadInAltSectors(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
altSectorsParseData pData;
// Open xml file
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -174,16 +174,16 @@ BOOLEAN ReadInAltSectors(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, altSectorsStartElementHandle, altSectorsEndElementHandle);
XML_SetCharacterDataHandler(parser, altSectorsCharacterDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
@@ -221,14 +221,14 @@ BOOLEAN WriteInAltSectors(STR fileName)
fprintf (outfile, "</ALT_SECTORS_LIST>\n");
fclose(outfile);
return (TRUE);
}
UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ )
{
UNDERGROUND_SECTORINFO *curr;
curr = (UNDERGROUND_SECTORINFO*)MemAlloc( sizeof( UNDERGROUND_SECTORINFO ) );
curr = (UNDERGROUND_SECTORINFO*)MemAlloc( sizeof( UNDERGROUND_SECTORINFO ) );
AssertMsg( curr, "Failed to create an underground sector info node." );
memset( curr, 0, sizeof( UNDERGROUND_SECTORINFO ) );
@@ -292,34 +292,34 @@ void InitMiningLocations()
{
SECTORINFO *pSector;
//Set up mining sites
pSector = &SectorInfo[SEC_D4];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 33;
// pSector->ubIncomeValue = 33;
pSector = &SectorInfo[SEC_D13];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 41;
pSector = &SectorInfo[SEC_B2];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 20;
pSector = &SectorInfo[SEC_H8];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 64;
pSector = &SectorInfo[SEC_I14];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 80;
//Grumm
pSector = &SectorInfo[SEC_H3];
pSector->uiFlags |= SF_MINING_SITE;
// pSector->ubIncomeValue = 100;
}
//Mobile groups are handled separately from sectors, because they are on the move.
//Mobile groups are handled separately from sectors, because they are on the move.
void GeneratePatrolGroups()
{
GROUP *pGroup;
@@ -379,14 +379,13 @@ void TrashUndergroundSectorInfo()
gpUndergroundSectorInfoTail = NULL;
}
//Defines the sectors that can be occupied by enemies, creatures, etc. It also
//Defines the sectors that can be occupied by enemies, creatures, etc. It also
//contains the network of cave connections critical for strategic creature spreading, as we can't
//know how the levels connect without loading the maps. This is completely hardcoded, and any
//know how the levels connect without loading the maps. This is completely hardcoded, and any
//changes to the maps, require changes accordingly.
void BuildUndergroundSectorInfoList()
{
UNDERGROUND_SECTORINFO *curr;
SECTORINFO *pSector = NULL;
TrashUndergroundSectorInfo();
@@ -394,13 +393,13 @@ void BuildUndergroundSectorInfoList()
//* BASEMENT LEVEL 1 *
//********************
//Miguel's basement. Nothing here.
//Miguel's basement. Nothing here.
curr = NewUndergroundNode( 10, 1, 1 );
//Chitzena mine. Nothing here.
//Chitzena mine. Nothing here.
curr = NewUndergroundNode( 2, 2, 1 );
//San mona mine. Nothing here.
//San mona mine. Nothing here.
curr = NewUndergroundNode( 4, 4, 1 );
curr = NewUndergroundNode( 5, 4, 1 );
@@ -429,13 +428,13 @@ void BuildUndergroundSectorInfoList()
curr = NewUndergroundNode( 4, 11, 1 );
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
//O3
curr = NewUndergroundNode( 3, 15, 1 );
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
//P3
curr = NewUndergroundNode( 3, 16, 1 );
switch( gGameOptions.ubDifficultyLevel )
@@ -456,7 +455,7 @@ void BuildUndergroundSectorInfoList()
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
//Do all of the mandatory underground mine sectors
//Drassen's mine
//D13_B1
curr = NewUndergroundNode( 13, 4, 1 );
@@ -549,8 +548,8 @@ void BuildUndergroundSectorInfoList()
}
// Lesh: this function creates randomized world
// every sector can be randomized between common and alternative, chances 50/50
// randomization of individual sectors can be switched off via array RandomSector[]
// every sector can be randomized between common and alternative, chances 50/50
// randomization of individual sectors can be switched off via array RandomSector[]
void InitWorld()
{
INT16 sSectorCounter;
@@ -565,28 +564,28 @@ void InitWorld()
}
}
//This is the function that is called only once, when the player begins a new game. This will calculate
//This is the function that is called only once, when the player begins a new game. This will calculate
//starting numbers of the queen's army in various parts of the map, which will vary from campaign to campaign.
//This is also highly effected by the game's difficulty setting.
void InitNewCampaign()
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewCampaign");
//First clear all the sector information of all enemy existance. Conveniently, the
//First clear all the sector information of all enemy existance. Conveniently, the
//ubGroupType is also cleared, which is perceived to be an empty group.
memset( &SectorInfo, 0, sizeof( SECTORINFO ) * 256 );
InitStrategicMovementCosts();
RemoveAllGroups();
InitWorld(); // Lesh: generate different world each time using alternative maps
InitWorld(); // Lesh: generate different world each time using alternative maps
InitMiningLocations();
InitKnowFacilitiesFlags( );
BuildUndergroundSectorInfoList();
// allow overhead view of omerta A9 on game onset
SetSectorFlag( 9, 1, 0, SF_ALREADY_VISITED );
//Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors
//Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors
//so that no two games are the same.
InitStrategicAI();
+13 -13
View File
@@ -56,8 +56,8 @@ enum //strategic values for each sector
#define SF_USE_MAP_SETTINGS 0x00000001
#define SF_ENEMY_AMBUSH_LOCATION 0x00000002
//Special case flag used when players encounter enemies in a sector, then retreat. The number of enemies
//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and
//Special case flag used when players encounter enemies in a sector, then retreat. The number of enemies
//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and
//a question mark is displayed to reflect that the player no longer knows.
#define SF_PLAYER_KNOWS_ENEMIES_ARE_HERE 0x00000004
@@ -172,7 +172,7 @@ extern UINT8 gszTerrain[NUM_TRAVTERRAIN_TYPES][15];
#define TRAVELRATING_HIGH 75
#define TRAVELRATING_EXTREME 100
//Used by ubGarrisonID when a sector doesn't point to a garrison. Used by strategic AI only.
//Used by ubGarrisonID when a sector doesn't point to a garrison. Used by strategic AI only.
#define NO_GARRISON 255
typedef struct SECTORINFO
@@ -194,7 +194,7 @@ typedef struct SECTORINFO
UINT8 ubNumElites; //the actual number of elites here.
UINT8 ubNumAdmins; //the actual number of admins here.
UINT8 ubNumCreatures; //only set when immediately before ground attack made!
UINT8 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle;
UINT8 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle;
INT8 bLastKnownEnemies; // -1 means never been there, no idea, otherwise it's what we'd observed most recently
// while this is being maintained (partially, surely buggy), nothing uses it anymore. ARM
@@ -206,15 +206,15 @@ typedef struct SECTORINFO
//The last index represents the traversability if travelling
//throught the sector without entering it.
INT8 bNameId;
INT8 bUSUSED;
INT8 bUSUSED;
INT8 bBloodCats;
INT8 bBloodCatPlacements;
INT8 UNUSEDbSAMCondition;
UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating,
//the more people go near it. A travel rating of 0 means there are never people
//around. This value is used for determining how often items would "vanish" from
//a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM)
UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating,
//the more people go near it. A travel rating of 0 means there are never people
//around. This value is used for determining how often items would "vanish" from
//a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM)
UINT8 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE
UINT16 usUNUSEDMilitiaLevels; // unused (ARM)
UINT8 ubUNUSEDNumberOfJoeBlowCivilians; // unused (ARM)
@@ -247,9 +247,9 @@ typedef struct UNDERGROUND_SECTORINFO
UINT8 ubSectorX, ubSectorY, ubSectorZ;
UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumCreatures;
UINT8 fVisited;
INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating,
//the more people go near it. A travel rating of 0 means there are never people
//around. This value is used for determining how often items would "vanish" from
INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating,
//the more people go near it. A travel rating of 0 means there are never people
//around. This value is used for determining how often items would "vanish" from
//a sector.
UINT32 uiTimeCurrentSectorWasLastLoaded; //Specifies the last time the player was in the sector
struct UNDERGROUND_SECTORINFO *next;
@@ -262,7 +262,7 @@ typedef struct UNDERGROUND_SECTORINFO
//no padding left!
}UNDERGROUND_SECTORINFO;
//The sector information required for the strategic AI. Contains the number of enemy troops,
//The sector information required for the strategic AI. Contains the number of enemy troops,
//as well as intentions, etc.
extern SECTORINFO SectorInfo[256];
extern UNDERGROUND_SECTORINFO *gpUndergroundSectorInfoHead;
+109 -108
View File
@@ -53,8 +53,8 @@
//#define HARD_QUEEN_START_DAY 7 //hard start day 7-8
//#define HARD_QUEEN_START_BONUS 1
//This is how often the creatures spread, once the quest begins. The smaller the gap,
//the faster the creatures will advance. This is also directly related to the reproduction
//This is how often the creatures spread, once the quest begins. The smaller the gap,
//the faster the creatures will advance. This is also directly related to the reproduction
//rates which are applied each time the creatures spread.
#define EASY_SPREAD_TIME_IN_MINUTES 510 //easy spreads every 8.5 hours
#define NORMAL_SPREAD_TIME_IN_MINUTES 450 //normal spreads every 7.5 hours
@@ -62,26 +62,26 @@
#define INSANE_SPREAD_TIME_IN_MINUTES 150 //insane spreads every 2.5 hours
//Once the queen is added to the game, we can instantly let her spread x number of times
//to give her a head start. This can also be a useful tool for having slow reproduction rates
//to give her a head start. This can also be a useful tool for having slow reproduction rates
//but quicker head start to compensate to make the creatures less aggressive overall.
#define EASY_QUEEN_INIT_BONUS_SPREADS 1
#define NORMAL_QUEEN_INIT_BONUS_SPREADS 2
#define HARD_QUEEN_INIT_BONUS_SPREADS 3
#define INSANE_QUEEN_INIT_BONUS_SPREADS 5
//This value modifies the chance to populate a given sector. This is different from the previous definition.
//This value modifies the chance to populate a given sector. This is different from the previous definition.
//This value gets applied to a potentially complicated formula, using the creature habitat to modify
//chance to populate, along with factoring in the relative distance to the hive range (to promote deeper lair
//population increases), etc. I would recommend not tweaking the value too much in either direction from
//zero due to the fact that this can greatly effect spread times and maximum populations. Basically, if the
//population increases), etc. I would recommend not tweaking the value too much in either direction from
//zero due to the fact that this can greatly effect spread times and maximum populations. Basically, if the
//creatures are spreading too quickly, increase the value, otherwise decrease it to a negative value
#define EASY_POPULATION_MODIFIER 0
#define NORMAL_POPULATION_MODIFIER 0
#define HARD_POPULATION_MODIFIER 0
#define INSANE_POPULATION_MODIFIER 0
//Augments the chance that the creatures will attack a town. The conditions for attacking a town
//are based strictly on the occupation of the creatures in each of the four mine exits. For each creature
//Augments the chance that the creatures will attack a town. The conditions for attacking a town
//are based strictly on the occupation of the creatures in each of the four mine exits. For each creature
//there is a base chance of 10% that the creatures will feed sometime during the night.
#define EASY_CREATURE_TOWN_AGGRESSIVENESS -10
#define NORMAL_CREATURE_TOWN_AGGRESSIVENESS 0
@@ -89,7 +89,7 @@
#define INSANE_CREATURE_TOWN_AGGRESSIVENESS 50
//This is how many creatures the queen produces for each cycle of spreading. The higher
//This is how many creatures the queen produces for each cycle of spreading. The higher
//the numbers the faster the creatures will advance.
#define EASY_QUEEN_REPRODUCTION_BASE 6 //6-7
#define EASY_QUEEN_REPRODUCTION_BONUS 1
@@ -101,15 +101,15 @@
#define INSANE_QUEEN_REPRODUCTION_BONUS 5
//When either in a cave level with blue lights or there is a creature presence, then
//we override the normal music with the creature music. The conditions are maintained
//we override the normal music with the creature music. The conditions are maintained
//inside the function PrepareCreaturesForBattle() in this module.
BOOLEAN gfUseCreatureMusic = FALSE;
BOOLEAN gfCreatureMeanwhileScenePlayed = FALSE;
enum
{
QUEEN_LAIR, //where the queen lives. Highly protected
QUEEN_LAIR, //where the queen lives. Highly protected
LAIR, //part of the queen's lair -- lots of babies and defending mothers
LAIR_ENTRANCE, //where the creatures access the mine.
LAIR_ENTRANCE, //where the creatures access the mine.
INNER_MINE, //parts of the mines that aren't close to the outside world
OUTER_MINE, //area's where miners work, close to towns, creatures love to eat :)
FEEDING_GROUNDS, //creatures love to populate these sectors :)
@@ -287,7 +287,7 @@ void InitCreatureQuest()
#ifdef JA2BETAVERSION
if( guiCurrentScreen != AIVIEWER_SCREEN )
{
{
fPlayMeanwhile = TRUE;
}
#else
@@ -301,7 +301,7 @@ void InitCreatureQuest()
gfCreatureMeanwhileScenePlayed = TRUE;
}
giHabitatedDistance = 0;
giHabitatedDistance = 0;
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -318,32 +318,32 @@ void InitCreatureQuest()
break;
}
//Determine which of the four maps are infectible by creatures. Infectible mines
//are those that are player controlled and unlimited. We don't want the creatures to
//Determine which of the four maps are infectible by creatures. Infectible mines
//are those that are player controlled and unlimited. We don't want the creatures to
//infect the mine that runs out.
//Default them all to infectible
memset( fMineInfectible, 1, sizeof( BOOLEAN ) * 4 );
if( gMineStatus[ MINE_DRASSEN ].fAttackedHeadMiner ||
if( gMineStatus[ MINE_DRASSEN ].fAttackedHeadMiner ||
gMineStatus[ MINE_DRASSEN ].uiOreRunningOutPoint ||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_D13 ) ].fEnemyControlled )
{ //If head miner was attacked, ore will/has run out, or enemy controlled
fMineInfectible[ 0 ] = FALSE;
}
if( gMineStatus[ MINE_CAMBRIA ].fAttackedHeadMiner ||
if( gMineStatus[ MINE_CAMBRIA ].fAttackedHeadMiner ||
gMineStatus[ MINE_CAMBRIA ].uiOreRunningOutPoint ||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H8 ) ].fEnemyControlled )
{ //If head miner was attacked, ore will/has run out, or enemy controlled
fMineInfectible[ 1 ] = FALSE;
}
if( gMineStatus[ MINE_ALMA ].fAttackedHeadMiner ||
if( gMineStatus[ MINE_ALMA ].fAttackedHeadMiner ||
gMineStatus[ MINE_ALMA ].uiOreRunningOutPoint ||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_I14 ) ].fEnemyControlled )
{ //If head miner was attacked, ore will/has run out, or enemy controlled
fMineInfectible[ 2 ] = FALSE;
}
if( gMineStatus[ MINE_GRUMM ].fAttackedHeadMiner ||
if( gMineStatus[ MINE_GRUMM ].fAttackedHeadMiner ||
gMineStatus[ MINE_GRUMM ].uiOreRunningOutPoint ||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H3 ) ].fEnemyControlled )
{ //If head miner was attacked, ore will/has run out, or enemy controlled
@@ -391,7 +391,7 @@ void InitCreatureQuest()
case 1: //Drassen
InitLairDrassen();
curr = FindUnderGroundSector( 13, 5, 1 );
curr->uiFlags |= SF_PENDING_ALTERNATE_MAP;
curr->uiFlags |= SF_PENDING_ALTERNATE_MAP;
break;
case 2: //Cambria
InitLairCambria();
@@ -412,12 +412,12 @@ void InitCreatureQuest()
#ifdef JA2BETAVERSION
{
CHAR16 str[512];
swprintf( str, L"Creature quest never chose a lair and won't infect any mines. Infectible mines = %d, iRandom = %d. "
L"This isn't a bug if you are not receiving income from any mines.", iNumMinesInfectible, iOrigRandom );
swprintf( str, L"Creature quest never chose a lair and won't infect any mines. Infectible mines = %d, iRandom = %d. "
L"This isn't a bug if you are not receiving income from any mines.", iNumMinesInfectible, iOrigRandom );
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
}
#endif
return;
return;
}
//Now determine how often we will spread the creatures.
@@ -442,7 +442,7 @@ void InitCreatureQuest()
}
//Set things up so that the creatures can plan attacks on helpless miners and civilians while
//they are sleeping. They do their planning at 10PM every day, and decide to attack sometime
//they are sleeping. They do their planning at 10PM every day, and decide to attack sometime
//during the night.
AddEveryDayStrategicEvent( EVENT_CREATURE_NIGHT_PLANNING, 1320, 0 );
@@ -456,9 +456,9 @@ void InitCreatureQuest()
void AddCreatureToNode( CREATURE_DIRECTIVE *node )
{
node->pLevel->ubNumCreatures++;
if( node->pLevel->uiFlags & SF_PENDING_ALTERNATE_MAP )
{ //there is an alternate map meaning that there is a dynamic opening. From now on
{ //there is an alternate map meaning that there is a dynamic opening. From now on
//we substitute this map.
node->pLevel->uiFlags &= ~SF_PENDING_ALTERNATE_MAP;
node->pLevel->uiFlags |= SF_USE_ALTERNATE_MAP;
@@ -470,35 +470,35 @@ BOOLEAN PlaceNewCreature( CREATURE_DIRECTIVE *node, INT32 iDistance )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1");
if( !node )
return FALSE;
//check to see if the creatures are permitted to spread into certain areas. There are 4 mines (human perspective), and
//creatures won't spread to them until the player controls them. Additionally, if the player has recently cleared the
//check to see if the creatures are permitted to spread into certain areas. There are 4 mines (human perspective), and
//creatures won't spread to them until the player controls them. Additionally, if the player has recently cleared the
//mine, then temporarily prevent the spreading of creatures.
if( giHabitatedDistance == iDistance )
{ //FRONT-LINE CONDITIONS -- consider expansion or frontline fortification. The formulae used
if( giHabitatedDistance == iDistance )
{ //FRONT-LINE CONDITIONS -- consider expansion or frontline fortification. The formulae used
//in this sector are geared towards outer expansion.
//we have reached the distance limitation for the spreading. We will determine if
//the area is populated enough to spread further. The minimum population must be 4 before
//we have reached the distance limitation for the spreading. We will determine if
//the area is populated enough to spread further. The minimum population must be 4 before
//spreading is even considered.
if( node->pLevel->ubNumCreatures*10 - 10 <= (INT32)Random( 60 ) )
{ // x<=1 100%
// x==2 83%
// x==3 67%
// x==4 50%
// x==5 33%
// x==6 17%
// x>=7 0%
{ // x<=1 100%
// x==2 83%
// x==3 67%
// x==4 50%
// x==5 33%
// x==6 17%
// x>=7 0%
AddCreatureToNode( node );
return TRUE;
}
}
else if( giHabitatedDistance > iDistance )
{ //we are within the "safe" habitated area of the creature's area of influence. The chance of
{ //we are within the "safe" habitated area of the creature's area of influence. The chance of
//increasing the population inside this sector depends on how deep we are within the sector.
if( node->pLevel->ubNumCreatures < gGameExternalOptions.iMaxEnemyGroupSize ||
node->pLevel->ubNumCreatures < 32 && node->pLevel->ubCreatureHabitat == QUEEN_LAIR )
{ //there is ALWAYS a chance to habitate an interior sector, though the chances are slim for
//highly occupied sectors. This chance is modified by the type of area we are in.
node->pLevel->ubNumCreatures < 32 && node->pLevel->ubCreatureHabitat == QUEEN_LAIR )
{ //there is ALWAYS a chance to habitate an interior sector, though the chances are slim for
//highly occupied sectors. This chance is modified by the type of area we are in.
INT32 iAbsoluteMaxPopulation;
INT32 iMaxPopulation=-1;
INT32 iChanceToPopulate;
@@ -519,7 +519,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1");
case OUTER_MINE: //neg bonus -- actually promotes expansion over population, and decrease max pop here.
iAbsoluteMaxPopulation = 10;
break;
case FEEDING_GROUNDS: //get free food bonus! yummy humans :)
case FEEDING_GROUNDS: //get free food bonus! yummy humans :)
iAbsoluteMaxPopulation = 15;
break;
case MINE_EXIT: //close access to humans (don't want to overwhelm them)
@@ -552,13 +552,13 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1");
//Now, convert the previous value into a numeric population.
iMaxPopulation = iAbsoluteMaxPopulation * iMaxPopulation / 100;
iMaxPopulation = max( iMaxPopulation, 4 );
//The chance to populate a sector is higher for lower populations. This is calculated on
//The chance to populate a sector is higher for lower populations. This is calculated on
//the ratio of current population to the max population.
iChanceToPopulate = 100 - node->pLevel->ubNumCreatures * 100 / iMaxPopulation;
if( !node->pLevel->ubNumCreatures || iChanceToPopulate > (INT32)Random( 100 )
if( !node->pLevel->ubNumCreatures || iChanceToPopulate > (INT32)Random( 100 )
&& iMaxPopulation > node->pLevel->ubNumCreatures )
{
AddCreatureToNode( node );
@@ -586,8 +586,8 @@ void SpreadCreatures()
DecayCreatures();
return;
}
//queen just produced a litter of creature larvae. Let's do some spreading now.
//queen just produced a litter of creature larvae. Let's do some spreading now.
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -605,16 +605,17 @@ void SpreadCreatures()
}
while( usNewCreatures-- )
{
//Note, this function can and will fail if the population gets dense. This is a necessary
//feature. Otherwise, the queen would fill all the cave levels with MAX_STRATEGIC_TEAM_SIZE monsters, and that would
{
//Note, this function can and will fail if the population gets dense. This is a necessary
//feature. Otherwise, the queen would fill all the cave levels with MAX_STRATEGIC_TEAM_SIZE monsters, and that would
//be bad.
PlaceNewCreature( lair, 0 );
}
}
void DecayCreatures()
{ //when the queen dies, we need to kill off the creatures over a period of time.
{
//when the queen dies, we need to kill off the creatures over a period of time.
}
@@ -633,7 +634,7 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
case INSERTION_CODE_SOUTH: bDesiredDirection = NORTHWEST; break;
case INSERTION_CODE_WEST: bDesiredDirection = NORTHEAST; break;
case INSERTION_CODE_GRIDNO: break;
default: AssertMsg( 0, "Illegal direction passed to AddCreaturesToBattle()" ); break;
default: AssertMsg( 0, "Illegal direction passed to AddCreaturesToBattle()" ); break;
}
#ifdef JA2TESTVERSION
@@ -648,7 +649,7 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
while( ubNumYoungMales || ubNumYoungFemales || ubNumAdultMales || ubNumAdultFemales )
{
iRandom = (INT32)Random( ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales );
if( ubNumYoungMales && iRandom < (INT32)ubNumYoungMales )
if( ubNumYoungMales && iRandom < (INT32)ubNumYoungMales )
{
ubNumYoungMales--;
pSoldier = TacticalCreateCreature( YAM_MONSTER );
@@ -687,14 +688,14 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
pSoldier->ubInsertionDirection = bDesiredDirection;
//Setup the position
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->bHunting = TRUE;
pSoldier->aiData.bHunting = TRUE;
if( gsCreatureInsertionCode != INSERTION_CODE_GRIDNO )
{
if( ubCurrSlot < MapEdgepointInfo.ubNumPoints )
{ //using an edgepoint
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
}
else
else
{ //no edgepoints left, so put him at the entrypoint.
pSoldier->ubStrategicInsertionCode = (UINT8)gsCreatureInsertionCode;
}
@@ -840,7 +841,8 @@ void ChooseTownSectorToAttack( UINT8 ubSectorID, BOOLEAN fOverrideTest )
}
void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
{ //This is the launching point of the creature attack.
{
//This is the launching point of the creature attack.
UNDERGROUND_SECTORINFO *pSector;
UINT8 ubSectorX, ubSectorY;
@@ -851,7 +853,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
}
gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE;
ubSectorX = (UINT8)((ubSectorID % 16) + 1);
ubSectorY = (UINT8)((ubSectorID / 16) + 1);
@@ -872,8 +874,8 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
}
pSector->ubNumCreatures = 0;
//Choose one of the town sectors to attack. Sectors closer to
//Choose one of the town sectors to attack. Sectors closer to
//the mine entrance have a greater chance of being chosen.
ChooseTownSectorToAttack( ubSectorID, FALSE );
ubSectorX = (UINT8)((gubSectorIDOfCreatureAttack % 16) + 1);
@@ -884,12 +886,12 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
ChooseTownSectorToAttack( ubSectorID, TRUE );
gubNumCreaturesAttackingTown = 5;
}
//Now that the sector has been chosen, attack it!
if( PlayerGroupsInSector( ubSectorX, ubSectorY, 0 ) )
{ //we have players in the sector
if( ubSectorX == gWorldSectorX && ubSectorY == gWorldSectorY && !gbWorldSectorZ )
{ //This is the currently loaded sector. All we have to do is change the music and insert
{ //This is the currently loaded sector. All we have to do is change the music and insert
//the creatures tactically.
if( guiCurrentScreen == GAME_SCREEN )
{
@@ -907,7 +909,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
}
else if( CountAllMilitiaInSector( ubSectorX, ubSectorY ) )
{ //we have militia in the sector
gubCreatureBattleCode = CREATURE_BATTLE_CODE_AUTORESOLVE;
gubCreatureBattleCode = CREATURE_BATTLE_CODE_AUTORESOLVE;
}
else if( !StrategicMap[ ubSectorX + MAP_WORLD_X * ubSectorY ].fEnemyControlled )
{ //player controlled sector -- eat some civilians
@@ -915,7 +917,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest )
SectorInfo[ ubSectorID ].ubDayOfLastCreatureAttack = (UINT8)GetWorldDay();
return;
}
else
else
{ //enemy controlled sectors don't get attacked.
return;
}
@@ -945,7 +947,7 @@ void ChooseCreatureQuestStartDay()
// INT32 iRandom, iDay;
if( !(gGameOptions.ubGameStyle == STYLE_SCIFI) || !gGameExternalOptions.fEnableCrepitus)
return; //only available in science fiction mode.
//Post the event. Once it becomes due, it will setup the queen monster's location, and
//Post the event. Once it becomes due, it will setup the queen monster's location, and
//begin spreading and attacking towns from there.
switch( gGameOptions.ubDifficultyLevel )
{
@@ -966,7 +968,7 @@ void ChooseCreatureQuestStartDay()
void DeleteDirectiveNode( CREATURE_DIRECTIVE **node )
{
if( (*node)->next )
if( (*node)->next )
DeleteDirectiveNode( &((*node)->next) );
MemFree( *node );
*node = NULL;
@@ -994,13 +996,13 @@ void EndCreatureQuest()
CREATURE_DIRECTIVE *curr;
UNDERGROUND_SECTORINFO *pSector;
INT32 i;
//By setting the lairID to -1, when it comes time to spread creatures,
//They will get subtracted instead.
giDestroyedLairID = giLairID;
giLairID = -1;
//Also nuke all of the creatures in all of the other mine sectors. This
//Also nuke all of the creatures in all of the other mine sectors. This
//is keyed on the fact that the queen monster is killed.
curr = lair;
if( curr )
@@ -1092,7 +1094,7 @@ BOOLEAN MineClearOfMonsters( UINT8 ubMineIndex )
}
}
else
{ //mine was previously invaded by creatures. Don't allow mine production until queen is dead.
{ //mine was previously invaded by creatures. Don't allow mine production until queen is dead.
if( giLairID != -1 )
{
return FALSE;
@@ -1101,16 +1103,16 @@ BOOLEAN MineClearOfMonsters( UINT8 ubMineIndex )
return TRUE;
}
void DetermineCreatureTownComposition( UINT8 ubNumCreatures,
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales )
void DetermineCreatureTownComposition( UINT8 ubNumCreatures,
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales )
{
INT32 i, iRandom;
UINT8 ubYoungMalePercentage = 10;
UINT8 ubYoungFemalePercentage = 65;
UINT8 ubAdultMalePercentage = 5;
UINT8 ubAdultFemalePercentage = 20;
//First step is to convert the percentages into the numbers we will use.
ubYoungFemalePercentage += ubYoungMalePercentage;
ubAdultMalePercentage += ubYoungFemalePercentage;
@@ -1135,9 +1137,9 @@ void DetermineCreatureTownComposition( UINT8 ubNumCreatures,
}
}
void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures,
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales )
void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures,
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales )
{
SECTORINFO *pSector;
INT32 i;
@@ -1150,7 +1152,7 @@ void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCr
for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ )
{
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife )
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife )
{
switch( pSoldier->ubBodyType )
{
@@ -1197,7 +1199,6 @@ BOOLEAN PrepareCreaturesForBattle()
UINT8 ubNumYoungFemales = 0;
UINT8 ubNumAdultMales = 0;
UINT8 ubNumAdultFemales = 0;
UINT8 ubPercentage = 0;
UINT8 ubNumCreatures;
if( !gubCreatureBattleCode )
@@ -1207,7 +1208,7 @@ BOOLEAN PrepareCreaturesForBattle()
// ScreenMsg( FONT_RED, MSG_ERROR, L"This map has more than one light color -- KM, LC : 1" );
//By default, we only play creature music in the cave levels (the creature levels all consistently
//have blue lights while human occupied mines have red lights. We always play creature music
//have blue lights while human occupied mines have red lights. We always play creature music
//when creatures are in the level.
if( LColors->peBlue )
gfUseCreatureMusic = TRUE;
@@ -1215,7 +1216,7 @@ BOOLEAN PrepareCreaturesForBattle()
gfUseCreatureMusic = FALSE;
if( !gbWorldSectorZ )
return FALSE; //Creatures don't attack overworld with this battle code.
return FALSE; //Creatures don't attack overworld with this battle code.
pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
if( !pSector )
{
@@ -1239,7 +1240,7 @@ BOOLEAN PrepareCreaturesForBattle()
switch( ubCreatureHabitat )
{
case QUEEN_LAIR:
case QUEEN_LAIR:
fQueen = TRUE;
ubLarvaePercentage = 20;
ubInfantPercentage = 40;
@@ -1248,7 +1249,7 @@ BOOLEAN PrepareCreaturesForBattle()
ubAdultMalePercentage = 30;
ubAdultFemalePercentage = 10;
break;
case LAIR:
case LAIR:
fQueen = FALSE;
ubLarvaePercentage = 15;
ubInfantPercentage = 35;
@@ -1257,7 +1258,7 @@ BOOLEAN PrepareCreaturesForBattle()
ubAdultMalePercentage = 25;
ubAdultFemalePercentage = 10;
break;
case LAIR_ENTRANCE:
case LAIR_ENTRANCE:
fQueen = FALSE;
ubLarvaePercentage = 0;
ubInfantPercentage = 15;
@@ -1266,7 +1267,7 @@ BOOLEAN PrepareCreaturesForBattle()
ubAdultMalePercentage = 35;
ubAdultFemalePercentage = 10;
break;
case INNER_MINE:
case INNER_MINE:
fQueen = FALSE;
ubLarvaePercentage = 0;
ubInfantPercentage = 0;
@@ -1275,8 +1276,8 @@ BOOLEAN PrepareCreaturesForBattle()
ubAdultMalePercentage = 10;
ubAdultFemalePercentage = 30;
break;
case OUTER_MINE:
case MINE_EXIT:
case OUTER_MINE:
case MINE_EXIT:
fQueen = FALSE;
ubLarvaePercentage = 0;
ubInfantPercentage = 0;
@@ -1287,11 +1288,11 @@ BOOLEAN PrepareCreaturesForBattle()
break;
default:
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid creature habitat ID of %d for PrepareCreaturesForBattle. Ignoring...", ubCreatureHabitat );
ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid creature habitat ID of %d for PrepareCreaturesForBattle. Ignoring...", ubCreatureHabitat );
#endif
return FALSE;
}
//First step is to convert the percentages into the numbers we will use.
if( fQueen )
{
@@ -1331,7 +1332,7 @@ BOOLEAN PrepareCreaturesForBattle()
pUndergroundSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
if( !pUndergroundSector )
{ //No info?!!!!!
AssertMsg( 0, "Please report underground sector you are in or going to and send save if possible. KM : 0" );
AssertMsg( 0, "Please report underground sector you are in or going to and send save if possible. KM : 0" );
return FALSE;
}
pUndergroundSector->ubCreaturesInBattle = pUndergroundSector->ubNumCreatures;
@@ -1347,7 +1348,7 @@ BOOLEAN PrepareCreaturesForBattle()
switch( gubCreatureBattleCode )
{
case CREATURE_BATTLE_CODE_NONE: //in the mines
AddSoldierInitListCreatures( fQueen, ubNumLarvae, ubNumInfants,
AddSoldierInitListCreatures( fQueen, ubNumLarvae, ubNumInfants,
ubNumYoungMales, ubNumYoungFemales, ubNumAdultMales, ubNumAdultFemales );
break;
case CREATURE_BATTLE_CODE_TACTICALLYADD: //creature attacking a town sector
@@ -1361,7 +1362,8 @@ BOOLEAN PrepareCreaturesForBattle()
}
void CreatureNightPlanning()
{ //Check the populations of the mine exits, and factor a chance for them to attack at night.
{
//Check the populations of the mine exits, and factor a chance for them to attack at night.
UINT8 ubNumCreatures;
ubNumCreatures = CreaturesInUndergroundSector( SEC_H3, 1 );
if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) )
@@ -1396,15 +1398,15 @@ void CheckConditionsForTriggeringCreatureQuest( INT16 sSectorX, INT16 sSectorY,
//Count the number of "infectible mines" the player occupies
if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_D13 ) ].fEnemyControlled )
{
{
ubValidMines++;
}
if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H8 ) ].fEnemyControlled )
{
{
ubValidMines++;
}
if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_I14 ) ].fEnemyControlled )
{
{
ubValidMines++;
}
if( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H3 ) ].fEnemyControlled )
@@ -1472,7 +1474,7 @@ BOOLEAN LoadCreatureDirectives( HWFILE hFile, UINT32 uiSavedGameVersion )
{
return( FALSE );
}
FileRead( hFile, &gfUseCreatureMusic, 1, &uiNumBytesRead );
if( uiNumBytesRead != sizeof( BOOLEAN ) )
{
@@ -1512,7 +1514,7 @@ BOOLEAN LoadCreatureDirectives( HWFILE hFile, UINT32 uiSavedGameVersion )
case 4: InitLairGrumm(); break;
default:
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid restoration of creature lair ID of %d. Save game potentially hosed.", giLairID );
ScreenMsg( FONT_RED, MSG_ERROR, L"Invalid restoration of creature lair ID of %d. Save game potentially hosed.", giLairID );
#endif
break;
}
@@ -1532,7 +1534,6 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine()
INT32 i;
INT16 sSectorX, sSectorY;
INT8 bSectorZ;
BOOLEAN fPlayerInSector = FALSE;
if( giLairID <= 0 )
{ //Creature quest inactive
@@ -1551,11 +1552,11 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine()
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->bLife &&
if( pSoldier->bActive && pSoldier->stats.bLife &&
pSoldier->sSectorX == sSectorX &&
pSoldier->sSectorY == sSectorY &&
pSoldier->sSectorY == sSectorY &&
pSoldier->bSectorZ == bSectorZ &&
!pSoldier->fBetweenSectors )
!pSoldier->flags.fBetweenSectors )
{
return TRUE;
}
@@ -1570,19 +1571,19 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine()
//Returns TRUE if valid and creature quest over, FALSE if creature quest active or not yet started
BOOLEAN GetWarpOutOfMineCodes( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ, INT16 *psInsertionGridNo )
{
INT32 iSwitchValue;
INT32 iSwitchValue;
if( !gfWorldLoaded )
{
return FALSE;
}
if ( gbWorldSectorZ == 0 )
{
return( FALSE );
}
if ( gbWorldSectorZ == 0 )
{
return( FALSE );
}
iSwitchValue = giLairID;
iSwitchValue = giLairID;
if( iSwitchValue == -1 )
{
+4 -4
View File
@@ -45,12 +45,12 @@ enum{
extern UINT8 gubCreatureBattleCode;
void DetermineCreatureTownComposition( UINT8 ubNumCreatures,
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales );
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales );
void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures,
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales );
UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales,
UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales );
BOOLEAN PlayerGroupIsInACreatureInfestedMine();
+51 -49
View File
@@ -47,9 +47,9 @@ BOOLEAN fClockMouseRegionCreated = FALSE;
BOOLEAN fTimeCompressHasOccured = FALSE;
//This value represents the time that the sector was loaded. If you are in sector A9, and leave
//the game clock at that moment will get saved into the temp file associated with it. The next time you
//enter A9, this value will contain that time. Used for scheduling purposes.
//This value represents the time that the sector was loaded. If you are in sector A9, and leave
//the game clock at that moment will get saved into the temp file associated with it. The next time you
//enter A9, this value will contain that time. Used for scheduling purposes.
UINT32 guiTimeCurrentSectorWasLastLoaded = 0;
// did we JUST finish up a game pause by the player
@@ -63,7 +63,7 @@ void AdvanceClock( UINT8 ubWarpCode );
extern BOOLEAN fMapScreenBottomDirty;
#define SECONDS_PER_COMPRESSION 1 // 1/2 minute passes every 1 second of real time
#define SECONDS_PER_COMPRESSION 1 // 1/2 minute passes every 1 second of real time
#define SECONDS_PER_COMPRESSION_IN_RTCOMBAT 10
#define SECONDS_PER_COMPRESSION_IN_TBCOMBAT 10
#define CLOCK_STRING_HEIGHT 13
@@ -77,19 +77,19 @@ INT32 giTimeCompressMode = TIME_COMPRESS_X0;
UINT8 gubClockResolution = 1;
BOOLEAN gfGamePaused = TRUE;
BOOLEAN gfTimeInterrupt = FALSE;
BOOLEAN gfTimeInterruptPause = FALSE;
BOOLEAN gfTimeInterruptPause = FALSE;
BOOLEAN fSuperCompression = FALSE;
UINT32 guiGameClock = gGameExternalOptions.iGameStartingTime;
UINT32 guiPreviousGameClock = 0; // used only for error-checking purposes
UINT32 guiGameSecondsPerRealSecond;
UINT32 guiTimesThisSecondProcessed = 0;
INT32 iPausedPopUpBox = -1;
INT32 iPausedPopUpBox = -1;
UINT32 guiDay;
UINT32 guiHour;
UINT32 guiMin;
CHAR16 gswzWorldTimeStr[20];
INT32 giTimeCompressSpeeds[ NUM_TIME_COMPRESS_SPEEDS ] = { 0, 1, 5 * 60, 30 * 60, 60 * 60 };
UINT16 usPausedActualWidth;
UINT16 usPausedActualWidth;
UINT16 usPausedActualHeight;
UINT32 guiTimeOfLastEventQuery = 0;
BOOLEAN gfLockPauseState = FALSE;
@@ -98,7 +98,7 @@ BOOLEAN gfResetAllPlayerKnowsEnemiesFlags = FALSE;
BOOLEAN gfTimeCompressionOn = FALSE;
UINT32 guiLockPauseStateLastReasonId = 0;
//***When adding new saved time variables, make sure you remove the appropriate amount from the paddingbytes and
// more IMPORTANTLY, add appropriate code in Save/LoadGameClock()!
// more IMPORTANTLY, add appropriate code in Save/LoadGameClock()!
#define TIME_PADDINGBYTES 20
UINT8 gubUnusedTimePadding[TIME_PADDINGBYTES];
@@ -151,23 +151,23 @@ UINT32 GetWorldDay( )
UINT32 GetWorldDayInSeconds( )
{
return( guiDay * NUM_SEC_IN_DAY );
return( guiDay * NUM_SEC_IN_DAY );
}
UINT32 GetWorldDayInMinutes( )
{
return( ( guiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
return( ( guiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
}
UINT32 GetFutureDayInMinutes( UINT32 uiDay )
{
return( ( uiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
return( ( uiDay * NUM_SEC_IN_DAY ) / NUM_SEC_IN_MIN );
}
//this function returns the amount of minutes there has been from start of game to midnight of the uiDay.
//this function returns the amount of minutes there has been from start of game to midnight of the uiDay.
UINT32 GetMidnightOfFutureDayInMinutes( UINT32 uiDay )
{
return( GetWorldTotalMin() + ( uiDay * 1440 ) - GetWorldMinutesInDay( ) );
return( GetWorldTotalMin() + ( uiDay * 1440 ) - GetWorldMinutesInDay( ) );
}
// Not to be used too often by things other than internally
@@ -208,14 +208,14 @@ void AdvanceClock( UINT8 ubWarpCode )
if( ubWarpCode != WARPTIME_NO_PROCESSING_OF_EVENTS )
{
guiTimeOfLastEventQuery = guiGameClock;
//First of all, events are posted for movements, pending attacks, equipment arrivals, etc. This time
//adjustment using time compression can possibly pass one or more events in a single pass. So, this list
//First of all, events are posted for movements, pending attacks, equipment arrivals, etc. This time
//adjustment using time compression can possibly pass one or more events in a single pass. So, this list
//is looked at and processed in sequential order, until the uiAdjustment is fully applied.
if( GameEventsPending( guiGameSecondsPerRealSecond ) )
{
//If a special event, justifying the cancellation of time compression is reached, the adjustment
//will be shortened to the time of that event, and will stop processing events, otherwise, all
//of the events in the time slice will be processed. The time is adjusted internally as events
//of the events in the time slice will be processed. The time is adjusted internally as events
//are processed.
ProcessPendingGameEvents( guiGameSecondsPerRealSecond, ubWarpCode );
}
@@ -265,9 +265,9 @@ void AdvanceClock( UINT8 ubWarpCode )
void AdvanceToNextDay()
{
INT32 uiDiff;
INT32 uiDiff;
UINT32 uiTomorrowTimeInSec;
uiTomorrowTimeInSec = (guiDay+1)*NUM_SEC_IN_DAY + 8*NUM_SEC_IN_HOUR + 15*NUM_SEC_IN_MIN;
uiDiff = uiTomorrowTimeInSec - guiGameClock;
WarpGameTime( uiDiff, WARPTIME_PROCESS_EVENTS_NORMALLY );
@@ -294,7 +294,7 @@ void ResetTimeCompressHasOccured( void )
// has time compress occured?
BOOLEAN HasTimeCompressOccured( void )
{
return( fTimeCompressHasOccured );
return( fTimeCompressHasOccured );
}
@@ -328,7 +328,7 @@ void RenderClock( INT16 sX, INT16 sY )
// Erase first!
RestoreExternBackgroundRect(sX, sY, CLOCK_STRING_WIDTH, CLOCK_STRING_HEIGHT );
if( ( gfPauseDueToPlayerGamePause == FALSE ) )
{
mprintf( sX + (CLOCK_STRING_WIDTH - StringPixLength( WORLDTIMESTR, CLOCK_FONT ))/2, sY, WORLDTIMESTR );
@@ -348,7 +348,7 @@ void ToggleSuperCompression()
// Display message
if ( gTacticalStatus.uiFlags & INCOMBAT )
{
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Cannot toggle compression in Combat Mode." );
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Cannot toggle compression in Combat Mode." );
return;
}
@@ -360,16 +360,16 @@ void ToggleSuperCompression()
giTimeCompressMode = TIME_SUPER_COMPRESS;
guiGameSecondsPerRealSecond = giTimeCompressSpeeds[ giTimeCompressMode ] * SECONDS_PER_COMPRESSION;
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression ON." );
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression ON." );
}
else
{
giTimeCompressMode = uiOldTimeCompressMode;
guiGameSecondsPerRealSecond = giTimeCompressSpeeds[ giTimeCompressMode ] * SECONDS_PER_COMPRESSION;
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression OFF." );
//ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, L"Time compression OFF." );
}
}
}
BOOLEAN DidGameJustStart()
@@ -393,7 +393,7 @@ void StopTimeCompression( void )
void StartTimeCompression( void )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartTimeCompression");
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"StartTimeCompression");
if ( !gfTimeCompressionOn )
{
@@ -645,7 +645,7 @@ BOOLEAN PauseStateLocked()
void PauseGame()
{
// always allow pausing, even if "locked". Locking applies only to trying to compress time, not to pausing it
// always allow pausing, even if "locked". Locking applies only to trying to compress time, not to pausing it
if( !gfGamePaused )
{
gfGamePaused = TRUE;
@@ -702,9 +702,9 @@ void PauseTimeForInterupt()
}
//USING CLOCK RESOLUTION
//Note, that changing the clock resolution doesn't affect the amount of game time that passes per
//real second, but how many times per second the clock is updated. This rate will break up the actual
//time slices per second into smaller chunks. This is useful for animating strategic movement under
//Note, that changing the clock resolution doesn't effect the amount of game time that passes per
//real second, but how many times per second the clock is updated. This rate will break up the actual
//time slices per second into smaller chunks. This is useful for animating strategic movement under
//fast time compression, so objects don't warp around.
void SetClockResolutionToDefault()
{
@@ -726,11 +726,11 @@ UINT8 ClockResolution()
//There are two factors that influence the flow of time in the game.
//-Speed: The speed is the amount of game time passes per real second of time. The higher this
// value, the faster the game time flows.
//-Resolution: The higher the resolution, the more often per second the clock is actually updated.
// This value doesn't affect how much game time passes per real second, but allows for
// a more accurate representation of faster time flows.
//-Speed: The speed is the amount of game time passes per real second of time. The higher this
// value, the faster the game time flows.
//-Resolution: The higher the resolution, the more often per second the clock is actually updated.
// This value doesn't affect how much game time passes per real second, but allows for
// a more accurate representation of faster time flows.
void UpdateClock()
{
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"UpdateClock");
@@ -788,7 +788,7 @@ void UpdateClock()
#endif
//Because we debug so much, breakpoints tend to break the game, and cause unnecessary headaches.
//This line ensures that no more than 1 real-second passes between frames. This otherwise has
//This line ensures that no more than 1 real-second passes between frames. This otherwise has
//no effect on anything else.
uiLastSecondTime = max( uiNewTime - 1000, uiLastSecondTime );
@@ -799,7 +799,7 @@ void UpdateClock()
{
uiLastSecondTime = uiNewTime;
guiTimesThisSecondProcessed = uiLastTimeProcessed = 0;
AdvanceClock( WARPTIME_PROCESS_EVENTS_NORMALLY );
AdvanceClock( WARPTIME_PROCESS_EVENTS_NORMALLY );
}
else if( gubClockResolution > 1 )
{
@@ -830,7 +830,7 @@ void UpdateClock()
WarpGameTime( uiNewTimeProcessed - uiLastTimeProcessed, WARPTIME_PROCESS_EVENTS_NORMALLY );
if( uiNewTimeProcessed < guiGameSecondsPerRealSecond )
{ //Processed the same real second
uiLastTimeProcessed = uiNewTimeProcessed;
uiLastTimeProcessed = uiNewTimeProcessed;
}
else
{ //We have moved into a new real second.
@@ -1027,7 +1027,7 @@ BOOLEAN LoadGameClock( HWFILE hFile )
swprintf( WORLDTIMESTR, L"%s %d, %02d:%02d", pDayStrings[ 0 ], guiDay, guiHour, guiMin );
if( !gfBasement && !gfCaves )
gfDoLighting = TRUE;
gfDoLighting = TRUE;
return( TRUE );
}
@@ -1039,8 +1039,8 @@ void CreateMouseRegionForPauseOfClock( INT16 sX, INT16 sY )
{
// create a mouse region for pausing of game clock
MSYS_DefineRegion( &gClockMouseRegion, (UINT16)( sX ), (UINT16)( sY ),(UINT16)( sX + CLOCK_REGION_WIDTH ), (UINT16)( sY + CLOCK_REGION_HEIGHT ), MSYS_PRIORITY_HIGHEST,
MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback );
MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PauseOfClockBtnCallback );
fClockMouseRegionCreated = TRUE;
if ( gfGamePaused == FALSE )
@@ -1071,7 +1071,7 @@ void PauseOfClockBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
HandlePlayerPauseUnPauseOfGame( );
HandlePlayerPauseUnPauseOfGame( );
}
}
@@ -1139,13 +1139,13 @@ void CreateDestroyScreenMaskForPauseGame( void )
{
// create a mouse region for pausing of game clock
MSYS_DefineRegion( &gClockScreenMaskMouseRegion, 0, 0 ,SCREEN_WIDTH, SCREEN_HEIGHT , MSYS_PRIORITY_HIGHEST,
0, MSYS_NO_CALLBACK, ScreenMaskForGamePauseBtnCallBack );
0, MSYS_NO_CALLBACK, ScreenMaskForGamePauseBtnCallBack );
fCreated = TRUE;
// get region x and y values
sX = ( &gClockMouseRegion ) -> RegionTopLeftX;
sY = ( &gClockMouseRegion ) -> RegionTopLeftY;
sX = ( &gClockMouseRegion )->RegionTopLeftX;
sY = ( &gClockMouseRegion )->RegionTopLeftY;
//re create region on top of this
RemoveMouseRegionForPauseOfClock( );
CreateMouseRegionForPauseOfClock( sX, sY );
@@ -1176,7 +1176,7 @@ void RenderPausedGameBox( void )
if( ( gfPauseDueToPlayerGamePause == TRUE ) && ( gfGamePaused == TRUE ) && ( iPausedPopUpBox != -1 ) )
{
RenderMercPopUpBoxFromIndex( iPausedPopUpBox, ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), FRAME_BUFFER );
InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) );
InvalidateRegion( ( INT16 )( 320 - usPausedActualWidth / 2 ), ( INT16 )( 200 - usPausedActualHeight / 2 ), ( INT16 )( 320 - usPausedActualWidth / 2 + usPausedActualWidth ), ( INT16 )( 200 - usPausedActualHeight / 2 + usPausedActualHeight ) );
}
// reset we've just finished a pause by the player
@@ -1184,12 +1184,14 @@ void RenderPausedGameBox( void )
}
BOOLEAN DayTime()
{ //between 7AM and 9PM
{
//between 7AM and 9PM
return ( guiHour >= 7 && guiHour < 21 );
}
BOOLEAN NightTime()
{ //before 7AM or after 9PM
{
//before 7AM or after 9PM
return ( guiHour < 7 || guiHour >= 21 );
}
@@ -1197,7 +1199,7 @@ BOOLEAN NightTime()
void ClearTacticalStuffDueToTimeCompression( void )
{
// is this test the right thing? ARM
// is this test the right thing? ARM
if ( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN )
{
// clear tactical event queue
+20 -20
View File
@@ -24,16 +24,16 @@
//Kris:
//This is the plan for game time...
//Game time should be restricted to outside code. Think of it as encapsulation. Anyway, using these
//simple functions, you will be able to change the amount of time that passes per frame. The gameloop will
//Game time should be restricted to outside code. Think of it as encapsulation. Anyway, using these
//simple functions, you will be able to change the amount of time that passes per frame. The gameloop will
//automatically update the clock once per cycle, regardless of the mode you are in.
//This does pose potential problems in modes such as the editor, or similar where time shouldn't pass, and
//isn't currently handled. The best thing to do in these cases is call the PauseGame() function when entering
//such a mode, and UnPauseGame() when finished. Everything will be restored just the way you left it. This
//is much simpler to handle in the overall scheme of things.
//isn't currently handled. The best thing to do in these cases is call the PauseGame() function when entering
//such a mode, and UnPauseGame() when finished. Everything will be restored just the way you left it. This
//is much simpler to handle in the overall scheme of things.
//PAUSE FEATURES
//Pauses and unpauses the game. It sets and clears a flag which preserves the time rate.
//Pauses and unpauses the game. It sets and clears a flag which preserves the time rate.
extern void PauseGame();
extern void UnPauseGame();
extern void TogglePause();
@@ -60,8 +60,8 @@ BOOLEAN IsTimeCompressionOn( void ); // returns TRUE if the player currently wa
//USING TIME COMPRESSION
//Allows the setting/changing/access of time rate via predefined compression values.
//These functions change the index in giTimeCompressSpeeds which aren't in any
//particular mathematical pattern. The higher the index, the faster the time is processed
//per frame. These functions have their limits, so game time will also be between
//particular mathematical pattern. The higher the index, the faster the time is processed
//per frame. These functions have their limits, so game time will also be between
//TIME_COMPRESS_X1 to TIME_COMPRESS_X8 based in the laptop time compression.
void SetGameTimeCompressionLevel( UINT32 uiCompressionRate );
void DecreaseGameTimeCompressionRate();
@@ -69,10 +69,10 @@ void IncreaseGameTimeCompressionRate();
//USING CLOCK RESOLUTION
//Note, that changing the clock resolution doesn't effect the amount of game time that passes per
//real second, but how many times per second the clock is updated. This rate will break up the actual
//time slices per second into smaller chunks. This is useful for animating strategic movement under
//real second, but how many times per second the clock is updated. This rate will break up the actual
//time slices per second into smaller chunks. This is useful for animating strategic movement under
//fast time compression, so objects don't warp around.
void SetClockResolutionToDefault(); //1 time per second
void SetClockResolutionToDefault(); //1 time per second
//Valid range is 1 - 60 times per second.
void SetClockResolutionPerSecond( UINT8 ubNumTimesPerSecond );
//Function for accessing the current rate
@@ -118,7 +118,7 @@ void WarpGameTime( UINT32 uiAdjustment, UINT8 ubWarpCode );
void AdvanceToNextDay();
//This function is called once per cycle in the game loop. This determine how often the clock should be
//This function is called once per cycle in the game loop. This determine how often the clock should be
//as well as how much to update the clock by.
void UpdateClock();
@@ -129,14 +129,14 @@ extern UINT32 guiDay;
extern UINT32 guiHour;
extern UINT32 guiMin;
//Advanced function used by certain event callbacks. In the case where time is warped, certain event
//need to know how much time was warped since the last query to the event list.
//Advanced function used by certain event callbacks. In the case where time is warped, certain event
//need to know how much time was warped since the last query to the event list.
//This function returns that value
extern UINT32 guiTimeOfLastEventQuery;
//This value represents the time that the sector was loaded. If you are in sector A9, and leave
//the game clock at that moment will get saved into the temp file associated with it. The next time you
//enter A9, this value will contain that time. Used for scheduling purposes.
//This value represents the time that the sector was loaded. If you are in sector A9, and leave
//the game clock at that moment will get saved into the temp file associated with it. The next time you
//enter A9, this value will contain that time. Used for scheduling purposes.
extern UINT32 guiTimeCurrentSectorWasLastLoaded;
// is the current pause state due to the player?
@@ -170,9 +170,9 @@ void RenderClock( INT16 sX, INT16 sY );
void ToggleSuperCompression();
//IMPORTANT FUNCTION: Used whenever an event or situation is deemed important enough to cancel the
//further processing of time in this current time slice! This can only be used inside of event callback
//functions -- otherwise, it'll be ignored and automatically reset. An example of this would be when arriving
//IMPORTANT FUNCTION: Used whenever an event or situation is deemed important enough to cancel the
//further processing of time in this current time slice! This can only be used inside of event callback
//functions -- otherwise, it'll be ignored and automatically reset. An example of this would be when arriving
//in a new sector and being prompted to attack or retreat.
void InterruptTime();
void PauseTimeForInterupt();
+17 -16
View File
@@ -8,7 +8,7 @@
#include "environment.h"
#include "Ambient Control.h"
#include "Quests.h"
#include "Sound Control.h"
// #include "Sound Control.h"
#include "AimMembers.h"
#include "Strategic Event Handler.h"
#include "BobbyR.h"
@@ -22,7 +22,7 @@
#include "Assignments.h"
#include "Strategic Mines.h"
#include "Strategic Town Loyalty.h"
#include "Message.h"
#include "Message.h"
#include "Map Screen Interface.h"
#include "Map Screen Helicopter.h"
#include "Scheduling.h"
@@ -82,14 +82,14 @@ BOOLEAN DelayEventIfBattleInProgress( STRATEGICEVENT *pEvent )
BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
{
BOOLEAN bMercDayOne = FALSE;
BOOLEAN bMercDayOne = FALSE;
// Kaiden: Opening the INI File
CIniReader iniReader("..\\Ja2_Options.ini");
//Kaiden: Getting Value for MERC Available on Day one?
// for some reason, this can't be in gamesettings.cpp
// or it won't work.
// or it won't work.
bMercDayOne = iniReader.ReadBoolean("Options","MERC_DAY_ONE",FALSE);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent");
@@ -99,7 +99,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Strategic event skipped!" );
return TRUE;
}
BOOLEAN fOrigPreventFlag;
fOrigPreventFlag = gfPreventDeletionOfAnyEvent;
@@ -135,7 +135,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
if( gfMercsNeverQuit )
{
if( pEvent->ubCallbackID == EVENT_MERC_ABOUT_TO_LEAVE_COMMENT ||
pEvent->ubCallbackID == EVENT_MERC_CONTRACT_OVER )
pEvent->ubCallbackID == EVENT_MERC_CONTRACT_OVER )
{
gfPreventDeletionOfAnyEvent = fOrigPreventFlag;
return FALSE;
@@ -151,7 +151,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
// Change light to value
gubEnvLightValue = (UINT8)pEvent->uiParam;
if( !gfBasement && !gfCaves )
gfDoLighting = TRUE;
gfDoLighting = TRUE;
break;
case EVENT_CHECKFORQUESTS:
CheckForQuests( GetWorldDay() );
@@ -180,7 +180,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
case EVENT_BOBBYRAY_PURCHASE:
BobbyRayPurchaseEventCallback( (UINT8) pEvent->uiParam);
break;
//Gets called once a day ( at BOBBYRAY_UPDATE_TIME). To simulate the items being bought and sold at bobby rays
//Gets called once a day ( at BOBBYRAY_UPDATE_TIME). To simulate the items being bought and sold at bobby rays
case EVENT_DAILY_UPDATE_BOBBY_RAY_INVENTORY:
DailyUpdateOfBobbyRaysNewInventory();
DailyUpdateOfBobbyRaysUsedInventory();
@@ -195,7 +195,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
case EVENT_DAILY_UPDATE_OF_MERC_SITE:
DailyUpdateOfMercSite( (UINT16)GetWorldDay() );
break;
case EVENT_DAY3_ADD_EMAIL_FROM_SPECK:
case EVENT_DAY3_ADD_EMAIL_FROM_SPECK:
if(!bMercDayOne)
{
AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1 );
@@ -205,7 +205,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), -1 );
break;
//If a merc gets hired and they dont show up immediately, the merc gets added to the queue and shows up
// uiTimeTillMercArrives minutes later
// uiTimeTillMercArrives minutes later
case EVENT_DELAYED_HIRING_OF_MERC:
MercArrivesCallback( (UINT8) pEvent->uiParam );
break;
@@ -296,7 +296,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
break;
case EVENT_DAILY_EARLY_MORNING_EVENTS:
HandleEarlyMorningEvents();
break;
break;
case EVENT_GROUP_ABOUT_TO_ARRIVE:
HandleGroupAboutToArrive();
break;
@@ -311,8 +311,8 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
break;
case EVENT_RAINSTORM:
// ATE: Disabled
//rain
// ATE: Disabled
//rain
if( pEvent->ubEventType == ENDRANGED_EVENT )
{
EnvEndRainStorm( );
@@ -453,14 +453,14 @@ void CrippledVersionEndGameCheck()
if( guiDay >= 8 )
{
swprintf( zString, L"Game Over. We hope you have enjoyed playing the limited version of Jagged Alliance 2." );
swprintf( zString, L"Game Over. We hope you have enjoyed playing the limited version of Jagged Alliance 2." );
}
else
{
swprintf( zString, L"You have %d game days left in this limited version of Jagged Alliance 2.", ( 8 - guiDay ) );
swprintf( zString, L"You have %d game days left in this limited version of Jagged Alliance 2.", ( 8 - guiDay ) );
}
DoScreenIndependantMessageBox( zString, MSG_BOX_FLAG_OK, CrippledVersionEndGameCheckCallBack );
DoScreenIndependantMessageBox( zString, MSG_BOX_FLAG_OK, CrippledVersionEndGameCheckCallBack );
}
void CrippledVersionEndGameCheckCallBack( UINT8 bExitValue )
@@ -486,3 +486,4 @@ void CrippledVersionEndGameCheckCallBack( UINT8 bExitValue )
#endif
+19 -19
View File
@@ -47,7 +47,7 @@ enum
EVENT_SETUP_TOWN_OPINION,
EVENT_MAKE_CIV_GROUP_HOSTILE_ON_NEXT_SECTOR_ENTRANCE,
EVENT_BEGIN_AIR_RAID,
EVENT_TOWN_LOYALTY_UPDATE, /* Delayed loyalty effects elimininated. Sep.12/98. ARM */
EVENT_TOWN_LOYALTY_UPDATE, /* Delayed loyalty effects elimininated. Sep.12/98. ARM */
EVENT_MEANWHILE,
EVENT_BEGIN_CREATURE_QUEST,
EVENT_CREATURE_SPREAD,
@@ -80,7 +80,7 @@ enum
EVENT_RPC_WHINE_ABOUT_PAY,
EVENT_HAVENT_MADE_IMP_CHARACTER_EMAIL,
EVENT_RAINSTORM,
EVENT_QUARTER_HOUR_UPDATE,
EVENT_QUARTER_HOUR_UPDATE,
EVENT_MERC_MERC_WENT_UP_LEVEL_EMAIL_DELAY,
EVENT_MERC_SITE_NEW_MERC_AVAILABLE,
// EVENT_CHECK_FOR_AIR_RAID,
@@ -89,14 +89,14 @@ enum
EVENT_CRIPPLED_VERSION_END_GAME_CHECK,
#endif
/*
HEY, YOU GUYS AREN'T DOING THIS!!!!!! (see below)
HEY, YOU GUYS AREN'T DOING THIS!!!!!! (see below)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! IMPORTANT NOTE !!
!! FOR ALL NEW EVENTS: For text debug support, make sure you add the text version of the !!
!! new event into the gEventName[] at the top of Game Events.c. !!
!! IMPORTANT NOTE !!
!! FOR ALL NEW EVENTS: For text debug support, make sure you add the text version of the !!
!! new event into the gEventName[] at the top of Game Events.c. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
@@ -110,7 +110,7 @@ enum
//One Time Events
//These events are scheduled to happen, and when their time is up, they are processed
//once, and deleted. The first prototype requires the actual world time in minutes
//once, and deleted. The first prototype requires the actual world time in minutes
//included the current day, and the additional ones are wrappers which calculate the
//actual world time for you.
BOOLEAN AddStrategicEvent( UINT8 ubCallbackID, UINT32 uiMinStamp, UINT32 uiParam );
@@ -123,11 +123,11 @@ BOOLEAN AddFutureDayStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiSec
//Ranged Events
//In certain cases, you may wish to create an event that has a start time and an end
//time. If this is used, then the execution of the event will happen once at the
//beginning of the event and once at the expiration time of the event. A flag,
//pEvent->fEndEvent is set for the second call. It is up to you process it
//separately. An example use of ranged events would be for ambient sounds. The
//start time would be called to define the sounds for use within the game. The end
//time. If this is used, then the execution of the event will happen once at the
//beginning of the event and once at the expiration time of the event. A flag,
//pEvent->fEndEvent is set for the second call. It is up to you process it
//separately. An example use of ranged events would be for ambient sounds. The
//start time would be called to define the sounds for use within the game. The end
//time would be used to remove the sound from the system.
BOOLEAN AddRangedStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiLengthMin, UINT32 uiParam );
BOOLEAN AddSameDayRangedStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiLengthMin, UINT32 uiParam);
@@ -138,23 +138,23 @@ BOOLEAN AddFutureDayRangedStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32
//EveryDay Events
//A second special case event, this event will get processed automatically at the
//same time every day. Time of day lighting is a perfect example. Other events
//such as checking for quests, can also be automated using this system. NOTE:
//same time every day. Time of day lighting is a perfect example. Other events
//such as checking for quests, can also be automated using this system. NOTE:
//Only specify the time of day in minutes (don't add the actual day to this value)
BOOLEAN AddEveryDayStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiParam );
BOOLEAN AddEveryDayStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiStartSeconds, UINT32 uiParam );
//Periodic Events
//Event will get processed automatically once every X minutes. The period is added to the current time for
//the time stamp.
//Event will get processed automatically once every X minutes. The period is added to the current time for
//the time stamp.
BOOLEAN AddPeriodStrategicEvent( UINT8 ubCallbackID, UINT32 uiOnceEveryXMinutes, UINT32 uiParam );
BOOLEAN AddPeriodStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiOnceEveryXSeconds, UINT32 uiParam );
//Hybrids that aren't based from the current time. They are offsetted from the current time first.
//Hybrids that aren't based from the current time. They are offsetted from the current time first.
BOOLEAN AddPeriodStrategicEventWithOffset( UINT8 ubCallbackID, UINT32 uiOnceEveryXMinutes, UINT32 uiOffsetFromCurrent, UINT32 uiParam );
BOOLEAN AddPeriodStrategicEventUsingSecondsWithOffset( UINT8 ubCallbackID, UINT32 uiOnceEveryXSeconds, UINT32 uiOffsetFromCurrent, UINT32 uiParam );
//Searches for and removes the first event matching the supplied information. There may very well be a need
//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if
//Searches for and removes the first event matching the supplied information. There may very well be a need
//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if
//no events were found.
BOOLEAN DeleteStrategicEvent( UINT8 ubCallbackID, UINT32 uiParam );
void DeleteAllStrategicEventsOfType( UINT8 ubCallbackID );
+22 -22
View File
@@ -14,7 +14,7 @@
#endif
#ifdef JA2TESTVERSION
CHAR16 gEventName[NUMBER_OF_EVENT_TYPES_PLUS_ONE][40]={
//1234567890123456789012345678901234567890 (increase size of array if necessary)
L"Null",
@@ -231,11 +231,11 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode )
curr = gpEventList;
prev = NULL; //prev only used when warping time to target time.
while( !gfTimeInterrupt && curr && curr->uiTimeStamp <= guiGameClock + uiAdjustment )
{
{
fDeleteEvent = FALSE;
//Update the time by the difference, but ONLY if the event comes after the current time.
//In the beginning of the game, series of events are created that are placed in the list
//BEFORE the start time. Those events will be processed without influencing the actual time.
//BEFORE the start time. Those events will be processed without influencing the actual time.
if( curr->uiTimeStamp > guiGameClock && ubWarpCode != WARPTIME_PROCESS_TARGET_TIME_FIRST )
{
AdjustClockToEventStamp( curr, &uiAdjustment );
@@ -252,7 +252,7 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode )
AdjustClockToEventStamp( curr, &uiAdjustment );
fDeleteEvent = ExecuteStrategicEvent( curr );
if( curr && prev && fDeleteQueuedEvent )
{ //The only case where we are deleting a node in the middle of the list
prev->next = curr->next;
@@ -260,15 +260,15 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode )
}
else
{ //We are at the current target warp time however, there are still other events following in this time cycle.
//We will only target the final event in this time. NOTE: Events are posted using a FIFO method
//We will only target the final event in this time. NOTE: Events are posted using a FIFO method
prev = curr;
curr = curr->next;
continue;
}
}
else
{ //We are warping time to the target time. We haven't found the event yet,
//so continuing will keep processing the list until we find it. NOTE: Events are posted using a FIFO method
{ //We are warping time to the target time. We haven't found the event yet,
//so continuing will keep processing the list until we find it. NOTE: Events are posted using a FIFO method
prev = curr;
curr = curr->next;
continue;
@@ -298,7 +298,7 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode )
prev = NULL;
//ValidateGameEvents();
}
else
else
{
temp = curr;
prev->next = curr->next;
@@ -313,7 +313,7 @@ void ProcessPendingGameEvents( UINT32 uiAdjustment, UINT8 ubWarpCode )
curr = curr->next;
}
}
gfProcessingGameEvents = FALSE;
if( gfEventDeletionPending )
@@ -362,11 +362,11 @@ STRATEGICEVENT* AddAdvancedStrategicEvent( UINT8 ubEventType, UINT8 ubCallbackID
#ifdef JA2TESTVERSION
//if( ubCallbackID == EVENT_PROCESS_TACTICAL_SCHEDULE )
{
ScreenMsg( FONT_RED, MSG_DEBUG, L"%s Event Rejected: Can't post events <= time while inside an event callback. This is a special case situation that isn't a bug.", gEventName[ ubCallbackID ] );
ScreenMsg( FONT_RED, MSG_DEBUG, L"%s Event Rejected: Can't post events <= time while inside an event callback. This is a special case situation that isn't a bug.", gEventName[ ubCallbackID ] );
}
//else
//{
// AssertMsg( 0, String( "%S Event Rejected: Can't post events <= time while inside an event callback.", gEventName[ ubCallbackID ] ) );
// AssertMsg( 0, String( "%S Event Rejected: Can't post events <= time while inside an event callback.", gEventName[ ubCallbackID ] ) );
//}
#endif
return NULL;
@@ -407,7 +407,7 @@ STRATEGICEVENT* AddAdvancedStrategicEvent( UINT8 ubEventType, UINT8 ubCallbackID
if ( !pNode )
{
pPrevNode->next = pNewNode;
pNewNode->next = NULL;
pNewNode->next = NULL;
}
else
{
@@ -443,7 +443,7 @@ BOOLEAN AddStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiSecondStamp,
return FALSE;
}
BOOLEAN AddRangedStrategicEvent( UINT8 ubCallbackID, UINT32 uiStartMin, UINT32 uiLengthMin, UINT32 uiParam )
{
STRATEGICEVENT *pEvent;
@@ -502,7 +502,7 @@ BOOLEAN AddEveryDayStrategicEventUsingSeconds( UINT8 ubCallbackID, UINT32 uiStar
return FALSE;
}
//NEW: Period Events
//NEW: Period Events
//Event will get processed automatically once every X minutes.
BOOLEAN AddPeriodStrategicEvent( UINT8 ubCallbackID, UINT32 uiOnceEveryXMinutes, UINT32 uiParam )
{
@@ -574,7 +574,7 @@ void DeleteAllStrategicEventsOfType( UINT8 ubCallbackID )
prev->next = curr->next;
else
gpEventList = curr->next;
//isolate and remove curr
temp = curr;
curr = curr->next;
@@ -603,8 +603,8 @@ void DeleteAllStrategicEvents()
gpEventList = NULL;
}
//Searches for and removes the first event matching the supplied information. There may very well be a need
//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if
//Searches for and removes the first event matching the supplied information. There may very well be a need
//for more specific event removal, so let me know (Kris), of any support needs. Function returns FALSE if
//no events were found or if the event wasn't deleted due to delete lock,
BOOLEAN DeleteStrategicEvent( UINT8 ubCallbackID, UINT32 uiParam )
{
@@ -652,7 +652,7 @@ BOOLEAN SaveStrategicEventsToSavedGame( HWFILE hFile )
UINT32 uiNumGameEvents=0;
STRATEGICEVENT *pTempEvent = gpEventList;
//Go through the list and determine the number of events
while( pTempEvent )
{
@@ -686,7 +686,7 @@ BOOLEAN SaveStrategicEventsToSavedGame( HWFILE hFile )
pTempEvent = pTempEvent->next;
}
return( TRUE );
}
@@ -703,7 +703,7 @@ BOOLEAN LoadStrategicEventsFromSavedGame( HWFILE hFile )
//erase the old Game Event queue
DeleteAllStrategicEvents();
//Read the number of strategic events
FileRead( hFile, &uiNumGameEvents, sizeof( UINT32 ), &uiNumBytesRead );
if( uiNumBytesRead != sizeof( UINT32 ) )
@@ -736,7 +736,7 @@ BOOLEAN LoadStrategicEventsFromSavedGame( HWFILE hFile )
// Add the new node to the list
//if its the first node,
//if its the first node,
if( cnt == 0 )
{
// assign it as the head node
@@ -783,4 +783,4 @@ void ValidateGameEvents()
return;
}
}
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
typedef struct STRATEGICEVENT
{
struct STRATEGICEVENT *next;
struct STRATEGICEVENT *next;
UINT32 uiTimeStamp;
UINT32 uiParam;
UINT32 uiTimeOffset;
+55 -32
View File
@@ -11,7 +11,7 @@
#include "Soldier Control.h"
#include "overhead.h"
#include "fade screen.h"
#include "gamescreen.h"
#include "gamescreen.h"
#include "email.h"
#include "Game Clock.h"
#include "soldier profile.h"
@@ -60,8 +60,13 @@
#include "Air Raid.h"
#include "Interface.h"
#include "cheats.h"
#include "Interface Panels.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
// Temp function
void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex );
BOOLEAN QuickGameMemberHireMerc( UINT8 ubCurrentSoldier );
@@ -130,7 +135,7 @@ void InitNPCs( void )
SectorInfo[ SECTOR( 4, MAP_ROW_E ) ].uiFlags |= SF_USE_ALTERNATE_MAP;
break;
}
// add Micky in random location
pProfile = &(gMercProfiles[MICKY]);
@@ -170,10 +175,10 @@ void InitNPCs( void )
// use alternate map in this sector
//SectorInfo[ SECTOR( pProfile->sSectorX, pProfile->sSectorY ) ].uiFlags |= SF_USE_ALTERNATE_MAP;
gfPlayerTeamSawJoey = FALSE;
gfPlayerTeamSawJoey = FALSE;
if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus )
if ( gGameOptions.ubGameStyle == STYLE_SCIFI && gGameExternalOptions.fEnableCrepitus )
{
// add Bob
pProfile = &(gMercProfiles[BOB]);
@@ -226,9 +231,9 @@ void InitNPCs( void )
void InitBloodCatSectors()
{
INT32 i;
//Hard coded table of bloodcat populations. We don't have
//access to the real population (if different) until we physically
//load the map. If the real population is different, then an error
//Hard coded table of bloodcat populations. We don't have
//access to the real population (if different) until we physically
//load the map. If the real population is different, then an error
//will be reported.
for( i = 0; i < 255; i++ )
{
@@ -374,6 +379,24 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
// Reset the selected soldier
gusSelectedSoldier = NOBODY;
// CHRISL: Init inventory
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: set initial inventory coords");
if( gubScreenCount == 0 )
{
if((UsingNewInventorySystem() == true))
{
InitNewInventorySystem();
InitializeSMPanelCoordsNew();
InitializeInvPanelCoordsNew();
}
else
{
InitOldInventorySystem();
InitializeSMPanelCoordsOld();
InitializeInvPanelCoordsOld();
}
}
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: loading merc profiles");
if( gubScreenCount == 0 )
{
@@ -391,7 +414,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
}
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: clearing messages");
// clear tactical
// clear tactical
ClearTacticalMessageQueue( );
// clear mapscreen messages
@@ -413,11 +436,11 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
ResetHeliSeats( );
// Setup two new messages!
AddPreReadEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
AddPreReadEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
AddPreReadEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin() );
AddPreReadEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1);
AddPreReadEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
AddPreReadEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
AddPreReadEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin() );
AddPreReadEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin(), -1);
//AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin() );
if(gGameExternalOptions.fMercDayOne)
{
@@ -449,7 +472,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
case DIF_LEVEL_INSANE:
iStartingCash = gGameExternalOptions.iStartingCashInsane;
iStartingCash = gGameExternalOptions.iStartingCashInsane;
// iStartingCash = 15000;
break;
@@ -481,7 +504,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
}
}
//Add an event to check for the end of the crippled version
//Add an event to check for the end of the crippled version
AddEveryDayStrategicEvent( EVENT_CRIPPLED_VERSION_END_GAME_CHECK, 0, 0 );
#endif
@@ -518,7 +541,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
/*
if ( gubScreenCount == 2 )
{
if ( !SetCurrentWorldSector( 9, 1, 0 ) )
{
@@ -531,12 +554,12 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
EnterTacticalScreen( );
if( gfAtLeastOneMercWasHired == TRUE )
{
{
gubScreenCount = 3;
}
else
{
}
return( TRUE );
@@ -553,16 +576,16 @@ BOOLEAN AnyMercsHired( )
{
INT32 cnt;
SOLDIERTYPE *pTeamSoldier;
INT16 bLastTeamID;
INT16 bLastTeamID;
// Find first guy availible in team
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
// look for all mercs on the same team,
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++)
{
// look for all mercs on the same team,
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++)
{
if ( pTeamSoldier->bActive )
{
return( TRUE );
@@ -571,7 +594,7 @@ BOOLEAN AnyMercsHired( )
return( FALSE );
}
void QuickStartGame( )
{
@@ -604,7 +627,7 @@ void QuickStartGame( )
do
{
usVal = (UINT16)Random( 40 );
}
}
while( usVal != ub1 && usVal != ub2 );
QuickSetupOfMercProfileItems( cnt, (UINT8)usVal );
@@ -619,7 +642,7 @@ void QuickStartGame( )
void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex )
{
// Quickly give some guys we hire some items
if ( uiCount == 0 )
{
//CreateGun( GLOCK_17, &(pSoldier->inv[ HANDPOS ] ) );
@@ -655,7 +678,7 @@ void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex )
// TEMP!
// make carman's opinion of us high!
gMercProfiles[ 78 ].bMercOpinion[ ubProfileIndex ] = 25;
gMercProfiles[ 78 ].bMercOpinion[ ubProfileIndex ] = 25;
}
else if ( uiCount == 1 )
@@ -721,7 +744,7 @@ void QuickSetupOfMercProfileItems( UINT32 uiCount, UINT8 ubProfileIndex )
gMercProfiles[ ubProfileIndex ].inv[ BIGPOCK2POS ] = RDX;
gMercProfiles[ ubProfileIndex ].bInvStatus[ BIGPOCK2POS ] = 10;
gMercProfiles[ ubProfileIndex ].bInvNumber[ BIGPOCK2POS ] = 1;
gMercProfiles[ ubProfileIndex ].inv[ SMALLPOCK4POS ] = HAND_GRENADE;
gMercProfiles[ ubProfileIndex ].bInvStatus[ SMALLPOCK4POS ] = 100;
gMercProfiles[ ubProfileIndex ].bInvNumber[ SMALLPOCK4POS ] = 4;
@@ -759,10 +782,10 @@ BOOLEAN QuickGameMemberHireMerc( UINT8 ubCurrentSoldier )
{
return(FALSE);
}
//add an entry in the finacial page for the hiring of the merc
AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -(INT32) gMercProfiles[ubCurrentSoldier].uiWeeklySalary );
if( gMercProfiles[ ubCurrentSoldier ].bMedicalDeposit )
{
//add an entry in the finacial page for the medical deposit
@@ -778,7 +801,7 @@ BOOLEAN QuickGameMemberHireMerc( UINT8 ubCurrentSoldier )
//This function is called when the game is REstarted. Things that need to be reinited are placed in here
//This function is called when the game is REstarted. Things that need to be reinited are placed in here
void ReStartingGame()
{
UINT16 cnt;
@@ -800,7 +823,7 @@ void ReStartingGame()
//Loop through all the soldier and delete them all
for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++)
{
{
TacticalRemoveSoldier( cnt );
}
@@ -834,7 +857,7 @@ void ReStartingGame()
if ( InAirRaid( ) )
{
EndAirRaid( );
}
}
#ifdef JA2TESTVERSION
//Reset so we can use the 'cheat key' to start with mercs
+1 -1
View File
@@ -2,7 +2,7 @@
#define __GAME_INIT_H
BOOLEAN InitNewGame( BOOLEAN fReset );
BOOLEAN InitNewGame( BOOLEAN fReset );
BOOLEAN AnyMercsHired( );
void QuickStartGame( );
+21 -19
View File
@@ -43,7 +43,7 @@ void HandleHourlyUpdate()
if ( DidGameJustStart() )
return;
// hourly update of town loyalty
// hourly update of town loyalty
HandleTownLoyalty();
// hourly update of team assignments
@@ -83,7 +83,7 @@ void HandleHourlyUpdate()
void UpdateRegenCounters( void )
{
UINT8 ubID;
for ( ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubID++ )
{
if ( MercPtrs[ ubID ]->bRegenBoostersUsedToday > 0 )
@@ -99,7 +99,7 @@ void HandleQuarterHourUpdate()
if ( DidGameJustStart() )
return;
DecayTacticalMoraleModifiers( );
DecayTacticalMoraleModifiers( );
}
@@ -107,7 +107,7 @@ void HourlyQuestUpdate( void )
{
UINT32 uiHour = GetWorldHour();
// brothel
// brothel
if ( uiHour == 4 )
{
SetFactFalse( FACT_BROTHEL_OPEN );
@@ -124,7 +124,7 @@ void HourlyQuestUpdate( void )
SetFactTrue( FACT_CLUB_OPEN );
SetFactFalse( FACT_PAST_CLUB_CLOSING_AND_PLAYER_WARNED );
// reset boxes fought
for ( ubLoop = 0; ubLoop < NUM_BOXERS; ubLoop++ )
{
@@ -168,9 +168,9 @@ UINT16 LarryItems[ NUM_LARRY_ITEMS ][ 3 ] =
{
// item, temptation, points to use
{ ADRENALINE_BOOSTER, 5, 100 },
{ ALCOHOL, BAR_TEMPTATION, 25 },
{ MEDICKIT, 4, 10 },
{ WINE, 3, 50 },
{ ALCOHOL, BAR_TEMPTATION, 25 },
{ MEDICKIT, 4, 10 },
{ WINE, 3, 50 },
{ REGEN_BOOSTER, 3, 100 },
{ BEER, 2, 100 },
};
@@ -197,7 +197,7 @@ void HourlyLarryUpdate( void )
{
return;
}
if ( pSoldier->fBetweenSectors )
if ( pSoldier->flags.fBetweenSectors )
{
return;
}
@@ -217,17 +217,17 @@ void HourlyLarryUpdate( void )
}
}
// check to see if we're in a bar sector, if we are, we have access to alcohol
// check to see if we're in a bar sector, if we are, we have access to alcohol
// which may be better than anything we've got...
if ( usTemptation < BAR_TEMPTATION && GetCurrentBalance() >= Item[ ALCOHOL ].usPrice )
{
if ( pSoldier->bSectorZ == 0 &&
if ( pSoldier->bSectorZ == 0 &&
( ( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_B) ||
( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_C) ||
( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_C) ||
( pSoldier->sSectorX == 6 && pSoldier->sSectorY == MAP_ROW_C) ||
( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_D) ||
( pSoldier->sSectorX == 2 && pSoldier->sSectorY == MAP_ROW_H)
( pSoldier->sSectorX == 2 && pSoldier->sSectorY == MAP_ROW_H)
)
)
{
@@ -235,10 +235,10 @@ void HourlyLarryUpdate( void )
fBar = TRUE;
usTemptation = BAR_TEMPTATION;
}
}
}
if ( usTemptation > 0 )
{
{
if ( pSoldier->ubProfile == LARRY_NORMAL )
{
gMercProfiles[ LARRY_NORMAL ].bNPCData += (INT8) Random( usTemptation );
@@ -250,7 +250,8 @@ void HourlyLarryUpdate( void )
usCashAmount = Item[ ALCOHOL ].usPrice;
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( usCashAmount ) );
// give Larry some booze and set slot etc values appropriately
bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, SMALLPOCK8POS );
// CHRISL: Change final parameter to allow dynamic control of inventory slots
bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS );
if ( bBoozeSlot != NO_SLOT )
{
// give Larry booze here
@@ -281,7 +282,8 @@ void HourlyLarryUpdate( void )
usCashAmount = Item[ ALCOHOL ].usPrice;
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( usCashAmount ) );
// give Larry some booze and set slot etc values appropriately
bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, SMALLPOCK8POS );
// CHRISL: Change final parameter to allow dynamic control of inventory slots
bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS );
if ( bBoozeSlot != NO_SLOT )
{
// give Larry booze here
@@ -308,7 +310,7 @@ void HourlyLarryUpdate( void )
}
}
}
void HourlyCheckIfSlayAloneSoHeCanLeave()
@@ -319,11 +321,11 @@ void HourlyCheckIfSlayAloneSoHeCanLeave()
{
return;
}
if( pSoldier->fBetweenSectors )
if( pSoldier->flags.fBetweenSectors )
{
return;
}
if( !pSoldier->bActive || !pSoldier->bLife )
if( !pSoldier->bActive || !pSoldier->stats.bLife )
{
return;
}
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -5,8 +5,8 @@
#include "Soldier Control.h"
// costs of flying through sectors
#define COST_AIRSPACE_SAFE 100
#define COST_AIRSPACE_UNSAFE 1000 // VERY dangerous
#define COST_AIRSPACE_SAFE 100
#define COST_AIRSPACE_UNSAFE 1000 // VERY dangerous
#define MIN_PROGRESS_FOR_SKYRIDER_QUOTE_DOING_WELL 25 // scale of 0-100
#define MIN_REGRESS_FOR_SKYRIDER_QUOTE_DOING_BADLY 10 // scale of 0-100
@@ -29,7 +29,7 @@
#define BELIEVED_ENEMY_SECTOR 30 // may become unused
#define ARRIVED_IN_NON_HOSTILE_SECTOR 31
#define HOVERING_A_WHILE 32
#define RETURN_TO_BASE 33
#define RETURN_TO_BASE 33
#define ENEMIES_SPOTTED_EN_ROUTE_IN_FRIENDLY_SECTOR_A 34
#define ENEMIES_SPOTTED_EN_ROUTE_IN_FRIENDLY_SECTOR_B 35
#define MENTION_HOSPITAL_IN_CAMBRIA 45
+199 -199
View File
@@ -34,7 +34,7 @@
// extern to anchored button in winbart97
extern GUI_BUTTON *gpAnchoredButton;
extern BOOLEAN gfAnchoredState;
extern BOOLEAN gfAnchoredState;
// mouse levels
MOUSE_REGION LevelMouseRegions[ 4 ];
@@ -130,7 +130,7 @@ void DrawTextOnMapBorder( void )
SetFontDestBuffer( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
//FindFontCenterCoordinates( MAP_INV_X_OFFSET + MAP_INVENTORY_POOL_SLOT_START_X, MAP_INVENTORY_POOL_SLOT_START_Y - 20, 630 - MAP_INVENTORY_POOL_SLOT_START_X, GetFontHeight( FONT14ARIAL ), sString, FONT14ARIAL, &sX, &sY );
//FindFontCenterCoordinates( MAP_INV_X_OFFSET + MAP_INVENTORY_POOL_SLOT_START_X, MAP_INVENTORY_POOL_SLOT_START_Y - 20, 630 - MAP_INVENTORY_POOL_SLOT_START_X, GetFontHeight( FONT14ARIAL ), sString, FONT14ARIAL, &sX, &sY );
FindFontCenterCoordinates( 271, 18, SCREEN_WIDTH - 271, GetFontHeight( FONT14ARIAL ), sString, FONT14ARIAL, &sX, &sY );
@@ -147,10 +147,10 @@ void DrawTextOnMapBorder( void )
BOOLEAN LoadMapBorderGraphics( void )
{
// this procedure will load the graphics needed for the map border
VOBJECT_DESC VObjectDesc;
// this procedure will load the graphics needed for the map border
VOBJECT_DESC VObjectDesc;
// will load map border
// will load map border
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
if (iResolution == 0)
@@ -176,7 +176,7 @@ BOOLEAN LoadMapBorderGraphics( void )
fCursorIsOnMapScrollButtons = FALSE;
*/
return ( TRUE );
}
@@ -184,7 +184,7 @@ BOOLEAN LoadMapBorderGraphics( void )
void DeleteMapBorderGraphics( void )
{
// procedure will delete graphics loaded for map border
// procedure will delete graphics loaded for map border
DeleteVideoObjectFromIndex( guiMapBorder );
// DeleteVideoObjectFromIndex( guiMapBorderCorner );
@@ -197,9 +197,9 @@ void DeleteMapBorderGraphics( void )
void RenderMapBorder( void )
{
// renders the actual border to the guiSAVEBUFFER
HVOBJECT hHandle;
HVOBJECT hHandle;
/*
/*
if( fDisabledMapBorder )
{
return;
@@ -214,7 +214,7 @@ void RenderMapBorder( void )
}
// get and blt border
GetVideoObject(&hHandle, guiMapBorder );
GetVideoObject(&hHandle, guiMapBorder );
BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_BORDER_X, MAP_BORDER_Y, VO_BLT_SRCTRANSPARENCY,NULL );
if (iResolution == 1 || iResolution == 2)
@@ -223,11 +223,11 @@ void RenderMapBorder( void )
}
RestoreExternBackgroundRect( MAP_BORDER_X, MAP_BORDER_Y, SCREEN_WIDTH - MAP_BORDER_X, SCREEN_HEIGHT );
// show the level marker
DisplayCurrentLevelMarker( );
return;
}
@@ -237,12 +237,12 @@ void RenderMapBorderCorner( void )
{
// renders map border corner to the FRAME_BUFFER
HVOBJECT hHandle;
if( fDisabledMapBorder )
{
return;
}
if( fShowMapInventoryPool )
{
return;
@@ -250,9 +250,9 @@ void RenderMapBorderCorner( void )
// get and blt corner
GetVideoObject(&hHandle, guiMapBorderCorner );
GetVideoObject(&hHandle, guiMapBorderCorner );
BltVideoObject( FRAME_BUFFER , hHandle, 0,MAP_BORDER_CORNER_X, MAP_BORDER_CORNER_Y, VO_BLT_SRCTRANSPARENCY,NULL );
InvalidateRegion( MAP_BORDER_CORNER_X, MAP_BORDER_CORNER_Y, 635, 315);
return;
@@ -284,14 +284,14 @@ void RenderMapBorderEtaPopUp( void )
}
// get and blt ETA box
GetVideoObject(&hHandle, guiMapBorderEtaPopUp );
GetVideoObject(&hHandle, guiMapBorderEtaPopUp );
/*BltVideoObject( FRAME_BUFFER , hHandle, 0, MAP_BORDER_X + 215, 291, VO_BLT_SRCTRANSPARENCY,NULL );
InvalidateRegion( MAP_BORDER_X + 215, 291, MAP_BORDER_X + 215 + 100 , 310);*/
BltVideoObject( FRAME_BUFFER , hHandle, 0, MAP_BORDER_X + MAP_BORDER_X_OFFSET + 215, MAP_BORDER_Y_OFFSET + 291, VO_BLT_SRCTRANSPARENCY,NULL );
InvalidateRegion( MAP_BORDER_X + MAP_BORDER_X_OFFSET + 215, MAP_BORDER_Y_OFFSET + 291, MAP_BORDER_X + MAP_BORDER_X_OFFSET + 215 + 100 , MAP_BORDER_Y_OFFSET + 310);
return;
@@ -304,25 +304,25 @@ BOOLEAN CreateButtonsForMapBorder( void )
/*
// up button
guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_UP ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 );
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_UP ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_UP ], 602, 303,
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_UP ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_UP ], 602, 303,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollNorthMapScreenCallback);
// dwn button
guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_DWN ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 );
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_DWN ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_DWN ], 602, 338,
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_DWN ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_DWN ], 602, 338,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollSouthMapScreenCallback);
// left button
guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_LEFT ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 );
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_LEFT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_LEFT ], 584, 322,
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_LEFT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_LEFT ], 584, 322,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollWestMapScreenCallback);
// right button
guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_RIGHT ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 );
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_RIGHT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_RIGHT ], 619, 322,
guiMapBorderScrollButtons[ ZOOM_MAP_SCROLL_RIGHT ] = QuickCreateButton( guiMapBorderScrollButtonsImage[ ZOOM_MAP_SCROLL_RIGHT ], 619, 322,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnScrollEastMapScreenCallback);
@@ -335,38 +335,38 @@ BOOLEAN CreateButtonsForMapBorder( void )
// towns
giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,5,-1,14,-1 );
giMapBorderButtons[ MAP_BORDER_TOWN_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 152), (SCREEN_HEIGHT - 160),
giMapBorderButtons[ MAP_BORDER_TOWN_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TOWN_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 152), (SCREEN_HEIGHT - 160),
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnTownCallback);
// mines
giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,4,-1,13,-1 );
giMapBorderButtons[ MAP_BORDER_MINE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 109), (SCREEN_HEIGHT - 160),
giMapBorderButtons[ MAP_BORDER_MINE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MINE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 109), (SCREEN_HEIGHT - 160),
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMineCallback);
// people
giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,3,-1,12,-1 );
giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 66), (SCREEN_HEIGHT - 160),
giMapBorderButtons[ MAP_BORDER_TEAMS_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_TEAMS_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 66), (SCREEN_HEIGHT - 160),
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnTeamCallback);
// militia
giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,8,-1,17,-1 );
giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 23), (SCREEN_HEIGHT - 160),
giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MILITIA_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 - 23), (SCREEN_HEIGHT - 160),
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMilitiaCallback);
// airspace
giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,2,-1,11,-1 );
giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 20), (SCREEN_HEIGHT - 160),
giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_AIRSPACE_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 20), (SCREEN_HEIGHT - 160),
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnAircraftCallback);
// items
giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,1,-1,10,-1 );
giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 63), (SCREEN_HEIGHT - 160),
giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 63), (SCREEN_HEIGHT - 160),
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnItemCallback);
@@ -381,7 +381,7 @@ BOOLEAN CreateButtonsForMapBorder( void )
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnRaiseLevelBtnCallback);
// lower
guiMapBorderLandRaiseButtonsImage[ MAP_BORDER_LOWER_LEVEL ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 );
guiMapBorderLandRaiseButtonsImage[ MAP_BORDER_LOWER_LEVEL ] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 );
guiMapBorderLandRaiseButtons[ MAP_BORDER_LOWER_LEVEL ] = QuickCreateButton( guiMapBorderLandRaiseButtonsImage[ MAP_BORDER_LOWER_LEVEL ], MAP_BORDER_X + 264, 340,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnLowerLevelBtnCallback);
@@ -468,7 +468,7 @@ void DeleteMapBorderButtons( void )
/*
void BtnLowerLevelBtnCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
@@ -480,19 +480,19 @@ void BtnLowerLevelBtnCallback(GUI_BUTTON *btn,INT32 reason)
MarkButtonsDirty( );
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// go down one level
GoDownOneLevelInMap( );
// go down one level
GoDownOneLevelInMap( );
}
}
}
}
}
void BtnRaiseLevelBtnCallback(GUI_BUTTON *btn,INT32 reason)
@@ -505,21 +505,21 @@ void BtnRaiseLevelBtnCallback(GUI_BUTTON *btn,INT32 reason)
fMapPanelDirty = TRUE;
}
MarkButtonsDirty( );
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// go up one level
GoUpOneLevelInMap( );
GoUpOneLevelInMap( );
}
}
}
}
}
*/
@@ -548,7 +548,7 @@ void BtnTeamCallback(GUI_BUTTON *btn,INT32 reason)
{
CommonBtnCallbackBtnDownChecks();
}
}
}
void BtnTownCallback(GUI_BUTTON *btn,INT32 reason)
@@ -557,12 +557,12 @@ void BtnTownCallback(GUI_BUTTON *btn,INT32 reason)
{
CommonBtnCallbackBtnDownChecks();
ToggleShowTownsMode();
}
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
CommonBtnCallbackBtnDownChecks();
}
}
}
void BtnMineCallback(GUI_BUTTON *btn,INT32 reason)
@@ -576,17 +576,17 @@ void BtnMineCallback(GUI_BUTTON *btn,INT32 reason)
{
CommonBtnCallbackBtnDownChecks();
}
}
}
void BtnAircraftCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
CommonBtnCallbackBtnDownChecks();
ToggleAirspaceMode();
}
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
CommonBtnCallbackBtnDownChecks();
@@ -596,17 +596,17 @@ void BtnAircraftCallback(GUI_BUTTON *btn,INT32 reason)
void BtnItemCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
CommonBtnCallbackBtnDownChecks();
ToggleItemsFilter();
}
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
CommonBtnCallbackBtnDownChecks();
}
}
}
/*
@@ -622,40 +622,40 @@ void BtnZoomCallback(GUI_BUTTON *btn,INT32 reason)
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
fZoomFlag=FALSE;
btn->uiFlags&=~(BUTTON_CLICKED_ON);
fZoomFlag=FALSE;
}
else
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
fZoomFlag=TRUE;
if( sSelMapX > 14 )
{
iZoomX = ( ( sSelMapX + 2 ) / 2 ) * ( MAP_GRID_X * 2 );
}
else
{
iZoomX=sSelMapX/2*MAP_GRID_X*2;
}
if( sOldSelMapY > 14 )
{
iZoomY = ( ( sSelMapY + 2 ) / 2 ) * ( MAP_GRID_Y * 2 );
}
else
{
iZoomY=sSelMapY/2*MAP_GRID_Y*2;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
fZoomFlag=TRUE;
if( sSelMapX > 14 )
{
iZoomX = ( ( sSelMapX + 2 ) / 2 ) * ( MAP_GRID_X * 2 );
}
else
{
iZoomX=sSelMapX/2*MAP_GRID_X*2;
}
fMapPanelDirty=TRUE;
}
if( sOldSelMapY > 14 )
{
iZoomY = ( ( sSelMapY + 2 ) / 2 ) * ( MAP_GRID_Y * 2 );
}
else
{
iZoomY=sSelMapY/2*MAP_GRID_Y*2;
}
}
fMapPanelDirty=TRUE;
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
CommonBtnCallbackBtnDownChecks();
}
}
}
*/
@@ -864,15 +864,15 @@ void ShowDestinationOfPlottedPath( STR16 pLoc )
INT16 sFontX, sFontY;
SetFontDestBuffer( FRAME_BUFFER, 0, 0, 640, 480, FALSE );
SetFont( COMPFONT );
SetFontForeground( 183 );
SetFontBackground( FONT_BLACK );
VarFindFontCenterCoordinates( 461, 344, 70, 12, COMPFONT, &sFontX, &sFontY, pLoc );
VarFindFontCenterCoordinates( 461, 344, 70, 12, COMPFONT, &sFontX, &sFontY, pLoc );
gprintfdirty(sFontX, sFontY, pLoc );
mprintf(sFontX, sFontY, pLoc );
mprintf(sFontX, sFontY, pLoc );
return;
}
*/
@@ -882,9 +882,9 @@ void BtnScrollNorthMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
// not zoomed in?...don't push down
if( fZoomFlag == FALSE )
if( fZoomFlag == FALSE )
{
return;
}
@@ -895,21 +895,21 @@ void BtnScrollNorthMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
fMapPanelDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = NORTH_DIR;
fMapScrollDueToPanelButton = TRUE;
}
}
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = NORTH_DIR;
fMapScrollDueToPanelButton = TRUE;
}
}
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
giScrollButtonState = NORTH_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
}
@@ -918,45 +918,9 @@ void BtnScrollSouthMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
// not zoomed in?...don't push down
if( fZoomFlag == FALSE )
{
return;
}
// are help messages being displayed?..redraw
if( ScrollButtonsDisplayingHelpMessage( ) )
{
fMapPanelDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = SOUTH_DIR;
fMapScrollDueToPanelButton = TRUE;
}
}
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
giScrollButtonState = SOUTH_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
}
void BtnScrollEastMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
// not zoomed in?...don't push down
if( fZoomFlag == FALSE )
if( fZoomFlag == FALSE )
{
return;
}
@@ -967,22 +931,58 @@ void BtnScrollEastMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
fMapPanelDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = EAST_DIR;
fMapScrollDueToPanelButton = TRUE;
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = SOUTH_DIR;
fMapScrollDueToPanelButton = TRUE;
}
}
}
}
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
giScrollButtonState = EAST_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
giScrollButtonState = SOUTH_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
}
void BtnScrollEastMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
// not zoomed in?...don't push down
if( fZoomFlag == FALSE )
{
return;
}
// are help messages being displayed?..redraw
if( ScrollButtonsDisplayingHelpMessage( ) )
{
fMapPanelDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = EAST_DIR;
fMapScrollDueToPanelButton = TRUE;
}
}
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
giScrollButtonState = EAST_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
}
@@ -992,8 +992,8 @@ void BtnScrollWestMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
// not zoomed in?...don't push down
if( fZoomFlag == FALSE )
// not zoomed in?...don't push down
if( fZoomFlag == FALSE )
{
return;
}
@@ -1004,47 +1004,47 @@ void BtnScrollWestMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
fMapPanelDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = WEST_DIR;
fMapScrollDueToPanelButton = TRUE;
btn->uiFlags&=~(BUTTON_CLICKED_ON);
giScrollButtonState = WEST_DIR;
fMapScrollDueToPanelButton = TRUE;
}
}
}
}
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
giScrollButtonState = WEST_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
giScrollButtonState = WEST_DIR;
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
}
void MapScrollButtonMvtCheck( void )
void MapScrollButtonMvtCheck( void )
{
// run through each button's mouse region, if mouse cursor there...don't show map white sector highlight
fCursorIsOnMapScrollButtons = FALSE;
if( ButtonList[ guiMapBorderScrollButtons[ 0 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA )
if( ButtonList[ guiMapBorderScrollButtons[ 0 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA )
{
fCursorIsOnMapScrollButtons = TRUE;
}
if( ButtonList[ guiMapBorderScrollButtons[ 1 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA )
if( ButtonList[ guiMapBorderScrollButtons[ 1 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA )
{
fCursorIsOnMapScrollButtons = TRUE;
}
if( ButtonList[ guiMapBorderScrollButtons[ 2 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA )
if( ButtonList[ guiMapBorderScrollButtons[ 2 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA )
{
fCursorIsOnMapScrollButtons = TRUE;
}
if( ButtonList[ guiMapBorderScrollButtons[ 3 ] ] ->Area.uiFlags & MSYS_MOUSE_IN_AREA )
if( ButtonList[ guiMapBorderScrollButtons[ 3 ] ]->Area.uiFlags & MSYS_MOUSE_IN_AREA )
{
fCursorIsOnMapScrollButtons = TRUE;
}
@@ -1082,21 +1082,21 @@ void HandleMapScrollButtonStates( void )
if( fZoomFlag )
{
EnableButton( guiMapBorderScrollButtons[ 0 ]);
EnableButton( guiMapBorderScrollButtons[ 1 ]);
EnableButton( guiMapBorderScrollButtons[ 2 ]);
EnableButton( guiMapBorderScrollButtons[ 3 ]);
UpdateScrollButtonStatesWhileScrolling( );
EnableButton( guiMapBorderScrollButtons[ 1 ]);
EnableButton( guiMapBorderScrollButtons[ 2 ]);
EnableButton( guiMapBorderScrollButtons[ 3 ]);
UpdateScrollButtonStatesWhileScrolling( );
}
else
{
DisableButton( guiMapBorderScrollButtons[ 0 ]);
DisableButton( guiMapBorderScrollButtons[ 1 ]);
DisableButton( guiMapBorderScrollButtons[ 2 ]);
DisableButton( guiMapBorderScrollButtons[ 3 ]);
DisableButton( guiMapBorderScrollButtons[ 1 ]);
DisableButton( guiMapBorderScrollButtons[ 2 ]);
DisableButton( guiMapBorderScrollButtons[ 3 ]);
}
// check mvt too
@@ -1112,15 +1112,15 @@ void HandleMapScrollButtonStates( void )
void BtnGenericMouseMoveButtonCallbackForMapBorder(GUI_BUTTON *btn,INT32 reason)
{
//If the button isn't the anchored button, then we don't want to modify the button state.
if( btn != gpAnchoredButton )
{
if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
{
if( btn->Area.uiFlags & MSYS_FASTHELP )
{
// redraw area
fMapPanelDirty = TRUE;
{
// redraw area
fMapPanelDirty = TRUE;
}
}
return;
@@ -1129,15 +1129,15 @@ void BtnGenericMouseMoveButtonCallbackForMapBorder(GUI_BUTTON *btn,INT32 reason)
if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
{
if( !gfAnchoredState )
btn->uiFlags &= (~BUTTON_CLICKED_ON );
btn->uiFlags &= (~BUTTON_CLICKED_ON );
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
btn->uiFlags |= BUTTON_CLICKED_ON ;
btn->uiFlags |= BUTTON_CLICKED_ON ;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
}
/*
@@ -1162,7 +1162,7 @@ void DisplayCurrentLevelMarker( void )
{
// display the current level marker on the map border
HVOBJECT hHandle;
/*
if( fDisabledMapBorder )
{
@@ -1171,7 +1171,7 @@ void DisplayCurrentLevelMarker( void )
*/
// it's actually a white rectangle, not a green arrow!
GetVideoObject(&hHandle, guiLEVELMARKER );
GetVideoObject(&hHandle, guiLEVELMARKER );
BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), VO_BLT_SRCTRANSPARENCY,NULL );
RestoreExternBackgroundRect(MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), 55, 9);
@@ -1185,17 +1185,17 @@ void CreateMouseRegionsForLevelMarkers( void )
{
INT16 sCounter = 0;
CHAR16 sString[ 64 ];
for( sCounter = 0; sCounter < 4 ; sCounter++ )
for( sCounter = 0; sCounter < 4 ; sCounter++ )
{
MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR,
MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR,
MSYS_NO_CALLBACK, LevelMarkerBtnCallback );
MSYS_SetRegionUserData(&LevelMouseRegions[sCounter],0,sCounter);
swprintf( sString, L"%s %d", zMarksMapScreenText[ 0 ], sCounter + 1 );
SetRegionFastHelpText( &LevelMouseRegions[ sCounter ], sString );
}
}
}
@@ -1208,7 +1208,7 @@ void DeleteMouseRegionsForLevelMarkers( void )
for( sCounter = 0; sCounter < 4; sCounter++ )
{
MSYS_RemoveRegion( &LevelMouseRegions[ sCounter ] );
MSYS_RemoveRegion( &LevelMouseRegions[ sCounter ] );
}
}
@@ -1216,7 +1216,7 @@ void LevelMarkerBtnCallback(MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment screen mask region
INT32 iCounter = 0;
iCounter = MSYS_GetRegionUserData( pRegion, 0 );
if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) )
@@ -1352,7 +1352,7 @@ void TurnOnAirSpaceMode( void )
}
// if showing underground
// if showing underground
if ( iCurrentMapSectorZ != 0 )
{
// switch to the surface
@@ -1507,7 +1507,7 @@ void InitializeMapBorderButtonStates( void )
{
MapBorderButtonOff( MAP_BORDER_MINE_BTN );
}
if( fShowTeamFlag )
{
MapBorderButtonOn( MAP_BORDER_TEAMS_BTN );
@@ -1516,7 +1516,7 @@ void InitializeMapBorderButtonStates( void )
{
MapBorderButtonOff( MAP_BORDER_TEAMS_BTN );
}
if( fShowAircraftFlag )
{
MapBorderButtonOn( MAP_BORDER_AIRSPACE_BTN );
@@ -1547,7 +1547,7 @@ BOOLEAN DoesPlayerHaveAnyMilitia( void )
{
for( sY = 1; sY < MAP_WORLD_Y - 1; sY++ )
{
if( ( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]
if( ( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]
+ SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] ) > 0 )
{
// found at least one
+8 -8
View File
@@ -3,8 +3,8 @@
#include "Types.h"
//#define MAP_BORDER_START_X 261
//#define MAP_BORDER_START_Y 0
//#define MAP_BORDER_START_X 261
//#define MAP_BORDER_START_Y 0
@@ -12,16 +12,16 @@
// scroll directions
enum{
ZOOM_MAP_SCROLL_UP =0,
ZOOM_MAP_SCROLL_DWN,
ZOOM_MAP_SCROLL_DWN,
ZOOM_MAP_SCROLL_RIGHT,
ZOOM_MAP_SCROLL_LEFT,
};
enum{
EAST_DIR = 0,
WEST_DIR,
NORTH_DIR,
SOUTH_DIR,
EAST_DIR = 0,
WEST_DIR,
NORTH_DIR,
SOUTH_DIR,
};
enum{
MAP_BORDER_TOWN_BTN =0,
@@ -92,7 +92,7 @@ void EnableMapBorderRegion( void );
void DeleteMapBorderButtons( void );
BOOLEAN CreateButtonsForMapBorder( void );
// render the pop up for eta in path plotting in map screen
// render the pop up for eta in path plotting in map screen
void RenderMapBorderEtaPopUp( void );
BOOLEAN DoesPlayerHaveAnyMilitia( void );
+182 -145
View File
@@ -51,17 +51,23 @@
#include "SaveLoadScreen.h"
#endif
/* CHRISL: Adjusted settings to allow new Map_Screen_Bottom_800x600.sti to work. This is needed if we
want to have the new inventory panel not overlap the message text area. */
#define MAP_BOTTOM_X 0
#define MAP_BOTTOM_Y (SCREEN_HEIGHT - 121) //359
#define MESSAGE_SCROLL_AREA_START_X 330
#define MESSAGE_SCROLL_AREA_END_X 344
//#define MESSAGE_SCROLL_AREA_START_X (SCREEN_WIDTH - 534) //330
//#define MESSAGE_SCROLL_AREA_END_X (SCREEN_WIDTH - 522) //344
#define MESSAGE_SCROLL_AREA_WIDTH ( MESSAGE_SCROLL_AREA_END_X - MESSAGE_SCROLL_AREA_START_X + 1 )
#define MESSAGE_SCROLL_AREA_START_Y (SCREEN_HEIGHT - 90) //390
#define MESSAGE_SCROLL_AREA_END_Y (SCREEN_HEIGHT - 32) //448
#define MESSAGE_SCROLL_AREA_HEIGHT ( MESSAGE_SCROLL_AREA_END_Y - MESSAGE_SCROLL_AREA_START_Y + 1 )
// CHRISL: Use these if we want scroll bar based on left edge of screen
#define MESSAGE_SCROLL_AREA_START_X 330
#define MESSAGE_SCROLL_AREA_END_X 344
#define SLIDER_HEIGHT 11
#define SLIDER_WIDTH 11
@@ -79,7 +85,7 @@
/*
// delay to start auto message scroll
#define DELAY_TO_START_MESSAGE_SCROLL 3000
// delay per auto message scroll
// delay per auto message scroll
#define DELAY_PER_MESSAGE_SCROLL 300
*/
@@ -160,6 +166,7 @@ extern BOOLEAN fShowDescriptionFlag;
extern MOUSE_REGION gMPanelRegion;
extern BOOLEAN gfDisableTacticalPanelButtons;
// PROTOTYPES
@@ -210,9 +217,9 @@ void MapScreenMessageScrollBarCallBack(MOUSE_REGION * pRegion, INT32 iReason );
void HandleLoadOfMapBottomGraphics( void )
{
// will load the graphics needed for the mapscreen interface bottom
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
// will create buttons for interface bottom
// will create buttons for interface bottom
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
if (iResolution == 0)
@@ -245,7 +252,7 @@ BOOLEAN LoadMapScreenInterfaceBottom( void )
// create pause region
CreateCompressModePause( );
return( TRUE );
}
@@ -273,24 +280,27 @@ void DeleteMapScreenInterfaceBottom( void )
}
void RenderMapScreenInterfaceBottom( void )
// Headrock: this function used to accept no arguments. It now accepts a Boolean so it can be forced to run
// the whole process when we call it from other files. See also .h file!!!
void RenderMapScreenInterfaceBottom( BOOLEAN fForceMapscreenFullRender )
{
// will render the map screen bottom interface
HVOBJECT hHandle;
CHAR8 bFilename[ 32 ];
fDisplayOverheadMap = FALSE;
// render whole panel
if( fMapScreenBottomDirty == TRUE )
// HEADROCK Changed this line to accept outside influence through the new boolean:
if ( fForceMapscreenFullRender == TRUE || fMapScreenBottomDirty == TRUE )
{
// get and blt panel
GetVideoObject(&hHandle, guiMAPBOTTOMPANEL );
BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_BOTTOM_X, MAP_BOTTOM_Y, VO_BLT_SRCTRANSPARENCY,NULL );
GetVideoObject(&hHandle, guiMAPBOTTOMPANEL );
BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_BOTTOM_X, MAP_BOTTOM_Y, VO_BLT_SRCTRANSPARENCY,NULL );
if( GetSectorFlagStatus( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, SF_ALREADY_VISITED ) == TRUE )
{
GetMapFileName( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, bFilename, TRUE, TRUE );
GetMapFileName( sSelMapX, sSelMapY, ( UINT8 )iCurrentMapSectorZ, bFilename, TRUE, TRUE );
LoadRadarScreenBitmap( bFilename );
}
else
@@ -307,7 +317,7 @@ void RenderMapScreenInterfaceBottom( void )
MarkButtonsDirty( );
// invalidate region
RestoreExternBackgroundRect( MAP_BOTTOM_X, MAP_BOTTOM_Y, SCREEN_WIDTH, SCREEN_HEIGHT - MAP_BOTTOM_Y );
RestoreExternBackgroundRect( MAP_BOTTOM_X, MAP_BOTTOM_Y, SCREEN_WIDTH - MAP_BOTTOM_X, SCREEN_HEIGHT - MAP_BOTTOM_Y );
// re render radar map
RenderRadarScreen( );
@@ -315,6 +325,9 @@ void RenderMapScreenInterfaceBottom( void )
// reset dirty flag
fMapScreenBottomDirty = FALSE;
fMapBottomDirtied = TRUE;
// Headrock: Moved this next line from the above marker ^
fMapScreenBottomDirty = FALSE;
}
DisplayCompressMode( );
@@ -324,13 +337,16 @@ void RenderMapScreenInterfaceBottom( void )
// draw the name of the loaded sector
DrawNameOfLoadedSector( );
// display slider on the scroll bar
DisplayScrollBarSlider( );
// CHRISL: Don't display messagelist if inventory panel is open
// CHRISL: Only run this condition if we're drawing the message list on the left
// display messages that can be scrolled through
DisplayStringsInMapScreenMessageList( );
if(!fShowInventoryFlag)
DisplayStringsInMapScreenMessageList( );
// handle auto scroll
//CheckForAndHandleAutoMessageScroll( );
@@ -346,25 +362,25 @@ void RenderMapScreenInterfaceBottom( void )
BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void )
{
// laptop
guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,6,-1,15,-1 );
guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ], (SCREEN_WIDTH - 184), (SCREEN_HEIGHT - 70),
guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,6,-1,15,-1 );
guiMapBottomExitButtons[ MAP_EXIT_TO_LAPTOP ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_LAPTOP ], (SCREEN_WIDTH - 184), (SCREEN_HEIGHT - 70),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnLaptopCallback);
// tactical
guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,7,-1,16,-1 );
guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,7,-1,16,-1 );
guiMapBottomExitButtons[ MAP_EXIT_TO_TACTICAL ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_TACTICAL ], (SCREEN_WIDTH - 144), (SCREEN_HEIGHT - 70),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTacticalCallback);
// options
guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,18,-1,19,-1 );
guiMapBottomExitButtons[ MAP_EXIT_TO_OPTIONS ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ], (SCREEN_WIDTH - 182), (SCREEN_HEIGHT - 108),
guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ]= LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,18,-1,19,-1 );
guiMapBottomExitButtons[ MAP_EXIT_TO_OPTIONS ] = QuickCreateButton( guiMapBottomExitButtonsImage[ MAP_EXIT_TO_OPTIONS ], (SCREEN_WIDTH - 182), (SCREEN_HEIGHT - 108),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnOptionsFromMapScreenCallback);
SetButtonFastHelpText( guiMapBottomExitButtons[ 0 ], pMapScreenBottomFastHelp[ 0 ] );
SetButtonFastHelpText( guiMapBottomExitButtons[ 1 ], pMapScreenBottomFastHelp[ 1 ] );
SetButtonFastHelpText( guiMapBottomExitButtons[ 2 ], pMapScreenBottomFastHelp[ 2 ] );
@@ -375,37 +391,45 @@ BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void )
// time compression buttons
guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 );
guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_MORE ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ], (SCREEN_WIDTH - 112), (SCREEN_HEIGHT - 24),
guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,10,1,-1,3,-1 );
guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_MORE ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_MORE ], (SCREEN_WIDTH - 112), (SCREEN_HEIGHT - 24),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2 ,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressMoreMapScreenCallback);
guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 );
guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_LESS ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ], (SCREEN_WIDTH - 174), (SCREEN_HEIGHT - 24),
guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,9,0,-1,2,-1 );
guiMapBottomTimeButtons[ MAP_TIME_COMPRESS_LESS ] = QuickCreateButton( guiMapBottomTimeButtonsImage[ MAP_TIME_COMPRESS_LESS ], (SCREEN_WIDTH - 174), (SCREEN_HEIGHT - 24),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressLessMapScreenCallback);
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTimeCompressLessMapScreenCallback);
SetButtonFastHelpText( guiMapBottomTimeButtons[ 0 ], pMapScreenBottomFastHelp[ 3 ] );
SetButtonFastHelpText( guiMapBottomTimeButtons[ 1 ], pMapScreenBottomFastHelp[ 4 ] );
SetButtonFastHelpText( guiMapBottomTimeButtons[ 1 ], pMapScreenBottomFastHelp[ 4 ] );
SetButtonCursor(guiMapBottomTimeButtons[ 0 ], MSYS_NO_CURSOR );
SetButtonCursor(guiMapBottomTimeButtons[ 1 ], MSYS_NO_CURSOR );
// scroll buttons
// CHRISL: Changed coordinates to dynamically place scroll buttons from the right edge of screen.
guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 );
// guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ], (SCREEN_WIDTH - 533), (SCREEN_HEIGHT - 109),
// BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
// (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpMapScreenCallback);
guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 );
// guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ], (SCREEN_WIDTH - 533), (SCREEN_HEIGHT - 28),
// BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
// (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownMapScreenCallback);
// CHRISL: Use these if we want buttons based on left edge of screen
guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_UP ], 331, (SCREEN_HEIGHT - 109),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpMapScreenCallback);
guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 );
guiMapMessageScrollButtons[ MAP_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiMapMessageScrollButtonsImage[ MAP_SCROLL_MESSAGE_DOWN ], 331, (SCREEN_HEIGHT - 28),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
(GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownMapScreenCallback);
SetButtonFastHelpText( guiMapMessageScrollButtons[ 0 ], pMapScreenBottomFastHelp[ 5 ] );
SetButtonFastHelpText( guiMapMessageScrollButtons[ 1 ], pMapScreenBottomFastHelp[ 6 ] );
SetButtonFastHelpText( guiMapMessageScrollButtons[ 1 ], pMapScreenBottomFastHelp[ 6 ] );
SetButtonCursor(guiMapMessageScrollButtons[ 0 ], MSYS_NO_CURSOR );
SetButtonCursor(guiMapMessageScrollButtons[ 1 ], MSYS_NO_CURSOR );
@@ -425,7 +449,7 @@ void DestroyButtonsForMapScreenInterfaceBottom( void )
RemoveButton( guiMapMessageScrollButtons[ 0 ] );
RemoveButton( guiMapMessageScrollButtons[ 1 ] );
RemoveButton( guiMapBottomTimeButtons[ 0 ] );
RemoveButton( guiMapBottomTimeButtons[ 1 ] );
RemoveButton( guiMapBottomTimeButtons[ 1 ] );
UnloadButtonImage( guiMapBottomExitButtonsImage[ 0 ] );
@@ -438,7 +462,7 @@ void DestroyButtonsForMapScreenInterfaceBottom( void )
// reset dirty flag
fMapScreenBottomDirty = TRUE;
return;
}
@@ -459,24 +483,24 @@ void BtnLaptopCallback(GUI_BUTTON *btn,INT32 reason)
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
if( IsMapScreenHelpTextUp() )
{
// stop mapscreen text
StopMapScreenHelpText( );
}
if (btn->uiFlags & BUTTON_CLICKED_ON)
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON | BUTTON_DIRTY);
DrawButton( btn->IDNum );
RequestTriggerExitFromMapscreen( MAP_EXIT_TO_LAPTOP );
}
}
}
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
if( IsMapScreenHelpTextUp() )
@@ -485,12 +509,12 @@ void BtnLaptopCallback(GUI_BUTTON *btn,INT32 reason)
StopMapScreenHelpText( );
}
}
}
}
void BtnTacticalCallback( GUI_BUTTON *btn,INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
if( IsMapScreenHelpTextUp() )
@@ -506,16 +530,16 @@ void BtnTacticalCallback( GUI_BUTTON *btn,INT32 reason )
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
RequestTriggerExitFromMapscreen( MAP_EXIT_TO_TACTICAL );
}
}
}
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
@@ -542,22 +566,22 @@ void BtnOptionsFromMapScreenCallback( GUI_BUTTON *btn, INT32 reason )
}
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
fMapScreenBottomDirty = TRUE;
RequestTriggerExitFromMapscreen( MAP_EXIT_TO_OPTIONS );
}
}
}
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
@@ -573,15 +597,15 @@ void BtnOptionsFromMapScreenCallback( GUI_BUTTON *btn, INT32 reason )
void DrawNameOfLoadedSector( void )
{
CHAR16 sString[ 128 ];
INT16 sFontX, sFontY;
INT16 sFontX, sFontY;
SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
SetFont( COMPFONT );
SetFontForeground( 183 );
SetFontBackground( FONT_BLACK );
GetSectorIDString( sSelMapX, sSelMapY, ( INT8 )( iCurrentMapSectorZ ),sString, TRUE );
ReduceStringLength( sString, 80, COMPFONT );
@@ -595,7 +619,7 @@ void DrawNameOfLoadedSector( void )
void CompressModeClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
if( iReason & ( MSYS_CALLBACK_REASON_RBUTTON_UP | MSYS_CALLBACK_REASON_LBUTTON_UP ) )
{
{
if ( CommonTimeCompressionChecks() == TRUE )
return;
@@ -613,22 +637,22 @@ void BtnTimeCompressMoreMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
return;
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
fMapScreenBottomDirty = TRUE;
RequestIncreaseInTimeCompression();
}
}
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
@@ -642,29 +666,29 @@ void BtnTimeCompressMoreMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
void BtnTimeCompressLessMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
if ( CommonTimeCompressionChecks() == TRUE )
return;
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
fMapScreenBottomDirty = TRUE;
RequestDecreaseInTimeCompression();
}
}
}
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
{
if ( CommonTimeCompressionChecks() == TRUE )
@@ -688,39 +712,39 @@ void BtnMessageDownMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
}
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
iLastRepeatScrollTime = 0;
iLastRepeatScrollTime = 0;
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
// down a line
MapScreenMsgScrollDown( 1 );
}
}
}
}
else if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
{
if( GetJA2Clock() - iLastRepeatScrollTime >= MESSAGE_BTN_SCROLL_TIME )
{
// down a line
MapScreenMsgScrollDown( 1 );
iLastRepeatScrollTime = GetJA2Clock( );
iLastRepeatScrollTime = GetJA2Clock( );
}
}
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
@@ -733,39 +757,39 @@ void BtnMessageDownMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
}
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
iLastRepeatScrollTime = 0;
iLastRepeatScrollTime = 0;
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP )
{
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
// down a page
MapScreenMsgScrollDown( MAX_MESSAGES_ON_MAP_BOTTOM );
}
}
}
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_REPEAT )
{
{
if( GetJA2Clock() - iLastRepeatScrollTime >= MESSAGE_BTN_SCROLL_TIME )
{
// down a page
MapScreenMsgScrollDown( MAX_MESSAGES_ON_MAP_BOTTOM );
iLastRepeatScrollTime = GetJA2Clock( );
iLastRepeatScrollTime = GetJA2Clock( );
}
}
}
@@ -785,41 +809,41 @@ void BtnMessageUpMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
return;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
// redraw region
// redraw region
if( btn->Area.uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
iLastRepeatScrollTime = 0;
iLastRepeatScrollTime = 0;
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
// up a line
MapScreenMsgScrollUp( 1 );
}
}
}
else if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
{
if( GetJA2Clock() - iLastRepeatScrollTime >= MESSAGE_BTN_SCROLL_TIME )
{
// up a line
MapScreenMsgScrollUp( 1 );
iLastRepeatScrollTime = GetJA2Clock( );
iLastRepeatScrollTime = GetJA2Clock( );
}
}
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
@@ -832,30 +856,30 @@ void BtnMessageUpMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
}
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
iLastRepeatScrollTime = 0;
iLastRepeatScrollTime = 0;
}
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP )
{
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// redraw region
if( btn ->uiFlags & MSYS_HAS_BACKRECT )
if( btn->uiFlags & MSYS_HAS_BACKRECT )
{
fMapScreenBottomDirty = TRUE;
}
// up a page
MapScreenMsgScrollUp( MAX_MESSAGES_ON_MAP_BOTTOM );
}
}
}
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_REPEAT )
{
@@ -864,7 +888,7 @@ void BtnMessageUpMapScreenCallback( GUI_BUTTON *btn,INT32 reason )
// up a page
MapScreenMsgScrollUp( MAX_MESSAGES_ON_MAP_BOTTOM );
iLastRepeatScrollTime = GetJA2Clock( );
iLastRepeatScrollTime = GetJA2Clock( );
}
}
}
@@ -875,7 +899,7 @@ void EnableDisableMessageScrollButtonsAndRegions( void )
{
UINT8 ubNumMessages;
ubNumMessages = GetRangeOfMapScreenMessages();
ubNumMessages = GetRangeOfMapScreenMessages();
// if no scrolling required, or already showing the topmost message
if( ( ubNumMessages <= MAX_MESSAGES_ON_MAP_BOTTOM ) || ( gubFirstMapscreenMessageIndex == 0 ) )
@@ -935,7 +959,7 @@ void DisplayCompressMode( void )
SetFontDestBuffer( FRAME_BUFFER, 0,0,SCREEN_WIDTH,SCREEN_HEIGHT, FALSE );
SetFont( COMPFONT );
if( GetJA2Clock() - guiCompressionStringBaseTime >= PAUSE_GAME_TIMER )
{
if( usColor == FONT_LTGREEN )
@@ -957,11 +981,11 @@ void DisplayCompressMode( void )
SetFontForeground( usColor );
SetFontBackground( FONT_BLACK );
//FindFontCenterCoordinates( 489, 456, 522 - 489, 467 - 454, sString, COMPFONT, &sX, &sY );
FindFontCenterCoordinates( (SCREEN_WIDTH - 151), (SCREEN_HEIGHT - 24), 33, 13, sString, COMPFONT, &sX, &sY );
mprintf( sX, sY, sString );
return;
}
@@ -986,9 +1010,9 @@ void RemoveCompressModePause( void )
void LoadMessageSliderBar( void )
{
// this function will load the message slider bar
VOBJECT_DESC VObjectDesc;
// this function will load the message slider bar
VOBJECT_DESC VObjectDesc;
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP( "INTERFACE\\map_screen_bottom_arrows.sti", VObjectDesc.ImageFile );
if( !AddVideoObject( &VObjectDesc, &guiSliderBar ) )
@@ -1006,13 +1030,13 @@ void CreateMapScreenBottomMessageScrollBarRegion( void )
{
MSYS_DefineRegion( &gMapMessageScrollBarRegion, MESSAGE_SCROLL_AREA_START_X, MESSAGE_SCROLL_AREA_START_Y,
MESSAGE_SCROLL_AREA_END_X, MESSAGE_SCROLL_AREA_END_Y,
MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenMessageScrollBarCallBack );
MSYS_PRIORITY_NORMAL, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MapScreenMessageScrollBarCallBack );
}
void DeleteMapScreenBottomMessageScrollRegion( void )
{
MSYS_RemoveRegion( &gMapMessageScrollBarRegion );
MSYS_RemoveRegion( &gMapMessageScrollBarRegion );
}
@@ -1026,23 +1050,23 @@ void MapScreenMessageScrollBarCallBack( MOUSE_REGION *pRegion, INT32 iReason )
UINT8 ubNumMessages;
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
return;
}
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
return;
}
if ( iReason & ( MSYS_CALLBACK_REASON_LBUTTON_DWN | MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) )
{
{
// how many messages are there?
ubNumMessages = GetRangeOfMapScreenMessages();
ubNumMessages = GetRangeOfMapScreenMessages();
// region is supposed to be disabled if there aren't enough messages to scroll. Formulas assume this
// region is supposed to be disabled if there aren't enough messages to scroll. Formulas assume this
if ( ubNumMessages > MAX_MESSAGES_ON_MAP_BOTTOM )
{
// where is the mouse?
GetCursorPos( &MousePos );
ScreenToClient(ghWindow, &MousePos); // In window coords!
ScreenToClient(ghWindow, &MousePos); // In window coords!
ubMouseYOffset = (UINT8) MousePos.y - MESSAGE_SCROLL_AREA_START_Y;
@@ -1087,7 +1111,7 @@ void DisplayScrollBarSlider( )
HVOBJECT hHandle;
ubNumMessages = GetRangeOfMapScreenMessages();
ubNumMessages = GetRangeOfMapScreenMessages();
// only show the slider if there are more messages than will fit on screen
if ( ubNumMessages > MAX_MESSAGES_ON_MAP_BOTTOM )
@@ -1124,7 +1148,7 @@ void CheckForAndHandleAutoMessageScroll( void )
// we just scrolled to a new message, reset timer
iBaseScrollTime = GetJA2Clock( );
// reset flag
// reset flag
gfNewScrollMessage = FALSE;
fScrollMessage = FALSE;
}
@@ -1133,13 +1157,13 @@ void CheckForAndHandleAutoMessageScroll( void )
if( GetJA2Clock( ) - iBaseScrollTime > DELAY_TO_START_MESSAGE_SCROLL )
{
if( fScrollMessage == FALSE )
{
// set up scroll delay
iBaseScrollDelay = GetJA2Clock( );
// set up scroll delay
iBaseScrollDelay = GetJA2Clock( );
// start scroll
// start scroll
fScrollMessage = TRUE;
}
@@ -1180,7 +1204,7 @@ void EnableDisableBottomButtonsAndRegions( void )
{
EnableButton( guiMapBottomExitButtons[ iExitButtonIndex ]);
}
else
else
{
DisableButton( guiMapBottomExitButtons[ iExitButtonIndex ]);
}
@@ -1201,7 +1225,7 @@ void EnableDisableBottomButtonsAndRegions( void )
{
DisableButton( giMapInvDoneButton );
}
else
else
{
EnableButton( giMapInvDoneButton );
}
@@ -1358,7 +1382,7 @@ BOOLEAN AllowedToTimeCompress( void )
{
return( FALSE );
}
// hostile sector / in battle
if( (gTacticalStatus.uiFlags & INCOMBAT ) || ( gTacticalStatus.fEnemyInSector ) )
{
@@ -1389,8 +1413,10 @@ void DisplayCurrentBalanceTitleForMapBottom( void )
swprintf( sString, L"%s", pMapScreenBottomText[ 0 ] );
// center it
// CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen
//VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 107), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// CHRISL: Use this if we want to display from the left edge
VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 107), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
//VarFindFontCenterCoordinates( 359, 387 - 14, 437 - 359, 10, COMPFONT, &sFontX, &sFontY, sString );
// print it
mprintf( sFontX, sFontY, L"%s", sString );
@@ -1398,7 +1424,9 @@ void DisplayCurrentBalanceTitleForMapBottom( void )
swprintf( sString, L"%s", zMarksMapScreenText[ 2 ] );
// center it
//VarFindFontCenterCoordinates( 359, 433 - 14, 437 - 359, 10, COMPFONT, &sFontX, &sFontY, sString );
// CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen
//VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 61), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// CHRISL: Use this if we want to display from the left edge
VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 61), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// print it
@@ -1425,12 +1453,15 @@ void DisplayCurrentBalanceForMapBottom( void )
swprintf( sString, L"%d", LaptopSaveInfo.iCurrentBalance );
// insert
// insert
InsertCommasForDollarFigure( sString );
InsertDollarSignInToString( sString );
// center it
// CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen
//VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 91), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// CHRISL: Use this if we want to display from the left edge
VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 91), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// print it
@@ -1509,13 +1540,13 @@ void CompressMaskClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
void DisplayProjectedDailyMineIncome( void )
{
INT32 iRate = 0;
static INT32 iOldRate = -1;
static INT32 iOldRate = -1;
CHAR16 sString[ 128 ];
INT16 sFontX, sFontY;
// grab the rate from the financial system
iRate = GetProjectedTotalDailyIncome( );
if( iRate != iOldRate )
{
iOldRate = iRate;
@@ -1537,16 +1568,19 @@ void DisplayProjectedDailyMineIncome( void )
swprintf( sString, L"%d", iRate );
// insert
// insert
InsertCommasForDollarFigure( sString );
InsertDollarSignInToString( sString );
// center it
// CHRISL: Replaced X coordinate with dynamic coordinate set from right edge of screen
//VarFindFontCenterCoordinates( (SCREEN_WIDTH - 637), (SCREEN_HEIGHT - 45), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// CHRISL: Use this if we want to display from the left edge
VarFindFontCenterCoordinates( 359, (SCREEN_HEIGHT - 45), 78, 10, COMPFONT, &sFontX, &sFontY, sString );
// print it
mprintf( sFontX, sFontY, L"%s", sString );
return;
}
@@ -1589,8 +1623,8 @@ BOOLEAN AnyUsableRealMercenariesOnTeam( void )
{
pSoldier = &Menptr[ iCounter ];
if( ( pSoldier->bActive ) && ( pSoldier->bLife > 0 ) &&
!( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) &&
if( ( pSoldier->bActive ) && ( pSoldier->stats.bLife > 0 ) &&
!( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) &&
( pSoldier->bAssignment != ASSIGNMENT_POW ) &&
( pSoldier->bAssignment != ASSIGNMENT_DEAD ) &&
( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__EPC ) )
@@ -1627,6 +1661,9 @@ void RequestTriggerExitFromMapscreen( INT8 bExitToWhere )
// delay until mapscreen has had a chance to render at least one full frame
gfOneFramePauseOnExit = TRUE;
//CHRISL: To force activation of tactical team panel buttons when switching to tactical
gfDisableTacticalPanelButtons = FALSE;
}
}
@@ -1703,7 +1740,7 @@ BOOLEAN AllowedToExitFromMapscreenTo( INT8 bExitToWhere )
{
// if in battle or air raid, the ONLY sector we can go tactical in is the one that's loaded
if ( ( ( gTacticalStatus.uiFlags & INCOMBAT ) || ( gTacticalStatus.fEnemyInSector ) /*|| InAirRaid( )*/ ) &&
( ( sSelMapX != gWorldSectorX ) || ( sSelMapY != gWorldSectorY ) || ( ( UINT8 )iCurrentMapSectorZ ) != gbWorldSectorZ ) )
( ( sSelMapX != gWorldSectorX ) || ( sSelMapY != gWorldSectorY ) || ( ( UINT8 )iCurrentMapSectorZ ) != gbWorldSectorZ ) )
{
return( FALSE );
}
@@ -1751,7 +1788,7 @@ void HandleExitsFromMapScreen( void )
if( gfExtraBuffer )
{ //Then initiate the transition animation from the mapscreen to laptop...
BlitBufferToBuffer( FRAME_BUFFER, guiEXTRABUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
gfStartMapScreenToLaptopTransition = TRUE;
}
@@ -1796,7 +1833,7 @@ void MapScreenMsgScrollDown( UINT8 ubLinesDown )
{
UINT8 ubNumMessages;
ubNumMessages = GetRangeOfMapScreenMessages();
ubNumMessages = GetRangeOfMapScreenMessages();
// check if we can go that far, only go as far as we can
if ( ( gubFirstMapscreenMessageIndex + MAX_MESSAGES_ON_MAP_BOTTOM + ubLinesDown ) > ubNumMessages )
@@ -1815,7 +1852,7 @@ void MapScreenMsgScrollUp( UINT8 ubLinesUp )
{
UINT8 ubNumMessages;
ubNumMessages = GetRangeOfMapScreenMessages();
ubNumMessages = GetRangeOfMapScreenMessages();
// check if we can go that far, only go as far as we can
if ( gubFirstMapscreenMessageIndex < ubLinesUp )
@@ -1836,7 +1873,7 @@ void MoveToEndOfMapScreenMessageList( void )
UINT8 ubDesiredMessageIndex;
UINT8 ubNumMessages;
ubNumMessages = GetRangeOfMapScreenMessages();
ubNumMessages = GetRangeOfMapScreenMessages();
ubDesiredMessageIndex = ubNumMessages - min( ubNumMessages, MAX_MESSAGES_ON_MAP_BOTTOM );
ChangeCurrentMapscreenMessageIndex( ubDesiredMessageIndex );
+3 -2
View File
@@ -5,7 +5,7 @@
#include "Soldier Control.h"
#define MAX_MESSAGES_ON_MAP_BOTTOM 9
#define MAX_MESSAGES_ON_MAP_BOTTOM 9
// exit to where defines
@@ -32,7 +32,8 @@ BOOLEAN LoadMapScreenInterfaceBottom( void );
void DeleteMapScreenInterfaceBottom( void );
void DestroyButtonsForMapScreenInterfaceBottom( void );
BOOLEAN CreateButtonsForMapScreenInterfaceBottom( void );
void RenderMapScreenInterfaceBottom( void );
// Headrock: Added argument to this function:
void RenderMapScreenInterfaceBottom( BOOLEAN fForceMapscreenBottomRerender );
// delete map bottom graphics
void DeleteMapBottomGraphics( void );
File diff suppressed because it is too large Load Diff
@@ -40,16 +40,15 @@ INT32 GetTotalNumberOfItems( void );
void HandleFlashForHighLightedItem( void );
// the list for the inventory
extern WORLDITEM *pInventoryPoolList;
extern std::vector<WORLDITEM> pInventoryPoolList;
// autoplace down object
BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr );
BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr, INT16 sGridNo=0 );
// the current inventory item
extern INT32 iCurrentlyHighLightedItem;
extern BOOLEAN fFlashHighLightInventoryItemOnradarMap;
extern INT16 sObjectSourceGridNo;
extern WORLDITEM *pInventoryPoolList;
extern INT32 iCurrentInventoryPoolPage;
extern BOOLEAN fMapInventoryItemCompatable[ ];
extern INT32 MAP_INVENTORY_POOL_SLOT_COUNT;
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -54,7 +54,7 @@ void CancelPathForCharacter( SOLDIERTYPE *pCharacter );
void CancelPathForVehicle( VEHICLETYPE *pVehicle, BOOLEAN fAlreadyReversed );
void CancelPathForGroup( GROUP *pGroup );
// check if we have waited long enought o update temp path
// check if we have waited long enought object update temp path
void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY );
// clear out helicopter list after this sector
@@ -115,13 +115,13 @@ void CreateDestroyMilitiaPopUPRegions( void );
BOOLEAN DrawMilitiaPopUpBox( void );
//Returns true if the player knows how many enemies are in the sector if that number is greater than 0.
//Returns true if the player knows how many enemies are in the sector if that number is greater than 0.
//Returns false for all other cases.
UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
//There is a special case flag used when players encounter enemies in a sector, then retreat. The number of enemies
//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and
//a question mark is displayed to reflect that the player no longer knows. This is the function that clears that
//There is a special case flag used when players encounter enemies in a sector, then retreat. The number of enemies
//will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and
//a question mark is displayed to reflect that the player no longer knows. This is the function that clears that
//flag.
void ClearAnySectorsFlashingNumberOfEnemies();
@@ -177,17 +177,17 @@ enum {
//#define MAP_VIEW_HEIGHT 298
// zoomed in grid sizes
#define MAP_GRID_ZOOM_X MAP_GRID_X*2
#define MAP_GRID_ZOOM_Y MAP_GRID_Y*2
#define MAP_GRID_ZOOM_X MAP_GRID_X*2
#define MAP_GRID_ZOOM_Y MAP_GRID_Y*2
// number of units wide
#define WORLD_MAP_X 18
#define WORLD_MAP_X 18
// dirty regions for the map
#define DMAP_GRID_X ( MAP_GRID_X + 1 )
#define DMAP_GRID_Y ( MAP_GRID_Y + 1 )
#define DMAP_GRID_ZOOM_X ( MAP_GRID_ZOOM_X+1)
#define DMAP_GRID_ZOOM_Y ( MAP_GRID_ZOOM_Y+1)
#define DMAP_GRID_ZOOM_X ( MAP_GRID_ZOOM_X+1)
#define DMAP_GRID_ZOOM_Y ( MAP_GRID_ZOOM_Y+1)
// Orta position on the map
@@ -200,7 +200,7 @@ enum {
// what are we showing?..teams/vehicles
// Show values
#define SHOW_TEAMMATES 1
#define SHOW_VEHICLES 2
#define SHOW_VEHICLES 2
// wait time until temp path is drawn, from placing cursor on a map grid
@@ -263,7 +263,7 @@ extern INT8 bSelectedContractChar;
extern UINT32 guiMAPCURSORS;
// has temp path for character path or helicopter been already drawn
extern BOOLEAN fTempPathAlreadyDrawn;
extern BOOLEAN fTempPathAlreadyDrawn;
// map view region clipping rect
extern SGPRect MapScreenRect;
@@ -18,7 +18,7 @@
#include "Strategic Town Loyalty.h"
#include "Strategic Mines.h"
#include "finances.h"
#include "Map Screen Interface Map Inventory.h"
#include "Map Screen Interface Map Inventory.h"
#include "Strategic.h"
#include "Utilities.h"
#include "video.h"
@@ -78,7 +78,7 @@ void AddItemsInSectorToBox(void);
// position town/mine info box on the screen
void PositionTownMineInfoBox( void );
// add the pop up button for the map inventory pop up activation
// add the pop up button for the map inventory pop up activation
void AddInventoryButtonForMapPopUpBox( void );
// now remove the above button
@@ -98,14 +98,14 @@ void DisplayTownInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// set current sector
if( ( bCurrentTownMineSectorX != sMapX ) || ( bCurrentTownMineSectorY != sMapY ) || ( bCurrentTownMineSectorZ != bMapZ ) )
{
bCurrentTownMineSectorX = ( INT8 )sMapX;
bCurrentTownMineSectorY = ( INT8 )sMapY;
bCurrentTownMineSectorZ = bMapZ;
bCurrentTownMineSectorX = ( INT8 )sMapX;
bCurrentTownMineSectorY = ( INT8 )sMapY;
bCurrentTownMineSectorZ = bMapZ;
}
//create destroy the box
CreateDestroyTownInfoBox( );
}
void CreateDestroyTownInfoBox( void )
@@ -114,7 +114,6 @@ void CreateDestroyTownInfoBox( void )
static BOOLEAN fCreated = FALSE;
SGPRect pDimensions;
SGPPoint pPosition;
INT16 sButtonX = 0, sButtonY = 0;
INT8 bTownId = 0;
if( ( fCreated == FALSE ) && ( fShowTownInfo == TRUE ) )
@@ -161,7 +160,7 @@ void CreateDestroyTownInfoBox( void )
// set font type
SetBoxFont(ghTownMineBox, BLOCKFONT2);
SetBoxFont(ghTownMineBox, BLOCKFONT2);
// set highlight color
SetBoxHighLight(ghTownMineBox, FONT_WHITE);
@@ -198,7 +197,7 @@ void CreateDestroyTownInfoBox( void )
}
pDimensions.iBottom += BOX_BUTTON_HEIGHT;
SetBoxSize( ghTownMineBox, pDimensions );
ShowBox( ghTownMineBox );
@@ -237,7 +236,7 @@ void CreateDestroyTownInfoBox( void )
fCreated = FALSE;
}
return;
}
@@ -246,7 +245,7 @@ void CreateTownInfoBox( void )
{
// create basic box
CreatePopUpBox(&ghTownMineBox, TownMineDimensions, TownMinePosition, (POPUP_BOX_FLAG_CLIP_TEXT ));
// which buffer will box render to
SetBoxBuffer(ghTownMineBox, FRAME_BUFFER);
@@ -329,7 +328,7 @@ void AddTextToTownBox( void )
// town size
swprintf( wString, L"%s:", pwTownInfoStrings[ 0 ] );
AddMonoString( &hStringHandle, wString );
swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) );
swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) );
AddSecondColumnMonoString( &hStringHandle, wString );
// main facilities
@@ -345,7 +344,7 @@ void AddTextToTownBox( void )
// town control
swprintf( wString, L"%s:", pwTownInfoStrings[ 2 ] );
AddMonoString( &hStringHandle, wString );
swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( ubTownId ) * 100) / GetTownSectorSize( ubTownId ));
swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( ubTownId ) * 100) / GetTownSectorSize( ubTownId ));
AddSecondColumnMonoString( &hStringHandle, wString );
}
@@ -364,9 +363,9 @@ void AddTextToTownBox( void )
if( sMineSector != -1 )
{
// Associated Mine: Sector
swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] );
swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] );
AddMonoString( &hStringHandle, wString );
GetShortSectorString( ( INT16 )( sMineSector % MAP_WORLD_X ), ( INT16 )( sMineSector / MAP_WORLD_X ), wString );
GetShortSectorString( ( INT16 )( sMineSector % MAP_WORLD_X ), ( INT16 )( sMineSector / MAP_WORLD_X ), wString );
AddSecondColumnMonoString( &hStringHandle, wString );
}
}
@@ -461,7 +460,7 @@ void AddTextToMineBox( void )
// town control percentage
swprintf( wString, L"%s:", pwMineStrings[ 12 ]);
AddMonoString( &hStringHandle, wString );
swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( gMineLocation[ ubMineIndex ].bAssociatedTown ) * 100) / GetTownSectorSize( gMineLocation[ ubMineIndex ].bAssociatedTown ));
swprintf( wString, L"%d%%%%", (GetTownSectorsUnderControl( gMineLocation[ ubMineIndex ].bAssociatedTown ) * 100) / GetTownSectorSize( gMineLocation[ ubMineIndex ].bAssociatedTown ));
AddSecondColumnMonoString( &hStringHandle, wString );
ubTown = gMineLocation[ ubMineIndex ].bAssociatedTown;
@@ -599,7 +598,7 @@ void AddCommonInfoToBox(void)
// in sector where militia can be trained,
// control of the sector matters, display who controls this sector. Map brightness no longer gives this!
// control of the sector matters, display who controls this sector. Map brightness no longer gives this!
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) && !fUnknownSAMSite )
{
// controlled:
@@ -619,7 +618,7 @@ void AddCommonInfoToBox(void)
if (ubMilitiaTotal > 0)
{
// some militia, show total & their breakdown by level
swprintf( wString, L"%d (%d/%d/%d)", ubMilitiaTotal,
swprintf( wString, L"%d (%d/%d/%d)", ubMilitiaTotal,
MilitiaInSectorOfRank(bCurrentTownMineSectorX, bCurrentTownMineSectorY, GREEN_MILITIA),
MilitiaInSectorOfRank(bCurrentTownMineSectorX, bCurrentTownMineSectorY, REGULAR_MILITIA),
MilitiaInSectorOfRank(bCurrentTownMineSectorX, bCurrentTownMineSectorY, ELITE_MILITIA));
@@ -647,7 +646,7 @@ void AddCommonInfoToBox(void)
// how many are there, really?
ubNumEnemies = NumEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
switch ( WhatPlayerKnowsAboutEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
{
case KNOWS_NOTHING:
@@ -701,10 +700,9 @@ void PositionTownMineInfoBox( void )
SGPRect pDimensions;
SGPPoint pPosition;
INT16 sX =0, sY = 0;
INT16 sNewMargin = 0;
// position the box based on x and y of the selected sector
GetScreenXYFromMapXY( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &sX, &sY);
GetScreenXYFromMapXY( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &sX, &sY);
// set box position
pPosition.iX = sX;
@@ -721,7 +719,7 @@ void PositionTownMineInfoBox( void )
if( pDimensions.iRight < ( sTotalButtonWidth + 30 ) )
{
SpecifyBoxMinWidth( ghTownMineBox, ( sTotalButtonWidth + 30 ) );
SpecifyBoxMinWidth( ghTownMineBox, ( sTotalButtonWidth + 30 ) );
pDimensions.iRight = sTotalButtonWidth + 30;
}
@@ -733,7 +731,7 @@ void PositionTownMineInfoBox( void )
if( pPosition.iX + pDimensions.iRight > MapScreenRect.iRight )
{
pPosition.iX = MapScreenRect.iRight - pDimensions.iRight - 5;
pPosition.iX = MapScreenRect.iRight - pDimensions.iRight - 5;
}
@@ -743,12 +741,12 @@ void PositionTownMineInfoBox( void )
pPosition.iY = MapScreenRect.iTop + 5;
}
if( pPosition.iY + pDimensions.iBottom > MapScreenRect.iBottom )
if( pPosition.iY + pDimensions.iBottom > MapScreenRect.iBottom )
{
pPosition.iY = MapScreenRect.iBottom - pDimensions.iBottom - 8;
pPosition.iY = MapScreenRect.iBottom - pDimensions.iBottom - 8;
}
// reset position
SetBoxPosition( ghTownMineBox, pPosition );
@@ -768,50 +766,50 @@ void AddInventoryButtonForMapPopUpBox( void )
INT16 sWidthA = 0, sWidthB = 0, sTotalBoxWidth = 0;
HVOBJECT hHandle;
// load the button
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
FilenameForBPP("INTERFACE\\mapinvbtns.sti", VObjectDesc.ImageFile);
AddVideoObject( &VObjectDesc, &uiObject );
AddVideoObject( &VObjectDesc, &uiObject );
// Calculate smily face positions...
GetVideoObject( &hHandle, uiObject );
pTrav = &(hHandle->pETRLEObject[ 0 ] );
sWidthA = pTrav->usWidth;
pTrav = &(hHandle->pETRLEObject[ 1 ] );
sWidthB = pTrav->usWidth;
sTotalBoxWidth = sTotalButtonWidth;
GetBoxSize( ghTownMineBox , &pDimensions );
GetBoxPosition( ghTownMineBox, &pPosition );
sX = pPosition.iX + ( pDimensions.iRight - sTotalBoxWidth ) / 3;
sY = pPosition.iY + pDimensions.iBottom - ( ( BOX_BUTTON_HEIGHT + 5 ) );
sY = pPosition.iY + pDimensions.iBottom - ( ( BOX_BUTTON_HEIGHT + 5 ) );
guiMapButtonInventoryImage[0] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,0,-1,2,-1 );
guiMapButtonInventoryImage[0] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,0,-1,2,-1 );
guiMapButtonInventory[0] = CreateIconAndTextButton( guiMapButtonInventoryImage[0], pMapPopUpInventoryText[ 0 ], BLOCKFONT2,
FONT_WHITE, FONT_BLACK,
FONT_WHITE, FONT_BLACK,
TEXT_CJUSTIFIED,
(INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineInventoryButtonCallBack );
guiMapButtonInventory[0] = CreateIconAndTextButton( guiMapButtonInventoryImage[0], pMapPopUpInventoryText[ 0 ], BLOCKFONT2,
FONT_WHITE, FONT_BLACK,
FONT_WHITE, FONT_BLACK,
TEXT_CJUSTIFIED,
(INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineInventoryButtonCallBack );
sX = sX + sWidthA + ( pDimensions.iRight - sTotalBoxWidth ) / 3;
sY = pPosition.iY + pDimensions.iBottom - ( ( BOX_BUTTON_HEIGHT + 5) );
guiMapButtonInventoryImage[1] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,1,-1,3,-1 );
guiMapButtonInventoryImage[1] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti" ,-1,1,-1,3,-1 );
guiMapButtonInventory[1] = CreateIconAndTextButton( guiMapButtonInventoryImage[1], pMapPopUpInventoryText[ 1 ], BLOCKFONT2,
FONT_WHITE, FONT_BLACK,
FONT_WHITE, FONT_BLACK,
TEXT_CJUSTIFIED,
(INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineExitButtonCallBack );
guiMapButtonInventory[1] = CreateIconAndTextButton( guiMapButtonInventoryImage[1], pMapPopUpInventoryText[ 1 ], BLOCKFONT2,
FONT_WHITE, FONT_BLACK,
FONT_WHITE, FONT_BLACK,
TEXT_CJUSTIFIED,
(INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineExitButtonCallBack );
// delete video object
DeleteVideoObjectFromIndex( uiObject );
@@ -832,11 +830,11 @@ void RemoveInventoryButtonForMapPopUpBox( void )
// get rid of button
RemoveButton( guiMapButtonInventory[0] );
UnloadButtonImage( guiMapButtonInventoryImage[0] );
UnloadButtonImage( guiMapButtonInventoryImage[0] );
RemoveButton( guiMapButtonInventory[1] );
UnloadButtonImage( guiMapButtonInventoryImage[1] );
UnloadButtonImage( guiMapButtonInventoryImage[1] );
return;
}
@@ -845,13 +843,13 @@ void MapTownMineInventoryButtonCallBack( GUI_BUTTON *btn, INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// done
fShowMapInventoryPool = TRUE;
@@ -866,7 +864,7 @@ void MapTownMineInventoryButtonCallBack( GUI_BUTTON *btn, INT32 reason )
ShouldTheHelpScreenComeUp( HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY, TRUE );
}
}
}
}
}
@@ -874,13 +872,13 @@ void MapTownMineExitButtonCallBack( GUI_BUTTON *btn, INT32 reason )
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// done
fMapPanelDirty = TRUE;
@@ -888,7 +886,7 @@ void MapTownMineExitButtonCallBack( GUI_BUTTON *btn, INT32 reason )
fShowTownInfo = FALSE;
}
}
}
}
@@ -903,17 +901,17 @@ void MinWidthOfTownMineInfoBox( void )
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
FilenameForBPP("INTERFACE\\mapinvbtns.sti", VObjectDesc.ImageFile);
AddVideoObject( &VObjectDesc, &uiObject );
AddVideoObject( &VObjectDesc, &uiObject );
// Calculate smily face positions...
GetVideoObject( &hHandle, uiObject );
pTrav = &(hHandle->pETRLEObject[ 0 ] );
sWidthA = pTrav->usWidth;
pTrav = &(hHandle->pETRLEObject[ 1 ] );
sWidthB = pTrav->usWidth;
sTotalBoxWidth = sWidthA + sWidthB;
sTotalButtonWidth = sTotalBoxWidth;
@@ -921,4 +919,4 @@ void MinWidthOfTownMineInfoBox( void )
DeleteVideoObjectFromIndex( uiObject );
return;
}
}
File diff suppressed because it is too large Load Diff
+26 -14
View File
@@ -48,9 +48,9 @@ typedef struct FASTHELPREGION {
#define MAP_SCREEN_FONT BLOCKFONT2
// characterlist regions
#define Y_START 135 //146
#define MAP_START_KEYRING_Y 107
#define Y_SIZE GetFontHeight(MAP_SCREEN_FONT)
#define Y_START 135 //146
#define MAP_START_KEYRING_Y 107
#define Y_SIZE GetFontHeight(MAP_SCREEN_FONT)
//lal
// militia control menu
@@ -211,7 +211,7 @@ enum{
#define UPDATE_MERC_FACE_X_HEIGHT 50
#define UPDATE_MERC_FACE_X_OFFSET 2
#define UPDATE_MERC_FACE_Y_OFFSET 2
#define WIDTH_OF_UPDATE_PANEL_BLOCKS 50
#define WIDTH_OF_UPDATE_PANEL_BLOCKS 50
#define HEIGHT_OF_UPDATE_PANEL_BLOCKS 50
#define UPDATE_MERC_Y_OFFSET 4
#define UPDATE_MERC_X_OFFSET 4
@@ -222,7 +222,7 @@ enum{
#define TACT_UPDATE_MERC_FACE_X_HEIGHT 49
#define TACT_UPDATE_MERC_FACE_X_OFFSET 8
#define TACT_UPDATE_MERC_FACE_Y_OFFSET 6
#define TACT_WIDTH_OF_UPDATE_PANEL_BLOCKS 70
#define TACT_WIDTH_OF_UPDATE_PANEL_BLOCKS 70
#define TACT_HEIGHT_OF_UPDATE_PANEL_BLOCKS 49
#define TACT_UPDATE_MERC_Y_OFFSET 4
#define TACT_UPDATE_MERC_X_OFFSET 4
@@ -231,10 +231,22 @@ enum{
// the first vehicle slot int he list
#define FIRST_VEHICLE 18
typedef struct MERC_LEAVE_ITEM{
OBJECTTYPE o;
struct MERC_LEAVE_ITEM *pNext;
}MERC_LEAVE_ITEM;
class OLD_MERC_LEAVE_ITEM_101
{
public:
OLD_OBJECTTYPE_101 oldObject;
class MERC_LEAVE_ITEM *pNext;
};
class MERC_LEAVE_ITEM
{
public:
BOOLEAN Save( HWFILE hFile);
BOOLEAN Load( HWFILE hFile);
void initialize() {object.initialize(); pNext = NULL;};
OBJECTTYPE object;
class MERC_LEAVE_ITEM *pNext;
};
extern BOOLEAN fShowAssignmentMenu;
extern BOOLEAN fShowTrainingMenu ;
@@ -320,11 +332,11 @@ extern INT32 iCurrentMapSectorZ;
extern INT32 giBoxY;
// pop up box textures
extern UINT32 guiPOPUPTEX;
extern UINT32 guiPOPUPBORDERS;
extern UINT32 guiPOPUPTEX;
extern UINT32 guiPOPUPBORDERS;
// the level-changing markers on the map border
extern UINT32 guiLEVELMARKER;
extern UINT32 guiLEVELMARKER;
// the currently selected character arrow
extern UINT32 guiSelectedCharArrow;
@@ -392,7 +404,7 @@ void EnableTeamInfoPanels( void );
void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, INT16 yp );
// do mapscreen message box
INT32 DoMapMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
INT32 DoMapMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
// hop up one leve,l int he map screen level interface
void GoUpOneLevelInMap( void );
@@ -434,7 +446,7 @@ void InitLeaveList( void );
void ShutDownLeaveList( void );
// add item to leave equip index
BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *o, UINT32 uiIndex );
BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *object, UINT32 uiIndex );
// release memory for all items in this slot's leave item list
void FreeLeaveListSlot( UINT32 uiSlotIndex );
+105 -115
View File
@@ -40,7 +40,7 @@
#define MAX_MEANWHILE_PROFILES 10
INT8 gzMeanwhileStr[][30] =
INT8 gzMeanwhileStr[][30] =
{
"End of player's first battle",
"Drassen Lib. ",
@@ -63,7 +63,7 @@ INT8 gzMeanwhileStr[][30] =
// the snap to grid nos for meanwhile scenes
UINT16 gusMeanWhileGridNo[]=
INT16 gsMeanWhileGridNo[]=
{
12248,
12248,
@@ -96,7 +96,7 @@ typedef struct
} NPC_SAVE_INFO;
// BEGIN SERALIZATION
// BEGIN SERALIZATION
MEANWHILE_DEFINITION gCurrentMeanwhileDef;
MEANWHILE_DEFINITION gMeanwhileDef[NUM_MEANWHILES];
BOOLEAN gfMeanwhileTryingToStart = FALSE;
@@ -113,7 +113,7 @@ UINT32 guiOldScreen;
NPC_SAVE_INFO gNPCSaveData[ MAX_MEANWHILE_PROFILES ];
UINT32 guiNumNPCSaves = 0;
BOOLEAN gfReloadingScreenFromMeanwhile = FALSE;
INT16 gsOldCurInterfacePanel = 0;
INT16 gsOldCurInterfacePanel = 0;
BOOLEAN gfWorldWasLoaded = FALSE;
UINT8 ubCurrentMeanWhileId = 0;
@@ -142,10 +142,10 @@ UINT32 uiMeanWhileFlags = 0;
#define KILL_CHOPPER_FLAG 0x00001000
#define AWOL_SCIENTIST_FLAG 0x00002000
#define OUTSKIRTS_MEDUNA_FLAG 0x00004000
#define INTERROGATION_FLAG 0x00008000
#define INTERROGATION_FLAG 0x00008000
#define BALIME_LIBERATED_FLAG 0x00010000
extern void InternalLocateGridNo( UINT16 sGridNo, BOOLEAN fForce );
extern void InternalLocateGridNo( INT16 sGridNo, BOOLEAN fForce );
void ProcessImplicationsOfMeanwhile( void );
@@ -318,7 +318,7 @@ void ScheduleMeanwhileEvent( MEANWHILE_DEFINITION *pMeanwhileDef, UINT32 uiTime
{
return;
}
// set the meanwhile flag for this event
SetMeanWhileFlag( pMeanwhileDef->ubMeanwhileID );
@@ -328,14 +328,14 @@ void ScheduleMeanwhileEvent( MEANWHILE_DEFINITION *pMeanwhileDef, UINT32 uiTime
// Copy definiaiotn structure into position in global array....
memcpy( &(gMeanwhileDef[pMeanwhileDef->ubMeanwhileID]), pMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) );
// A meanwhile.. poor elliot!
// increment his slapped count...
// A meanwhile.. poor elliot!
// increment his slapped count...
// We need to do it here 'cause they may skip it...
if ( gMercProfiles[ ELLIOT ].bNPCData != 17 )
{
gMercProfiles[ ELLIOT ].bNPCData++;
}
// We need to do it here 'cause they may skip it...
if ( gMercProfiles[ ELLIOT ].bNPCData != 17 )
{
gMercProfiles[ ELLIOT ].bNPCData++;
}
AddStrategicEvent( EVENT_MEANWHILE, uiTime, pMeanwhileDef->ubMeanwhileID );
}
@@ -403,25 +403,25 @@ void CheckForMeanwhileOKStart( )
return;
}
if ( !DialogueQueueIsEmptyOrSomebodyTalkingNow( ) )
{
return;
}
if ( !DialogueQueueIsEmptyOrSomebodyTalkingNow( ) )
{
return;
}
gfMeanwhileTryingToStart = FALSE;
guiOldScreen = guiCurrentScreen;
if ( guiCurrentScreen == GAME_SCREEN )
{
LeaveTacticalScreen( GAME_SCREEN );
}
if ( guiCurrentScreen == GAME_SCREEN )
{
LeaveTacticalScreen( GAME_SCREEN );
}
// We need to make sure we have no item - at least in tactical
// In mapscreen, time is paused when manipulating items...
CancelItemPointer( );
// We need to make sure we have no item - at least in tactical
// In mapscreen, time is paused when manipulating items...
CancelItemPointer( );
BringupMeanwhileBox( );
}
@@ -430,7 +430,6 @@ void CheckForMeanwhileOKStart( )
void StartMeanwhile( )
{
INT32 iIndex;
INT8 bNumDone = 0;
// OK, save old position...
if ( gfWorldLoaded )
@@ -447,14 +446,14 @@ void StartMeanwhile( )
gfInMeanwhile = TRUE;
// ATE: Change music before load
SetMusicMode( MUSIC_MAIN_MENU );
SetMusicMode( MUSIC_MAIN_MENU );
gfWorldWasLoaded = gfWorldLoaded;
// OK, we have been told to start.....
SetCurrentInterfacePanel( (UINT8)TEAM_PANEL );
// Setup NPC locations, depending on meanwhile type...
switch( gCurrentMeanwhileDef.ubMeanwhileID )
{
@@ -464,7 +463,7 @@ void StartMeanwhile( )
case ALMA_LIBERATED:
case GRUMM_LIBERATED:
case CHITZENA_LIBERATED:
case BALIME_LIBERATED:
case BALIME_LIBERATED:
case NW_SAM:
case NE_SAM:
case CENTRAL_SAM:
@@ -480,10 +479,10 @@ void StartMeanwhile( )
if ( iIndex != -1 )
{
gNPCSaveData[ iIndex ].ubProfile = QUEEN;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo;
// Force reload of NPC files...
ReloadQuoteFile( QUEEN );
@@ -496,10 +495,10 @@ void StartMeanwhile( )
if ( iIndex != -1 )
{
gNPCSaveData[ iIndex ].ubProfile = ELLIOT;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo;
// Force reload of NPC files...
ReloadQuoteFile( ELLIOT );
@@ -514,10 +513,10 @@ void StartMeanwhile( )
if ( iIndex != -1 )
{
gNPCSaveData[ iIndex ].ubProfile = JOE;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo;
// Force reload of NPC files...
ReloadQuoteFile( JOE );
@@ -536,10 +535,10 @@ void StartMeanwhile( )
if ( iIndex != -1 )
{
gNPCSaveData[ iIndex ].ubProfile = QUEEN;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ QUEEN ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ QUEEN ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ QUEEN ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ QUEEN ].sGridNo;
// Force reload of NPC files...
ReloadQuoteFile( QUEEN );
@@ -552,10 +551,10 @@ void StartMeanwhile( )
if ( iIndex != -1 )
{
gNPCSaveData[ iIndex ].ubProfile = ELLIOT;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ ELLIOT ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ ELLIOT ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ ELLIOT ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ ELLIOT ].sGridNo;
// Force reload of NPC files...
ReloadQuoteFile( ELLIOT );
@@ -568,10 +567,10 @@ void StartMeanwhile( )
if ( iIndex != -1 )
{
gNPCSaveData[ iIndex ].ubProfile = JOE;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo;
gNPCSaveData[ iIndex ].sX = gMercProfiles[ JOE ].sSectorX;
gNPCSaveData[ iIndex ].sY = gMercProfiles[ JOE ].sSectorY;
gNPCSaveData[ iIndex ].sZ = gMercProfiles[ JOE ].bSectorZ;
gNPCSaveData[ iIndex ].sGridNo = gMercProfiles[ JOE ].sGridNo;
// Force reload of NPC files...
ReloadQuoteFile( JOE );
@@ -597,7 +596,7 @@ void StartMeanwhile( )
void DoneFadeOutMeanwhile( )
{
// OK, insertion data found, enter sector!
SetCurrentWorldSector( gCurrentMeanwhileDef.sSectorX, gCurrentMeanwhileDef.sSectorY, 0 );
//LocateToMeanwhileCharacter( );
@@ -653,8 +652,8 @@ BOOLEAN AreInMeanwhile( )
{
STRATEGICEVENT *curr;
//KM: April 6, 1999
//Tactical traversal needs to take precedence over meanwhile events. When tactically traversing, we
//KM: April 6, 1999
//Tactical traversal needs to take precedence over meanwhile events. When tactically traversing, we
//expect to make it to the other side without interruption.
if( gfTacticalTraversal )
{
@@ -665,7 +664,7 @@ BOOLEAN AreInMeanwhile( )
{
return TRUE;
}
//Check to make sure a meanwhile scene isn't in the event list occurring at the exact same time as this call. Meanwhile
//Check to make sure a meanwhile scene isn't in the event list occurring at the exact same time as this call. Meanwhile
//scenes have precedence over a new battle if they occur in the same second.
curr = gpEventList;
while( curr )
@@ -726,12 +725,12 @@ void ProcessImplicationsOfMeanwhile( void )
//HandleNPCDoAction( QUEEN, NPC_ACTION_SEND_SOLDIERS_TO_DRASSEN, 0 );
ExecuteStrategicAIAction( NPC_ACTION_SEND_SOLDIERS_TO_DRASSEN, 13, 4 );
break;
case CREATURES:
// add Rat
HandleNPCDoAction( QUEEN, NPC_ACTION_ADD_RAT, 0 );
break;
case AWOL_SCIENTIST:
{
INT16 sSectorX, sSectorY;
@@ -781,7 +780,7 @@ void ProcessImplicationsOfMeanwhile( void )
case CENTRAL_SAM:
ExecuteStrategicAIAction( NPC_ACTION_SEND_TROOPS_TO_SAM, SAM_3_X, SAM_3_X );
break;
default:
break;
}
@@ -804,8 +803,8 @@ void EndMeanwhile( )
UnLockPauseState();
UnPauseGame();
// ATE: Make sure!
TurnOffSectorLocator();
// ATE: Make sure!
TurnOffSectorLocator();
if ( gCurrentMeanwhileDef.ubMeanwhileID != INTERROGATION )
{
@@ -823,23 +822,23 @@ void EndMeanwhile( )
// Set music mode to enemy present!
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
// ATE: Restore people to saved positions...
// OK, restore NPC save info...
for ( cnt = 0; cnt < guiNumNPCSaves; cnt++ )
{
ubProfile = gNPCSaveData[ cnt ].ubProfile;
// ATE: Restore people to saved positions...
// OK, restore NPC save info...
for ( cnt = 0; cnt < guiNumNPCSaves; cnt++ )
{
ubProfile = gNPCSaveData[ cnt ].ubProfile;
if ( ubProfile != NO_PROFILE )
{
gMercProfiles[ ubProfile ].sSectorX = gNPCSaveData[ cnt ].sX;
gMercProfiles[ ubProfile ].sSectorY = gNPCSaveData[ cnt ].sY;
gMercProfiles[ ubProfile ].bSectorZ = (INT8)gNPCSaveData[ cnt ].sZ;
gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo;
if ( ubProfile != NO_PROFILE )
{
gMercProfiles[ ubProfile ].sSectorX = gNPCSaveData[ cnt ].sX;
gMercProfiles[ ubProfile ].sSectorY = gNPCSaveData[ cnt ].sY;
gMercProfiles[ ubProfile ].bSectorZ = (INT8)gNPCSaveData[ cnt ].sZ;
gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo;
// Ensure NPC files loaded...
ReloadQuoteFile( ubProfile );
}
}
// Ensure NPC files loaded...
ReloadQuoteFile( ubProfile );
}
}
}
@@ -853,13 +852,13 @@ void DoneFadeOutMeanwhileOnceDone( )
// OK, insertion data found, enter sector!
gfReloadingScreenFromMeanwhile = TRUE;
if( gfWorldWasLoaded )
{
SetCurrentWorldSector( gsOldSectorX, gsOldSectorY, (INT8)gsOldSectorZ );
ExamineCurrentSquadLights( );
}
ExamineCurrentSquadLights( );
}
else
{
TrashWorld( );
@@ -883,7 +882,7 @@ void DoneFadeOutMeanwhileOnceDone( )
gMercProfiles[ ubProfile ].sSectorX = gNPCSaveData[ cnt ].sX;
gMercProfiles[ ubProfile ].sSectorY = gNPCSaveData[ cnt ].sY;
gMercProfiles[ ubProfile ].bSectorZ = (INT8)gNPCSaveData[ cnt ].sZ;
gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo;
gMercProfiles[ ubProfile ].sGridNo = (INT8)gNPCSaveData[ cnt ].sGridNo;
// Ensure NPC files loaded...
ReloadQuoteFile( ubProfile );
@@ -912,7 +911,7 @@ void DoneFadeOutMeanwhileOnceDone( )
void DoneFadeInMeanwhileOnceDone( )
{
}
void LocateMeanWhileGrid( void )
@@ -920,7 +919,7 @@ void LocateMeanWhileGrid( void )
INT16 sGridNo = 0;
// go to the approp. gridno
sGridNo = gusMeanWhileGridNo[ ubCurrentMeanWhileId ];
sGridNo = gsMeanWhileGridNo[ ubCurrentMeanWhileId ];
InternalLocateGridNo( sGridNo, TRUE );
@@ -958,14 +957,14 @@ void HandleCreatureRelease( void )
{
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
MeanwhileDef.sSectorX = 3;
MeanwhileDef.sSectorY = 16;
MeanwhileDef.ubNPCNumber = QUEEN;
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
MeanwhileDef.ubMeanwhileID = CREATURES;
// schedule the event
@@ -987,7 +986,7 @@ void HandleMeanWhileEventPostingForTownLiberation( UINT8 bTownId )
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
// which town iberated?
switch( bTownId )
{
@@ -1024,10 +1023,10 @@ void HandleMeanWhileEventPostingForTownLiberation( UINT8 bTownId )
// schedule the event
ScheduleMeanwhileEvent( &MeanwhileDef, uiTime );
}
}
}
void HandleMeanWhileEventPostingForTownLoss( UINT8 bTownId )
{
{
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
@@ -1043,7 +1042,7 @@ void HandleMeanWhileEventPostingForTownLoss( UINT8 bTownId )
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
MeanwhileDef.ubMeanwhileID = LOST_TOWN;
// schedule the event
@@ -1072,9 +1071,9 @@ void HandleMeanWhileEventPostingForSAMLiberation( INT8 bSamId )
MeanwhileDef.sSectorY = 16;
MeanwhileDef.ubNPCNumber = QUEEN;
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
// which SAM iberated?
switch( bSamId )
{
@@ -1103,15 +1102,13 @@ void HandleMeanWhileEventPostingForSAMLiberation( INT8 bSamId )
ScheduleMeanwhileEvent( &MeanwhileDef, uiTime );
}
}
void HandleFlowersMeanwhileScene( INT8 bTimeCode )
{
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
UINT8 ubId = 0;
// make sure scene hasn't been used before
if ( GetMeanWhileFlag( FLOWERS ) )
{
@@ -1134,7 +1131,7 @@ void HandleFlowersMeanwhileScene( INT8 bTimeCode )
// 2-4 days later
uiTime = GetWorldTotalMin() + 60 * ( 24 + Random( 48 ) );
}
MeanwhileDef.ubMeanwhileID = FLOWERS;
// schedule the event
@@ -1145,8 +1142,6 @@ void HandleOutskirtsOfMedunaMeanwhileScene( void )
{
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
UINT8 ubId = 0;
// make sure scene hasn't been used before
if ( GetMeanWhileFlag( OUTSKIRTS_MEDUNA ) )
{
@@ -1159,7 +1154,7 @@ void HandleOutskirtsOfMedunaMeanwhileScene( void )
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
MeanwhileDef.ubMeanwhileID = OUTSKIRTS_MEDUNA;
// schedule the event
@@ -1170,8 +1165,6 @@ void HandleKillChopperMeanwhileScene( void )
{
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
UINT8 ubId = 0;
// make sure scene hasn't been used before
if ( GetMeanWhileFlag( KILL_CHOPPER ) )
{
@@ -1184,7 +1177,7 @@ void HandleKillChopperMeanwhileScene( void )
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 55 + Random( 10 );
MeanwhileDef.ubMeanwhileID = KILL_CHOPPER;
// schedule the event
@@ -1195,8 +1188,6 @@ void HandleScientistAWOLMeanwhileScene( void )
{
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
UINT8 ubId = 0;
// make sure scene hasn't been used before
if ( GetMeanWhileFlag( AWOL_SCIENTIST ) )
{
@@ -1209,7 +1200,7 @@ void HandleScientistAWOLMeanwhileScene( void )
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
MeanwhileDef.ubMeanwhileID = AWOL_SCIENTIST;
// schedule the event
@@ -1218,10 +1209,8 @@ void HandleScientistAWOLMeanwhileScene( void )
void HandleInterrogationMeanwhileScene( void )
{
UINT32 uiTime = 0;
UINT32 uiTime = 0;
MEANWHILE_DEFINITION MeanwhileDef;
UINT8 ubId = 0;
// make sure scene hasn't been used before
if ( GetMeanWhileFlag( INTERROGATION ) )
{
@@ -1234,7 +1223,7 @@ void HandleInterrogationMeanwhileScene( void )
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 60;
MeanwhileDef.ubMeanwhileID = INTERROGATION;
// schedule the event
@@ -1251,14 +1240,14 @@ void HandleFirstBattleVictory( void )
{
return;
}
MeanwhileDef.sSectorX = 3;
MeanwhileDef.sSectorY = 16;
MeanwhileDef.ubNPCNumber = QUEEN;
MeanwhileDef.usTriggerEvent = 0;
uiTime = GetWorldTotalMin() + 5;
ubId = END_OF_PLAYERS_FIRST_BATTLE;
MeanwhileDef.ubMeanwhileID = ubId;
@@ -1279,7 +1268,7 @@ void HandleDelayedFirstBattleVictory( void )
{
return;
}
MeanwhileDef.sSectorX = 3;
MeanwhileDef.sSectorY = 16;
MeanwhileDef.ubNPCNumber = QUEEN;
@@ -1287,11 +1276,11 @@ void HandleDelayedFirstBattleVictory( void )
/*
//It is theoretically impossible to liberate a town within 60 minutes of the first battle (which is supposed to
//occur outside of a town in this scenario). The delay is attributed to the info taking longer to reach the queen.
//occur outside of a town in this scenario). The delay is attributed to the info taking longer to reach the queen.
uiTime = GetWorldTotalMin() + 60;
*/
uiTime = GetWorldTotalMin() + 5;
ubId = END_OF_PLAYERS_FIRST_BATTLE;
MeanwhileDef.ubMeanwhileID = ubId;
@@ -1313,7 +1302,7 @@ void HandleFirstBattleEndingWhileInTown( INT16 sSectorX, INT16 sSectorY, INT16 b
}
// if this is in fact a town and it is the first battle, then set gfFirstBattleMeanwhileScenePending true
// if is true then this is the end of the second battle, post the first meanwhile OR, on call to trash world, that
// if is true then this is the end of the second battle, post the first meanwhile OR, on call to trash world, that
// means player is leaving sector
// grab sector value
@@ -1357,6 +1346,7 @@ void HandleFirstMeanWhileSetUpWithTrashWorld( void )
+92 -92
View File
@@ -20,7 +20,7 @@
#include "strategic.h"
#include "strategicmap.h"
#include "Quests.h"
#include "worlddef.h"
#include "worlddef.h"
#include "rotting corpses.h"
#include "Animation Control.h"
#include "Tactical Save.h"
@@ -64,7 +64,7 @@ BOOLEAN fEnterMapDueToContract = FALSE;
extern BOOLEAN fOneFrame;
extern BOOLEAN fPausedTimeDuringQuote;
UINT8 ubQuitType = 0;
BOOLEAN gfFirstMercSayQuote = FALSE;
BOOLEAN gfFirstMercSayQuote = FALSE;
extern BOOLEAN gfFirstMercSayingQuoteWillLeaveNoMatterWhat;
extern CHAR16 gzUserDefinedButton1[ 128 ];
@@ -82,12 +82,12 @@ UINT8 ubNumContractRenewals = 0;
// end
UINT8 ubCurrentContractRenewal = 0;
UINT8 ubCurrentContractRenewalInProgress = FALSE;
BOOLEAN gfContractRenewalSquenceOn = FALSE;
BOOLEAN gfContractRenewalSquenceOn = FALSE;
BOOLEAN gfInContractMenuFromRenewSequence = FALSE;
// the airport sector
#define AIRPORT_X 13
#define AIRPORT_X 13
#define AIRPORT_Y 2
@@ -108,7 +108,7 @@ BOOLEAN SaveContractRenewalDataToSaveGameFile( HWFILE hFile )
}
return( TRUE );
return( TRUE );
}
@@ -128,7 +128,7 @@ BOOLEAN LoadContractRenewalDataFromSaveGameFile( HWFILE hFile )
return( FALSE );
}
return( TRUE );
return( TRUE );
}
void BeginContractRenewalSequence( )
@@ -146,7 +146,7 @@ void BeginContractRenewalSequence( )
if ( pSoldier )
{
if( ( pSoldier->bActive == FALSE ) || ( pSoldier->bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) )
if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) )
{
// no
continue;
@@ -226,7 +226,7 @@ void HandleContractRenewalSequence( )
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW , pSoldier->ubID,0 ,0 ,0 ,0 );
}
else
{
{
// OK check what dialogue to play
// If we have not used this one before....
if ( pSoldier->ubContractRenewalQuoteCode == SOLDIER_CONTRACT_RENEW_QUOTE_NOT_USED )
@@ -242,7 +242,7 @@ void HandleContractRenewalSequence( )
HandleImportantMercQuote( pSoldier, QUOTE_MERC_LEAVING_ALSUCO_SOON );
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 );
}
// Do special dialogue event...
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTRACT_WANTS_TO_RENEW , pSoldier->ubID,0 ,0 ,0 ,0 );
}
@@ -263,7 +263,7 @@ void EndCurrentContractRenewal( )
{
// OK stop this one and increment current one
ubCurrentContractRenewalInProgress = FALSE;
gfInContractMenuFromRenewSequence = FALSE;
gfInContractMenuFromRenewSequence = FALSE;
ubCurrentContractRenewal++;
@@ -296,7 +296,7 @@ void HandleMercIsNotWillingToRenew( UINT8 ubID )
// We wish to lock interface
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1,MAP_SCREEN,0,0,0 );
// Setup variable for this....
gfInContractMenuFromRenewSequence = TRUE;
@@ -378,7 +378,7 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction )
return(FALSE);
}
fPausedTimeDuringQuote = TRUE;
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 );
@@ -395,7 +395,7 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction )
//determine the end of the contract
pSoldier->iEndofContractTime += ( iContractLength * 1440 );
if( ( pSoldier->usLifeInsurance ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) // DEF: Removed cause they can extend a 1 day contract && ( iContractLength > 1 )
if( ( pSoldier->usLifeInsurance ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) // DEF: Removed cause they can extend a 1 day contract && ( iContractLength > 1 )
{
// check if player can afford insurance, if not, tell them
iCostOfInsurance = CalculateInsuranceContractCost( iContractLength, pSoldier->ubProfile );
@@ -436,22 +436,22 @@ BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction )
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 );
// ATE: Setup when they can be signed again!
// If they are 2-weeks this can be extended
// otherwise don't change from current
if ( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK )
{
pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime;
}
// ATE: Setup when they can be signed again!
// If they are 2-weeks this can be extended
// otherwise don't change from current
if ( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK )
{
pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime;
}
// ARM: Do not reset because of renewal! The quote is for early dismissal from *initial* time of hiring
// ARM: Do not reset because of renewal! The quote is for early dismissal from *initial* time of hiring
// pSoldier->uiTimeOfLastContractUpdate = GetWorldTotalMin();
// ARM: Do not reset because of renewal! The deposit in the profile goes up when merc levels, but the one in the soldier
// ARM: Do not reset because of renewal! The deposit in the profile goes up when merc levels, but the one in the soldier
// structure must always reflect the deposit actually paid (which does NOT change when a merc levels).
// pSoldier->usMedicalDeposit = gMercProfiles[ pSoldier->ubProfile ].sMedicalDepositAmount;
//add an entry in the finacial page for the extending of the mercs contract
//add an entry in the finacial page for the extending of the mercs contract
AddTransactionToPlayersBook( ubFinancesContractType, pSoldier->ubProfile, GetWorldTotalMin(), -iContractCharge );
//add an entry in the history page for the extending of the merc contract
@@ -476,7 +476,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote )
return( FALSE );
// does the merc have another contract already lined up?
if( pSoldier->fSignedAnotherContract )
if( pSoldier->flags.fSignedAnotherContract )
{
// NOTE: Having a buddy around will NOT stop a merc from leaving on another contract (IC's call)
@@ -569,14 +569,14 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote )
if ( bMercID >= 0 )
{
if ( IsMercOnTeamAndInOmertaAlreadyAndAlive( (UINT8) bMercID ) )
{
{
if ( gMercProfiles[ pSoldier->ubProfile ].bLearnToHateCount == 0 )
{
// our tolerance has run out!
fUnhappy = TRUE;
usReasonQuote = QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW;
}
}
else if ( gMercProfiles[ pSoldier->ubProfile ].bLearnToHateCount <= gMercProfiles[ pSoldier->ubProfile ].bLearnToHateTime / 2 )
{
pHated = FindSoldierByProfileID( bMercID, TRUE );
@@ -596,7 +596,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote )
if (!fUnhappy)
{
// check if death rate is too high
if( MercThinksDeathRateTooHigh( pSoldier-> ubProfile ) )
if( MercThinksDeathRateTooHigh( pSoldier->ubProfile ) )
{
fUnhappy = TRUE;
usReasonQuote = QUOTE_DEATH_RATE_RENEWAL;
@@ -641,7 +641,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote )
}
else
{
SetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usReasonQuote ) ) );
SetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usReasonQuote ) ) );
}
}
}
@@ -682,7 +682,7 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote )
if( ( SoldierWantsToDelayRenewalOfContract( pSoldier ) ) )
{
// has a new job lined up
HandleImportantMercQuote( pSoldier, QUOTE_DELAY_CONTRACT_RENEWAL );
HandleImportantMercQuote( pSoldier, QUOTE_DELAY_CONTRACT_RENEWAL );
}
else
*/
@@ -717,11 +717,11 @@ void HandleSoldierLeavingWithLowMorale( SOLDIERTYPE *pSoldier )
void HandleSoldierLeavingForAnotherContract( SOLDIERTYPE *pSoldier )
{
if (pSoldier->fSignedAnotherContract)
if (pSoldier->flags.fSignedAnotherContract)
{
// merc goes to work elsewhere
gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_WORKING_ELSEWHERE;
gMercProfiles[ pSoldier->ubProfile ].uiDayBecomesAvailable += 1 + Random(6 + (pSoldier->bExpLevel / 2) ); // 1-(6 to 11) days
gMercProfiles[ pSoldier->ubProfile ].uiDayBecomesAvailable += 1 + Random(6 + (pSoldier->stats.bExpLevel / 2) ); // 1-(6 to 11) days
}
}
@@ -738,11 +738,11 @@ BOOLEAN SoldierWantsToDelayRenewalOfContract( SOLDIERTYPE *pSoldier )
// does the soldier want to delay renew of contract, possibly due to poor performance by player
if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC )
return( FALSE );
// type of contract the merc had
bTypeOfCurrentContract = pSoldier -> bTypeOfLastContract;
bTypeOfCurrentContract = pSoldier->bTypeOfLastContract;
iLeftTimeOnContract = pSoldier->iEndofContractTime - GetWorldTotalMin();
// grab tolerance
switch( bTypeOfCurrentContract )
{
@@ -783,14 +783,14 @@ void CheckIfMercGetsAnotherContract( SOLDIERTYPE *pSoldier )
if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC )
return;
// ATE: check time we have and see if we can accept new contracts....
if ( GetWorldTotalMin() <= (UINT32) pSoldier->iTimeCanSignElsewhere )
{
return;
}
// ATE: check time we have and see if we can accept new contracts....
if ( GetWorldTotalMin() <= (UINT32) pSoldier->iTimeCanSignElsewhere )
{
return;
}
// if he doesn't already have another contract
if (!pSoldier->fSignedAnotherContract)
if (!pSoldier->flags.fSignedAnotherContract)
{
// chance depends on how much time he has left in his contract, and his experience level (determines demand)
uiFullDaysRemaining = (pSoldier->iEndofContractTime - GetWorldTotalMin()) / (24 * 60);
@@ -820,36 +820,36 @@ void CheckIfMercGetsAnotherContract( SOLDIERTYPE *pSoldier )
}
// multiply by experience level
iChance *= pSoldier->bExpLevel;
iChance *= pSoldier->stats.bExpLevel;
if( (INT32) Random( 100 ) < iChance )
{
// B'bye!
pSoldier->fSignedAnotherContract = TRUE;
pSoldier->flags.fSignedAnotherContract = TRUE;
}
}
}
//for ubRemoveType pass in the enum from the .h, ( MERC_QUIT, MERC_FIRED )
//for ubRemoveType pass in the enum from the .h, ( MERC_QUIT, MERC_FIRED )
BOOLEAN BeginStrategicRemoveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fAddRehireButton )
{
InterruptTime( );
PauseGame();
LockPauseState( 8 );
//if the soldier may have some special action when he/she leaves the party, handle it
HandleUniqueEventWhenPlayerLeavesTeam( pSoldier );
// IF the soldier is an EPC, don't ask about equipment
if ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC )
{
UnEscortEPC( pSoldier );
}
else
{
NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( pSoldier, fAddRehireButton );
}
//if the soldier may have some special action when he/she leaves the party, handle it
HandleUniqueEventWhenPlayerLeavesTeam( pSoldier );
// IF the soldier is an EPC, don't ask about equipment
if ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC )
{
UnEscortEPC( pSoldier );
}
else
{
NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( pSoldier, fAddRehireButton );
}
return( TRUE );
}
@@ -863,7 +863,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
{
EndCurrentContractRenewal( );
}
// ATE: Determine which HISTORY ENTRY to use...
if ( pSoldier->ubLeaveHistoryCode == 0 )
{
@@ -874,7 +874,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
ubHistoryCode = pSoldier->ubLeaveHistoryCode;
//if the soldier is DEAD
if( pSoldier->bLife <= 0 )
if( pSoldier->stats.bLife <= 0 )
{
AddCharacterToDeadList( pSoldier );
}
@@ -894,7 +894,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC )
{
SetupProfileInsertionDataForSoldier( pSoldier );
SetupProfileInsertionDataForSoldier( pSoldier );
}
//remove him from the soldier structure
@@ -911,7 +911,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
{
// remove him from any existing merc slot he could be in
RemoveMercSlot( pSoldier );
TakeSoldierOutOfVehicle( pSoldier );
TakeSoldierOutOfVehicle( pSoldier );
}
}
@@ -937,7 +937,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
//add an entry in the history page for the firing/quiting of the merc
// ATE: Don't do this if they are already dead!
if ( !( pSoldier->uiStatusFlags & SOLDIER_DEAD ) )
if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) )
{
AddHistoryToPlayersLog( ubHistoryCode, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->sSectorX, pSoldier->sSectorY );
}
@@ -955,7 +955,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
CalculateMedicalDepositRefund( pSoldier );
}
//remove the merc from the tactical
//remove the merc from the tactical
TacticalRemoveSoldier( pSoldier->ubID );
// Check if we should remove loaded world...
@@ -973,7 +973,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
// stop time compression so player can react to the departure
StopTimeCompression();
// WDS: This allows for replacing dead IMP mercs. See "BtnIMPBeginScreenDoneCallback" in "IMP Begin Screen.cpp"
// WDS: This allows for replacing dead IMP mercs. See "BtnIMPBeginScreenDoneCallback" in "IMP Begin Screen.cpp"
if( ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER ) &&
( gMercProfiles[ pSoldier->ubProfile ].bMercStatus == MERC_IS_DEAD ) ) {
// Replace the name with an empty string
@@ -982,7 +982,7 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
// ATE: update team panels....
UpdateTeamPanelAssignments( );
// And unpause the @#$@#$ interface
UnLockPauseState();
UnPauseGame();
@@ -1000,7 +1000,7 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier )
return;
//if the merc is at full health, refund the full medical deposit
if( pSoldier->bLife == pSoldier->bLifeMax )
if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax )
{
//add an entry in the finacial page for the FULL refund of the medical deposit
// use the medical deposit in pSoldier, not in profile, which goes up with leveling
@@ -1010,7 +1010,7 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier )
AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile );
}
//else if the merc is a dead, refund NOTHING!!
else if( pSoldier->bLife <= 0 )
else if( pSoldier->stats.bLife <= 0 )
{
//add an entry in the finacial page for NO refund of the medical deposit
//AddTransactionToPlayersBook( NO_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), 0 );
@@ -1023,7 +1023,7 @@ void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier )
else
{
// use the medical deposit in pSoldier, not in profile, which goes up with leveling
iRefundAmount = (INT32) ( ( pSoldier->bLife / ( FLOAT ) pSoldier->bLifeMax ) * pSoldier->usMedicalDeposit + 0.5 );
iRefundAmount = (INT32) ( ( pSoldier->stats.bLife / ( FLOAT ) pSoldier->stats.bLifeMax ) * pSoldier->usMedicalDeposit + 0.5 );
//add an entry in the finacial page for a PARTIAL refund of the medical deposit
AddTransactionToPlayersBook( PARTIAL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), iRefundAmount );
@@ -1056,12 +1056,12 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi
pLeaveSoldier = pSoldier;
if( pSoldier->fSignedAnotherContract == TRUE )
if( pSoldier->flags.fSignedAnotherContract == TRUE )
{
fAddRehireButton = FALSE;
}
if( pSoldier->fSignedAnotherContract == TRUE )
if( pSoldier->flags.fSignedAnotherContract == TRUE )
{
fAddRehireButton = FALSE;
}
@@ -1086,9 +1086,9 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi
}
// check if drassen controlled
else if( StrategicMap[ ( AIRPORT_X + ( MAP_WORLD_X * AIRPORT_Y ) ) ].fEnemyControlled == FALSE )
else if( StrategicMap[ ( AIRPORT_X + ( MAP_WORLD_X * AIRPORT_Y ) ) ].fEnemyControlled == FALSE )
{
if( ( pSoldier->sSectorX == AIRPORT_X ) && ( pSoldier->sSectorY == AIRPORT_Y ) && ( pSoldier->bSectorZ == 0 ) )
{
if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE )
@@ -1114,7 +1114,7 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi
{
swprintf( sString, pMercSheLeaveString[ 0 ], pSoldier->name, zShortTownIDString );
}
}
}
else
@@ -1151,13 +1151,13 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi
if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
{
if( fInSector == FALSE )
{
{
// set up for mapscreen
DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC ) ), MercDepartEquipmentBoxCallBack );
}
else
{
DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ), MercDepartEquipmentBoxCallBack );
DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, ( UINT16 )( ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ), MercDepartEquipmentBoxCallBack );
}
}
@@ -1166,15 +1166,15 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi
if( fInSector == FALSE )
{
// set up for all otherscreens
DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC ) ), MercDepartEquipmentBoxCallBack, &pCenteringRect );
DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_GENERICCONTRACT : MSG_BOX_FLAG_GENERIC ) ), MercDepartEquipmentBoxCallBack, &pCenteringRect );
}
else
{
DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ) , MercDepartEquipmentBoxCallBack, &pCenteringRect );
DoMessageBox( MSG_BOX_BASIC_STYLE, sString, guiCurrentScreen, ( UINT16 ) ( MSG_BOX_FLAG_USE_CENTERING_RECT | ( fAddRehireButton ? MSG_BOX_FLAG_OKCONTRACT : MSG_BOX_FLAG_OK ) ) , MercDepartEquipmentBoxCallBack, &pCenteringRect );
}
}
if( pSoldier->fSignedAnotherContract == TRUE )
if( pSoldier->flags.fSignedAnotherContract == TRUE )
{
//fCurrentMercFired = FALSE;
}
@@ -1193,7 +1193,7 @@ void MercDepartEquipmentBoxCallBack( UINT8 bExitValue )
{
// yep (NOTE that this passes the SOLDIER index, not the PROFILE index as the others do)
HandleLeavingOfEquipmentInCurrentSector( pLeaveSoldier->ubID );
// aim merc will say goodbye when leaving
if( ( pLeaveSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && ( ubQuitType != HISTORY_MERC_FIRED ) )
{
@@ -1205,7 +1205,7 @@ void MercDepartEquipmentBoxCallBack( UINT8 bExitValue )
HandleExtendMercsContract( pLeaveSoldier );
return;
}
else if( bExitValue == MSG_BOX_RETURN_YES )
else if( bExitValue == MSG_BOX_RETURN_YES )
{
// yep (NOTE that this passes the SOLDIER index, not the PROFILE index as the others do)
HandleLeavingOfEquipmentInCurrentSector( pLeaveSoldier->ubID );
@@ -1265,7 +1265,7 @@ BOOLEAN HandleFiredDeadMerc( SOLDIERTYPE *pSoldier )
SET_PALETTEREP_ID ( Corpse.HeadPal, pSoldier->HeadPal );
SET_PALETTEREP_ID ( Corpse.VestPal, pSoldier->VestPal );
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
Corpse.bDirection = pSoldier->ubDirection;
@@ -1301,12 +1301,12 @@ void HandleExtendMercsContract( SOLDIERTYPE *pSoldier )
pContractReHireSoldier = pSoldier;
uiContractTimeMode = giTimeCompressMode;
}
fTeamPanelDirty = TRUE;
fCharacterInfoPanelDirty = TRUE;
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE, 1, MAP_SCREEN, 0, 0, 0 );
CheckIfSalaryIncreasedAndSayQuote( pSoldier, TRUE );
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE, 0 ,MAP_SCREEN, 0, 0, 0 );
@@ -1339,9 +1339,9 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void )
for( iCounter = 0; iCounter < iNumberOnTeam; iCounter++ )
{
pSoldier = &Menptr[ iCounter ];
// valid soldier?
if( ( pSoldier->bActive == FALSE ) || ( pSoldier->bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) )
if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) )
{
// no
continue;
@@ -1392,7 +1392,7 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void )
// OK, he does not want to renew.......
HandleImportantMercQuote( pSoldierWhoWillQuit, QUOTE_MERC_LEAVING_ALSUCO_SOON );
AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON );
AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON );
TacticalCharacterDialogueWithSpecialEvent( pSoldierWhoWillQuit, 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 );
pSoldierWhoWillQuit->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_115_USED;
@@ -1409,7 +1409,7 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void )
HandleImportantMercQuote( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], QUOTE_CONTRACTS_OVER );
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 );
AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON );
AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON );
TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 );
MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ]->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_89_USED;
@@ -1446,13 +1446,13 @@ void HandleNotifyPlayerCanAffordInsurance( SOLDIERTYPE *pSoldier, UINT8 ubLength
// now pop up the message box
DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_YESNO, ExtendMercInsuranceContractCallBack );
return;
}
void ExtendMercInsuranceContractCallBack( UINT8 bExitValue )
{
if( bExitValue == MSG_BOX_RETURN_YES )
if( bExitValue == MSG_BOX_RETURN_YES )
{
PurchaseOrExtendInsuranceForSoldier( gpInsuranceSoldier, gubContractLength );
}
@@ -1507,7 +1507,7 @@ BOOLEAN ContractIsExpiring( SOLDIERTYPE *pSoldier )
if ( GetWorldHour( ) == uiCheckHour )
{
// All's good for go!
return( TRUE );
return( TRUE );
}
}
@@ -1529,10 +1529,10 @@ BOOLEAN ContractIsGoingToExpireSoon( SOLDIERTYPE *pSoldier )
if ( GetWorldHour( ) >= ( uiCheckHour - 2 ) )
{
// All's good for go!
return( TRUE );
return( TRUE );
}
}
return( FALSE );
}
}
+90 -69
View File
@@ -48,9 +48,9 @@
#define BASE_DIR_PRIORITY 5
// little chance to move if below minimum
//#define MINIMUM_MILITIA_SQUAD_SIZE 10
//#define MINIMUM_MILITIA_SQUAD_SIZE 10
// should be 2* Minimum
//#define MAXIMUM_MILITIA_SQUAD_SIZE 30
//#define MAXIMUM_MILITIA_SQUAD_SIZE 30
//#define MAXIMUM_MILITIA_SQUAD_SIZE_BATTLE MAXIMUM_MILITIA_SQUAD_SIZE
#define DIR_WITH_UNFULL_SQUAD_RATING_BONUS 100
@@ -63,7 +63,7 @@
#define DIR_SOUTH 2
#define DIR_WEST 3
INT32 iRestrictedSectorArraySize;
INT32 iRestrictedSectorArraySize;
UINT32 gRestrictMilitia[256];
UINT8 gpAttackDirs[5][4]; // 0. Green Militia 1. Regular Militia 2. Elite Militia 3. Insertion code
@@ -87,16 +87,16 @@ BOOLEAN PlayerMercsInSector_MSE( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fDont
while( pGroup )
{
if( pGroup->fPlayer )// && !pGroup->fBetweenSectors)
{
{
if ( ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == 0 ) ||
( !fDontConsiderNextSector && ( pGroup->ubNextX == ubSectorX && pGroup->ubNextY == ubSectorY && pGroup->ubSectorZ == 0 ) ) )
( !fDontConsiderNextSector && ( pGroup->ubNextX == ubSectorX && pGroup->ubNextY == ubSectorY && pGroup->ubSectorZ == 0 ) ) )
{
//we have a group, make sure that it isn't a group containing only dead members.
pPlayer = pGroup->pPlayerList;
while( pPlayer )
{
// robots count as mercs here, because they can fight, but vehicles don't
if( ( pPlayer->pSoldier->bLife ) && !( pPlayer->pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
if( ( pPlayer->pSoldier->stats.bLife ) && !( pPlayer->pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
ubNumMercs++;
}
@@ -121,7 +121,7 @@ UINT8 GetEnemyGroupIdInSector( INT16 sMapX, INT16 sMapY )
if( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && !curr->fPlayer )
if( !curr->ubGroupID )
return curr->ubGroupID;
else
else
ubRes = curr->ubGroupID;
curr = curr->next;
}
@@ -141,7 +141,7 @@ UINT8 CountMilitia(SECTORINFO *pSectorInfo)
void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia);
StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia);
StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia);
@@ -149,9 +149,20 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY )
pSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] );
while( CountMilitia(pSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSize )
if(pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];else
if(pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];else
if(pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
{
if(pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA])
{
--pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];
}
else if(pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])
{
--pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];
}
else if(pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])
{
--pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
}
}
// Update the militia if the current sector is affected
if (gfStrategicMilitiaChangesMade)
@@ -165,7 +176,7 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
SECTORINFO *pTSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] );
StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] );
StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] );
StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] );
@@ -176,12 +187,23 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
while( !fAlternativeMax && CountMilitia(pTSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSize ||
fAlternativeMax && CountMilitia(pTSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSizeBattle )
{
if(pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA])
{--pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];}else
if(pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])
{--pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];}else
if(pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])
{--pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];}
{
--pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];
++pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];
}
else if(pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])
{
--pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];
++pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];
}
else if(pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])
{
--pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
++pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
}
}
if (gfStrategicMilitiaChangesMade)
{
@@ -245,7 +267,7 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
default:
return 0;
}
//for( uiSector = 0 ; uiSector < 256 ; ++uiSector )
for( sLMX = 0; sLMX < 16 ; ++sLMX )
for( sLMY = 0; sLMY < 16 ; ++sLMY )
@@ -263,14 +285,14 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
else ddAngle = atan2( (double)(sLMY - sMapY), (double)(sLMX - sMapX) );
if( ddAngle < 0 && uiDir == DIR_WEST )ddAngle += pix2;
// is it in a right direction?
if( ddAngle >= ddMinAngle && ddAngle <= ddMaxAngle )
{
DOUBLE ddDistance = sqrt( pow( (double)(sLMY - sMapY), 2 ) + pow( (double)(sLMX - sMapX), 2 ) );
ddRes += (DOUBLE)uiSumOfEnemyTroops / pow( ddDistance, 2 );
}
}
}
@@ -310,17 +332,17 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
if( CountAllMilitiaInSector( sDMapX, sDMapY ) &&
(UINT32)( CountAllMilitiaInSector( sDMapX, sDMapY ) + CountAllMilitiaInSector( sMapX, sMapY ) ) <= gGameExternalOptions.guiMaxMilitiaSquadSize )
iRes += DIR_WITH_UNFULL_SQUAD_RATING_BONUS;
if( NumEnemiesInSector( sDMapX, sDMapY ) )
if( NumEnemiesInSector( sDMapX, sDMapY ) )
{
// if( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR )
iDiff = (INT32)( (FLOAT)iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sDMapX, sDMapY ) / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) ) );
// else
// else
// iDiff = iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sMapX, sMapY ) / DIV_OF_ORIGINAL_MILITIA / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) );
if( iDiff > (INT32)( (FLOAT)DIR_MIN_DIF * (FLOAT)iRes ) )
if( iDiff > (INT32)( (FLOAT)DIR_MIN_DIF * (FLOAT)iRes ) )
iRes = iDiff;
else
else
iRes = 0;
}
@@ -344,7 +366,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s
if( !fForBattle && gfMSBattle && NumEnemiesInSector( sMapX, sMapY ) ) return FALSE;
return (GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR || fWithCities) && !IsThisSectorASAMSector( sMapX, sMapY , 0 ) &&
return (GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR || fWithCities) && !IsThisSectorASAMSector( sMapX, sMapY , 0 ) &&
(GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR || !fOnlyCitySectors);// &&
// ( !NumEnemiesInSector( sMapX, sMapY ) || GetEnemyGroupIdInSector(sMapX, sMapY ) || fForBattle ) &&
// ( fForBattle || CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSize || PlayerMercsInSector( sMapX, sMapY, 0 ) )
@@ -360,7 +382,7 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX, sMapY - 1, fWithCities, fForBattle, fOnlyCitySectors ) )
{
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY - 1 );
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY - 1 );
if( fForBattle )
pMoveDir[ *uiDirNumber ][1] = 0;
@@ -375,9 +397,9 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1
++(*uiDirNumber);
}
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX - 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors ))
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX - 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors ))
{
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX - 1, sMapY );
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX - 1, sMapY );
if( fForBattle )
pMoveDir[ *uiDirNumber ][1] = 0;
@@ -392,10 +414,10 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1
++(*uiDirNumber);
}
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX, sMapY + 1, fWithCities, fForBattle, fOnlyCitySectors ))
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX, sMapY + 1, fWithCities, fForBattle, fOnlyCitySectors ))
{
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY + 1 );
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX, sMapY + 1 );
if( fForBattle )
pMoveDir[ *uiDirNumber ][1] = 0;
else
@@ -409,10 +431,10 @@ void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT1
++(*uiDirNumber);
}
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX + 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors ))
if(CheckStandardConditionsForDirection( sMapX, sMapY, sMapX + 1, sMapY, fWithCities, fForBattle, fOnlyCitySectors ))
{
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX + 1, sMapY );
pMoveDir[ *uiDirNumber ][0] = SECTOR( sMapX + 1, sMapY );
if( fForBattle )
pMoveDir[ *uiDirNumber ][1] = 0;
else
@@ -475,7 +497,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
if( CheckInBlockMoveList( sMapX, sMapY ) )return;
uiMilitiaCount = CountMilitia(pSectorInfo);
if( !uiMilitiaCount )return;
// Kaiden: Moved Create Militia code into CreateMilitiaSquads
@@ -483,7 +505,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
// If it's time, and this is a city sector create a new group.
// But only if we're not training our own.
if( (!gGameExternalOptions.gfmusttrainroaming) && ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) )
if( (!gGameExternalOptions.gfmusttrainroaming) && ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) )
{
if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay)
return;
@@ -492,7 +514,6 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
return;
CreateMilitiaSquads( sMapX, sMapY );
if (gfStrategicMilitiaChangesMade)
{
ResetMilitia();
@@ -501,8 +522,8 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
// moving squad, if it is not a SAM site
if( ( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ) && (!IsThisSectorASAMSector( sMapX, sMapY, 0 )) )
{
if( ( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ) && (!IsThisSectorASAMSector( sMapX, sMapY, 0 )) )
{
if( !PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, FALSE ) ) // and there's no player's mercs in the sector
{
if( GetWorldHour() % 2 )return;
@@ -514,8 +535,8 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
{
for( x = 1; x < uiDirNumber ; ++x )pMoveDir[x][1] += pMoveDir[x-1][1];
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld", x, pMoveDir[x][1]);
iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] +
iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] +
( uiMilitiaCount >= gGameExternalOptions.guiMinMilitiaSquadSize ? CHANCE_TO_MOVE_A_SQUAD : CHANCE_TO_MOVE_AN_UNFULL_SQUAD ) );
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Roll %ld", iRandomRes);
@@ -528,13 +549,13 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
iRandomRes = x;
break;
}
// "Decided" to stay here
if(iRandomRes >= uiDirNumber)
return;
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld. Have %ld militia men", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ), uiMilitiaCount);
//Kaiden: if Restricted Sectors List option is turned on,
//Kaiden: if Restricted Sectors List option is turned on,
// militia can't move to any sectors in the list.
// Unless they are following a group of mercs.
if (gGameExternalOptions.gflimitedRoaming)
@@ -552,6 +573,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
Assert(targetY >= 0 && targetY < MAP_WORLD_Y);
MoveMilitiaSquad( sMapX, sMapY, targetX, targetY, FALSE );
AddToBlockMoveList( targetX, targetY );
if ( gfStrategicMilitiaChangesMade)
{
ResetMilitia();
@@ -562,7 +584,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
extern GROUP *gpBattleGroup;
gpBattleGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) );
/* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) );
if(pEnemyGroup && pEnemyGroup->ubGroupID)
{
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, targetX, SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID ));
@@ -573,9 +595,9 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
pEnemyGroup->ubNextX = targetX;
pEnemyGroup->ubNextY = targetY;
*/
*/
gfMSBattle = TRUE;
// GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE );
EnterAutoResolveMode( targetX, targetY );
// }
@@ -587,7 +609,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
}
// Kaiden: Roaming Militia Training:
// If we're training roaming militia,
// If we're training roaming militia,
// we'll get our squad from here:
// Don't need to check for delay, as this function won't be
// called if there is a delay set.
@@ -595,13 +617,13 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
{
UINT16 pMoveDir[4][3];
UINT8 uiDirNumber = 0;
UINT32 iRandomRes = 0, iRandom = 0;
UINT32 iRandomRes = 0;
UINT8 x;//,y;
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
UINT8 uiMilitiaCount;
// If we're not allowing roaming groups,
// If we're not allowing roaming groups,
// then we're not creating them either.
// Remove this if you want to create them
// for some other reason. But you also have to
@@ -621,7 +643,7 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
if( CheckInBlockMoveList( sMapX, sMapY ) )return;
uiMilitiaCount = CountMilitia(pSectorInfo);
if( !uiMilitiaCount )return;
// Create new Militia Squad
@@ -642,19 +664,19 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
iRandomRes = x;
break;
}
// shouldn't be!
if(iRandomRes >= uiDirNumber)iRandomRes = 0;
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ));
GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
if( NumEnemiesInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) && CountAllMilitiaInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) )
{
/* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) );
if(pEnemyGroup && pEnemyGroup->ubGroupID)
{
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID ));
@@ -668,8 +690,8 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
*/
gfMSBattle = TRUE;
// GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE );
EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
// }
}
@@ -703,7 +725,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
guiDirNumber = 0;
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir,
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir,
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, FALSE );
ZeroMemory( gpAttackDirs, sizeof( gpAttackDirs ) );
@@ -713,7 +735,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
gpAttackDirs[ guiDirNumber ][2] = uiNumElite = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
gpAttackDirs[ guiDirNumber ][3] = INSERTION_CODE_CENTER;
guiDirNumber = uiDirNumber + 1;
guiDirNumber = uiDirNumber + 1;
x = 0;
while( CountMilitia(pSectorInfo ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle &&
@@ -729,7 +751,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
gpAttackDirs[ x + 1 ][1] += pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA] - uiNumReg;
gpAttackDirs[ x + 1 ][2] += pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA] - uiNumElite;
gpAttackDirs[ x + 1 ][3] = (UINT8)pMoveDir[ x ][2];
uiNumGreen = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];
uiNumReg = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];
uiNumElite = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
@@ -743,10 +765,10 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
}
}
// If militia have been moved here, no reason to reset--just add them. If militia have not moved, then no strategic
// changes were made. Either case, this flag should be false.
// If militia have been moved here, no reason to reset--just add them. If militia have not moved, then no strategic
// changes were made. Either case, this flag should be false.
gfStrategicMilitiaChangesMade = FALSE;
}
}
void MSCallBack( UINT8 ubResult )
{
@@ -764,7 +786,7 @@ BOOLEAN IsThereMilitiaInAdjacentSector( INT16 sMapX, INT16 sMapY )
UINT8 x;
BOOLEAN fResult = FALSE;
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir,
GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir,
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, FALSE );
for( x = 0; x < uiDirNumber ; ++x )
@@ -778,7 +800,6 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
{
sMSMapX = sMapX;
sMSMapY = sMapY;
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
if( !gGameExternalOptions.gfAllowMilitiaGroups )
return;
@@ -790,7 +811,7 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
// if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES );
// This is no longer a question of simply whether to have a full militia count, but also whether we want
// reinforcements. So if there are any available, always ask.
// reinforcements. So if there are any available, always ask.
if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) ) // && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle )
DoScreenIndependantMessageBox( gzCWStrings[0], MSG_BOX_FLAG_YESNO, MSCallBack );
}
@@ -798,11 +819,11 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
void MilitiaFollowPlayer( INT16 sMapX, INT16 sMapY, INT16 sDMapX, INT16 sDMapY )
{
if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ||
IsThisSectorASAMSector( sMapX, sMapY, 0 ) ||
PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, TRUE ) )return;
IsThisSectorASAMSector( sMapX, sMapY, 0 ) ||
PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, TRUE ) )return;
if( GetTownIdForSector( sDMapX, sDMapY ) != BLANK_SECTOR ||
IsThisSectorASAMSector( sDMapX, sDMapY, 0 ) )return;
IsThisSectorASAMSector( sDMapX, sDMapY, 0 ) )return;
MoveMilitiaSquad( sMapX, sMapY, sDMapX, sDMapY, FALSE );
+25 -25
View File
@@ -37,7 +37,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString
if( SectorInfo[ SECTOR( sMapX, sMapY ) ].uiFacilitiesFlags == 0 )
{
// none
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 0 ] );
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 0 ] );
return;
}
@@ -53,7 +53,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString
{
if( wcslen( sFacilitiesString ) == 0 )
{
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 2 ] );
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 2 ] );
}
else
{
@@ -67,7 +67,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString
{
if( wcslen( sFacilitiesString ) == 0 )
{
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 3 ] );
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 3 ] );
}
else
{
@@ -81,7 +81,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString
{
if( wcslen( sFacilitiesString ) == 0 )
{
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 5 ] );
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 5 ] );
}
else
{
@@ -95,7 +95,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString
{
if( wcslen( sFacilitiesString ) == 0 )
{
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 6 ] );
swprintf( sFacilitiesString, L"%s", sFacilitiesStrings[ 6 ] );
}
else
{
@@ -103,7 +103,7 @@ void GetSectorFacilitiesFlags( INT16 sMapX, INT16 sMapY, STR16 sFacilitiesString
wcscat( sFacilitiesString, sFacilitiesStrings[ 6 ]);
}
}
sFacilitiesString[ wcslen( sFacilitiesString ) ] = 0;
return;
@@ -138,7 +138,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
}
*/
if( NumHostilesInSector( sMapX, sMapY, bMapZ ) )
{ //too premature: enemies still in sector.
{ //too premature: enemies still in sector.
return FALSE;
}
@@ -148,7 +148,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
LaptopSaveInfo.fBobbyRSiteCanBeAccessed = TRUE;
//If the player has been to Bobbyr when it was down, and we havent already sent email, send him an email
if( LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction == BOBBYR_BEEN_TO_SITE_ONCE && LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction != BOBBYR_ALREADY_SENT_EMAIL )
if( LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction == BOBBYR_BEEN_TO_SITE_ONCE && LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction != BOBBYR_ALREADY_SENT_EMAIL )
{
AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin(), -1);
LaptopSaveInfo.ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction = BOBBYR_ALREADY_SENT_EMAIL;
@@ -206,7 +206,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
{
if ( 1 /*!GetSectorFlagStatus( sMapX, sMapY, bMapZ, SF_SECTOR_HAS_BEEN_LIBERATED_ONCE ) */)
{
// SAM site liberated for first time, schedule meanwhile
// SAM site liberated for first time, schedule meanwhile
HandleMeanWhileEventPostingForSAMLiberation( GetSAMIdFromSector( sMapX, sMapY, bMapZ ) );
}
@@ -268,13 +268,13 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled = TRUE;
}
//KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands,
// even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace,
// even though the player controls it.
//KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands,
// even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace,
// even though the player controls it.
UpdateAirspaceControl( );
// redraw map/income if in mapscreen
fMapPanelDirty = TRUE;
fMapPanelDirty = TRUE;
fMapScreenBottomDirty = TRUE;
return fWasEnemyControlled;
@@ -291,8 +291,8 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO
UINT8 ubSectorID;
//KM : August 6, 1999 Patch fix
// This check was added because this function gets called when player mercs retreat from an unresolved
// battle between militia and enemies. It will get called again AFTER autoresolve is finished.
// This check was added because this function gets called when player mercs retreat from an unresolved
// battle between militia and enemies. It will get called again AFTER autoresolve is finished.
if( gfAutomaticallyStartAutoResolve )
{
return( FALSE );
@@ -310,7 +310,7 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO
if ( fWasPlayerControlled )
{
if( PlayerMercsInSector( (UINT8)sMapX, (UINT8)sMapY, (UINT8)bMapZ ) )
{ //too premature: Player mercs still in sector.
{ //too premature: Player mercs still in sector.
return FALSE;
}
@@ -361,13 +361,13 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO
NotifyPlayerWhenEnemyTakesControlOfImportantSector( sMapX, sMapY, 0, fContested );
}
// NOTE: Stealing is intentionally OUTSIDE the fWasPlayerControlled branch. This function gets called if new
// NOTE: Stealing is intentionally OUTSIDE the fWasPlayerControlled branch. This function gets called if new
// enemy reinforcements arrive, and they deserve another crack at stealing what the first group missed! :-)
// stealing should fail anyway 'cause there shouldn't be a temp file for unvisited sectors, but let's check anyway
if ( GetSectorFlagStatus( sMapX, sMapY, ( UINT8 ) bMapZ, SF_ALREADY_VISITED ) == TRUE )
{
// enemies can steal items left lying about (random chance). The more there are, the more they take!
// enemies can steal items left lying about (random chance). The more there are, the more they take!
ubTheftChance = 5 * NumEnemiesInAnySector( sMapX, sMapY, bMapZ );
// max 90%, some stuff may just simply not get found
if (ubTheftChance > 90 )
@@ -386,13 +386,13 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO
SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = FALSE;
}
//KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands,
// even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace,
// even though the player controls it.
//KM : Aug 11, 1999 -- Patch fix: Relocated this check so it gets called everytime a sector changes hands,
// even if the sector isn't a SAM site. There is a bug _somewhere_ that fails to update the airspace,
// even though the player controls it.
UpdateAirspaceControl( );
// redraw map/income if in mapscreen
fMapPanelDirty = TRUE;
fMapPanelDirty = TRUE;
fMapScreenBottomDirty = TRUE;
return fWasPlayerControlled;
@@ -440,7 +440,7 @@ void MakePlayerPerceptionOfSectorControlCorrect( INT16 sMapX, INT16 sMapY, INT8
{
if (bMapZ == 0)
{
SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = !( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) ].fEnemyControlled );
SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = !( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) ].fEnemyControlled );
}
// else nothing, underground sector control is always up to date, because we don't track control down there
@@ -472,5 +472,5 @@ void ReplaceSoldierProfileInPlayerGroup( UINT8 ubGroupID, UINT8 ubOldProfile, UI
}
curr = curr->next;
}
}
}
+94 -94
View File
@@ -141,7 +141,7 @@ extern INT32 giCharInfoButton[ 2 ];
extern void CreateDestroyMapCharacterScrollButtons( void );
extern void UpdateTheStateOfTheNextPrevMapScreenCharacterButtons( void );
// were we showing the mapscreen inventory when the prebattle interface came up
// were we showing the mapscreen inventory when the prebattle interface came up
extern BOOLEAN fShowInventoryFlag;
UINT32 guiNumInvolved;
@@ -149,18 +149,18 @@ UINT32 guiNumUninvolved;
//SAVE START
//Using the ESC key in the PBI will get rid of the PBI and go back to mapscreen, but
//Using the ESC key in the PBI will get rid of the PBI and go back to mapscreen, but
//only if the PBI isn't persistant (!gfPersistantPBI).
BOOLEAN gfPersistantPBI = FALSE;
//Contains general information about the type of encounter the player is faced with. This
//determines whether or not you can autoresolve the battle or even retreat. This code
//Contains general information about the type of encounter the player is faced with. This
//determines whether or not you can autoresolve the battle or even retreat. This code
//dictates the header that is used at the top of the PBI.
UINT8 gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
//The autoresolve during tactical battle option needs more detailed information than the
//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes
//for reasons not normally used in the PBI. For example, if we were fighting the enemy
//The autoresolve during tactical battle option needs more detailed information than the
//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes
//for reasons not normally used in the PBI. For example, if we were fighting the enemy
//in a normal situation, then shot at a civilian, the civilians associated with the victim
//would turn hostile, which would disable the ability to autoresolve the battle.
BOOLEAN gubExplicitEnemyEncounterCode = NO_ENCOUNTER_CODE;
@@ -226,16 +226,16 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup )
if( ubInvalidGroups || pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle || pSector->ubCreaturesInBattle )
{
CHAR16 str[ 512 ];
swprintf( str, L"Strategic info warning: Sector 'in battle' counters are not clear when they should be. "
L"If you can provide information on how a previous battle was resolved here or nearby patrol "
L"(auto resolve, tactical battle, cheat keys, or retreat),"
L"please forward that info (no data files necessary) as well as the following code (very important): "
L"G(%02d:%c%d_b%d) A(%02d:%02d) T(%02d:%02d) E(%02d:%02d) C(%02d:%02d)",
ubInvalidGroups, pLocGroup->ubSectorY + 'A' - 1, pLocGroup->ubSectorX, pLocGroup->ubSectorZ,
pSector->ubNumAdmins, pSector->ubAdminsInBattle,
pSector->ubNumTroops, pSector->ubTroopsInBattle,
pSector->ubNumElites, pSector->ubElitesInBattle,
pSector->ubNumCreatures, pSector->ubCreaturesInBattle );
swprintf( str, L"Strategic info warning: Sector 'in battle' counters are not clear when they should be. "
L"If you can provide information on how a previous battle was resolved here or nearby patrol "
L"(auto resolve, tactical battle, cheat keys, or retreat),"
L"please forward that info (no data files necessary) as well as the following code (very important): "
L"G(%02d:%c%d_b%d) A(%02d:%02d) T(%02d:%02d) E(%02d:%02d) C(%02d:%02d)",
ubInvalidGroups, pLocGroup->ubSectorY + 'A' - 1, pLocGroup->ubSectorX, pLocGroup->ubSectorZ,
pSector->ubNumAdmins, pSector->ubAdminsInBattle,
pSector->ubNumTroops, pSector->ubTroopsInBattle,
pSector->ubNumElites, pSector->ubElitesInBattle,
pSector->ubNumCreatures, pSector->ubCreaturesInBattle );
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
pSector->ubAdminsInBattle = 0;
pSector->ubTroopsInBattle = 0;
@@ -247,7 +247,7 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup )
void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
{
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
INT32 i;
UINT8 ubGroupID = 0;
UINT8 ubNumStationaryEnemies = 0;
@@ -292,7 +292,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
}
}
//If we are currently in the AI Viewer development utility, then remove it first. It automatically
//If we are currently in the AI Viewer development utility, then remove it first. It automatically
//returns to the mapscreen upon removal, which is where we want to go.
#ifdef JA2BETAVERSION
if( guiCurrentScreen == AIVIEWER_SCREEN )
@@ -318,8 +318,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gfUsePersistantPBI = TRUE;
return;
}
if( gfTacticalTraversal && (pBattleGroup == gpTacticalTraversalGroup || gbWorldSectorZ > 0) )
if( gfTacticalTraversal && (pBattleGroup == gpTacticalTraversalGroup || gbWorldSectorZ > 0) )
{
return;
}
@@ -331,7 +331,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gfDisplayPotentialRetreatPaths = FALSE;
gpBattleGroup = pBattleGroup;
//calc sector values
if( gpBattleGroup )
{
@@ -366,7 +366,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
{ //We are underground, so no autoresolve allowed
pSector = &SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ];
if( pSector->ubCreaturesInBattle )
{
{
gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE;
}
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle )
@@ -375,19 +375,19 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
}
}
else if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE ||
gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE ||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == ENEMY_INVASION_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE )
gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE ||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == ENEMY_INVASION_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE )
{ //use same code
gubExplicitEnemyEncounterCode = gubEnemyEncounterCode;
}
else
else
{
#ifdef JA2BETAVERSION
DoScreenIndependantMessageBox( L"Can't determine valid reason for battle indicator. Please try to provide information as to when and why this indicator first appeared and send whatever files that may help.", MSG_BOX_FLAG_OK, NULL );
DoScreenIndependantMessageBox( L"Can't determine valid reason for battle indicator. Please try to provide information as to when and why this indicator first appeared and send whatever files that may help.", MSG_BOX_FLAG_OK, NULL );
#endif
gfBlitBattleSectorLocator = FALSE;
return;
@@ -396,7 +396,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
fMapScreenBottomDirty = TRUE;
ChangeSelectedMapSector( gubPBSectorX, gubPBSectorY, gubPBSectorZ );
RenderMapScreenInterfaceBottom();
// Headrock: Added FALSE argument, We might need TRUE but not sure. Will need to initiate battle :)
RenderMapScreenInterfaceBottom( FALSE );
//If we are currently in tactical, then set the flag to automatically bring up the mapscreen.
if( guiCurrentScreen == GAME_SCREEN )
@@ -475,21 +476,21 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
guiNumInvolved = 0;
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{
if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) )
{
// involved
if( !ubGroupID )
{ //Record the first groupID. If there are more than one group in this battle, we
//can detect it by comparing the first value with future values. If we do, then
{ //Record the first groupID. If there are more than one group in this battle, we
//can detect it by comparing the first value with future values. If we do, then
//we set a flag which determines whether to use the singular help text or plural version
//for the retreat button.
ubGroupID = MercPtrs[ i ]->ubGroupID;
if( !gpBattleGroup )
gpBattleGroup = GetGroup( ubGroupID );
if( bBestExpLevel > MercPtrs[ i ]->bExpLevel )
bBestExpLevel = MercPtrs[ i ]->bExpLevel;
if( bBestExpLevel > MercPtrs[ i ]->stats.bExpLevel )
bBestExpLevel = MercPtrs[ i ]->stats.bExpLevel;
if( MercPtrs[ i ]->ubPrevSectorID == 255 )
{ //Not able to retreat (calculate it for group)
GROUP *pTempGroup;
@@ -547,7 +548,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
// WANNE: Added an ja2_options.ini Property "ENABLE_CHANCE_OF_ENEMY_AMBUSHES_ON_INSANE_DIFFICULT"
else if( gGameExternalOptions.fEnableChanceOfEnemyAmbushesOnInsaneDifficult &&
gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE &&
CurrentPlayerProgressPercentage() >= 25 )
CurrentPlayerProgressPercentage() >= 25 )
{ //if the enemy outnumbers the players, then there is a chance of the enemies ambushing the group
if( ubNumMobileEnemies > ubNumMercs )
{
@@ -568,8 +569,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
}
}
}
else if( WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) == KNOWS_NOTHING &&
CurrentPlayerProgressPercentage() >= 30 - gGameOptions.ubDifficultyLevel * 5 )
else if( WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) == KNOWS_NOTHING &&
CurrentPlayerProgressPercentage() >= 30 - gGameOptions.ubDifficultyLevel * 5 )
{ //if the enemy outnumbers the players, then there is a small chance of the enemies ambushing the group
if( ubNumMobileEnemies > ubNumMercs )
{
@@ -616,7 +617,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
break;
}
}
}
}
}
@@ -666,14 +667,14 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
//when necessary.
if( gfPersistantPBI )
{
if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE ||
if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE ||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
{ //Don't allow autoresolve for player initiated invasion battle types
DisableButton( iPBButton[ 0 ] );
SetButtonFastHelpText( iPBButton[ 0 ], gpStrategicString[ STR_PB_DISABLED_AUTORESOLVE_FASTHELP ] );
}
else if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE )
else if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE )
{ //Don't allow autoresolve for ambushes
DisableButton( iPBButton[ 0 ] );
SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 3 ] );
@@ -692,9 +693,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gfCantRetreatInPBI = FALSE;
fRetreatAnOption = FALSE;
}
if( gfAutomaticallyStartAutoResolve || !fRetreatAnOption ||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
if( gfAutomaticallyStartAutoResolve || !fRetreatAnOption ||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE )
{
DisableButton( iPBButton[ 2 ] );
@@ -714,7 +715,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
}
else
{ //use the explicit encounter code to determine what get's disable and the associated help text that is used.
//First of all, the retreat button is always disabled seeing a battle is in progress.
DisableButton( iPBButton[ 2 ] );
SetButtonFastHelpText( iPBButton[ 2 ], gzNonPersistantPBIText[ 0 ] );
@@ -751,7 +752,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
}
}
//Disable the options button when the auto resolve screen comes up
//Disable the options button when the auto resolve screen comes up
EnableDisAbleMapScreenOptionsButton( FALSE );
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
@@ -780,7 +781,7 @@ void DoTransitionFromMapscreenToPreBattleInterface()
PBIRect.iBottom = 359;
iWidth = 261;
iHeight = 359;
uiTimeRange = 1000;
iPercentage = 0;
uiStartTime = GetJA2Clock();
@@ -795,8 +796,8 @@ void DoTransitionFromMapscreenToPreBattleInterface()
BlitBufferToBuffer( FRAME_BUFFER, guiEXTRABUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
if( gfEnterAutoResolveMode )
{ //If we are intending on immediately entering autoresolve, change the global flag so that it will actually
//render the interface once. If gfEnterAutoResolveMode is clear, then RenderPreBattleInterface() won't do
{ //If we are intending on immediately entering autoresolve, change the global flag so that it will actually
//render the interface once. If gfEnterAutoResolveMode is clear, then RenderPreBattleInterface() won't do
//anything.
fEnterAutoResolveMode = TRUE;
gfEnterAutoResolveMode = FALSE;
@@ -822,7 +823,7 @@ void DoTransitionFromMapscreenToPreBattleInterface()
InvalidateScreen();
RefreshScreen( NULL );
while( iPercentage < 100 )
while( iPercentage < 100 )
{
uiCurrTime = GetJA2Clock();
iPercentage = (uiCurrTime-uiStartTime) * 100 / uiTimeRange;
@@ -853,7 +854,7 @@ void DoTransitionFromMapscreenToPreBattleInterface()
RefreshScreen( NULL );
//Restore the previous rect.
BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop,
BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop,
(UINT16)(DstRect.iRight-DstRect.iLeft+1), (UINT16)(DstRect.iBottom-DstRect.iTop+1) );
}
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
@@ -895,7 +896,7 @@ void KillPreBattleInterface()
fCharacterInfoPanelDirty = TRUE;
gfDisplayPotentialRetreatPaths = FALSE;
//Enable the options button when the auto resolve screen comes up
//Enable the options button when the auto resolve screen comes up
EnableDisAbleMapScreenOptionsButton( TRUE );
ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, 261, 359, 0 );
@@ -913,7 +914,6 @@ void KillPreBattleInterface()
{
ShowButton( giCharInfoButton[ 1 ] );
}
gfPersistantPBI = FALSE; // If killing the PBI, it must not be persistant anymore!
}
@@ -990,8 +990,8 @@ void RenderPreBattleInterface()
UINT8 ubJunk;
//PLAYERGROUP *pPlayer;
//This code determines if the cursor is inside the rectangle consisting of the
//retreat button. If it is inside, then we set up the variables so that the retreat
//This code determines if the cursor is inside the rectangle consisting of the
//retreat button. If it is inside, then we set up the variables so that the retreat
//arrows get drawn in the mapscreen.
if( ButtonList[ iPBButton[ 2 ] ]->uiFlags & BUTTON_ENABLED )
{
@@ -1077,7 +1077,7 @@ void RenderPreBattleInterface()
width = StringPixLength( str, BLOCKFONTNARROW );
}
mprintf( 54 - width , 38, str );
SetFont( BLOCKFONT );
swprintf( str, gpStrategicString[ STR_PB_MERCS ] );
width = StringPixLength( str, BLOCKFONT );
@@ -1087,7 +1087,7 @@ void RenderPreBattleInterface()
width = StringPixLength( str, BLOCKFONTNARROW );
}
mprintf( 139 - width , 38, str );
SetFont( BLOCKFONT );
swprintf( str, gpStrategicString[ STR_PB_MILITIA ] );
width = StringPixLength( str, BLOCKFONT );
@@ -1119,10 +1119,10 @@ void RenderPreBattleInterface()
GetSectorIDString( gubPBSectorX, gubPBSectorY, gubPBSectorZ, pSectorName, TRUE );
mprintf( 70, 17, L"%s %s", gpStrategicString[ STR_PB_SECTOR ], pSectorName );
//enemy
//enemy
SetFont( FONT14ARIAL );
if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ||
WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) != KNOWS_HOW_MANY )
{
@@ -1154,12 +1154,12 @@ void RenderPreBattleInterface()
SetFontForeground( FONT_YELLOW );
//print out the participants of the battle.
// | NAME | ASSIGN | COND | HP | BP |
// | NAME | ASSIGN | COND | HP | BP |
line = 0;
y = TOP_Y + 1;
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{
if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) )
{ //involved
@@ -1197,7 +1197,7 @@ void RenderPreBattleInterface()
}
//print out the uninvolved members of the battle
// | NAME | ASSIGN | LOC | DEST | DEP |
// | NAME | ASSIGN | LOC | DEST | DEP |
if( !guiNumUninvolved )
{
SetFontForeground( FONT_YELLOW );
@@ -1212,7 +1212,7 @@ void RenderPreBattleInterface()
y = BOTTOM_Y - ROW_HEIGHT * guiNumUninvolved + 2;
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && !(MercPtrs[ i ]->uiStatusFlags & SOLDIER_VEHICLE) )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{
if ( !PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) )
{
@@ -1263,7 +1263,7 @@ void RenderPreBattleInterface()
RenderPBHeader( &x, &width ); //the text is important enough to blink.
}
//InvalidateRegion( 0, 0, 261, 359 );
//InvalidateRegion( 0, 0, 261, 359 );
if( gfEnterAutoResolveMode )
{
gfEnterAutoResolveMode = FALSE;
@@ -1342,8 +1342,8 @@ void GoToSectorCallback( GUI_BUTTON *btn, INT32 reason )
SetMusicMode( MUSIC_TACTICAL_NOTHING );
return;
}
if( gfPersistantPBI && gpBattleGroup && gpBattleGroup->fPlayer &&
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
if( gfPersistantPBI && gpBattleGroup && gpBattleGroup->fPlayer &&
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
gubEnemyEncounterCode != CREATURE_ATTACK_CODE &&
gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE )
{
@@ -1436,14 +1436,14 @@ enum
void GetSoldierConditionInfo( SOLDIERTYPE *pSoldier, STR16 szCondition, UINT8 *pubHPPercent, UINT8 *pubBPPercent )
{
Assert( pSoldier );
*pubHPPercent = (UINT8)(pSoldier->bLife * 100 / pSoldier->bLifeMax);
*pubHPPercent = (UINT8)(pSoldier->stats.bLife * 100 / pSoldier->stats.bLifeMax);
*pubBPPercent = pSoldier->bBreath;
//Go from the worst condition to the best.
if( !pSoldier->bLife )
if( !pSoldier->stats.bLife )
{ //0 life
swprintf( szCondition, pConditionStrings[ COND_DEAD ] );
}
else if( pSoldier->bLife < OKLIFE && pSoldier->bBleeding )
else if( pSoldier->stats.bLife < OKLIFE && pSoldier->bBleeding )
{ //life less than OKLIFE and bleeding
swprintf( szCondition, pConditionStrings[ COND_DYING ] );
}
@@ -1455,7 +1455,7 @@ void GetSoldierConditionInfo( SOLDIERTYPE *pSoldier, STR16 szCondition, UINT8 *p
{ //bleeding
swprintf( szCondition, pConditionStrings[ COND_BLEEDING ] );
}
else if( pSoldier->bLife*100 < pSoldier->bLifeMax*50 )
else if( pSoldier->stats.bLife*100 < pSoldier->stats.bLifeMax*50 )
{ //less than 50% life
swprintf( szCondition, pConditionStrings[ COND_WOUNDED ] );
}
@@ -1463,11 +1463,11 @@ void GetSoldierConditionInfo( SOLDIERTYPE *pSoldier, STR16 szCondition, UINT8 *p
{ //breath less than half
swprintf( szCondition, pConditionStrings[ COND_FATIGUED ] );
}
else if( pSoldier->bLife*100 < pSoldier->bLifeMax*67 )
else if( pSoldier->stats.bLife*100 < pSoldier->stats.bLifeMax*67 )
{ //less than 67% life
swprintf( szCondition, pConditionStrings[ COND_FAIR ] );
}
else if( pSoldier->bLife*100 < pSoldier->bLifeMax*86 )
else if( pSoldier->stats.bLife*100 < pSoldier->stats.bLifeMax*86 )
{ //less than 86% life
swprintf( szCondition, pConditionStrings[ COND_GOOD ] );
}
@@ -1647,11 +1647,11 @@ void ActivateAutomaticAutoResolveStart()
void CalculateNonPersistantPBIInfo()
{
//We need to set up the non-persistant PBI
if( !gfBlitBattleSectorLocator ||
if( !gfBlitBattleSectorLocator ||
gubPBSectorX != gWorldSectorX || gubPBSectorY != gWorldSectorY || gubPBSectorZ != gbWorldSectorZ )
{ //Either the locator isn't on or the locator info is in a different sector
//Calculated the encounter type
//Calculated the encounter type
gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
gubExplicitEnemyEncounterCode = NO_ENCOUNTER_CODE;
if( HostileCiviliansPresent() )
@@ -1667,7 +1667,7 @@ void CalculateNonPersistantPBIInfo()
UNDERGROUND_SECTORINFO *pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
Assert( pSector );
if( pSector->ubCreaturesInBattle )
{
{
gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE;
}
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle )
@@ -1681,7 +1681,7 @@ void CalculateNonPersistantPBIInfo()
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
Assert( pSector );
if( pSector->ubCreaturesInBattle )
{
{
gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE;
}
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle )
@@ -1711,7 +1711,7 @@ void PutNonSquadMercsInBattleSectorOnSquads( BOOLEAN fExitVehicles )
{
GROUP *pGroup, *pNextGroup;
// IMPORTANT: Have to do this by group, so everyone inside vehicles gets assigned to the same squad. Needed for
// IMPORTANT: Have to do this by group, so everyone inside vehicles gets assigned to the same squad. Needed for
// the tactical placement interface to work in case of simultaneous multi-vehicle arrivals!
pGroup = gpGroupList;
@@ -1771,7 +1771,7 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles
// store ptr to next soldier in group, once removed from group, his info will get memfree'd!
pNextPlayer = pPlayer->next;
if ( pSoldier->bActive && pSoldier->bLife && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
if ( pSoldier->bActive && pSoldier->stats.bLife && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
// if involved, but off-duty (includes mercs inside vehicles!)
if ( PlayerMercInvolvedInThisCombat( pSoldier ) && ( pSoldier->bAssignment >= ON_DUTY ) )
@@ -1783,7 +1783,7 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles
{
TakeSoldierOutOfVehicle( pSoldier );
// put them on the unique squad assigned to people leaving this vehicle. Can't add them to existing squads,
// put them on the unique squad assigned to people leaving this vehicle. Can't add them to existing squads,
// because if this is a simultaneous group attack, the mercs could be coming from different sides, and the
// placement screen can't handle mercs on the same squad arriving from difference edges!
fSuccess = AddCharacterToSquad( pSoldier, bUniqueVehicleSquad );
@@ -1799,8 +1799,8 @@ void PutNonSquadMercsInPlayerGroupOnSquads( GROUP *pGroup, BOOLEAN fExitVehicles
Assert( fSuccess );
// clear any desired squad assignments
pSoldier -> ubNumTraversalsAllowedToMerge = 0;
pSoldier -> ubDesiredSquadAssignment = NO_ASSIGNMENT;
pSoldier->ubNumTraversalsAllowedToMerge = 0;
pSoldier->ubDesiredSquadAssignment = NO_ASSIGNMENT;
// stand him up
MakeSoldiersTacticalAnimationReflectAssignment( pSoldier );
@@ -1826,10 +1826,10 @@ void WakeUpAllMercsInSectorUnderAttack( void )
{
pSoldier = &( Menptr[ iCounter ] );
if ( pSoldier->bActive && pSoldier->bLife && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
if ( pSoldier->bActive && pSoldier->stats.bLife && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
// if involved, but asleep
if ( PlayerMercInvolvedInThisCombat( pSoldier ) && ( pSoldier->fMercAsleep == TRUE ) )
if ( PlayerMercInvolvedInThisCombat( pSoldier ) && ( pSoldier->flags.fMercAsleep == TRUE ) )
{
// FORCE him wake him up
SetMercAwake( pSoldier, FALSE, TRUE );
@@ -1887,11 +1887,11 @@ BOOLEAN PlayerMercInvolvedInThisCombat( SOLDIERTYPE *pSoldier )
Assert( pSoldier );
Assert( pSoldier->bActive );
if( !pSoldier->fBetweenSectors &&
if( !pSoldier->flags.fBetweenSectors &&
pSoldier->bAssignment != IN_TRANSIT &&
pSoldier->bAssignment != ASSIGNMENT_POW &&
pSoldier->bAssignment != ASSIGNMENT_DEAD &&
!(pSoldier->uiStatusFlags & SOLDIER_VEHICLE) &&
!(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) &&
// Robot is involved if it has a valid controller with it, uninvolved otherwise
( !AM_A_ROBOT( pSoldier ) || ( pSoldier->ubRobotRemoteHolderID != NOBODY ) ) &&
!SoldierAboardAirborneHeli( pSoldier ) )
@@ -1960,15 +1960,15 @@ void CheckForRobotAndIfItsControlled( void )
// search for the robot on player's team
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife && AM_A_ROBOT( MercPtrs[ i ] ))
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && AM_A_ROBOT( MercPtrs[ i ] ))
{
// check whether it has a valid controller with it. This sets its ubRobotRemoteHolderID field.
UpdateRobotControllerGivenRobot( MercPtrs[ i ] );
MercPtrs[ i ]->UpdateRobotControllerGivenRobot( );
// if he has a controller, set controllers
// if he has a controller, set controllers
if ( MercPtrs[ i ]->ubRobotRemoteHolderID != NOBODY )
{
UpdateRobotControllerGivenController( MercPtrs[ MercPtrs[ i ]->ubRobotRemoteHolderID ] );
MercPtrs[ MercPtrs[ i ]->ubRobotRemoteHolderID ]->UpdateRobotControllerGivenController( );
}
break;
+4 -4
View File
@@ -58,14 +58,14 @@ void ClearNonPersistantPBIInfo();
//only if the PBI isn't persistant (!gfPersistantPBI).
extern BOOLEAN gfPersistantPBI;
//Contains general information about the type of encounter the player is faced with. This
//determines whether or not you can autoresolve the battle or even retreat. This code
//Contains general information about the type of encounter the player is faced with. This
//determines whether or not you can autoresolve the battle or even retreat. This code
//dictates the header that is used at the top of the PBI.
extern UINT8 gubEnemyEncounterCode;
//The autoresolve during tactical battle option needs more detailed information than the
//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes
//for reasons not normally used in the PBI. For example, if we were fighting the enemy
//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes
//for reasons not normally used in the PBI. For example, if we were fighting the enemy
//in a normal situation, then shot at a civilian, the civilians associated with the victim
//would turn hostile, which would disable the ability to autoresolve the battle.
extern BOOLEAN gubExplicitEnemyEncounterCode;
+90 -93
View File
@@ -42,7 +42,7 @@
#include "Campaign Init.h"
#include "meanwhile.h"
#include "Soldier macros.h"
#include "Morale.h"
#include "Morale.h"
#endif
#ifdef JA2BETAVERSION
@@ -132,7 +132,7 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
//Count stationary hostiles
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
ubNumHostiles = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumCreatures);
//Count mobile enemies
pGroup = gpGroupList;
while( pGroup )
@@ -173,7 +173,7 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
//Count stationary enemies
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
ubNumEnemies = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites);
//Count mobile enemies
pGroup = gpGroupList;
while( pGroup )
@@ -224,7 +224,7 @@ UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
{ //If no garrison, no stationary.
return( 0 );
}
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
// don't count roadblocks as stationary garrison, we want to see how many enemies are in them, not question marks
@@ -334,7 +334,7 @@ void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8
void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites )
{
UINT8 ubNumAdmins, ubNumTroops, ubNumElites;
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites );
GetNumberOfMobileEnemiesInSector( sSectorX, sSectorY, &ubNumAdmins, &ubNumTroops, &ubNumElites );
@@ -347,7 +347,7 @@ void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAd
void EndTacticalBattleForEnemy()
{
GROUP *pGroup;
INT32 i, iNumMilitia = 0, iNumEnemies = 0;
INT32 i;
//Clear enemies in battle for all stationary groups in the sector.
if( gbWorldSectorZ > 0 )
@@ -393,12 +393,12 @@ void EndTacticalBattleForEnemy()
//severe loyalty blow.
for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife >= OKLIFE )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife >= OKLIFE )
{ //found one live militia, so look for any enemies/creatures.
// NOTE: this is relying on ENEMY_TEAM being immediately followed by CREATURE_TEAM
for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife >= OKLIFE )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife >= OKLIFE )
{ //confirmed at least one enemy here, so do the loyalty penalty.
HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ABANDON_MILITIA, gWorldSectorX, gWorldSectorY, 0 );
break;
@@ -452,7 +452,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
// Reinforcement groups? Bring it on!
if( gGameExternalOptions.gfAllowReinforcements &&
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) )
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) )
{
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber = 0, ubIndex;
@@ -462,7 +462,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
// They arrived in multiple groups, so here they come
pThisSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir,
GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir,
( GetTownIdForSector( gWorldSectorX, gWorldSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
@@ -484,11 +484,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
while( pGroup )
{
if( pGroup != gpBattleGroup && !pGroup->fPlayer && !pGroup->fVehicle &&
pGroup->ubSectorX == gpBattleGroup->ubSectorX &&
pGroup->ubSectorY == gpBattleGroup->ubSectorY &&
!pGroup->pEnemyGroup->ubAdminsInBattle &&
!pGroup->pEnemyGroup->ubTroopsInBattle &&
!pGroup->pEnemyGroup->ubElitesInBattle )
pGroup->ubSectorX == gpBattleGroup->ubSectorX &&
pGroup->ubSectorY == gpBattleGroup->ubSectorY &&
!pGroup->pEnemyGroup->ubAdminsInBattle &&
!pGroup->pEnemyGroup->ubTroopsInBattle &&
!pGroup->pEnemyGroup->ubElitesInBattle )
{
HandleArrivalOfReinforcements( pGroup );
}
@@ -524,7 +524,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
case SOLDIER_CLASS_ADMINISTRATOR: ubTotalAdmins++; break;
case SOLDIER_CLASS_ARMY: ubTotalTroops++; break;
case SOLDIER_CLASS_ELITE: ubTotalElites++; break;
}
}
}
curr = curr->next;
}
@@ -547,7 +547,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
if( ubStationaryEnemies > 32 )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"The total stationary enemy forces in sector %c%d is %d. (max %d)",
ScreenMsg( FONT_RED, MSG_ERROR, L"The total stationary enemy forces in sector %c%d is %d. (max %d)",
gWorldSectorY + 'A' - 1, gWorldSectorX, ubTotalAdmins + ubTotalTroops + ubTotalElites, 32 );
#endif
@@ -560,7 +560,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
pSector->ubTroopsInBattle += ubTotalTroops;
pSector->ubElitesInBattle += ubTotalElites;
#ifdef JA2TESTVERSION
#ifdef JA2TESTVERSION
if( gfOverrideSector )
{
//if there are no troops in the current groups, then we're done.
@@ -590,14 +590,14 @@ BOOLEAN PrepareEnemyForSectorBattle()
sNumSlots -= ubTotalAdmins + ubTotalTroops + ubTotalElites;
//Now, process all of the groups and search for both enemy and player groups in the sector.
//For enemy groups, we fill up the slots until we have none left or all of the groups have been
//For enemy groups, we fill up the slots until we have none left or all of the groups have been
//processed.
for( pGroup = gpGroupList;
pGroup;
pGroup = pGroup->next)
{
if( !pGroup->fPlayer && !pGroup->fVehicle &&
if( !pGroup->fPlayer && !pGroup->fVehicle &&
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
{ //Process enemy group in sector.
if( sNumSlots > 0 )
@@ -619,7 +619,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
sNumSlots -= ubNumTroops;
if( sNumSlots < 0 )
{ //adjust the value to zero
ubNumTroops += sNumSlots;
ubNumTroops += sNumSlots;
sNumSlots = 0;
gfPendingEnemies = TRUE;
}
@@ -668,13 +668,13 @@ BOOLEAN PrepareEnemyForSectorBattle()
AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites );
//Now, we have to go through all of the enemies in the new map, and assign their respective groups if
//in a mobile group, but only for the ones that were assigned from the
//in a mobile group, but only for the ones that were assigned from the
sNumSlots = 32 - ubStationaryEnemies;
pGroup = gpGroupList;
while( pGroup && sNumSlots )
{
if( !pGroup->fPlayer && !pGroup->fVehicle &&
if( !pGroup->fPlayer && !pGroup->fVehicle &&
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
{
ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
@@ -682,7 +682,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
num = ubNumAdmins + ubNumTroops + ubNumElites;
for (i= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
for (i= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
i<= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID && num;
i++)
{
@@ -690,7 +690,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
Assert( sNumSlots);
pSoldier = &Menptr[ i ];
// Skip inactive and already grouped soldiers
if (!pSoldier->bActive || pSoldier->ubGroupID)
{
@@ -746,7 +746,7 @@ BOOLEAN PrepareEnemyForUndergroundBattle()
pUnderground = gpUndergroundSectorInfoHead;
while( pUnderground )
{
if( pUnderground->ubSectorX == gWorldSectorX &&
if( pUnderground->ubSectorX == gWorldSectorX &&
pUnderground->ubSectorY == gWorldSectorY &&
pUnderground->ubSectorZ == gbWorldSectorZ )
{ //This is the sector we are going to be fighting in.
@@ -819,7 +819,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
break;
}
if( pSoldier->bNeutral || pSoldier->bTeam != ENEMY_TEAM && pSoldier->bTeam != CREATURE_TEAM )
if( pSoldier->aiData.bNeutral || pSoldier->bTeam != ENEMY_TEAM && pSoldier->bTeam != CREATURE_TEAM )
return;
//we are recording an enemy death
if( pSoldier->ubGroupID )
@@ -941,7 +941,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
#ifdef JA2BETAVERSION
UINT32 ubTotalEnemies;
#endif
// if( !IsAutoResolveActive() )
// {
pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ];
@@ -951,7 +951,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
// pSector = &SectorInfo[ GetAutoResolveSectorID() ];
// }
#ifdef JA2BETAVERSION
#ifdef JA2BETAVERSION
ubTotalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites;
#endif
@@ -1148,7 +1148,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
if( pSoldier->ubBodyType == QUEENMONSTER )
{
//Need to call this, as the queen is really big, and killing her leaves a bunch
//Need to call this, as the queen is really big, and killing her leaves a bunch
//of bad tiles in behind her. Calling this function cleans it up.
InvalidateWorldRedundency();
//Now that the queen is dead, turn off the creature quest.
@@ -1231,7 +1231,7 @@ void AddPossiblePendingEnemiesToBattle()
// It's probable that the "pending enemies" flag isn't working right. So we'll go ahead and continue into
// the group insertion code from here.
//return;
//return;
}
if( pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins )
@@ -1301,7 +1301,7 @@ void AddPossiblePendingEnemiesToBattle()
else if( !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY - 1 ) )
ubStrategicInsertionCode = INSERTION_CODE_NORTH;
}
if( ubStrategicInsertionCode < INSERTION_CODE_NORTH ||ubStrategicInsertionCode > INSERTION_CODE_WEST )
ubStrategicInsertionCode = INSERTION_CODE_NORTH + Random( 4 );
@@ -1318,7 +1318,6 @@ void AddPossiblePendingEnemiesToBattle()
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
ubNumGroupsInSector++;
}
pGroupInSectorList = (GROUP**) MemAlloc( ubNumGroupsInSector * sizeof( GROUP*));
for (ubNumGroupsInSector = 0, pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
{
@@ -1422,7 +1421,7 @@ void NotifyPlayersOfNewEnemies()
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{ //find a merc that is aware.
pSoldier = MercPtrs[ i ];
if( pSoldier->bInSector && pSoldier->bActive && pSoldier->bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH )
if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH )
{
iSoldiers++;
}
@@ -1434,7 +1433,7 @@ void NotifyPlayersOfNewEnemies()
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{ //find a merc that is aware.
pSoldier = MercPtrs[ i ];
if( pSoldier->bInSector && pSoldier->bActive && pSoldier->bLife >= OKLIFE )
if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE )
{
iSoldiers++;
}
@@ -1446,7 +1445,7 @@ void NotifyPlayersOfNewEnemies()
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
{ //find a merc that is aware.
pSoldier = MercPtrs[ i ];
if( pSoldier->bInSector && pSoldier->bActive && pSoldier->bLife >= OKLIFE &&
if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE &&
( ( pSoldier->bBreath >= OKBREATH ) || fIgnoreBreath ) )
{
if( !iChosenSoldier )
@@ -1488,7 +1487,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
#endif
if( fMagicallyAppeared )
{ //update the strategic counters
{ //update the strategic counters
if( !gbWorldSectorZ )
{
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
@@ -1539,7 +1538,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
}
else
else
{ //no edgepoints left, so put him at the entrypoint.
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
}
@@ -1562,7 +1561,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
}
else
else
{ //no edgepoints left, so put him at the entrypoint.
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
}
@@ -1585,7 +1584,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
}
else
else
{ //no edgepoints left, so put him at the entrypoint.
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
}
@@ -1628,7 +1627,7 @@ BOOLEAN SaveUnderGroundSectorInfoToSaveGame( HWFILE hFile )
{
return(FALSE);
}
TempNode = TempNode->next;
}
@@ -1710,10 +1709,10 @@ UNDERGROUND_SECTORINFO* FindUnderGroundSector( INT16 sMapX, INT16 sMapY, UINT8 b
while( pUnderground )
{
//If the sector is the right one
if( pUnderground->ubSectorX == sMapX &&
if( pUnderground->ubSectorX == sMapX &&
pUnderground->ubSectorY == sMapY &&
pUnderground->ubSectorZ == bMapZ )
{
{
return( pUnderground );
}
pUnderground = pUnderground->next;
@@ -1771,7 +1770,7 @@ void EndCaptureSequence( )
}
}
// CJC Dec 1 2002: fixing multiple captures
else
else
{
// !?!? set both flags
gStrategicStatus.uiFlags |= STRATEGIC_PLAYER_CAPTURED_FOR_RESCUE;
@@ -1783,8 +1782,7 @@ void EndCaptureSequence( )
void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
{
INT32 i;
WORLDITEM WorldItem;
UINT32 i;
BOOLEAN fMadeCorpse;
INT32 iNumEnemiesInSector;
@@ -1793,7 +1791,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
static INT16 sAlmaCaptureItemsGridNo[] = { 12246, 12406, 13046 };
static INT16 sInterrogationItemGridNo[] = { 12089, 12089, 12089 };
// ATE: Check first if ! in player captured sequence already
// CJC Dec 1 2002: fixing multiple captures
@@ -1812,18 +1810,18 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
// If this is an EPC , just kill them...
if ( AM_AN_EPC( pSoldier ) )
{
pSoldier->bLife = 0;
pSoldier->stats.bLife = 0;
HandleSoldierDeath( pSoldier, &fMadeCorpse );
return;
}
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )
{
return;
}
// ATE: Patch fix If in a vehicle, remove from vehicle...
TakeSoldierOutOfVehicle( pSoldier );
TakeSoldierOutOfVehicle( pSoldier );
// Are there anemies in ALMA? ( I13 )
@@ -1840,7 +1838,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
// Change to POW....
//-add him to a POW assignment/group
if( ( pSoldier->bAssignment != ASSIGNMENT_POW ) )
if( ( pSoldier->bAssignment != ASSIGNMENT_POW ) )
{
SetTimeOfAssignmentChangeForMerc( pSoldier );
}
@@ -1849,11 +1847,13 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
// ATE: Make them neutral!
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED )
{
pSoldier->bNeutral = TRUE;
pSoldier->aiData.bNeutral = TRUE;
}
RemoveCharacterFromSquads( pSoldier );
WORLDITEM WorldItem;
// Is this the first one..?
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED )
{
@@ -1863,12 +1863,12 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
pSoldier->bSectorZ = 0;
// put him on the floor!!
pSoldier->bLevel = 0;
pSoldier->pathing.bLevel = 0;
// OK, drop all items!
for ( i = 0; i < NUM_INV_SLOTS; i++ )
{
if( pSoldier->inv[ i ].usItem != 0 )
for ( i = 0; i < pSoldier->inv.size(); i++ )
{
if( pSoldier->inv[ i ].exists() == true )
{
WorldItem.fExists = TRUE;
WorldItem.sGridNo = sAlmaCaptureItemsGridNo[ gStrategicStatus.ubNumCapturedForRescue ];
@@ -1876,11 +1876,9 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
WorldItem.usFlags = 0;
WorldItem.bVisible = FALSE;
WorldItem.bRenderZHeightAboveLevel = 0;
memcpy( &(WorldItem.o), &pSoldier->inv[i], sizeof( OBJECTTYPE ) );
pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object);
AddWorldItemsToUnLoadedSector( 13, 9, 0, sAlmaCaptureItemsGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, &WorldItem, FALSE );
DeleteObj( &( pSoldier->inv[ i ] ) );
}
}
@@ -1897,12 +1895,12 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
pSoldier->bSectorZ = 0;
// put him on the floor!!
pSoldier->bLevel = 0;
pSoldier->pathing.bLevel = 0;
// OK, drop all items!
for ( i = 0; i < NUM_INV_SLOTS; i++ )
{
if( pSoldier->inv[ i ].usItem != 0 )
for ( i = 0; i < pSoldier->inv.size(); i++ )
{
if( pSoldier->inv[ i ].exists() == true )
{
WorldItem.fExists = TRUE;
WorldItem.sGridNo = sInterrogationItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ];
@@ -1910,11 +1908,9 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
WorldItem.usFlags = 0;
WorldItem.bVisible = FALSE;
WorldItem.bRenderZHeightAboveLevel = 0;
memcpy( &(WorldItem.o), &pSoldier->inv[i], sizeof( OBJECTTYPE ) );
pSoldier->inv[ i ].MoveThisObjectTo(WorldItem.object);
AddWorldItemsToUnLoadedSector( 7, 14, 0, sInterrogationItemGridNo[ gStrategicStatus.ubNumCapturedForRescue ], 1, &WorldItem, FALSE );
DeleteObj( &( pSoldier->inv[ i ] ) );
}
}
@@ -1928,27 +1924,27 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
pSoldier->bBleeding = 0;
// wake him up
if ( pSoldier->fMercAsleep )
if ( pSoldier->flags.fMercAsleep )
{
PutMercInAwakeState( pSoldier );
pSoldier->fForcedToStayAwake = FALSE;
pSoldier->flags.fForcedToStayAwake = FALSE;
}
//Set his life to 50% + or - 10 HP.
pSoldier->bLife = pSoldier->bLifeMax / 2;
if ( pSoldier->bLife <= 35 )
pSoldier->stats.bLife = pSoldier->stats.bLifeMax / 2;
if ( pSoldier->stats.bLife <= 35 )
{
pSoldier->bLife = 35;
pSoldier->stats.bLife = 35;
}
else if ( pSoldier->bLife >= 45 )
else if ( pSoldier->stats.bLife >= 45 )
{
pSoldier->bLife += (INT8)(10 - Random( 21 ) );
pSoldier->stats.bLife += (INT8)(10 - Random( 21 ) );
}
// make him quite exhausted when found
pSoldier->bBreath = pSoldier->bBreathMax = 50;
pSoldier->sBreathRed = 0;
pSoldier->fMercCollapsedFlag = FALSE;
pSoldier->flags.fMercCollapsedFlag = FALSE;
}
@@ -1961,9 +1957,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap()
//If any of the soldiers are dying, kill them now.
for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife )
{
MercPtrs[ i ]->bLife = 0;
MercPtrs[ i ]->stats.bLife = 0;
HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse );
bKilledEnemies++;
}
@@ -1971,9 +1967,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap()
//Do the same for the creatures.
for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife )
{
MercPtrs[ i ]->bLife = 0;
MercPtrs[ i ]->stats.bLife = 0;
HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse );
bKilledCreatures++;
}
@@ -1981,9 +1977,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap()
//Militia
for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife )
{
MercPtrs[ i ]->bLife = 0;
MercPtrs[ i ]->stats.bLife = 0;
HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse );
bKilledRebels++;
}
@@ -1991,9 +1987,9 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap()
//Civilians
for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ )
{
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bLife < OKLIFE && MercPtrs[ i ]->bLife )
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife )
{
MercPtrs[ i ]->bLife = 0;
MercPtrs[ i ]->stats.bLife = 0;
HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse );
bKilledCivilians++;
}
@@ -2008,7 +2004,7 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap()
ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d enemies died after you left the sector.", bKilledEnemies );
if( bKilledCreatures )
ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d creatures died after you left the sector.", bKilledCreatures );
if( !gbWorldSectorZ )
{
SECTORINFO *pSector;
@@ -2017,7 +2013,7 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap()
pSector->ubTroopsInBattle = 0;
pSector->ubElitesInBattle = 0;
pSector->ubCreaturesInBattle = 0;
//RecalculateSectorWeight(
//RecalculateSectorWeight(
}
else if( gbWorldSectorZ > 0 )
{
@@ -2060,9 +2056,9 @@ BOOLEAN OnlyHostileCivsInSector()
for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ )
{
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife )
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife )
{
if( !pSoldier->bNeutral )
if( !pSoldier->aiData.bNeutral )
{
fHostileCivs = TRUE;
break;
@@ -2077,9 +2073,9 @@ BOOLEAN OnlyHostileCivsInSector()
for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; i++ )
{
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife )
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife )
{
if( !pSoldier->bNeutral )
if( !pSoldier->aiData.bNeutral )
{
return FALSE;
}
@@ -2088,9 +2084,9 @@ BOOLEAN OnlyHostileCivsInSector()
for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ )
{
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife )
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife )
{
if( !pSoldier->bNeutral )
if( !pSoldier->aiData.bNeutral )
{
return FALSE;
}
@@ -2099,9 +2095,9 @@ BOOLEAN OnlyHostileCivsInSector()
for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ )
{
pSoldier = MercPtrs[ i ];
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife )
if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife )
{
if( !pSoldier->bNeutral )
if( !pSoldier->aiData.bNeutral )
{
return FALSE;
}
@@ -2111,3 +2107,4 @@ BOOLEAN OnlyHostileCivsInSector()
return TRUE;
}
+1 -1
View File
@@ -43,7 +43,7 @@ void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap();
BOOLEAN SaveUnderGroundSectorInfoToSaveGame( HWFILE hFile );
BOOLEAN LoadUnderGroundSectorInfoFromSavedGame( HWFILE hFile );
//Finds and returns the specified underground structure ( DONT MODIFY IT ). Else returns NULL
//Finds and returns the specified underground structure ( DONT MODIFY IT ). Else returns NULL
UNDERGROUND_SECTORINFO* FindUnderGroundSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ );
void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier );
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -6,7 +6,7 @@
extern BOOLEAN gfNpcLogButton;
extern UINT16 gusQdsEnteringGridNo;
extern INT16 gsQdsEnteringGridNo;
void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT8 ubApproach );
+1 -1
View File
@@ -353,7 +353,7 @@ STR16 FactDescText[] =
L"Fact keith out of business", // 274
L"Fact mike available to army",// 275
L"Fact kingpin can send assassins",// 276
L"Fact estoni refuelling possible",// 277
L"Fact estoni refuelling possible",// 277
L"Fact museum alarm went off",// 278
L"",
+52 -51
View File
@@ -76,9 +76,9 @@ BOOLEAN CheckForNewShipment( void )
{
ITEM_POOL * pItemPool;
if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) )
if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) )
{
if ( GetItemPool( BOBBYR_SHIPPING_DEST_GRIDNO, &pItemPool, 0 ) )
if ( GetItemPoolFromGround( BOBBYR_SHIPPING_DEST_GRIDNO, &pItemPool ) )
{
return( !( ITEMPOOL_VISIBLE( pItemPool ) ) );
}
@@ -92,7 +92,7 @@ BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly )
// is the NPC is wounded at all?
pSoldier = FindSoldierByProfileID( ubProfileID, FALSE );
if (pSoldier && pSoldier->bLife < pSoldier->bLifeMax)
if (pSoldier && pSoldier->stats.bLife < pSoldier->stats.bLifeMax)
{
if (fByPlayerOnly)
{
@@ -104,7 +104,7 @@ BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly )
{
return( FALSE );
}
}
}
else
{
return( TRUE );
@@ -113,7 +113,7 @@ BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly )
else
{
return( FALSE );
}
}
@@ -123,7 +123,7 @@ BOOLEAN CheckNPCInOkayHealth( UINT8 ubProfileID )
// is the NPC at better than half health?
pSoldier = FindSoldierByProfileID( ubProfileID, FALSE );
if (pSoldier && pSoldier->bLife > (pSoldier->bLifeMax / 2) && pSoldier->bLife > 30)
if (pSoldier && pSoldier->stats.bLife > (pSoldier->stats.bLifeMax / 2) && pSoldier->stats.bLife > 30)
{
return( TRUE );
}
@@ -139,7 +139,7 @@ BOOLEAN CheckNPCBleeding( UINT8 ubProfileID )
// the NPC is wounded...
pSoldier = FindSoldierByProfileID( ubProfileID, FALSE );
if (pSoldier && pSoldier->bLife > 0 && pSoldier->bBleeding > 0)
if (pSoldier && pSoldier->stats.bLife > 0 && pSoldier->bBleeding > 0)
{
return( TRUE );
}
@@ -174,7 +174,7 @@ BOOLEAN CheckGuyVisible( UINT8 ubNPC, UINT8 ubGuy )
{
return( FALSE );
}
if (pNPC->bOppList[ pGuy->ubID ] == SEEN_CURRENTLY )
if (pNPC->aiData.bOppList[ pGuy->ubID ] == SEEN_CURRENTLY )
{
return( TRUE );
}
@@ -205,7 +205,7 @@ BOOLEAN CheckNPCIsEnemy( UINT8 ubProfileID )
{
return( FALSE );
}
if (pNPC->bSide == gbPlayerNum || pNPC->bNeutral)
if (pNPC->bSide == gbPlayerNum || pNPC->aiData.bNeutral)
{
if (pNPC->ubCivilianGroup != NON_CIV_GROUP)
{
@@ -270,7 +270,7 @@ INT8 NumWoundedMercsNearby( UINT8 ubProfileID )
{
pSoldier = MercSlots[ uiLoop ];
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife > 0 && pSoldier->bLife < pSoldier->bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL )
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife > 0 && pSoldier->stats.bLife < pSoldier->stats.bLifeMax && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL )
{
if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= HOSPITAL_PATIENT_DISTANCE)
{
@@ -301,7 +301,7 @@ INT8 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist )
{
pSoldier = MercSlots[ uiLoop ];
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE )
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE )
{
if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= ubMaxDist)
{
@@ -379,7 +379,7 @@ BOOLEAN PCInSameRoom( UINT8 ubProfileID )
}
}
}
return( FALSE );
}
@@ -388,11 +388,11 @@ BOOLEAN CheckTalkerStrong( void )
{
if (gpSrcSoldier && gpSrcSoldier->bTeam == gbPlayerNum)
{
return( gpSrcSoldier->bStrength >= 84 );
return( gpSrcSoldier->stats.bStrength >= 84 );
}
else if (gpDestSoldier && gpDestSoldier->bTeam == gbPlayerNum)
{
return( gpDestSoldier->bStrength >= 84 );
return( gpDestSoldier->stats.bStrength >= 84 );
}
return( FALSE );
}
@@ -448,7 +448,7 @@ INT8 NumMalesPresent( UINT8 ubProfileID )
{
pSoldier = MercSlots[ uiLoop ];
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE)
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE)
{
if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile].bSex == MALE )
{
@@ -482,7 +482,7 @@ BOOLEAN FemalePresent( UINT8 ubProfileID )
{
pSoldier = MercSlots[ uiLoop ];
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->bLife >= OKLIFE)
if ( pSoldier && pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE)
{
if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile].bSex == FEMALE )
{
@@ -507,17 +507,17 @@ BOOLEAN CheckPlayerHasHead( void )
{
pSoldier = MercPtrs[ bLoop ];
if ( pSoldier->bActive && pSoldier->bLife > 0 )
if ( pSoldier->bActive && pSoldier->stats.bLife > 0 )
{
if ( FindObjInObjRange( pSoldier, HEAD_2, HEAD_7 ) != NO_SLOT )
{
{
return( TRUE );
}
}
}
return( FALSE );
}
BOOLEAN CheckNPCSector( UINT8 ubProfileID, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
@@ -555,7 +555,7 @@ BOOLEAN AIMMercWithin( INT16 sGridNo, INT16 sDistance )
{
pSoldier = MercSlots[ uiLoop ];
if ( pSoldier && (pSoldier->bTeam == gbPlayerNum) && (pSoldier->bLife >= OKLIFE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) )
if ( pSoldier && (pSoldier->bTeam == gbPlayerNum) && (pSoldier->stats.bLife >= OKLIFE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) )
{
if (PythSpacesAway( sGridNo, pSoldier->sGridNo ) <= sDistance)
{
@@ -576,7 +576,7 @@ BOOLEAN CheckNPCCowering( UINT8 ubProfileID )
{
return( FALSE );
}
return( ( (pNPC->uiStatusFlags & SOLDIER_COWERING) != 0) );
return( ( (pNPC->flags.uiStatusFlags & SOLDIER_COWERING) != 0) );
}
UINT8 CountBartenders( void )
@@ -603,7 +603,7 @@ BOOLEAN CheckNPCIsUnderFire( UINT8 ubProfileID )
{
return( FALSE );
}
return( pNPC->bUnderFire != 0 );
return( pNPC->aiData.bUnderFire != 0 );
}
BOOLEAN NPCHeardShot( UINT8 ubProfileID )
@@ -645,7 +645,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
case FACT_DIMITRI_DEAD:
gubFact[ usFact ] = (gMercProfiles[ DIMITRI ].bMercStatus == MERC_IS_DEAD );
break;
case FACT_CURRENT_SECTOR_IS_SAFE:
case FACT_CURRENT_SECTOR_IS_SAFE:
gubFact[FACT_CURRENT_SECTOR_IS_SAFE] = !( ( (gTacticalStatus.fEnemyInSector && NPCHeardShot( ubProfileID ) ) || gTacticalStatus.uiFlags & INCOMBAT ) );
break;
case FACT_BOBBYRAY_SHIPMENT_IN_TRANSIT:
@@ -716,7 +716,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
gubFact[FACT_NPC_BLEEDING_BUT_OKAY] = FALSE;
}
break;
case FACT_PLAYER_HAS_HEAD_AND_CARMEN_IN_SAN_MONA:
gubFact[usFact] = (CheckNPCSector( CARMEN, 5, MAP_ROW_C, 0 ) && CheckPlayerHasHead() );
break;
@@ -746,7 +746,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
if ( gMercProfiles[ 85 ].bMercStatus == MERC_IS_DEAD)
{
gubFact[FACT_BRENDA_IN_STORE_AND_ALIVE] = FALSE;
}
}
// ensure in a building and nearby
else if ( !(NPCInRoom( 85, 47 ) ) )
{
@@ -875,12 +875,12 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
break;
case FACT_DYNAMO_IN_J9:
gubFact[usFact] = CheckNPCSector( DYNAMO, 9, MAP_ROW_J, 0 ) && NumEnemiesInAnySector( 9, 10, 0 );
break;
break;
case FACT_DYNAMO_ALIVE:
gubFact[usFact] = ( gMercProfiles[ DYNAMO ].bMercStatus != MERC_IS_DEAD );
break;
case FACT_DYNAMO_SPEAKING_OR_NEARBY:
gubFact[usFact] = ( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO || ( CheckNPCWithin( gpSrcSoldier->ubProfile, DYNAMO, 10 ) && CheckGuyVisible( gpSrcSoldier->ubProfile, DYNAMO ) ) ) );
gubFact[usFact] = ( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO || ( CheckNPCWithin( gpSrcSoldier->ubProfile, DYNAMO, 10 ) && CheckGuyVisible( gpSrcSoldier->ubProfile, DYNAMO ) ) ) );
break;
case FACT_JOHN_EPC:
gubFact[usFact] = CheckNPCIsEPC( JOHN );
@@ -909,10 +909,10 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
case FACT_ANOTHER_FIGHT_POSSIBLE:
gubFact[usFact] = AnotherFightPossible();
break;
break;
case FACT_RECEIVING_INCOME_FROM_DCAC:
gubFact[usFact] = (
gubFact[usFact] = (
( PredictDailyIncomeFromAMine( MINE_DRASSEN ) > 0 ) &&
( PredictDailyIncomeFromAMine( MINE_ALMA ) > 0 ) &&
( PredictDailyIncomeFromAMine( MINE_CAMBRIA ) > 0 ) &&
@@ -939,7 +939,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
bTown = gMercProfiles[ ubProfileID ].bTown;
if( ( bTown != BLANK_SECTOR ) && gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ])
{
gubFact[usFact] = ( (gTownLoyalty[ bTown ].ubRating >= LOYALTY_LOW_THRESHOLD ) && (gTownLoyalty[ bTown ].ubRating < LOYALTY_OK_THRESHOLD ) );
gubFact[usFact] = ( (gTownLoyalty[ bTown ].ubRating >= LOYALTY_LOW_THRESHOLD ) && (gTownLoyalty[ bTown ].ubRating < LOYALTY_OK_THRESHOLD ) );
}
else
{
@@ -953,7 +953,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
{
// if Skyrider, ignore low loyalty until he has monologues, and wait at least a day since the latest monologue to avoid a hot/cold attitude
if ( ( ubProfileID == SKYRIDER ) &&
( ( guiHelicopterSkyriderTalkState == 0 ) || ( ( GetWorldTotalMin() - guiTimeOfLastSkyriderMonologue ) < ( 24 * 60 ) ) ) )
( ( guiHelicopterSkyriderTalkState == 0 ) || ( ( GetWorldTotalMin() - guiTimeOfLastSkyriderMonologue ) < ( 24 * 60 ) ) ) )
{
gubFact[usFact] = FALSE;
}
@@ -1087,7 +1087,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
case FACT_TONY_IN_BUILDING:
gubFact[usFact] = CheckNPCSector( TONY, 5, MAP_ROW_C, 0 ) && NPCInRoom( TONY, 50 );
break;
break;
case FACT_SHANK_SPEAKING:
gubFact[usFact] = ( gpSrcSoldier && gpSrcSoldier->ubProfile == SHANK );
@@ -1120,7 +1120,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
case FACT_JENNY_ALIVE:
gubFact[usFact] = gMercProfiles[ JENNY ].bMercStatus != MERC_IS_DEAD;
break;
case FACT_ARNOLD_ALIVE:
gubFact[usFact] = gMercProfiles[ ARNIE ].bMercStatus != MERC_IS_DEAD;
break;
@@ -1193,7 +1193,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
break;
case FACT_SKYRIDER_IN_C16:
gubFact[ usFact ] = CheckNPCSector( SKYRIDER, 16, MAP_ROW_C, 0 );
gubFact[ usFact ] = CheckNPCSector( SKYRIDER, 16, MAP_ROW_C, 0 );
break;
case FACT_SKYRIDER_IN_E14:
gubFact[ usFact ] = CheckNPCSector( SKYRIDER, 14, MAP_ROW_E, 0 );
@@ -1206,8 +1206,8 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
gubFact[usFact] = (gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] >= CIV_GROUP_WILL_BECOME_HOSTILE);
break;
case FACT_DYNAMO_NOT_SPEAKER:
gubFact[usFact] = !( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO ) );
case FACT_DYNAMO_NOT_SPEAKER:
gubFact[usFact] = !( gpSrcSoldier != NULL && (gpSrcSoldier->ubProfile == DYNAMO ) );
break;
case FACT_PABLO_BRIBED:
@@ -1238,7 +1238,7 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
void StartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY )
{
InternalStartQuest( ubQuest, sSectorX, sSectorY, TRUE );
InternalStartQuest( ubQuest, sSectorX, sSectorY, TRUE );
}
@@ -1248,10 +1248,10 @@ void InternalStartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN
{
gubQuest[ubQuest] = QUESTINPROGRESS;
if ( fUpdateHistory )
{
SetHistoryFact( HISTORY_QUEST_STARTED, ubQuest, GetWorldTotalMin(), sSectorX, sSectorY );
}
if ( fUpdateHistory )
{
SetHistoryFact( HISTORY_QUEST_STARTED, ubQuest, GetWorldTotalMin(), sSectorX, sSectorY );
}
}
else
{
@@ -1261,7 +1261,7 @@ void InternalStartQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN
void EndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY )
{
InternalEndQuest( ubQuest, sSectorX, sSectorY, TRUE );
InternalEndQuest( ubQuest, sSectorX, sSectorY, TRUE );
}
void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fUpdateHistory )
@@ -1270,10 +1270,10 @@ void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fU
{
gubQuest[ubQuest] = QUESTDONE;
if ( fUpdateHistory )
{
ResetHistoryFact( ubQuest, sSectorX, sSectorY );
}
if ( fUpdateHistory )
{
ResetHistoryFact( ubQuest, sSectorX, sSectorY );
}
}
else
{
@@ -1287,13 +1287,13 @@ void InternalEndQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN fU
gMercProfiles[ MADAME ].bNPCData = 0;
gMercProfiles[ MADAME ].bNPCData2 = 0;
}
};
void InitQuestEngine()
{
memset(gubQuest, 0, sizeof(gubQuest));
memset(gubFact, 0, sizeof(gubFact));
memset(gubFact, 0, sizeof(gubFact));
// semi-hack to make the letter quest start right away
CheckForQuests( 1 );
@@ -1323,7 +1323,7 @@ void CheckForQuests( UINT32 uiDay )
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay );
#endif
// -------------------------------------------------------------------------------
// -------------------------------------------------------------------------------
// QUEST 0 : DELIVER LETTER
// -------------------------------------------------------------------------------
// The game always starts with DELIVER LETTER quest, so turn it on if it hasn't
@@ -1335,7 +1335,7 @@ void CheckForQuests( UINT32 uiDay )
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
#endif
}
// This quest gets turned OFF through conversation with Miguel - when user hands
// Miguel the letter
}
@@ -1389,6 +1389,7 @@ BOOLEAN LoadQuestInfoFromSavedGameFile( HWFILE hFile )
+5 -5
View File
@@ -4,7 +4,7 @@
#include "FileMan.h"
#include "strategicmap.h"
// Quest.ubStatus values
// Quest.ubStatus values
#define QUESTNOTSTARTED 0
#define QUESTINPROGRESS 1
#define QUESTDONE 2
@@ -37,7 +37,7 @@
// --------------------------------------------------------------------------------------
// Q U E S T D E F I N E S
// Q U E S T D E F I N E S
// --------------------------------------------------------------------------------------
enum Quests
@@ -216,7 +216,7 @@ enum Facts
FACT_MIGUEL_FOUND, // 12
FACT_LETTER_DELIVERED, // 13
FACT_FOOD_ROUTE_EXISTS, // 14
FACT_DIMITRI_DEAD, // 15
FACT_DIMITRI_DEAD, // 15
FACT_MIGUEL_READ_LETTER = 23,
@@ -447,7 +447,7 @@ enum Facts
FACT_KEITH_OUT_OF_BUSINESS, // 274
FACT_MIKE_AVAILABLE_TO_ARMY,// 275
FACT_KINGPIN_CAN_SEND_ASSASSINS,// 276
FACT_ESTONI_REFUELLING_POSSIBLE,// 277
FACT_ESTONI_REFUELLING_POSSIBLE,// 277
FACT_MUSEUM_ALARM_WENT_OFF,// 278
FACT_MADDOG_IS_SPEAKER = 280,
@@ -516,7 +516,7 @@ enum Facts
FACT_CONRAD_SHOULD_GO = 367,
FACT_PLAYER_KILLED_BOXERS = 368,
} ;
//** END FACTS *************************
//** END FACTS *************************
#define BOBBYR_SHIPPING_DEST_SECTOR_X 13
#define BOBBYR_SHIPPING_DEST_SECTOR_Y 2
+29 -35
View File
@@ -1,29 +1,29 @@
#ifdef PRECOMPILEDHEADERS
#include "Strategic All.h"
#include "Strategic All.h"
#else
#include "Town Militia.h"
#include "Militia Control.h"
#include "Campaign Types.h"
#include "strategic.h"
#include "strategicmap.h"
#include "Overhead.h"
#include "Strategic Town Loyalty.h"
#include "Utilities.h"
#include "random.h"
#include "text.h"
#include "Map Screen Interface.h"
#include "Interface.h"
#include "Laptopsave.h"
#include "finances.h"
#include "Game Clock.h"
#include "Assignments.h"
#include "squads.h"
#include "Soldier Create.h"
#include "Dialogue Control.h"
#include "Queen Command.h"
#include "GameSettings.h"
#include "Soldier Init List.h"
#include "Inventory Choosing.h"
#include "Town Militia.h"
#include "Militia Control.h"
#include "Campaign Types.h"
#include "strategic.h"
#include "strategicmap.h"
#include "Overhead.h"
#include "Strategic Town Loyalty.h"
#include "Utilities.h"
#include "random.h"
#include "text.h"
#include "Map Screen Interface.h"
#include "Interface.h"
#include "Laptopsave.h"
#include "finances.h"
#include "Game Clock.h"
#include "Assignments.h"
#include "squads.h"
#include "Soldier Create.h"
#include "Dialogue Control.h"
#include "Queen Command.h"
#include "GameSettings.h"
#include "Soldier Init List.h"
#include "Inventory Choosing.h"
#endif
#include "Reinforcement.h"
@@ -36,7 +36,7 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
UINT8 ubNumAdmins, ubNumTroops, ubNumElites;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubIndex;
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites );
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( sSectorX, sSectorY, &ubNumAdmins, &ubNumTroops, &ubNumElites );
@@ -75,7 +75,6 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
}
}
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), &ubNumAdmins, &ubNumTroops, &ubNumElites );
*pubNumAdmins += ubNumAdmins;
@@ -89,7 +88,7 @@ UINT8 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY )
UINT8 ubNumAdmins, ubNumTroops, ubNumElites;
GetNumberOfEnemiesInFiveSectors( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites );
return ubNumAdmins + ubNumTroops + ubNumElites;
}
@@ -134,7 +133,7 @@ UINT8 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY)
UINT8 ubResult = 0;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubIndex;
ubResult = CountAllMilitiaInSector( sMapX, sMapY );
if( !gGameExternalOptions.gfAllowReinforcements )
@@ -155,7 +154,7 @@ UINT8 MilitiaInFiveSectorsOfRank( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
UINT8 ubResult = 0;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber, ubIndex;
ubResult = MilitiaInSectorOfRank( sMapX, sMapY, ubRank );
if( !gGameExternalOptions.gfAllowReinforcements )
@@ -167,13 +166,11 @@ UINT8 MilitiaInFiveSectorsOfRank( INT16 sMapX, INT16 sMapY, UINT8 ubRank )
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
ubResult += MilitiaInSectorOfRank( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), ubRank );
return ubResult;
}
BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY)
{
UINT8 ubResult = 0;
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber;
UINT8 ubRandom;
@@ -383,7 +380,6 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
}
}
}
@@ -392,7 +388,6 @@ void AddPossiblePendingMilitiaToBattle()
UINT8 ubSlots;
UINT8 ubNumElites, ubNumRegulars, ubNumGreens;
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
static UINT8 ubPredefinedInsertionCode = 255;
static UINT8 ubPredefinedRank = 255;
@@ -452,5 +447,4 @@ void AddPossiblePendingMilitiaToBattle()
gfStrategicMilitiaChangesMade = FALSE; // Handled them here
}
}
}
}
+78 -74
View File
@@ -5,7 +5,7 @@
#include "Fileman.h"
#include "types.h"
#include "Scheduling.h"
#include "Soldier Control.h"
#include "message.h"
#include "overhead.h"
#include "Game Clock.h"
@@ -30,6 +30,11 @@
#include "Quests.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#ifdef JA2EDITOR
extern CHAR16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20];
#endif
@@ -52,8 +57,8 @@ void ReverseSchedules();
void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTime, UINT32 uiEndTime );
//IMPORTANT:
//This function adds a NEWLY allocated schedule to the list. The pointer passed is totally
//separate. So make sure that you delete the pointer if you don't need it anymore. The editor
//This function adds a NEWLY allocated schedule to the list. The pointer passed is totally
//separate. So make sure that you delete the pointer if you don't need it anymore. The editor
//uses a single static node to copy data from, hence this method.
void CopyScheduleToList( SCHEDULENODE *pSchedule, SOLDIERINITNODE *pNode )
{
@@ -170,7 +175,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
if( !pSchedule )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Schedule ID of %d not found.", ubScheduleID );
ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Schedule ID of %d not found.", ubScheduleID );
#endif
return;
}
@@ -178,7 +183,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
if( pSchedule->ubSoldierID >= TOTAL_SOLDIERS )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Illegal soldier ID of %d.", pSchedule->ubSoldierID );
ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Illegal soldier ID of %d.", pSchedule->ubSoldierID );
#endif
return;
}
@@ -190,7 +195,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
//Validate the existance of the soldier.
pSoldier = MercPtrs[ pSchedule->ubSoldierID ];
if ( pSoldier->bLife < OKLIFE )
if ( pSoldier->stats.bLife < OKLIFE )
{
// dead or dying!
return;
@@ -199,7 +204,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
if ( !pSoldier->bActive )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Soldier isn't active. Name is %s.", pSoldier->name );
ScreenMsg( FONT_RED, MSG_BETAVERSION, L"Schedule callback: Soldier isn't active. Name is %s.", pSoldier->name );
#endif
}
@@ -236,7 +241,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
if ( fAutoProcess )
{
UINT32 uiStartTime, uiEndTime;
//Grab the last time the eventlist was queued. This will tell us how much time has passed since that moment,
//Grab the last time the eventlist was queued. This will tell us how much time has passed since that moment,
//and how long we need to auto process this schedule.
uiStartTime = (guiTimeOfLastEventQuery / 60) % NUM_MIN_IN_DAY;
uiEndTime = GetWorldMinutesInDay();
@@ -247,7 +252,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
}
else
{
// turn off all active-schedule flags before setting
// turn off all active-schedule flags before setting
// the one that should be active!
pSchedule->usFlags &= ~SCHEDULE_FLAGS_ACTIVE_ALL;
@@ -258,13 +263,13 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
case 2: pSchedule->usFlags |= SCHEDULE_FLAGS_ACTIVE3; break;
case 3: pSchedule->usFlags |= SCHEDULE_FLAGS_ACTIVE4; break;
}
pSoldier->fAIFlags |= AI_CHECK_SCHEDULE;
pSoldier->aiData.fAIFlags |= AI_CHECK_SCHEDULE;
pSoldier->bAIScheduleProgress = 0;
}
}
//Called before leaving the editor, or saving the map. This recalculates
//Called before leaving the editor, or saving the map. This recalculates
//all of the schedule IDs from scratch and adjusts the effected structures accordingly.
void OptimizeSchedules()
{
@@ -311,12 +316,12 @@ void OptimizeSchedules()
}
}
//Called when transferring from the game to the editor.
//Called when transferring from the game to the editor.
void PrepareSchedulesForEditorEntry()
{
SCHEDULENODE *curr, *prev, *temp;
//Delete all schedule events. The editor will automatically warp all civilians to their starting locations.
//Delete all schedule events. The editor will automatically warp all civilians to their starting locations.
DeleteAllStrategicEventsOfType( EVENT_PROCESS_TACTICAL_SCHEDULE );
//Now, delete all of the temporary schedules.
@@ -336,14 +341,14 @@ void PrepareSchedulesForEditorEntry()
MemFree( temp );
gubScheduleID--;
}
else
else
{
if( curr->usFlags & SCHEDULE_FLAGS_SLEEP_CONVERTED )
{ //uncovert it!
INT32 i;
for( i = 0 ; i < MAX_SCHEDULE_ACTIONS; i++ )
{
//if( i
//if( i
}
}
prev = curr;
@@ -352,7 +357,7 @@ void PrepareSchedulesForEditorEntry()
}
}
//Called when leaving the editor to enter the game. This posts all of the events that apply.
//Called when leaving the editor to enter the game. This posts all of the events that apply.
void PrepareSchedulesForEditorExit()
{
PostSchedules();
@@ -463,7 +468,7 @@ BOOLEAN LoadSchedulesFromSave( HWFILE hFile )
}
//used to fix a bug in the editor where the schedules were reversed. Because only
//used to fix a bug in the editor where the schedules were reversed. Because only
//some maps were effected, this feature was required.
void ReverseSchedules()
{
@@ -566,7 +571,7 @@ BOOLEAN SaveSchedules( HWFILE hFile )
//Each schedule has upto four parts to it, so sort them chronologically.
//Happily, the fields with no times actually are the highest.
BOOLEAN SortSchedule( SCHEDULENODE *pSchedule )
{
{
INT32 index, i, iBestIndex;
UINT16 usTime;
UINT16 usData1;
@@ -574,7 +579,7 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule )
UINT8 ubAction;
BOOLEAN fSorted = FALSE;
//Use a bubblesort method (max: 3 switches).
//Use a bubblesort method (max: 3 switches).
index = 0;
while( index < 3 )
{
@@ -609,7 +614,7 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule )
return fSorted;
}
BOOLEAN BumpAnyExistingMerc( INT16 sGridNo )
BOOLEAN BumpAnyExistingMerc( INT16 sGridNo )
{
UINT8 ubID;
SOLDIERTYPE * pSoldier; // NB this is the person already in the location,
@@ -645,7 +650,7 @@ BOOLEAN BumpAnyExistingMerc( INT16 sGridNo )
}
ConvertGridNoToCellXY( sNewGridNo, &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
return( TRUE );
}
@@ -658,12 +663,12 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
if ( gTacticalStatus.uiFlags & LOADING_SAVED_GAME )
{
// CJC, November 28th: when reloading a saved game we want events posted but no events autoprocessed since
// that could change civilian positions. So rather than doing a bunch of checks outside of this function,
// CJC, November 28th: when reloading a saved game we want events posted but no events autoprocessed since
// that could change civilian positions. So rather than doing a bunch of checks outside of this function,
// I thought it easier to screen them out here.
return;
}
pSoldier = MercPtrs[ pSchedule->ubSoldierID ];
if (pSoldier->ubID == 0)
@@ -674,7 +679,7 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
#ifdef JA2EDITOR
if ( pSoldier->ubProfile != NO_PROFILE )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for %S (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d",
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for %S (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d",
gszScheduleActions[ pSchedule->ubAction[ index ] ],
pSoldier->name,
pSoldier->ubID,
@@ -686,8 +691,8 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
}
else
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for civ (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d",
gszScheduleActions[ pSchedule->ubAction[ index ] ],
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Autoprocessing schedule action %S for civ (%d) at time %02ld:%02ld (set for %02d:%02d), data1 = %d",
gszScheduleActions[ pSchedule->ubAction[ index ] ],
pSoldier->ubID,
GetWorldHour(),
guiMin,
@@ -698,7 +703,7 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
#endif
// always assume the merc is going to wake, unless the event is a sleep
pSoldier->fAIFlags &= ~(AI_ASLEEP);
pSoldier->aiData.fAIFlags &= ~(AI_ASLEEP);
switch( pSchedule->ubAction[ index ] )
{
@@ -706,11 +711,11 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
case SCHEDULE_ACTION_UNLOCKDOOR:
case SCHEDULE_ACTION_OPENDOOR:
case SCHEDULE_ACTION_CLOSEDOOR:
PerformActionOnDoorAdjacentToGridNo( pSchedule->ubAction[ index ], pSchedule->usData1[ index ] );
PerformActionOnDoorAdjacentToGridNo( pSchedule->ubAction[ index ], (INT16)pSchedule->usData1[ index ] );
BumpAnyExistingMerc( pSchedule->usData2[ index ] );
ConvertGridNoToCellXY( pSchedule->usData2[ index ], &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
if ( GridNoOnEdgeOfMap( pSchedule->usData2[ index ], &bDirection ) )
{
// civ should go off map; this tells us where the civ will return
@@ -721,15 +726,15 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
else
{
// let this person patrol from here from now on
pSoldier->usPatrolGrid[0] = pSchedule->usData2[ index ];
pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData2[ index ];
}
break;
case SCHEDULE_ACTION_GRIDNO:
BumpAnyExistingMerc( pSchedule->usData1[ index ] );
ConvertGridNoToCellXY( pSchedule->usData1[ index ], &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
// let this person patrol from here from now on
pSoldier->usPatrolGrid[0] = pSchedule->usData1[ index ];
pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData1[ index ];
break;
case SCHEDULE_ACTION_ENTERSECTOR:
if ( pSoldier->ubProfile != NO_PROFILE && gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR )
@@ -739,37 +744,37 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
}
BumpAnyExistingMerc( pSchedule->usData1[ index ] );
ConvertGridNoToCellXY( pSchedule->usData1[ index ], &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
MoveSoldierFromAwayToMercSlot( pSoldier );
pSoldier->bInSector = TRUE;
// let this person patrol from here from now on
pSoldier->usPatrolGrid[0] = pSchedule->usData1[ index ];
pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData1[ index ];
break;
case SCHEDULE_ACTION_WAKE:
BumpAnyExistingMerc( pSoldier->sInitialGridNo );
ConvertGridNoToCellXY( pSoldier->sInitialGridNo, &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
// let this person patrol from here from now on
pSoldier->usPatrolGrid[0] = pSoldier->sInitialGridNo;
pSoldier->aiData.sPatrolGrid[0] = pSoldier->sInitialGridNo;
break;
case SCHEDULE_ACTION_SLEEP:
pSoldier->fAIFlags |= AI_ASLEEP;
pSoldier->aiData.fAIFlags |= AI_ASLEEP;
// check for someone else in the location
BumpAnyExistingMerc( pSchedule->usData1[ index ] );
ConvertGridNoToCellXY( pSchedule->usData1[ index ], &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->usPatrolGrid[0] = pSchedule->usData1[ index ];
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->aiData.sPatrolGrid[0] = pSchedule->usData1[ index ];
break;
case SCHEDULE_ACTION_LEAVESECTOR:
sGridNo = FindNearestEdgePoint( pSoldier->sGridNo );
BumpAnyExistingMerc( sGridNo );
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
sGridNo = FindNearbyPointOnEdgeOfMap( pSoldier, &bDirection );
BumpAnyExistingMerc( sGridNo );
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
EVENT_SetSoldierPositionForceDelete( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
pSoldier->EVENT_SetSoldierPositionForceDelete( (FLOAT)sCellX, (FLOAT)sCellY );
// ok, that tells us where the civ will return
pSoldier->sOffWorldGridNo = sGridNo;
@@ -787,13 +792,13 @@ void PostSchedule( SOLDIERTYPE *pSoldier )
SCHEDULENODE *pSchedule;
UINT8 ubTempAction;
UINT16 usTemp;
if ( (pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP) && ( gTacticalStatus.fCivGroupHostile[ KINGPIN_CIV_GROUP ] || ( (gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS) && (CheckFact( FACT_KINGPIN_CAN_SEND_ASSASSINS, KINGPIN )) ) ) && (gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C) && (pSoldier->ubProfile == NO_PROFILE) )
{
// no schedules for people guarding Tony's!
return;
}
pSchedule = GetSchedule( pSoldier->ubScheduleID );
if( !pSchedule )
return;
@@ -840,7 +845,7 @@ void PostSchedule( SOLDIERTYPE *pSoldier )
usTemp = pSchedule->usTime[ bEmpty ];
pSchedule->usTime[ bEmpty ] = pSchedule->usTime[ i ];
pSchedule->usTime[ i ] = usTemp;
usTemp = pSchedule->usData1[ bEmpty ];
pSchedule->usData1[ bEmpty ] = pSchedule->usData1[ i ];
pSchedule->usData1[ i ] = usTemp;
@@ -854,10 +859,10 @@ void PostSchedule( SOLDIERTYPE *pSoldier )
// no morning entries but no space for a wakeup either, will sleep till
// next non-sleep event
}
}
break; //The break is here because nobody should have more than one sleep schedule with no time specified.
}
}
}
}
@@ -866,10 +871,10 @@ void PostSchedule( SOLDIERTYPE *pSoldier )
// always process previous 24 hours
uiEndTime = GetWorldTotalMin();
uiStartTime = uiEndTime - (NUM_MIN_IN_DAY - 1);
/*
//First thing we need is to get the time that the map was last loaded. If more than 24 hours,
//then process only 24 hours. If less, then process all the schedules that would have happened within
//First thing we need is to get the time that the map was last loaded. If more than 24 hours,
//then process only 24 hours. If less, then process all the schedules that would have happened within
//that period of time.
uiEndTime = GetWorldTotalMin();
if( GetWorldTotalMin() - guiTimeCurrentSectorWasLastLoaded > NUM_MIN_IN_DAY )
@@ -881,7 +886,7 @@ void PostSchedule( SOLDIERTYPE *pSoldier )
uiStartTime = guiTimeCurrentSectorWasLastLoaded;
}
*/
//Need a way to determine if the player has actually modified doors since this civilian was last loaded
uiEndTime %= NUM_MIN_IN_DAY;
uiStartTime %= NUM_MIN_IN_DAY;
@@ -894,7 +899,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi
BOOLEAN fPostedNextEvent = FALSE;
if ( uiStartTime > uiEndTime )
{ //The start time is later in the day than the end time, which means we'll be wrapping
{ //The start time is later in the day than the end time, which means we'll be wrapping
//through midnight and continuing to the end time.
for( i = 0; i < MAX_SCHEDULE_ACTIONS; i++ )
{
@@ -923,7 +928,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi
}
}
else
{ //Much simpler: start at the start and continue to the end.
{ //Much simpler: start at the start and continue to the end.
for( i = 0; i < MAX_SCHEDULE_ACTIONS; i++ )
{
if( pSchedule->usTime[i] == 0xffff )
@@ -947,7 +952,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi
{
// reached end of schedule, post first event for soldier in the next day
// 0th event will be first.
// Feb 1: ONLY IF THERE IS A VALID EVENT TO POST WITH A VALID TIME!
// Feb 1: ONLY IF THERE IS A VALID EVENT TO POST WITH A VALID TIME!
if ( pSchedule->usTime[0] != 0xffff )
{
AddStrategicEvent( EVENT_PROCESS_TACTICAL_SCHEDULE, GetWorldDayInMinutes() + NUM_MIN_IN_DAY + pSchedule->usTime[0], pSchedule->ubScheduleID );
@@ -955,7 +960,7 @@ void PrepareScheduleForAutoProcessing( SCHEDULENODE *pSchedule, UINT32 uiStartTi
}
}
//Leave at night, come back in the morning. The time variances are a couple hours, so
//Leave at night, come back in the morning. The time variances are a couple hours, so
//the town doesn't turn into a ghost town in 5 minutes.
void PostDefaultSchedule( SOLDIERTYPE *pSoldier )
{
@@ -966,7 +971,7 @@ void PostDefaultSchedule( SOLDIERTYPE *pSoldier )
{ //People in underground sectors don't get schedules.
return;
}
//Create a new node at the head of the list. The head will become the new schedule
//Create a new node at the head of the list. The head will become the new schedule
//we are about to add.
curr = gpScheduleList;
gpScheduleList = (SCHEDULENODE*)MemAlloc( sizeof( SCHEDULENODE ) );
@@ -993,7 +998,7 @@ void PostDefaultSchedule( SOLDIERTYPE *pSoldier )
gpScheduleList->ubAction[1] = SCHEDULE_ACTION_LEAVESECTOR;
gpScheduleList->usTime[1] = (UINT16)(1080 + Random( 121 ));
gpScheduleList->usFlags |= SCHEDULE_FLAGS_TEMPORARY;
if( gubScheduleID == 255 )
{ //Too much fragmentation, clean it up...
OptimizeSchedules();
@@ -1019,7 +1024,7 @@ void PostSchedules()
#endif
//If no way to leave the map, then don't post default schedules.
if( gMapInformation.sNorthGridNo != -1 || gMapInformation.sEastGridNo != -1 ||
gMapInformation.sSouthGridNo != -1 || gMapInformation.sWestGridNo != -1 )
gMapInformation.sSouthGridNo != -1 || gMapInformation.sWestGridNo != -1 )
{
fDefaultSchedulesPossible = TRUE;
}
@@ -1035,12 +1040,12 @@ void PostSchedules()
else if( fDefaultSchedulesPossible )
{
// ATE: There should be a better way here...
if( curr->pSoldier->ubBodyType != COW &&
curr->pSoldier->ubBodyType != BLOODCAT &&
if( curr->pSoldier->ubBodyType != COW &&
curr->pSoldier->ubBodyType != BLOODCAT &&
curr->pSoldier->ubBodyType != HUMVEE &&
curr->pSoldier->ubBodyType != ELDORADO &&
curr->pSoldier->ubBodyType != ICECREAMTRUCK &&
curr->pSoldier->ubBodyType != JEEP )
curr->pSoldier->ubBodyType != ELDORADO &&
curr->pSoldier->ubBodyType != ICECREAMTRUCK &&
curr->pSoldier->ubBodyType != JEEP )
{
PostDefaultSchedule( curr->pSoldier );
}
@@ -1050,12 +1055,12 @@ void PostSchedules()
}
}
void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, UINT16 usGridNo )
void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, INT16 sGridNo )
{
INT16 sDoorGridNo;
DOOR * pDoor;
sDoorGridNo = FindDoorAtGridNoOrAdjacent( (INT16) usGridNo );
sDoorGridNo = FindDoorAtGridNoOrAdjacent( (INT16) sGridNo );
if (sDoorGridNo != NOWHERE)
{
switch( ubScheduleAction )
@@ -1086,7 +1091,7 @@ void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, UINT16 usGridN
}
}
//Assumes that a schedule has just been processed. This takes the current time, and compares it to the
//Assumes that a schedule has just been processed. This takes the current time, and compares it to the
//schedule, and looks for the next schedule action that would get processed and posts it.
void PostNextSchedule( SOLDIERTYPE *pSoldier )
{
@@ -1140,7 +1145,7 @@ BOOLEAN ExtractScheduleEntryAndExitInfo( SOLDIERTYPE * pSoldier, UINT32 * puiEnt
pSchedule = GetSchedule( pSoldier->ubScheduleID );
if ( !pSchedule )
{
// If person had default schedule then would have been assigned and this would
// If person had default schedule then would have been assigned and this would
// have succeeded.
// Hence this is an error.
return( FALSE );
@@ -1153,7 +1158,7 @@ BOOLEAN ExtractScheduleEntryAndExitInfo( SOLDIERTYPE * pSoldier, UINT32 * puiEnt
fFoundEntryTime = TRUE;
*puiEntryTime = pSchedule->usTime[ iLoop ];
}
else if ( pSchedule->ubAction[ iLoop ] == SCHEDULE_ACTION_LEAVESECTOR )
else if ( pSchedule->ubAction[ iLoop ] == SCHEDULE_ACTION_LEAVESECTOR )
{
fFoundExitTime = TRUE;
*puiExitTime = pSchedule->usTime[ iLoop ];
@@ -1185,7 +1190,7 @@ BOOLEAN ExtractScheduleDoorLockAndUnlockInfo( SOLDIERTYPE * pSoldier, UINT32 * p
pSchedule = GetSchedule( pSoldier->ubScheduleID );
if ( !pSchedule )
{
// If person had default schedule then would have been assigned and this would
// If person had default schedule then would have been assigned and this would
// have succeeded.
// Hence this is an error.
return( FALSE );
@@ -1220,8 +1225,6 @@ BOOLEAN ExtractScheduleDoorLockAndUnlockInfo( SOLDIERTYPE * pSoldier, UINT32 * p
BOOLEAN GetEarliestMorningScheduleEvent( SCHEDULENODE *pSchedule, UINT32 * puiTime )
{
INT32 iLoop;
BOOLEAN fFoundTime = FALSE;
*puiTime = 100000;
for ( iLoop = 0; iLoop < MAX_SCHEDULE_ACTIONS; iLoop++ )
@@ -1296,7 +1299,7 @@ void ReconnectSchedules( void )
else
{
// need default schedule!
//PostDefaultSchedule( pSoldier );
//PostDefaultSchedule( pSoldier );
}
}
}
@@ -1400,6 +1403,7 @@ void SecureSleepSpots( void )
+6 -6
View File
@@ -5,8 +5,8 @@
#include "Soldier Init List.h"
//Merc scheduling actions
//NOTE: Any modifications to this enumeration also require updating the text in EditorMercs.c used
// in the editor for merc schedule purposes.
//NOTE: Any modifications to this enumeration also require updating the text in EditorMercs.c used
// in the editor for merc schedule purposes.
enum
{
SCHEDULE_ACTION_NONE,
@@ -79,19 +79,19 @@ void PostNextSchedule( SOLDIERTYPE *pSoldier );
//we then need to post the events and process schedules for the time that we have been gone.
void PostSchedules();
//Sorts the schedule in chronological order. Returns TRUE if any sorting took place.
//Sorts the schedule in chronological order. Returns TRUE if any sorting took place.
BOOLEAN SortSchedule( SCHEDULENODE *pSchedule );
//Adds a schedule to the list. COPIES THE DATA OVER (ALLOCATES NEW NODE!)
//Adds a schedule to the list. COPIES THE DATA OVER (ALLOCATES NEW NODE!)
void CopyScheduleToList( SCHEDULENODE *pSchedule, SOLDIERINITNODE *pNode );
//Entering the editor automatically removes all events posted.
void PrepareSchedulesForEditorEntry();
//Leaving the editor and entering the game posts the events.
void PrepareSchedulesForEditorExit();
//Packs all of the scheduleIDs, and updates the links. This is done whenever necessary and
//Packs all of the scheduleIDs, and updates the links. This is done whenever necessary and
//before saving the map, as this forces the IDs to align with the SOLDIERINITNODE->ubScheduleID's.
void OptimizeSchedules();
void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, UINT16 usMapIndex );
void PerformActionOnDoorAdjacentToGridNo( UINT8 ubScheduleAction, INT16 sMapIndex );
BOOLEAN ExtractScheduleEntryAndExitInfo( SOLDIERTYPE * pSoldier, UINT32 * puiEntryTime, UINT32 * puiExitTime );
BOOLEAN ExtractScheduleDoorLockAndUnlockInfo( SOLDIERTYPE * pSoldier, UINT32 * puiOpeningTime, UINT32 * puiClosingTime );
+545 -544
View File
File diff suppressed because it is too large Load Diff
+17 -17
View File
@@ -86,7 +86,7 @@ enum
BALIME_DEFENCE, //Rich town, paved roads, close to Meduna (in queen's favor)
TIXA_PRISON, //Prison, well defended, but no point in retaking
TIXA_SAMSITE, //The central-most sam site (important for queen to keep)
ALMA_DEFENCE, //The military town of Meduna. Also very important for queen.
ALMA_DEFENCE, //The military town of Meduna. Also very important for queen.
ALMA_MINE, //Mine income AND administrators
CAMBRIA_DEFENCE, //Medical town, large, central.
CAMBRIA_MINE,
@@ -106,26 +106,26 @@ extern UINT8 NUM_ARMY_COMPOSITIONS;
typedef struct ARMY_COMPOSITION
{
INT32 iReadability; //contains the enumeration which is useless, but helps readability.
INT8 bPriority;
INT8 bElitePercentage;
INT8 bTroopPercentage;
INT8 bAdminPercentage;
INT8 bDesiredPopulation;
INT8 bStartPopulation;
INT8 bPadding[10];
INT8 bPriority;
INT8 bElitePercentage;
INT8 bTroopPercentage;
INT8 bAdminPercentage;
INT8 bDesiredPopulation;
INT8 bStartPopulation;
INT8 bPadding[10];
}ARMY_COMPOSITION;
//Defines the patrol groups -- movement groups.
typedef struct PATROL_GROUP
{
INT8 bSize;
INT8 bPriority;
INT8 bSize;
INT8 bPriority;
UINT8 ubSectorID[4];
INT8 bFillPermittedAfterDayMod100;
INT8 bFillPermittedAfterDayMod100;
UINT8 ubGroupID;
INT8 bWeight;
INT8 bWeight;
UINT8 ubPendingGroupID;
INT8 bPadding[10];
INT8 bPadding[10];
}PATROL_GROUP;
//Defines all stationary defence forces.
@@ -133,13 +133,13 @@ typedef struct GARRISON_GROUP
{
UINT8 ubSectorID;
UINT8 ubComposition;
INT8 bWeight;
INT8 bWeight;
UINT8 ubPendingGroupID;
INT8 bPadding[10];
INT8 bPadding[10];
}GARRISON_GROUP;
#define MAX_GARRISON_GROUPS 100
#define MAX_PATROL_GROUPS 50
#define MAX_GARRISON_GROUPS 100
#define MAX_PATROL_GROUPS 50
#define MAX_ARMY_COMPOSITIONS 60
#endif
+8 -8
View File
@@ -155,7 +155,7 @@
#include <wchar.h>
#include <tchar.h>
#include "Interface Cursors.h"
#include "Interface Panels.h"
#include "Interface Panels.h"
#include "sys globals.h"
#include "faces.h"
#include "strategic turns.h"
@@ -189,21 +189,21 @@
#include "strategicmap.h"
#include "soldier add.h"
#include "Opplist.h"
#include "Handle Items.h"
#include "Game Clock.h"
#include "environment.h"
#include "Handle Items.h"
#include "Game Clock.h"
#include "environment.h"
#include "dialogue control.h"
#include "Soldier Control.h"
#include "overhead.h"
#include "AimMembers.h"
#include "MessageBoxScreen.h"
#include "MessageBoxScreen.h"
#include "Stdio.h"
#include "english.h"
#include "line.h"
#include "Keys.h"
#include "Keys.h"
#include "Interface Dialogue.h"
#include "SysUtil.h"
#include "Message.h"
#include "SysUtil.h"
#include "Message.h"
#include "Interface Dialogue.h"
#include "Render Fun.h"
#include "Boxing.h"
+99 -88
View File
@@ -4,7 +4,6 @@
#include "Strategic Event Handler.h"
#include "MemMan.h"
#include "message.h"
#include "Item Types.h"
#include "Items.h"
#include "Handle Items.h"
#include "LaptopSave.h"
@@ -34,6 +33,11 @@
#endif
#include "BobbyRMailOrder.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#define MEDUNA_ITEM_DROP_OFF_GRIDNO 10959
#define MEDUNA_ITEM_DROP_OFF_SECTOR_X 3
#define MEDUNA_ITEM_DROP_OFF_SECTOR_Y 14
@@ -42,7 +46,6 @@
extern INT16 gsRobotGridNo;
UINT32 guiPabloExtraDaysBribed = 0;
UINT8 gubCambriaMedicalObjects;
@@ -54,8 +57,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
{
UINT8 i,j;
UINT16 usItem;
OBJECTTYPE Object;
UINT16 usMapPos, usStandardMapPos;
INT16 sMapPos, sStandardMapPos;
UINT16 usNumberOfItems;
BOOLEAN fSectorLoaded = FALSE;
UINT16 usTotalNumberOfItemTypes;
@@ -71,7 +73,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
UINT8 ubTempNumItems;
UINT8 ubItemsPurchased;
usStandardMapPos = BOBBYR_SHIPPING_DEST_GRIDNO;
sStandardMapPos = BOBBYR_SHIPPING_DEST_GRIDNO;
// if the delivery is for meduna, drop the items off there instead
if( gpNewBobbyrShipments[ ubOrderID ].fActive && gpNewBobbyrShipments[ ubOrderID ].ubDeliveryLoc == BR_MEDUNA )
@@ -96,8 +98,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
{
// shipment went to wrong airport... reroute all items to a temporary
// gridno to represent the other airport (and damage them)
SetFactTrue( FACT_LAST_SHIPMENT_WENT_TO_WRONG_AIRPORT );
usStandardMapPos = LOST_SHIPMENT_GRIDNO;
SetFactTrue( FACT_LAST_SHIPMENT_WENT_TO_WRONG_AIRPORT );
sStandardMapPos = LOST_SHIPMENT_GRIDNO;
SetFactFalse( FACT_NEXT_PACKAGE_CAN_BE_DELAYED );
}
else if ( (gTownLoyalty[ DRASSEN ].ubRating < 20) || StrategicMap[ CALCULATE_STRATEGIC_INDEX( 13, MAP_ROW_B ) ].fEnemyControlled )
@@ -147,12 +149,10 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if( !fSectorLoaded )
{
//build an array of objects to be added
pObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems );
pStolenObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems );
pObject = new OBJECTTYPE[ usNumberOfItems ];
pStolenObject = new OBJECTTYPE[ usNumberOfItems ];
if( pObject == NULL || pStolenObject == NULL)
return;
memset( pObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems );
memset( pStolenObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems );
}
// WDS - Option to turn off stealing
@@ -164,7 +164,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
}
else if (CheckFact( FACT_PABLOS_BRIBED, 0 ))
{
// Since Pacos has some money, reduce record of # of shipments since last bribed...
// Since Pacos has some money, reduce record of # of shipments since last bribed...
ubShipmentsSinceNoBribes /= 2;
uiChanceOfTheft = 0;
}
@@ -182,14 +182,14 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
usItem = gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].usItemIndex;
//Create the item
CreateItem( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, &Object );
CreateItem( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, &gTempObject );
// if it's a gun
if (Item [ usItem ].usItemClass == IC_GUN )
{
// Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is done for BobbyR
// Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is done for BobbyR
// simply to be consistent with the dealers in Arulco, who must sell guns empty to prevent ammo cheats by players.
Object.ItemData.Gun.ubGunShotsLeft = 0;
gTempObject[0]->data.gun.ubGunShotsLeft = 0;
}
ubItemsDelivered = 0;
@@ -208,25 +208,25 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if ( !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + ubItemsPurchased) )
{
uiStolenCount++;
usMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen!
sMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen!
fPablosStoleSomething = TRUE;
fPablosStoleLastItem = TRUE;
}
else
{
usMapPos = usStandardMapPos;
sMapPos = sStandardMapPos;
fPablosStoleLastItem = FALSE;
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
if (sStandardMapPos == LOST_SHIPMENT_GRIDNO)
{
// damage the item a random amount!
Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 );
gTempObject[0]->data.objectStatus = (INT8) ( ( (70 + Random( 11 )) * (INT32) gTempObject[0]->data.objectStatus ) / 100 );
// make damn sure it can't hit 0
if (Object.ItemData.Generic.bStatus[0] == 0)
if (gTempObject[0]->data.objectStatus == 0)
{
Object.ItemData.Generic.bStatus[0] = 1;
gTempObject[0]->data.objectStatus = 1;
}
AddItemToPool( usMapPos, &Object, -1, 0, 0, 0 );
AddItemToPool( sMapPos, &gTempObject, -1, 0, 0, 0 );
}
else
{
@@ -239,7 +239,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
{
if ( j > 1 && !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + j) )
{
memcpy( &pStolenObject[ uiStolenCount ], &Object, sizeof( OBJECTTYPE ) );
pStolenObject[ uiStolenCount ] = gTempObject;
uiStolenCount++;
fPablosStoleSomething = TRUE;
fPablosStoleLastItem = TRUE;
@@ -251,16 +251,16 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
//else we are not currently in the sector, so we build an array of items to add in one lump
//add the item to the item array
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
if (sStandardMapPos == LOST_SHIPMENT_GRIDNO)
{
// damage the item a random amount!
Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 );
gTempObject[0]->data.objectStatus = (INT8) ( ( (70 + Random( 11 )) * (INT32) gTempObject[0]->data.objectStatus ) / 100 );
// make damn sure it can't hit 0
if (Object.ItemData.Generic.bStatus[0] == 0)
if (gTempObject[0]->data.objectStatus == 0)
{
Object.ItemData.Generic.bStatus[0] = 1;
gTempObject[0]->data.objectStatus = 1;
}
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
pObject[ uiCount ] = gTempObject;
uiCount++;
}
else
@@ -273,14 +273,14 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if ( gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].ubNumberPurchased == 1 && ubItemsDelivered == 1 )
{
// the item in Object will be the item to deliver
// the item in gTempObject will be the item to deliver
if( fSectorLoaded )
{
AddItemToPool( usStandardMapPos, &Object, -1, 0, 0, 0 );
AddItemToPool( sStandardMapPos, &gTempObject, -1, 0, 0, 0 );
}
else
{
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
pObject[ uiCount ] = gTempObject;
uiCount++;
}
}
@@ -289,17 +289,17 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
while ( ubItemsDelivered )
{
// treat 0s as 1s :-)
ubTempNumItems = __min( ubItemsDelivered, __max( 1, Item[ usItem ].ubPerPocket ) );
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &Object );
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&gTempObject, STACK_SIZE_LIMIT) );
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &gTempObject );
// stack as many as possible
if( fSectorLoaded )
{
AddItemToPool( usStandardMapPos, &Object, -1, 0, 0, 0 );
AddItemToPool( sStandardMapPos, &gTempObject, -1, 0, 0, 0 );
}
else
{
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
pObject[ uiCount ] = gTempObject;
uiCount++;
}
@@ -312,9 +312,9 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if( !fSectorLoaded )
{
//add all the items from the array that was built above
usMapPos = PABLOS_STOLEN_DEST_GRIDNO;
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
if( !AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, usStandardMapPos, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
sMapPos = PABLOS_STOLEN_DEST_GRIDNO;
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
if( !AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, sStandardMapPos, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
{
//Error adding the items
//return;
@@ -327,8 +327,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
//return;
}
}
MemFree( pObject );
MemFree( pStolenObject );
delete[] pObject ;
delete[]( pStolenObject );
pObject = NULL;
pStolenObject = NULL;
}
@@ -402,15 +402,13 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
void HandleDelayedItemsArrival( UINT32 uiReason )
{
// This function moves all the items that Pablos has stolen
// (or items that were delayed) to the arrival location for new shipments,
// This function moves all the items that Pablos has stolen
// (or items that were delayed) to the arrival location for new shipments,
INT16 sStartGridNo;
UINT32 uiNumWorldItems, uiLoop;
BOOLEAN fOk;
WORLDITEM * pTemp;
WORLDITEM * pTemp = 0;
UINT8 ubLoop;
OBJECTTYPE Object;
if (uiReason == NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS )
{
if ( gMercProfiles[ PABLO ].bMercStatus == MERC_IS_DEAD )
@@ -431,34 +429,34 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
{
case 0:
// 1 in 10 chance of a badly damaged gas mask
CreateItem( GASMASK, (INT8) (20 + Random( 10 )), &Object );
CreateItem( GASMASK, (INT8) (20 + Random( 10 )), &gTempObject );
break;
case 1:
case 2:
// 2 in 10 chance of a battered Desert Eagle
CreateItem( DESERTEAGLE, (INT8) (40 + Random( 10 )), &Object );
CreateItem( DESERTEAGLE, (INT8) (40 + Random( 10 )), &gTempObject );
break;
case 3:
case 4:
case 5:
// 3 in 10 chance of a stun grenade
CreateItem( STUN_GRENADE, (INT8) (70 + Random( 10 )), &Object );
CreateItem( STUN_GRENADE, (INT8) (70 + Random( 10 )), &gTempObject );
break;
case 6:
case 7:
case 8:
case 9:
// 4 in 10 chance of two 38s!
CreateItems( SW38, (INT8) (90 + Random( 10 )), 2, &Object );
CreateItems( SW38, (INT8) (90 + Random( 10 )), 2, &gTempObject );
break;
}
if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) )
{
AddItemToPool( BOBBYR_SHIPPING_DEST_GRIDNO, &Object, -1, 0, 0, 0 );
AddItemToPool( BOBBYR_SHIPPING_DEST_GRIDNO, &gTempObject, -1, 0, 0, 0 );
}
else
{
AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, BOBBYR_SHIPPING_DEST_GRIDNO, 1, &Object, 0, 0, 0, -1, FALSE );
AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, BOBBYR_SHIPPING_DEST_GRIDNO, 1, &gTempObject, 0, 0, 0, -1, FALSE );
}
}
}
@@ -486,12 +484,12 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
{
return;
}
pTemp = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumWorldItems);
pTemp = new WORLDITEM[ uiNumWorldItems];
if (!pTemp)
{
return;
}
fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp );
fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp );
if (fOk)
{
for (uiLoop = 0; uiLoop < uiNumWorldItems; uiLoop++)
@@ -505,6 +503,9 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
}
}
if (pTemp) {
delete [] pTemp;
}
}
@@ -513,7 +514,7 @@ void AddSecondAirportAttendant( void )
// add the second airport attendant to the Drassen airport...
gMercProfiles[99].sSectorX = BOBBYR_SHIPPING_DEST_SECTOR_X;
gMercProfiles[99].sSectorY = BOBBYR_SHIPPING_DEST_SECTOR_Y;
gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z;
gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z;
}
void SetPabloToUnbribed( void )
@@ -557,9 +558,9 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
{
// loop through all items, look for ownership
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == MONEY )
{
uiTotalCash += gWorldItems[uiLoop].o.ItemData.Money.uiMoneyAmount;
uiTotalCash += gWorldItems[uiLoop].object[0]->data.money.uiMoneyAmount;
}
}
@@ -577,7 +578,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
// add history log here
AddHistoryToPlayersLog( HISTORY_FOUND_MONEY, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY );
SetFactTrue( FACT_KINGPIN_WILL_LEARN_OF_MONEY_GONE );
SetFactTrue( FACT_KINGPIN_WILL_LEARN_OF_MONEY_GONE );
}
}
@@ -591,17 +592,17 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
if ( fFirstCheck )
{
// add event to make Kingpin aware, two days from now
fKingpinWillDiscover = TRUE;
fKingpinWillDiscover = TRUE;
}
else
{
fKingpinDiscovers = TRUE;
}
}
if ( fKingpinWillDiscover )
{
// set event for next day to check for real
// set event for next day to check for real
AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, Random( 120 ), FACT_KINGPIN_KNOWS_MONEY_GONE, 1 );
// the sector is unloaded NOW so set Kingpin's balance and remove the cash
@@ -610,7 +611,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
{
// loop through all items, look for ownership
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == MONEY )
{
// remove!
gWorldItems[ uiLoop ].fExists = FALSE;
@@ -647,7 +648,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent )
{
// set "really heavy old shipment" fact
SetFactTrue( FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING );
}
}
break;
case FACT_SHIPMENT_DELAYED_24_HOURS:
@@ -708,7 +709,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent )
}
break;
case NPC_ACTION_DELAYED_MAKE_BRENDA_LEAVE:
//IC:
//IC:
//TriggerNPCRecord( 85, 9 );
SetFactTrue( FACT_BRENDA_PATIENCE_TIMER_EXPIRED );
break;
@@ -742,7 +743,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent )
case NPC_ACTION_ADD_JOEY_TO_WORLD:
// If Joey is not dead, escorted, or already delivered
if ( gMercProfiles[ JOEY ].bMercStatus != MERC_IS_DEAD && !CheckFact( FACT_JOEY_ESCORTED, 0 ) &&
if ( gMercProfiles[ JOEY ].bMercStatus != MERC_IS_DEAD && !CheckFact( FACT_JOEY_ESCORTED, 0 ) &&
gMercProfiles[ JOEY ].sSectorX == 4 &&
gMercProfiles[ JOEY ].sSectorY == MAP_ROW_D &&
gMercProfiles[ JOEY ].bSectorZ == 1 )
@@ -816,7 +817,7 @@ void HandleEarlyMorningEvents( void )
}
}
}
if( gMercProfiles[ TONY ].ubLastDateSpokenTo > 0 && !( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) )
{
@@ -869,7 +870,7 @@ void HandleEarlyMorningEvents( void )
case 4:
gMercProfiles[ DEVIN ].sSectorX = 6;
gMercProfiles[ DEVIN ].sSectorY = MAP_ROW_C;
break;
break;
}
}
}
@@ -914,7 +915,7 @@ void HandleEarlyMorningEvents( void )
gMercProfiles[ HAMOUS ].sSectorY = MAP_ROW_D;
gMercProfiles[ PROF_ICECREAM ].sSectorX = 9;
gMercProfiles[ PROF_ICECREAM ].sSectorY = MAP_ROW_D;
break;
break;
}
}
@@ -948,7 +949,7 @@ void HandleEarlyMorningEvents( void )
gMercProfiles[ CARMEN ].sSectorY = MAP_ROW_C;
gMercProfiles[ CARMEN ].bSectorZ = 0;
// we should also reset # of terrorist heads and give him cash
// we should also reset # of terrorist heads and give him cash
if (gMercProfiles[ CARMEN ].bNPCData2 > 0)
{
if (gMercProfiles[ CARMEN ].uiMoney < 10000)
@@ -991,7 +992,7 @@ void HandleEarlyMorningEvents( void )
gMercProfiles[ CARMEN ].sSectorY = MAP_ROW_G;
break;
}
// he should have $5000... unless the player forgot to meet him
// he should have $5000... unless the player forgot to meet him
if (gMercProfiles[ CARMEN ].uiMoney < 5000)
{
SetMoneyInSoldierProfile( CARMEN, 5000 );
@@ -1043,20 +1044,31 @@ void CheckForMissingHospitalSupplies( void )
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
{
// loop through all items, look for ownership
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP && gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP && gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP )
{
GetItemPool( gWorldItems[ uiLoop ].sGridNo, &pItemPool, 0 ) ;
while( pItemPool )
GetItemPoolFromGround( gWorldItems[ uiLoop ].sGridNo, &pItemPool ) ;
while( pItemPool )
{
pObj = &( gWorldItems[ pItemPool->iItemIndex ].o );
pObj = &( gWorldItems[ pItemPool->iItemIndex ].object );
if ( pObj->ItemData.Generic.bStatus[ 0 ] > 60 )
#ifdef obsoleteCode
if ( (*pObj)[0]->data.objectStatus > 60 )
{
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
{
ubMedicalObjects++;
}
}
#endif//obsoleteCode
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
{
for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) {
if ( iter->data.objectStatus > 60 )
{
ubMedicalObjects++;
}
}
}
pItemPool = pItemPool->pNext;
}
@@ -1065,7 +1077,7 @@ void CheckForMissingHospitalSupplies( void )
if ( CheckFact( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN, 0 ) == TRUE )
{
// player returning stuff! if back to full then can operate
// player returning stuff! if back to full then can operate
if ( ubMedicalObjects >= gubCambriaMedicalObjects )
{
SetFactFalse( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN );
@@ -1073,7 +1085,7 @@ void CheckForMissingHospitalSupplies( void )
return;
}
}
if ( ubMedicalObjects < gubCambriaMedicalObjects )
{
// player's stolen something!
@@ -1089,14 +1101,13 @@ void CheckForMissingHospitalSupplies( void )
SetFactTrue( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN );
}
}
}
void DropOffItemsInMeduna( UINT8 ubOrderNum )
{
BOOLEAN fSectorLoaded = FALSE;
OBJECTTYPE Object;
UINT32 uiCount = 0;
OBJECTTYPE *pObject=NULL;
UINT16 usNumberOfItems=0, usItem;
@@ -1127,7 +1138,7 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
ChangeStatusOfOpenableStructInUnloadedSector( MEDUNA_ITEM_DROP_OFF_SECTOR_X, MEDUNA_ITEM_DROP_OFF_SECTOR_Y, MEDUNA_ITEM_DROP_OFF_SECTOR_Z, MEDUNA_ITEM_DROP_OFF_GRIDNO, FALSE );
}
for(i=0; i<gpNewBobbyrShipments[ ubOrderNum ].ubNumberPurchases; i++)
{
// Count how many items were purchased
@@ -1138,10 +1149,9 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
if( !fSectorLoaded )
{
//build an array of objects to be added
pObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems );
pObject = new OBJECTTYPE[ usNumberOfItems ];
if( pObject == NULL )
return;
memset( pObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems );
}
@@ -1153,20 +1163,21 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
ubItemsDelivered = gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].ubNumberPurchased;
usItem = gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].usItemIndex;
CreateItem(usItem, 100, &gTempObject);//to get the ItemSlotLimit only!
while ( ubItemsDelivered )
{
// treat 0s as 1s :-)
ubTempNumItems = __min( ubItemsDelivered, __max( 1, Item[ usItem ].ubPerPocket ) );
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &Object );
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&gTempObject, STACK_SIZE_LIMIT) );
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &gTempObject );
// stack as many as possible
if( fSectorLoaded )
{
AddItemToPool( MEDUNA_ITEM_DROP_OFF_GRIDNO, &Object, -1, 0, 0, 0 );
AddItemToPool( MEDUNA_ITEM_DROP_OFF_GRIDNO, &gTempObject, -1, 0, 0, 0 );
}
else
{
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
pObject[ uiCount ] = gTempObject;
uiCount++;
}
@@ -1179,13 +1190,13 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
{
//add all the items from the array that was built above
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
if( !AddItemsToUnLoadedSector( MEDUNA_ITEM_DROP_OFF_SECTOR_X, MEDUNA_ITEM_DROP_OFF_SECTOR_Y, MEDUNA_ITEM_DROP_OFF_SECTOR_Z, MEDUNA_ITEM_DROP_OFF_GRIDNO, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
{
//error
Assert( 0 );
}
MemFree( pObject );
delete[]( pObject );
pObject = NULL;
}
@@ -1194,4 +1205,4 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
//Add an email from kulba telling the user the shipment is there
AddEmail( BOBBY_R_MEDUNA_SHIPMENT, BOBBY_R_MEDUNA_SHIPMENT_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
}
}
+72 -66
View File
@@ -2,7 +2,7 @@
#include "Strategic All.h"
#else
#include "Types.h"
#include "Soldier Control.h"
#include "Strategic Merc Handler.h"
#include "History.h"
#include "Game clock.h"
@@ -43,6 +43,11 @@
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#define NUM_DAYS_TILL_UNPAID_RPC_QUITS 3
@@ -105,15 +110,15 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier )
// keep track of how many mercs have died under player's command (for death rate, can't wait until removed from team)
gStrategicStatus.ubMercDeaths++;
}
pSoldier->uiStatusFlags |= SOLDIER_DEAD;
pSoldier->flags.uiStatusFlags |= SOLDIER_DEAD;
// Set breath to 0!
pSoldier->bBreathMax = pSoldier->bBreath = 0;
// not asleep, DEAD!
pSoldier->fMercAsleep = FALSE;
pSoldier->flags.fMercAsleep = FALSE;
//if the merc had life insurance
@@ -169,7 +174,7 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier )
}
// MercDailyUpdate() gets called every day at midnight. If something is to happen to a merc that day, add an event for it.
// MercDailyUpdate() gets called every day at midnight. If something is to happen to a merc that day, add an event for it.
void MercDailyUpdate()
{
INT32 cnt;
@@ -179,8 +184,6 @@ void MercDailyUpdate()
MERCPROFILESTRUCT *pProfile;
UINT32 uiChance;
INT32 iOffset = 0;
BOOLEAN fFoundSomeOneForMenuShowing = FALSE;
//if its the first day, leave
if( GetWorldDay() == 1 )
return;
@@ -211,10 +214,10 @@ void MercDailyUpdate()
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
//loop though all the mercs
for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++)
for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++)
{
//if the merc is active
if ( ( pSoldier->bActive )&&( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) )
@@ -228,13 +231,13 @@ void MercDailyUpdate()
// ATE; Reset found something nice flag...
pSoldier->usQuoteSaidFlags &= ( ~SOLDIER_QUOTE_SAID_FOUND_SOMETHING_NICE );
// ATE: Decrement tolerance value...
pSoldier->bCorpseQuoteTolerance--;
// ATE: Decrement tolerance value...
pSoldier->bCorpseQuoteTolerance--;
if ( pSoldier->bCorpseQuoteTolerance < 0 )
{
pSoldier->bCorpseQuoteTolerance = 0;
}
if ( pSoldier->bCorpseQuoteTolerance < 0 )
{
pSoldier->bCorpseQuoteTolerance = 0;
}
// CJC: For some personalities, reset personality quote said flag
if ( pSoldier->ubProfile != NO_PROFILE )
@@ -266,13 +269,17 @@ void MercDailyUpdate()
// player has hired him, so he'll eligible to get killed off on another job
gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PLAYER_HAD_CHANCE_TO_HIRE;
//handle Slay differently if SlayForever is enabled
if( pSoldier->ubProfile == SLAY && gGameExternalOptions.fEnableSlayForever == TRUE)
{
}
//if the character is an RPC
if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC )
else if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC )
{
INT16 sSalary = gMercProfiles[ pSoldier->ubProfile ].sSalary;
INT32 iMoneyOwedToMerc = 0;
INT32 iMoneyOwedToMerc = 0;
//increment the number of days the mercs has been on the team
pSoldier->iTotalContractLength++;
@@ -353,7 +360,7 @@ void MercDailyUpdate()
// if active, here, & alive (POW is ok, don't care)
if( ( pSoldier->bActive ) && ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) &&
( pSoldier->bAssignment != IN_TRANSIT ) )
( pSoldier->bAssignment != IN_TRANSIT ) )
{
// increment the "man days" played counter for each such merc in the player's employment
gStrategicStatus.uiManDaysPlayed++;
@@ -438,7 +445,7 @@ void MercDailyUpdate()
//if the merc CAN become ready
if( pProfile->bMercStatus != MERC_FIRED_AS_A_POW )
{
pProfile->bMercStatus = MERC_OK;
pProfile->bMercStatus = MERC_OK;
// if the player has left a message for this merc
if ( pProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM )
@@ -502,7 +509,7 @@ void MercDailyUpdate()
HandleSlayDailyEvent( );
// rebuild list for mapscreen
ReBuildCharactersList( );
ReBuildCharactersList( );
}
/*
@@ -519,7 +526,7 @@ void BuildMercQuitList( SOLDIERTYPE *pMercList )
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
//loop though all the mercs
for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++, iCounter++ )
for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++, iCounter++ )
{
if ( pSoldier->bActive )
{
@@ -542,27 +549,27 @@ void BuildMercQuitList( SOLDIERTYPE *pMercList )
if( IsTheSoldierAliveAndConcious( MercPtrs[ cntB ] ) )
{
// swap
pSoldier = MercPtrs[ cntB ];
MercPtrs[ cntB ] = MercPtrs[ cnt ];
pSoldier = MercPtrs[ cntB ];
MercPtrs[ cntB ] = MercPtrs[ cnt ];
MercPtrs[ cnt ] = pSoldier;
}
}
}
else if( MercPtrs[ cntB ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM )
else if( MercPtrs[ cntB ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM )
{
if( MercPtrs[ cntB ]->iEndofContractTime < MercPtrs[ cnt ]->iEndofContractTime )
{
// swap
pSoldier = MercPtrs[ cntB ];
MercPtrs[ cntB ] = MercPtrs[ cnt ];
pSoldier = MercPtrs[ cntB ];
MercPtrs[ cntB ] = MercPtrs[ cnt ];
MercPtrs[ cnt ] = pSoldier;
}
}
else
{
// not a hirable guy, move to the botton
pSoldier = MercPtrs[ cnt ];
MercPtrs[ cnt ] = MercPtrs[ cntB ];
pSoldier = MercPtrs[ cnt ];
MercPtrs[ cnt ] = MercPtrs[ cntB ];
MercPtrs[ cntB ] = pSoldier;
}
}
@@ -582,11 +589,11 @@ void HandleMercsAboutToLeave( SOLDIERTYPE *pMercList )
if( iCounter == 0 )
{
// first guy, if he no leave today, no one is leave, go home
if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__MERC ) && ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM ) )
if( ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__MERC ) && ( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM ) )
{
return;
}
else
else
{
if( ( pSoldier->iEndofContractTime / 1440 ) > (INT32)GetWorldDay( ) )
{
@@ -633,7 +640,7 @@ void MercsContractIsFinished( UINT8 ubID )
{
fShowContractMenu = FALSE;
}
// go to mapscreen
SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_ENTER_MAPSCREEN,0,0,0,0,0 );
@@ -694,7 +701,6 @@ void RPCWhineAboutNoPay( UINT8 ubID )
// OK loop through and check!
BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier )
{
INT32 cnt;
UINT16 usItem;
INT32 bBestArmour = -1;
INT32 bBestArmourIndex = -1;
@@ -702,13 +708,13 @@ BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier )
INT32 bBestGunIndex = -1;
for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ )
for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
{
usItem = pSoldier->inv[ cnt ].usItem;
// Look for best gun/armour
if ( usItem != NOTHING )
if ( pSoldier->inv[cnt].exists() == true )
{
usItem = pSoldier->inv[ cnt ].usItem;
// Check if it's a gun
if ( Item[ usItem ].usItemClass & IC_GUN )
{
@@ -735,11 +741,11 @@ BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier )
// this of course assumes default morale is 50
if ( bBestGun != -1 )
{
bBestGun = (bBestGun * (50 + pSoldier->bMorale)) / 100;
bBestGun = (bBestGun * (50 + pSoldier->aiData.bMorale)) / 100;
}
if ( bBestArmour != -1 )
{
bBestArmour = (bBestArmour * (50 + pSoldier->bMorale)) / 100;
bBestArmour = (bBestArmour * (50 + pSoldier->aiData.bMorale)) / 100;
}
// OK, check values!
@@ -758,7 +764,7 @@ void MercComplainAboutEquipment( UINT8 ubProfile )
{
SOLDIERTYPE *pSoldier;
if ( ubProfile == LARRY_NORMAL )
if ( ubProfile == LARRY_NORMAL )
{
if ( CheckFact( FACT_LARRY_CHANGED, 0 ) )
{
@@ -777,7 +783,7 @@ void MercComplainAboutEquipment( UINT8 ubProfile )
if ( pSoldier != NULL )
{
if ( pSoldier->bLife >= OKLIFE && pSoldier->fMercAsleep != TRUE && pSoldier->bAssignment < ON_DUTY )
if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->flags.fMercAsleep != TRUE && pSoldier->bAssignment < ON_DUTY )
{
//ATE: Double check that this problem still exists!
if ( SoldierHasWorseEquipmentThanUsedTo( pSoldier ) )
@@ -809,8 +815,8 @@ void UpdateBuddyAndHatedCounters( void )
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
//loop though all the mercs
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
{
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
{
fSameGroupOnly = FALSE;
//if the merc is active and on a combat assignment
@@ -829,7 +835,7 @@ void UpdateBuddyAndHatedCounters( void )
bOtherID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( pOtherSoldier = MercPtrs[ bOtherID ]; bOtherID <= bLastTeamID; bOtherID++, pOtherSoldier++)
{
{
// is this guy in the same sector and on active duty (or in the same moving group)
if (bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->bAssignment < ON_DUTY )
@@ -846,12 +852,12 @@ void UpdateBuddyAndHatedCounters( void )
{
// check to see if the location is the same
if (pOtherSoldier->sSectorX != pSoldier->sSectorX ||
pOtherSoldier->sSectorY != pSoldier->sSectorY ||
pOtherSoldier->sSectorY != pSoldier->sSectorY ||
pOtherSoldier->bSectorZ != pSoldier->bSectorZ)
{
continue;
}
// if the OTHER soldier is in motion then we don't do anything!
if (pOtherSoldier->ubGroupID != 0 && PlayerIDGroupInMotion( pOtherSoldier->ubGroupID ))
{
@@ -875,7 +881,7 @@ void UpdateBuddyAndHatedCounters( void )
pProfile->bHatedCount[iLoop]--;
if ( pProfile->bHatedCount[iLoop] == 0 && pSoldier->bInSector && gTacticalStatus.fEnemyInSector )
{
// just reduced count to 0 but we have enemy in sector...
// just reduced count to 0 but we have enemy in sector...
pProfile->bHatedCount[iLoop] = 1;
}
else if (pProfile->bHatedCount[iLoop] > 0 && (pProfile->bHatedCount[iLoop] == pProfile->bHatedTime[iLoop] / 2 || ( pProfile->bHatedCount[iLoop] < pProfile->bHatedTime[iLoop] / 2 && pProfile->bHatedCount[iLoop] % TIME_BETWEEN_HATED_COMPLAINTS == 0 ) ) )
@@ -954,7 +960,7 @@ void UpdateBuddyAndHatedCounters( void )
{
TacticalCharacterDialogue( pSoldier, QUOTE_HATED_MERC_TWO );
}
}
}
}
}
break;
@@ -966,7 +972,7 @@ void UpdateBuddyAndHatedCounters( void )
pProfile->bLearnToHateCount--;
if ( pProfile->bLearnToHateCount == 0 && pSoldier->bInSector && gTacticalStatus.fEnemyInSector )
{
// just reduced count to 0 but we have enemy in sector...
// just reduced count to 0 but we have enemy in sector...
pProfile->bLearnToHateCount = 1;
}
else if (pProfile->bLearnToHateCount > 0 && (pProfile->bLearnToHateCount == pProfile->bLearnToHateTime / 2 || pProfile->bLearnToHateCount < pProfile->bLearnToHateTime / 2 && pProfile->bLearnToHateCount % TIME_BETWEEN_HATED_COMPLAINTS == 0 ) )
@@ -995,7 +1001,7 @@ void UpdateBuddyAndHatedCounters( void )
TacticalCharacterDialogue( pSoldier, QUOTE_LEARNED_TO_HATE_MERC );
}
}
}
if (pProfile->bLearnToHateCount < pProfile->bLearnToHateTime / 2)
{
// gradual opinion drop
@@ -1020,10 +1026,10 @@ void UpdateBuddyAndHatedCounters( void )
if ( pProfile->ubTimeTillNextHatedComplaint == 0 )
{
// complain!
TacticalCharacterDialogue( pSoldier, QUOTE_LEARNED_TO_HATE_MERC );
TacticalCharacterDialogue( pSoldier, QUOTE_LEARNED_TO_HATE_MERC );
}
}
}
}
break;
case 3:
if (pProfile->bLearnToLikeCount > 0 && pProfile->bLearnToLike == ubOtherProfileID)
@@ -1036,14 +1042,14 @@ void UpdateBuddyAndHatedCounters( void )
pProfile->bMercOpinion[ubOtherProfileID] = BUDDY_OPINION;
}
else if (pProfile->bLearnToLikeCount < pProfile->bLearnToLikeTime / 2)
{
{
// increase opinion of them!
pProfile->bMercOpinion[ubOtherProfileID] += (BUDDY_OPINION - pProfile->bMercOpinion[ubOtherProfileID]) / (pProfile->bLearnToLikeCount + 1);
break;
}
}
break;
}
}
}
}
}
@@ -1060,8 +1066,8 @@ void HourlyCamouflageUpdate( void )
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
// loop through all mercs
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
{
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
{
if ( pSoldier->bActive )
{
// if the merc has non-zero camo, degrade it by 1%
@@ -1106,8 +1112,8 @@ void HourlyCamouflageUpdate( void )
{
// Reload palettes....
if ( pSoldier->bInSector )
{
CreateSoldierPalettes( pSoldier );
{
pSoldier->CreateSoldierPalettes( );
}
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_CAMMO_WORN_OFF], pSoldier->name );
@@ -1116,22 +1122,22 @@ void HourlyCamouflageUpdate( void )
}
// if the merc has non-zero monster smell, degrade it by 1
if ( pSoldier->bMonsterSmell > 0 )
if ( pSoldier->aiData.bMonsterSmell > 0 )
{
pSoldier->bMonsterSmell--;
pSoldier->aiData.bMonsterSmell--;
/*
if (pSoldier->bMonsterSmell == 0)
if (pSoldier->aiData.bMonsterSmell == 0)
{
// Reload palettes....
if ( pSoldier->bInSector )
{
CreateSoldierPalettes( pSoldier );
{
pSoldier->CreateSoldierPalettes( );
}
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_CAMMO_WORN_OFF], pSoldier->name );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
}
*/
}
+2
View File
@@ -1,6 +1,8 @@
#ifndef _STRATEGIC_MERC_HANDLER_H_
#define _STRATEGIC_MERC_HANDLER_H_
//forward declarations of common classes to eliminate includes
class SOLDIERTYPE;
void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier );
void MercDailyUpdate();
+41 -42
View File
@@ -67,12 +67,12 @@ MINE_STATUS_TYPE gMineStatus[ MAX_NUMBER_OF_MINES ];
// this table holds mine values that never change and don't need to be saved
MINE_LOCATION_TYPE gMineLocation[MAX_NUMBER_OF_MINES] =
{
{ 4, 4, SAN_MONA },
{ 4, 4, SAN_MONA },
{ 13, 4, DRASSEN },
{ 14, 9, ALMA },
{ 8, 8, CAMBRIA },
{ 2, 2, CHITZENA },
{ 3, 8, GRUMM },
{ 8, 8, CAMBRIA },
{ 2, 2, CHITZENA },
{ 3, 8, GRUMM },
};
// the are not being randomized at all at this time
@@ -87,16 +87,16 @@ UINT8 gubMineTypes[]={
// These values also determine the most likely ratios of mine sizes after random production increases are done
UINT32 guiMinimumMineProduction[]={
0, // SAN MONA
1000, // DRASSEN
1500, // ALMA
1500, // CAMBRIA
500, // CHITZENA
2000, // GRUMM
0, // SAN MONA
1000, // DRASSEN
1500, // ALMA
1500, // CAMBRIA
500, // CHITZENA
2000, // GRUMM
};
HEAD_MINER_TYPE gHeadMinerData[NUM_HEAD_MINERS] =
HEAD_MINER_TYPE gHeadMinerData[NUM_HEAD_MINERS] =
{
// Profile # running out creatures! all dead! creatures again! external face graphic
{ FRED, 17, 18, 27, 26, MINER_FRED_EXTERNAL_FACE },
@@ -159,7 +159,7 @@ void InitializeMines( void )
gMineStatus->fShutDownIsPermanent = FALSE;
}
// randomize the exact size each mine. The total production is always the same and depends on the game difficulty,
// randomize the exact size each mine. The total production is always the same and depends on the game difficulty,
// but some mines will produce more in one game than another, while others produce less
// adjust for game difficulty
@@ -195,7 +195,7 @@ void InitializeMines( void )
}
// choose which mine will run out of production. This will never be the Alma mine or an empty mine (San Mona)...
// choose which mine will run out of production. This will never be the Alma mine or an empty mine (San Mona)...
do
{
ubDepletedMineIndex = ( UINT8 ) Random(MAX_NUMBER_OF_MINES);
@@ -271,7 +271,7 @@ void HourlyMinesUpdate(void)
IssueHeadMinerQuote( ubMineIndex, HEAD_MINER_STRATEGIC_QUOTE_CREATURES_GONE );
}
//Force the creatures to avoid the mine for a period of time. This gives the
//Force the creatures to avoid the mine for a period of time. This gives the
//player a chance to rest and decide how to deal with the problem.
ForceCreaturesToAvoidMineTemporarily( ubMineIndex );
@@ -282,7 +282,7 @@ void HourlyMinesUpdate(void)
else // mine is monster infested
{
// 'Der be monsters crawling around in there, lad!!!
// if it's still producing
if (!IsMineShutDown( ubMineIndex ))
{
@@ -312,7 +312,7 @@ void HourlyMinesUpdate(void)
IssueHeadMinerQuote( ubMineIndex, ubQuoteType );
}
// and immediately halt all work at the mine (whether it's ours or the queen's). This is a temporary shutdown
// and immediately halt all work at the mine (whether it's ours or the queen's). This is a temporary shutdown
ShutOffMineProduction( ubMineIndex );
}
}
@@ -350,7 +350,7 @@ UINT32 GetMaxDailyRemovalFromMine( INT8 bMineIndex )
{
UINT32 uiAmtExtracted;
// returns max amount that can be mined in one day
// returns max amount that can be mined in one day
Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) );
@@ -405,7 +405,6 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount )
{
// will remove the ore from the mine and return the amount that was removed
UINT32 uiAmountExtracted = 0;
UINT32 uiOreRunningOutPoint = 0;
INT16 sSectorX, sSectorY;
@@ -437,11 +436,11 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount )
GetMineSector( bMineIndex, &sSectorX, &sSectorY );
StrategicHandleMineThatRanOut( ( UINT8 ) SECTOR( sSectorX, sSectorY ) );
AddHistoryToPlayersLog( HISTORY_MINE_RAN_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_RAN_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
else // still some left after this extraction
{
// set amount used, and decrement ore remaining in mine
// set amount used, and decrement ore remaining in mine
uiAmountExtracted = uiAmount;
gMineStatus[ bMineIndex ].uiRemainingOreSupply -= uiAmount;
@@ -463,7 +462,7 @@ UINT32 ExtractOreFromMine( INT8 bMineIndex, UINT32 uiAmount )
// that mine's head miner tells player that the mine is running out
IssueHeadMinerQuote( bMineIndex, HEAD_MINER_STRATEGIC_QUOTE_RUNNING_OUT );
gMineStatus[ bMineIndex ].fWarnedOfRunningOut = TRUE;
AddHistoryToPlayersLog( HISTORY_MINE_RUNNING_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_RUNNING_OUT, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
}
}
@@ -479,7 +478,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex )
INT8 bTownId = 0;
// return the loyalty of the town associated with the mine
Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) );
// if mine is shut down
@@ -493,7 +492,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex )
{
return ( 0 );
}
bTownId = gMineLocation[ bMineIndex ].bAssociatedTown;
@@ -503,7 +502,7 @@ INT32 GetAvailableWorkForceForMineForPlayer( INT8 bMineIndex )
// get workforce size (is 0-100 based on local town's loyalty)
iWorkForceSize = gTownLoyalty[ bTownId ].ubRating;
/*
/*
// adjust for monster infestation
iWorkForceSize *= gubMonsterMineInfestation[ gMineStatus[ bMineIndex ].bMonsters ];
iWorkForceSize /= 100;
@@ -523,7 +522,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex )
INT8 bTownId = 0;
// return the loyalty of the town associated with the mine
Assert( ( bMineIndex >= 0 ) && ( bMineIndex < MAX_NUMBER_OF_MINES ) );
// if mine is shut down
@@ -534,7 +533,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex )
bTownId = gMineLocation[ bMineIndex ].bAssociatedTown;
if( GetTownSectorSize( bTownId ) == 0 )
if( GetTownSectorSize( bTownId ) == 0 )
{
return 0;
}
@@ -542,7 +541,7 @@ INT32 GetAvailableWorkForceForMineForEnemy( INT8 bMineIndex )
// get workforce size (is 0-100 based on REVERSE of local town's loyalty)
iWorkForceSize = 100 - gTownLoyalty[ bTownId ].ubRating;
/*
/*
// adjust for monster infestation
iWorkForceSize *= gubMonsterMineInfestation[ gMineStatus[ bMineIndex ].bMonsters ];
iWorkForceSize /= 100;
@@ -599,7 +598,7 @@ INT32 MineAMine( INT8 bMineIndex )
}
// who controls the PRODUCTION in the mine ? (Queen receives production unless player has spoken to the head miner)
// who controls the PRODUCTION in the mine ? (Queen receives production unless player has spoken to the head miner)
if( PlayerControlsMine(bMineIndex) )
{
// player controlled
@@ -628,7 +627,7 @@ INT32 MineAMine( INT8 bMineIndex )
{
// we didn't want mines to run out without player ever even going to them, so now the queen doesn't reduce the
// amount remaining until the mine has produced for the player first (so she'd have to capture it).
// WANNE: We do not want to give money to the player, when the queen has captured the mine!
if ( gMineStatus[ bMineIndex ].fMineHasProducedForPlayer )
{
@@ -667,7 +666,7 @@ void HandleIncomeFromMines( void )
}
if( iIncome )
{
AddTransactionToPlayersBook( DEPOSIT_FROM_SILVER_MINE, 0, GetWorldTotalMin( ), iIncome );
AddTransactionToPlayersBook( DEPOSIT_FROM_SILVER_MINE, 0, GetWorldTotalMin( ), iIncome );
}
}
@@ -690,7 +689,7 @@ UINT32 PredictDailyIncomeFromAMine( INT8 bMineIndex )
uiAmtExtracted = gMineStatus[ bMineIndex ].uiRemainingOreSupply;
}
}
return( uiAmtExtracted );
}
@@ -865,7 +864,7 @@ void ShutOffMineProduction( INT8 bMineIndex )
if ( !gMineStatus[ bMineIndex ].fShutDown )
{
gMineStatus[ bMineIndex ].fShutDown = TRUE;
AddHistoryToPlayersLog( HISTORY_MINE_SHUTDOWN, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_SHUTDOWN, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
}
@@ -879,7 +878,7 @@ void RestartMineProduction( INT8 bMineIndex )
if ( gMineStatus[ bMineIndex ].fShutDown )
{
gMineStatus[ bMineIndex ].fShutDown = FALSE;
AddHistoryToPlayersLog( HISTORY_MINE_REOPENED, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_MINE_REOPENED, gMineLocation[ bMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ bMineIndex ].sSectorX, gMineLocation[ bMineIndex ].sSectorY );
}
}
}
@@ -1019,7 +1018,7 @@ UINT8 GetHeadMinersMineIndex( UINT8 ubMinerProfileId)
}
}
// not found! Illegal profile id receieved or something is very wrong
// not found! Illegal profile id receieved or something is very wrong
Assert(FALSE);
return( 0 );
}
@@ -1030,11 +1029,11 @@ void PlayerSpokeToHeadMiner( UINT8 ubMinerProfileId )
UINT8 ubMineIndex;
ubMineIndex = GetHeadMinersMineIndex( ubMinerProfileId );
// if this is our first time set a history fact
// if this is our first time set a history fact
if( gMineStatus[ ubMineIndex ].fSpokeToHeadMiner == FALSE )
{
AddHistoryToPlayersLog( HISTORY_TALKED_TO_MINER, gMineLocation[ ubMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ ubMineIndex ].sSectorX, gMineLocation[ ubMineIndex ].sSectorY );
AddHistoryToPlayersLog( HISTORY_TALKED_TO_MINER, gMineLocation[ ubMineIndex ].bAssociatedTown, GetWorldTotalMin( ), gMineLocation[ ubMineIndex ].sSectorX, gMineLocation[ ubMineIndex ].sSectorY );
gMineStatus[ ubMineIndex ].fSpokeToHeadMiner = TRUE;
}
}
@@ -1187,7 +1186,7 @@ BOOLEAN HasHisMineBeenProducingForPlayerForSomeTime( UINT8 ubMinerProfileId )
ubMineIndex = GetHeadMinersMineIndex( ubMinerProfileId );
if ( gMineStatus[ ubMineIndex ].fMineHasProducedForPlayer &&
if ( gMineStatus[ ubMineIndex ].fMineHasProducedForPlayer &&
( ( GetWorldTotalMin() - gMineStatus[ ubMineIndex ].uiTimePlayerProductionStarted ) >= ( 24 * 60 ) ) )
{
return ( TRUE );
@@ -1287,10 +1286,10 @@ BOOLEAN PlayerForgotToTakeOverMine( UINT8 ubMineIndex )
// player hasn't spoken to the head miner, but hasn't attacked him either
// miner is alive
if ( (StrategicMap[( gMineLocation[ ubMineIndex ].sSectorX ) + ( MAP_WORLD_X * ( gMineLocation[ ubMineIndex ].sSectorY ) )].fEnemyControlled == FALSE ) &&
( !pMineStatus->fEmpty ) &&
( !pMineStatus->fSpokeToHeadMiner ) &&
( !pMineStatus->fAttackedHeadMiner ) &&
( gMercProfiles[ GetHeadMinerProfileIdForMine( ubMineIndex ) ].bLife > 0 ) )
( !pMineStatus->fEmpty ) &&
( !pMineStatus->fSpokeToHeadMiner ) &&
( !pMineStatus->fAttackedHeadMiner ) &&
( gMercProfiles[ GetHeadMinerProfileIdForMine( ubMineIndex ) ].bLife > 0 ) )
{
return( TRUE );
}
+29 -29
View File
@@ -8,7 +8,7 @@
// the mines
enum{
MINE_SAN_MONA = 0,
MINE_SAN_MONA = 0,
MINE_DRASSEN,
MINE_ALMA,
MINE_CAMBRIA,
@@ -36,13 +36,13 @@ enum{
// monster infestatation level, as percieved by the villagers
enum{
MINES_NO_MONSTERS = 0, // nothing there at all
MINES_TRACE_MONSTERS, // monsters leave traces behind, but no one has seen them yet
MINES_SOME_MONSTERS, // there have been sightings but no one believes the witnesses
MINES_MODERATE_MONSTERS, // scattered reports of monsters in lower levels, leaves workers uneasy
MINES_HIGH_MONSTERS, // workers know they are there and all but a few refuse to work
MINES_RAMPANT_MONSTERS, // the few that go down don't seem to return, no one wants to work period
MINES_MONSTERS_SURFACE, // monsters are coming out of the mines into the town looking for any edibles
MINES_NO_MONSTERS = 0, // nothing there at all
MINES_TRACE_MONSTERS, // monsters leave traces behind, but no one has seen them yet
MINES_SOME_MONSTERS, // there have been sightings but no one believes the witnesses
MINES_MODERATE_MONSTERS, // scattered reports of monsters in lower levels, leaves workers uneasy
MINES_HIGH_MONSTERS, // workers know they are there and all but a few refuse to work
MINES_RAMPANT_MONSTERS, // the few that go down don't seem to return, no one wants to work period
MINES_MONSTERS_SURFACE, // monsters are coming out of the mines into the town looking for any edibles
};
// head miner quote types
@@ -59,36 +59,36 @@ enum{
// the strategic mine structures
typedef struct MINE_LOCATION_TYPE
{
INT16 sSectorX; // x value of sector mine is in
INT16 sSectorY; // y value of sector mine is in
INT8 bAssociatedTown; // associated town of this mine
INT16 sSectorX; // x value of sector mine is in
INT16 sSectorY; // y value of sector mine is in
INT8 bAssociatedTown; // associated town of this mine
} MINE_LOCATION_TYPE;
typedef struct MINE_STATUS_TYPE
{
UINT8 ubMineType; // type of mine (silver or gold)
BYTE filler1[3];
UINT32 uiMaxRemovalRate; // fastest rate we can move ore from this mine in period
UINT8 ubMineType; // type of mine (silver or gold)
BYTE filler1[3];
UINT32 uiMaxRemovalRate; // fastest rate we can move ore from this mine in period
UINT32 uiRemainingOreSupply; // the total value left to this mine (-1 means unlimited)
UINT32 uiOreRunningOutPoint; // when supply drop below this, workers tell player the mine is running out of ore
UINT32 uiRemainingOreSupply; // the total value left to this mine (-1 means unlimited)
UINT32 uiOreRunningOutPoint; // when supply drop below this, workers tell player the mine is running out of ore
BOOLEAN fEmpty; // whether no longer minable
BOOLEAN fRunningOut; // whether mine is beginning to run out
BOOLEAN fWarnedOfRunningOut; // whether mine foreman has already told player the mine's running out
BOOLEAN fShutDownIsPermanent; // means will never produce again in the game (head miner was attacked & died/quit)
BOOLEAN fShutDown; // TRUE means mine production has been shut off
BOOLEAN fPrevInvadedByMonsters; // whether or not mine has been previously invaded by monsters
BOOLEAN fSpokeToHeadMiner; // player doesn't receive income from mine without speaking to the head miner first
BOOLEAN fMineHasProducedForPlayer; // player has earned income from this mine at least once
BOOLEAN fEmpty; // whether no longer minable
BOOLEAN fRunningOut; // whether mine is beginning to run out
BOOLEAN fWarnedOfRunningOut; // whether mine foreman has already told player the mine's running out
BOOLEAN fShutDownIsPermanent; // means will never produce again in the game (head miner was attacked & died/quit)
BOOLEAN fShutDown; // TRUE means mine production has been shut off
BOOLEAN fPrevInvadedByMonsters; // whether or not mine has been previously invaded by monsters
BOOLEAN fSpokeToHeadMiner; // player doesn't receive income from mine without speaking to the head miner first
BOOLEAN fMineHasProducedForPlayer; // player has earned income from this mine at least once
BOOLEAN fQueenRetookProducingMine; // whether or not queen ever retook a mine after a player had produced from it
BOOLEAN fAttackedHeadMiner; // player has attacked the head miner, shutting down mine & decreasing loyalty
UINT16 usValidDayCreaturesCanInfest; //Creatures will be permitted to spread if the game day is greater than this value.
UINT32 uiTimePlayerProductionStarted; // time in minutes when 'fMineHasProducedForPlayer' was first set
BOOLEAN fQueenRetookProducingMine; // whether or not queen ever retook a mine after a player had produced from it
BOOLEAN fAttackedHeadMiner; // player has attacked the head miner, shutting down mine & decreasing loyalty
UINT16 usValidDayCreaturesCanInfest; //Creatures will be permitted to spread if the game day is greater than this value.
UINT32 uiTimePlayerProductionStarted; // time in minutes when 'fMineHasProducedForPlayer' was first set
BYTE filler[11]; // reserved for expansion
BYTE filler[11]; // reserved for expansion
} MINE_STATUS_TYPE;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+21 -21
View File
@@ -9,7 +9,7 @@
enum //enemy intentions,
{
NO_INTENTIONS, //enemy intentions are undefined.
PURSUIT, //enemy group has spotted a player group and is pursuing them. If they lose the player group, they
PURSUIT, //enemy group has spotted a player group and is pursuing them. If they lose the player group, they
//will get reassigned.
STAGING, //enemy is prepare to assault a town sector, but doesn't have enough troops.
PATROL, //enemy is moving around determining safe areas.
@@ -36,8 +36,8 @@ enum
};
//This structure contains all of the information about a group moving in the strategic
//layer. This includes all troops, equipment, and waypoints, and location.
//NOTE: This is used for groups that are initiating a movement to another sector.
//layer. This includes all troops, equipment, and waypoints, and location.
//NOTE: This is used for groups that are initiating a movement to another sector.
typedef struct WAYPOINT
{
UINT8 x; //sector x position of waypoint
@@ -49,7 +49,7 @@ typedef struct WAYPOINT
typedef struct PLAYERGROUP
{
UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access)
UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access)
UINT8 ubID; //index in the Menptr array
SOLDIERTYPE *pSoldier; //direct access to the soldier pointer
UINT8 bFlags; //flags referring to individual player soldiers
@@ -65,22 +65,22 @@ typedef struct ENEMYGROUP
UINT8 ubLeaderProfileID; //could be Mike, maybe the warden... someone new, but likely nobody.
UINT8 ubPendingReinforcements;//This group is waiting for reinforcements before attacking or attempting to fortify newly aquired sector.
UINT8 ubAdminsInBattle; //number of administrators in currently in battle.
UINT8 ubIntention; //the type of group this is: patrol, assault, spies, etc.
UINT8 ubIntention; //the type of group this is: patrol, assault, spies, etc.
UINT8 ubTroopsInBattle; //number of soldiers currently in battle.
UINT8 ubElitesInBattle; //number of elite soldiers currently in battle.
INT8 bPadding[20];
INT8 bPadding[20];
}ENEMYGROUP;
//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE
// DELETED!!!
//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE
// DELETED!!!
#define GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED 0x00000001
#define GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED 0x00000002
//I use this flag when traversing through a list to determine which groups meet whatever conditions,
//then add this marker flag. The second time I traverse the list, I simply check for this flag,
//apply my modifications to the group, and remove the flag. If you decide to use it, make sure the
//then add this marker flag. The second time I traverse the list, I simply check for this flag,
//apply my modifications to the group, and remove the flag. If you decide to use it, make sure the
//flag is cleared.
#define GROUPFLAG_MARKER 0x00000004
//Set whenever a group retreats from battle. If the group arrives in the next sector and enemies are there
//Set whenever a group retreats from battle. If the group arrives in the next sector and enemies are there
//retreat will not be an option.
#define GROUPFLAG_JUST_RETREATED_FROM_BATTLE 0x00000008
#define GROUPFLAG_HIGH_POTENTIAL_FOR_AMBUSH 0x00000010
@@ -114,7 +114,7 @@ typedef struct GROUP
UINT8 ubTransportationMask; //the mask combining all of the groups transportation methods.
UINT32 uiFlags; //various conditions that apply to the group
UINT8 ubCreatedSectorID; //used for debugging strategic AI for keeping track of the sector ID a group was created in.
UINT8 ubSectorIDOfLastReassignment; //used for debuggin strategic AI. Records location of any reassignments.
UINT8 ubSectorIDOfLastReassignment; //used for debuggin strategic AI. Records location of any reassignments.
INT8 bPadding[29]; //***********************************************//
union
@@ -132,20 +132,20 @@ extern GROUP *gpGroupList;
void RemoveAllGroups();
GROUP* GetGroup( UINT8 ubGroupID );
//Remove a group from the list. This removes all of the waypoints as well as the members of the group.
//Calling this function doesn't position them in a sector. It is up to you to do that. The event system
//Remove a group from the list. This removes all of the waypoints as well as the members of the group.
//Calling this function doesn't position them in a sector. It is up to you to do that. The event system
//will automatically handle their updating as they arrive in sectors.
void RemoveGroup( UINT8 ubGroupID );//takes a groupID
void RemovePGroup( GROUP *pGroup ); //same function, but takes a GROUP*
void RemoveGroupIdFromList( UINT8 ubId );
//Clears a groups waypoints. This is necessary when sending new orders such as different routes.
//Clears a groups waypoints. This is necessary when sending new orders such as different routes.
void RemoveGroupWaypoints( UINT8 ubGroupID );
void RemovePGroupWaypoints( GROUP *pGroup ); //same function, but takes a GROUP*
//Player grouping functions
//.........................
//Creates a new player group, returning the unique ID of that group. This is the first
//Creates a new player group, returning the unique ID of that group. This is the first
//step before adding waypoints and members to the player group.
UINT8 CreateNewPlayerGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY );
//Allows you to add or remove players from the group.
@@ -160,7 +160,7 @@ BOOLEAN RemoveAllPlayersFromPGroup( GROUP *pGroup );
UINT8 CreateNewVehicleGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY , UINT32 uiVehicleId );
//Appends a waypoint to the end of the list. Waypoint MUST be on the
//Appends a waypoint to the end of the list. Waypoint MUST be on the
//same horizontal xor vertical level as the last waypoint added.
BOOLEAN AddWaypointToGroup( UINT8 ubGroupID, UINT8 ubSectorX, UINT8 ubSectorY );
BOOLEAN AddWaypointToPGroup( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY );
@@ -249,12 +249,12 @@ void HandleArrivalOfReinforcements( GROUP *pGroup );
void PlanSimultaneousGroupArrivalCallback( UINT8 bMessageValue );
//When groups meet up, then it is possible that they may join up. This only happens if
//When groups meet up, then it is possible that they may join up. This only happens if
//the groups were separated because of singular tactical/exitgrid traversal, and the timing
//expires.
BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversals );
//Called when all checks have been made for the group (if possible to retreat, etc.) This function
//Called when all checks have been made for the group (if possible to retreat, etc.) This function
//blindly determines where to move the group.
void RetreatGroupToPreviousSector( GROUP *pGroup );
@@ -263,7 +263,7 @@ GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fPla
BOOLEAN GroupAtFinalDestination( GROUP *pGroup );
// find the travel time between waypts for this group
INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROUP *pGroup );
INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROUP *pGroup );
BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fBuildingWaypoints );
BOOLEAN GroupBetweenSectorsAndSectorXYIsInDifferentDirection( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY );
@@ -276,7 +276,7 @@ void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY );
void ResetMovementForEnemyGroup( GROUP *pGroup );
//Determines if any particular group WILL be moving through a given sector given it's current
//position in the route and TREATS the pGroup->ubMoveType as ONE_WAY EVEN IF IT ISN'T. If the
//position in the route and TREATS the pGroup->ubMoveType as ONE_WAY EVEN IF IT ISN'T. If the
//group is currently IN the sector, or just left the sector, it will return FALSE.
BOOLEAN GroupWillMoveThroughSector( GROUP *pGroup, UINT8 ubSectorX, UINT8 ubSectorY );
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -9,14 +9,14 @@
// Shortest Path Defines
#define NORTH_MOVE -18
#define EAST_MOVE 1
#define WEST_MOVE -1
#define SOUTH_MOVE 18
#define EAST_MOVE 1
#define WEST_MOVE -1
#define SOUTH_MOVE 18
// Movement speed defines
#define NORMAL_MVT 1
#define SLOW_MVT 0
#define SLOW_MVT 0
// movment modes
@@ -29,7 +29,7 @@ enum{
INT32 FindStratPath(INT16 sStart, INT16 sDestination, INT16 sMvtGroupNumber, BOOLEAN fTacticalTraversal );
/*
BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSectorDest, INT8 bToDirection );
BOOLEAN SectorIsBlockedFromVehicleExit( UINT16 sSectorDest, INT8 bToDirection );
BOOLEAN SectorIsBlockedFromFootExit( UINT16 sSector, INT8 bToDirection );
BOOLEAN TravelBetweenSectorsIsBlockedFromVehicle( UINT16 sSourceSector, UINT16 sDestSector );
BOOLEAN TravelBetweenSectorsIsBlockedFromFoot( UINT16 sSourceSector, UINT16 sDestSector );
@@ -74,7 +74,7 @@ INT16 GetLastSectorIdInCharactersPath( SOLDIERTYPE *pCharacter );
INT16 GetLastSectorIdInVehiclePath( INT32 iId );
// copy paths
PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath );
PathStPtr CopyPaths( PathStPtr pSourcePath, PathStPtr pDestPath );
// build eta's for characters path - no longer used
//void CalculateEtaForCharacterPath( SOLDIERTYPE *pCharacter );
+13 -13
View File
@@ -33,7 +33,7 @@ void InitStrategicStatus(void)
BOOLEAN SaveStrategicStatusToSaveGameFile( HWFILE hFile )
{
UINT32 uiNumBytesWritten;
UINT32 uiNumBytesWritten;
//Save the Strategic Status structure to the saved game file
FileWrite( hFile, &gStrategicStatus, sizeof( STRATEGIC_STATUS ), &uiNumBytesWritten );
@@ -49,7 +49,7 @@ BOOLEAN SaveStrategicStatusToSaveGameFile( HWFILE hFile )
BOOLEAN LoadStrategicStatusFromSaveGameFile( HWFILE hFile )
{
UINT32 uiNumBytesRead;
UINT32 uiNumBytesRead;
//Load the Strategic Status structure from the saved game file
FileRead( hFile, &gStrategicStatus, sizeof( STRATEGIC_STATUS ), &uiNumBytesRead );
@@ -87,7 +87,7 @@ void ModifyPlayerReputation(INT8 bRepChange)
iNewBadRep = (INT32) gStrategicStatus.ubBadReputation - bRepChange;
// keep within a 0-100 range (0 = Saint, 100 = Satan)
iNewBadRep = __max( 0, iNewBadRep );
iNewBadRep = __max( 0, iNewBadRep );
iNewBadRep = __min( 100, iNewBadRep );
gStrategicStatus.ubBadReputation = (UINT8) iNewBadRep;
@@ -166,7 +166,7 @@ BOOLEAN MercThinksHisMoraleIsTooLow( SOLDIERTYPE *pSoldier )
// above 50, morale is GOOD, never below tolerance then
bMoraleTolerance = (100 - bRepTolerance) / 2;
if (pSoldier->bMorale < bMoraleTolerance)
if (pSoldier->aiData.bMorale < bMoraleTolerance)
{
// too low - sorry
return(TRUE);
@@ -198,7 +198,7 @@ UINT8 LackOfProgressTolerance( void )
{
return( 6 - gGameOptions.ubDifficultyLevel + gStrategicStatus.ubHighestProgress / 42 );
}
}
@@ -240,7 +240,7 @@ void HandleEnricoEmail(void)
// test for a major setback OR a second minor setback
if ((((ubHighestProgress - ubCurrentProgress) >= MAJOR_SETBACK_THRESHOLD) ||
(((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && (gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_FLAG_SETBACK_OVER))) &&
(((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) && (gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_FLAG_SETBACK_OVER))) &&
!(gStrategicStatus.usEnricoEmailFlags & ENRICO_EMAIL_SENT_MAJOR_SETBACK))
{
AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1);
@@ -249,7 +249,7 @@ void HandleEnricoEmail(void)
else
// test for a first minor setback
if (((ubHighestProgress - ubCurrentProgress) >= MINOR_SETBACK_THRESHOLD) &&
!(gStrategicStatus.usEnricoEmailFlags & (ENRICO_EMAIL_SENT_MINOR_SETBACK | ENRICO_EMAIL_SENT_MAJOR_SETBACK)))
!(gStrategicStatus.usEnricoEmailFlags & (ENRICO_EMAIL_SENT_MINOR_SETBACK | ENRICO_EMAIL_SENT_MAJOR_SETBACK)))
{
AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1);
gStrategicStatus.usEnricoEmailFlags |= ENRICO_EMAIL_SENT_MINOR_SETBACK;
@@ -270,7 +270,7 @@ void HandleEnricoEmail(void)
ubTolerance = LackOfProgressTolerance();
if ( gStrategicStatus.ubNumberOfDaysOfInactivity >= ubTolerance )
{
{
if ( gStrategicStatus.ubNumberOfDaysOfInactivity == ubTolerance )
{
// send email
@@ -344,7 +344,7 @@ void HandleEnricoEmail(void)
}
}
// reset # of new sectors visited 'today'
// reset # of new sectors visited 'today'
// grant some leeway for the next day, could have started moving
// at night...
gStrategicStatus.ubNumNewSectorsVisitedToday = __min( gStrategicStatus.ubNumNewSectorsVisitedToday, NEW_SECTORS_EQUAL_TO_ACTIVITY ) / 3;
@@ -354,9 +354,9 @@ void HandleEnricoEmail(void)
void TrackEnemiesKilled( UINT8 ubKilledHow, UINT8 ubSoldierClass )
{
INT8 bRankIndex;
bRankIndex = SoldierClassToRankIndex( ubSoldierClass );
// if it's not a standard enemy-class soldier
if ( bRankIndex == -1 )
{
@@ -383,7 +383,7 @@ INT8 SoldierClassToRankIndex( UINT8 ubSoldierClass )
case SOLDIER_CLASS_ADMINISTRATOR: bRankIndex = 0; break;
case SOLDIER_CLASS_ELITE: bRankIndex = 2; break;
case SOLDIER_CLASS_ARMY: bRankIndex = 1; break;
default:
// this happens when an NPC joins the enemy team (e.g. Conrad, Iggy, Mike)
break;
@@ -408,4 +408,4 @@ UINT8 RankIndexToSoldierClass( UINT8 ubRankIndex )
}
return( ubSoldierClass );
}
}
+8 -3
View File
@@ -2,9 +2,14 @@
#define __STRATEGIC_STATUS_H
#include "types.h"
#include "Item Types.h"
//#include "Item Types.h"
#include "Soldier Control.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
//Enemy is allowed to capture the player after certain day
#define STARTDAY_ALLOW_PLAYER_CAPTURE_FOR_RESCUE 4
@@ -92,9 +97,9 @@ typedef struct STRATEGIC_STATUS
UINT8 ubUnhiredMercDeaths; // how many mercs have died while NOT working for the player
UINT16 usPlayerKills; // kills achieved by all mercs controlled by player together. *Excludes* militia kills!
UINT16 usPlayerKills; // kills achieved by all mercs controlled by player together. *Excludes* militia kills!
UINT16 usEnemiesKilled[NUM_WAYS_ENEMIES_KILLED][NUM_ENEMY_RANKS]; // admin/troop/elite. Includes kills by militia, too
UINT16 usEnemiesKilled[NUM_WAYS_ENEMIES_KILLED][NUM_ENEMY_RANKS]; // admin/troop/elite. Includes kills by militia, too
UINT16 usLastDayOfPlayerActivity;
UINT8 ubNumNewSectorsVisitedToday;
UINT8 ubNumberOfDaysOfInactivity;
+90 -102
View File
@@ -35,7 +35,6 @@
#include "Strategic Status.h"
#endif
// the max loyalty rating for any given town
#define MAX_LOYALTY_VALUE 100
@@ -100,7 +99,7 @@
// THESE VALUES ARE ALL AFFECTED BY CHANGES to "GAIN_PTS_PER_LOYALTY_PT", SO BEWARE IF THAT SHOULD CHANGE
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
// macros for delayed town loyalty events
// get increment
@@ -117,8 +116,8 @@ TOWN_LOYALTY gTownLoyalty[ MAX_TOWNS ];
// town name and locations arrays, for town theft and what not
INT32 pTownNamesList [ MAX_TOWN_SECTORS ];
INT32 pTownLocationsList [ MAX_TOWN_SECTORS ];
INT32 pTownNamesList [ MAX_TOWN_SECTORS ];
INT32 pTownLocationsList [ MAX_TOWN_SECTORS ];
INT32 iTownDistances[ MAX_TOWNS ][ MAX_TOWNS ];
@@ -127,14 +126,14 @@ INT32 iTownDistances[ MAX_TOWNS ][ MAX_TOWNS ];
UINT32 uiPercentLoyaltyDecreaseForCivMurder[]={
// These get multiplied by GAIN_PTS_PER_LOYALTY_PT so they're in % of loyalty decrease (for an average town)
(5 * GAIN_PTS_PER_LOYALTY_PT), // fat civ
(7 * GAIN_PTS_PER_LOYALTY_PT), // man civ
(8 * GAIN_PTS_PER_LOYALTY_PT), // min civ
(10 * GAIN_PTS_PER_LOYALTY_PT), // dress (woman)
(20 * GAIN_PTS_PER_LOYALTY_PT), // hat kid
(20 * GAIN_PTS_PER_LOYALTY_PT), // kid
(20 * GAIN_PTS_PER_LOYALTY_PT), // cripple
(1 * GAIN_PTS_PER_LOYALTY_PT), // cow
(5 * GAIN_PTS_PER_LOYALTY_PT), // fat civ
(7 * GAIN_PTS_PER_LOYALTY_PT), // man civ
(8 * GAIN_PTS_PER_LOYALTY_PT), // min civ
(10 * GAIN_PTS_PER_LOYALTY_PT), // dress (woman)
(20 * GAIN_PTS_PER_LOYALTY_PT), // hat kid
(20 * GAIN_PTS_PER_LOYALTY_PT), // kid
(20 * GAIN_PTS_PER_LOYALTY_PT), // cripple
(1 * GAIN_PTS_PER_LOYALTY_PT), // cow
};
@@ -177,9 +176,6 @@ BOOLEAN gfTownUsesLoyalty[ MAX_TOWNS ];// =
// location of first enocunter with enemy
INT16 sWorldSectorLocationOfFirstBattle = 0;
// number of items in currently loaded sector
extern UINT32 guiNumWorldItems;
// preprocess sector for mercs in it
extern BOOLEAN fSectorsWithSoldiers[ MAP_WORLD_X * MAP_WORLD_X ][ 4 ];
@@ -199,7 +195,7 @@ void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId );
// update town loyalty based on number of bad guys in this town
void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId );
/* ARM: Civilian theft of items was removed
// handle theft by civi in a town sector
void HandleTheftByCiviliansInSector( INT16 sX, INT16 sY, INT32 iLoyalty );
@@ -245,7 +241,7 @@ void StartTownLoyaltyIfFirstTime( INT8 bTownId )
if (bTownId == OMERTA)
{
// start loyalty there at 0, since rebels distrust the player until Miguel receives the letter
gTownLoyalty[ bTownId ].ubRating = 0;
gTownLoyalty[ bTownId ].ubRating = 0;
}
else
{
@@ -435,7 +431,6 @@ void UpdateTownLoyaltyRating( INT8 bTownId )
// strategic handler, goes through and handles all strategic events for town loyalty updates...player controlled, monsters
void HandleTownLoyalty( void )
{
INT8 bTownId = 0;
/* ARM: removed to experiment with keeping loyalty from drifing without any direct causes from the player
for( bTownId = FIRST_TOWN; bTownId < NUM_TOWNS; bTownId++ )
@@ -473,7 +468,7 @@ void HandleTownLoyalty( void )
// update of town loyalty based on if the player controls the town's sectors
void UpdateLoyaltyBasedOnControl( INT8 bTownId )
{
// compare current loyalty to percent of sectors controlled, adjust in that direction
// compare current loyalty to percent of sectors controlled, adjust in that direction
INT32 iUnderControl = 0;
Assert( ( bTownId >= FIRST_TOWN ) && ( bTownId < NUM_TOWNS ) );
@@ -481,8 +476,8 @@ void UpdateLoyaltyBasedOnControl( INT8 bTownId )
// find how much of town is under control
iUnderControl = GetTownSectorsUnderControl( bTownId );
iUnderControl *= 100;
iUnderControl /= GetTownSectorSize( bTownId );
iUnderControl /= GetTownSectorSize( bTownId );
// the gain value will be the difference in iUnderControl and the current Loyalty rating / hours_per_day
if( gTownLoyalty[ bTownId ].ubRating < ( UINT8 ) iUnderControl )
{
@@ -497,13 +492,13 @@ void UpdateLoyaltyBasedOnControl( INT8 bTownId )
// we control less of the town, decrement gain
DecrementTownLoyalty( bTownId, gTownLoyalty[ bTownId ].ubRating - iUnderControl );
}
}
}
return;
}
// updates the loyalty of the town in a sector based on number of friendly troops in that sector ...to a point, after max number to
// updates the loyalty of the town in a sector based on number of friendly troops in that sector ...to a point, after max number to
void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId )
{
// check if valid town
@@ -521,17 +516,17 @@ void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId )
// find how much of town is under control
iUnderControl = GetTownSectorsUnderControl( bTownId );
iUnderControl *= 100;
iUnderControl /= GetTownSectorSize( bTownId );
iUnderControl /= GetTownSectorSize( bTownId );
// count how many of player's mercs are active in this town, then factor by number of sectors under control
// run through list of grunts on team
for (iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ )
for (iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ )
{
pSoldier = MercPtrs[ iCounter ];
if ( pSoldier->bLife >= OKLIFE && pSoldier->bActive )
if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive )
{
// if soldier is in this sector
if( SectorIsPartOfTown( bTownId, pSoldier->sSectorX, pSoldier->sSectorY ) == TRUE )
@@ -542,11 +537,11 @@ void UpdateTownLoyaltyBasedOnFriendliesInTown( INT8 bTownId )
// increment soldier count
iSoldierCount++;
}
// local influence: if the town is the character's home town
if( bTownId == gMercProfiles[ pSoldier->ubProfile ].bTown )
{
// he needn't be soldiering to have an impact... presence is enough
// he needn't be soldiering to have an impact... presence is enough
if( pSoldier->bAssignment < ASSIGNMENT_DEAD )
{
iLocalNPCBonus = HOURLY_GAIN_FOR_LOCAL_NPC_IN_TOWN;
@@ -637,7 +632,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId )
// regulars
iTotalEnemies += ( INT32 ) ubRegs * NUMBER_OF_RANKS_PER_REGULAR;
// elites
iTotalEnemies += ( INT32 ) ubElites * NUMBER_OF_RANKS_PER_ELITE;
iTotalEnemies += ( INT32 ) ubElites * NUMBER_OF_RANKS_PER_ELITE;
}
}
}
@@ -646,7 +641,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId )
// check vs. maximum influence possible
if( iTotalEnemies > MAX_ENEMY_SOLDIER_RANKS_FOR_IN_TOWN_LOYALTY_DROP )
{
// we have, adjust
// we have, adjust
iTotalEnemies = MAX_ENEMY_SOLDIER_RANKS_FOR_IN_TOWN_LOYALTY_DROP;
}
@@ -654,7 +649,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId )
// find how much of town is under enemy control
iUnderControl = GetTownSectorSize( bTownId ) - GetTownSectorsUnderControl( bTownId );
iUnderControl *= 100;
iUnderControl /= GetTownSectorSize( bTownId );
iUnderControl /= GetTownSectorSize( bTownId );
// adjust number of enemies for town control
iTotalEnemies *= iUnderControl;
@@ -669,7 +664,7 @@ void UpdateTownLoyaltyBasedOnBadGuysInTown( INT8 bTownId )
void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
{
// handle the impact on loyalty of the murder of a civilian
// handle the impact on loyalty of the murder of a civilian
INT8 bTownId = 0;
INT32 iLoyaltyChange = 0;
INT8 bSeenState = 0;
@@ -678,11 +673,9 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
UINT32 uiChanceFalseAccusal = 0;
INT8 bKillerTeam = 0;
BOOLEAN fIncrement = FALSE;
UINT32 uiLoyaltyEffectDelay = 0;
UINT32 uiValue = 0;
// ubAttacker CAN be NOBODY... Don't treat is as murder if NOBODY killed us...
// ubAttacker CAN be NOBODY... Don't treat is as murder if NOBODY killed us...
if ( pSoldier->ubAttackerID == NOBODY )
{
return;
@@ -789,7 +782,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
{
bSeenState |= 2;
}
}
}
// if player didn't do it
if( bKillerTeam != OUR_TEAM )
@@ -798,7 +791,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
switch (bSeenState)
{
case 0:
// nobody saw anything. When body is found, chance player is blamed depends on the town's loyalty at this time
// nobody saw anything. When body is found, chance player is blamed depends on the town's loyalty at this time
uiChanceFalseAccusal = MAX_LOYALTY_VALUE - gTownLoyalty[ bTownId ].ubRating;
break;
case 1:
@@ -806,7 +799,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
uiChanceFalseAccusal = 10;
break;
case 2:
// civilians only saw the victim. 50/50 chance...
// civilians only saw the victim. 50/50 chance...
uiChanceFalseAccusal = 50;
break;
case 3:
@@ -833,7 +826,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
}
}
// check who town thinks killed the civ
switch (bKillerTeam)
{
@@ -844,12 +837,12 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
// debug message
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Civilian killed by friendly forces.");
break;
case ENEMY_TEAM:
// check whose sector this is
if( StrategicMap[( pSoldier -> sSectorX ) + ( MAP_WORLD_X * ( pSoldier -> sSectorY ) )].fEnemyControlled == TRUE )
if( StrategicMap[( pSoldier->sSectorX ) + ( MAP_WORLD_X * ( pSoldier->sSectorY ) )].fEnemyControlled == TRUE )
{
// enemy soldiers... in enemy controlled sector. Gain loyalty
// enemy soldiers... in enemy controlled sector. Gain loyalty
fIncrement = TRUE;
// debug message
@@ -893,7 +886,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
iLoyaltyChange *= MULTIPLIER_FOR_MURDER_BY_MONSTER;
// check whose sector this is
if( StrategicMap[( pSoldier -> sSectorX ) + ( MAP_WORLD_X * ( pSoldier -> sSectorY ) )].fEnemyControlled == TRUE )
if( StrategicMap[( pSoldier->sSectorX ) + ( MAP_WORLD_X * ( pSoldier->sSectorY ) )].fEnemyControlled == TRUE )
{
// enemy controlled sector - gain loyalty
fIncrement = TRUE;
@@ -912,11 +905,11 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional )
}
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
// figure out how long before the news of the murder spreads and lowers town loyalty
if (bSeenState == 0)
{
// nobody saw nothing. Will be some time before the grisly remains are discovered...
// nobody saw nothing. Will be some time before the grisly remains are discovered...
uiLoyaltyEffectDelay = 60 * (1 + Random(12)); // 1-12 hrs in minutes
}
else
@@ -957,12 +950,11 @@ void HandleTownLoyaltyForNPCRecruitment( SOLDIERTYPE *pSoldier )
{
INT8 bTownId = 0;
UINT32 uiLoyaltyValue = 0;
INT32 iRating = 0;
// get town id civilian
bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY );
// is the merc currently in their home town?
// is the merc currently in their home town?
if( bTownId == gMercProfiles[ pSoldier->ubProfile ].bTown )
{
// yep, value of loyalty bonus depends on his importance to this to town
@@ -972,7 +964,7 @@ void HandleTownLoyaltyForNPCRecruitment( SOLDIERTYPE *pSoldier )
IncrementTownLoyalty( bTownId, uiLoyaltyValue );
// DESIGN QUESTION: How easy is it to abuse this bonus by repeatedly hiring the guy over & over
// (at worst daily? even more often if terminated & rehired?) (ARM)
// (at worst daily? even more often if terminated & rehired?) (ARM)
}
return;
@@ -992,12 +984,12 @@ BOOLEAN HandleLoyaltyAdjustmentForRobbery( SOLDIERTYPE *pSoldier )
INT8 bTownId = 0;
// get town id
// get town id
bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY );
// debug message
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Theft not yet implemented.");
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Theft not yet implemented.");
return ( FALSE );
*/
@@ -1020,9 +1012,9 @@ void HandleLoyaltyForDemolitionOfBuilding( SOLDIERTYPE *pSoldier, INT16 sPointsD
// penalty for not preventing the action
sPolicingLoyalty = sPointsDmg * MULTIPLIER_FOR_NOT_PREVENTING_BUILDING_DAMAGE;
// get town id
// get town id
bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY );
// penalize the side that did it
if( pSoldier->bTeam == OUR_TEAM )
{
@@ -1091,12 +1083,12 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
return;
}
pItemList = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumberOfItems );
pItemList = new WORLDITEM[ uiNumberOfItems ];
// now load items
LoadWorldItemsFromTempItemFile( sSectorX, sSectorY, ( UINT8 )sSectorZ, pItemList );
uiNewTotal = uiNumberOfItems;
// set up item list ptrs
for( iCounter = 0; iCounter < uiNumberOfItems ; iCounter++ )
{
@@ -1110,7 +1102,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
pItemList[ iCounter ].fExists = FALSE;
// debug message
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ pItemList[ iCounter ].o.usItem ], wSectorName );
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ pItemList[ iCounter ].object.usItem ], wSectorName );
}
}
}
@@ -1122,7 +1114,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
}
// mem free
MemFree( pItemList );
delete[]( pItemList );
}
else // handle a loaded sector
{
@@ -1135,7 +1127,7 @@ void RemoveRandomItemsInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
{
RemoveItemFromPool( gWorldItems[ iCounter ].sGridNo , iCounter, gWorldItems[ iCounter ].ubLevel );
// debug message
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ gWorldItems[ iCounter ].o.usItem ], wSectorName );
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s stolen in %s!", ItemNames[ gWorldItems[ iCounter ].object.usItem ], wSectorName );
}
}
}
@@ -1179,10 +1171,10 @@ void HandleTownTheft( void )
InitSectorsWithSoldiersList( );
// build list
BuildSectorsWithSoldiersList( );
BuildSectorsWithSoldiersList( );
while( pTownNamesList[ iCounter ] != 0 )
{
{
ubTown = StrategicMap[ pTownLocationsList[ iCounter ] ].bNameId;
// if this town tracks loyalty, and tracking has started
@@ -1221,7 +1213,7 @@ void BuildListOfTownSectors( void )
{
pTownNamesList[ iCounter] = StrategicMap[ usSector ].bNameId;
pTownLocationsList[ iCounter ] = usSector;
iCounter++;
}
}
@@ -1280,11 +1272,11 @@ void CalcDistancesBetweenTowns( void )
// same town, distance is 0 by definition
iDistance = 0;
}
// if it's the fastest route so far, store its length
if( iDistance < iTownDistances[ ubTownA ][ ubTownB ] )
{
// store it going both ways! The inner while loop is optimized to search each pair only once.
// store it going both ways! The inner while loop is optimized to search each pair only once.
iTownDistances[ ubTownA ][ ubTownB ] = iDistance;
iTownDistances[ ubTownB ][ ubTownA ] = iDistance;
}
@@ -1306,10 +1298,10 @@ void WriteOutDistancesBetweenTowns( void )
hFileHandle = FileOpen( "BinaryData\\TownDistances.dat", FILE_ACCESS_WRITE|FILE_OPEN_ALWAYS, FALSE );
FileWrite( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL );
FileWrite( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL );
// close file
FileClose( hFileHandle );
FileClose( hFileHandle );
return;
}
@@ -1317,35 +1309,35 @@ void WriteOutDistancesBetweenTowns( void )
void DumpDistancesBetweenTowns(void)
{
CHAR8 zPrintFileName[60];
FILE *FDump;
CHAR8 zPrintFileName[60];
FILE *FDump;
UINT8 ubTownA, ubTownB;
CHAR16 wHeading[4];
// open output file
// open output file
strcpy(zPrintFileName, "TownDistances.txt");
FDump = fopen(zPrintFileName, "wt");
FDump = fopen(zPrintFileName, "wt");
if (FDump == NULL)
{
return;
}
if (FDump == NULL)
{
return;
}
// print headings
fprintf(FDump, " ");
fprintf(FDump, " ");
for( ubTownB = FIRST_TOWN; ubTownB < NUM_TOWNS; ubTownB++ )
{
wcsncpy(wHeading, pTownNames[ubTownB], 3);
wHeading[3] = '\0';
fprintf(FDump, " %ls", wHeading);
fprintf(FDump, " %ls", wHeading);
}
fprintf(FDump, "\n");
fprintf(FDump, " ");
fprintf(FDump, " ");
for( ubTownB = FIRST_TOWN; ubTownB < NUM_TOWNS; ubTownB++ )
{
fprintf(FDump, " ---");
fprintf(FDump, " ---");
}
fprintf(FDump, "\n");
@@ -1361,7 +1353,7 @@ void DumpDistancesBetweenTowns(void)
fprintf(FDump, "\n");
}
fclose(FDump);
fclose(FDump);
}
//#endif
@@ -1371,10 +1363,10 @@ void ReadInDistancesBetweenTowns( void )
hFileHandle = FileOpen( "BinaryData\\TownDistances.dat", FILE_ACCESS_READ, FALSE );
FileRead( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL );
FileRead( hFileHandle, &( iTownDistances ), ( sizeof( INT32 ) * MAX_TOWNS * MAX_TOWNS ), NULL );
// close file
FileClose( hFileHandle );
FileClose( hFileHandle );
return;
}
@@ -1386,7 +1378,7 @@ INT32 GetTownDistances( UINT8 ubTown, UINT8 ubTownA )
}
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
void HandleDelayedTownLoyaltyEvent( UINT32 uiValue )
{
INT8 bTownId = 0;
@@ -1417,7 +1409,7 @@ void HandleDelayedTownLoyaltyEvent( UINT32 uiValue )
UINT32 BuildLoyaltyEventValue( INT8 bTownValue, UINT32 uiValue, BOOLEAN fIncrement )
{
UINT32 uiReturnValue = 0;
UINT32 uiReturnValue = 0;
UINT32 uiTempValue = 0;
// the town name in 8 most sig bits
@@ -1425,14 +1417,14 @@ UINT32 BuildLoyaltyEventValue( INT8 bTownValue, UINT32 uiValue, BOOLEAN fIncreme
uiReturnValue += ( uiTempValue << 24 );
// the incrment decrement amount is
// the incrment decrement amount is
uiTempValue = ( UINT32 )( uiValue );
uiTempValue = ( ( uiTempValue << 8 ) >> 7 );
uiReturnValue += uiTempValue;
uiReturnValue += ( fIncrement != 0 ? 1: 0 );
return( uiReturnValue );
}
*/
@@ -1487,7 +1479,7 @@ void ReduceLoyaltyForRebelsBetrayed(void)
}
else
{
// loyalty in other places is also strongly affected by this falling out with rebels, but this is not permanent
SetTownLoyalty(bTownId, (UINT8) (gTownLoyalty[ bTownId ].ubRating / 3));
}
@@ -1498,7 +1490,7 @@ INT32 GetNumberOfWholeTownsUnderControl( void )
{
INT32 iNumber = 0;
INT8 bTownId = 0;
// run through the list of towns..if the entire town is under player control, then increment the number of towns under player control
// make sure that each town is one for which loyalty matters
@@ -1518,7 +1510,7 @@ INT32 GetNumberOfWholeTownsUnderControlButExcludeCity( INT8 bCityToExclude )
{
INT32 iNumber = 0;
INT8 bTownId = 0;
// run through the list of towns..if the entire town is under player control, then increment the number of towns under player control
for( bTownId = FIRST_TOWN; bTownId < NUM_TOWNS; bTownId++ )
{
@@ -1534,8 +1526,6 @@ INT32 GetNumberOfWholeTownsUnderControlButExcludeCity( INT8 bCityToExclude )
// is the ENTIRE town under player control?
INT32 IsTownUnderCompleteControlByPlayer( INT8 bTownId )
{
INT32 iNumber = 0;
if( GetTownSectorSize( bTownId ) == GetTownSectorsUnderControl( bTownId ) )
{
return( TRUE );
@@ -1547,8 +1537,6 @@ INT32 IsTownUnderCompleteControlByPlayer( INT8 bTownId )
// is the ENTIRE town under enemy control?
INT32 IsTownUnderCompleteControlByEnemy( INT8 bTownId )
{
INT32 iNumber = 0;
if ( GetTownSectorsUnderControl( bTownId ) == 0 )
{
return( TRUE );
@@ -1624,7 +1612,7 @@ void HandleGlobalLoyaltyEvent( UINT8 ubEventType, INT16 sSectorX, INT16 sSectorY
}
// determine what the base loyalty change of this event type is worth
// these are ->hundredths<- of loyalty points, so choose appropriate values accordingly!
// these are->hundredths<- of loyalty points, so choose appropriate values accordingly!
// the closer a town is to the event, the more pronounced the effect upon that town is
switch (ubEventType)
{
@@ -1714,7 +1702,7 @@ void AffectAllTownsLoyaltyByDistanceFrom( INT32 iLoyaltyChange, INT16 sSectorX,
// skip path test if distance is already known to be zero to speed this up a bit
if (iShortestDistance[ bTownId ] > 0 )
{
// calculate across how many sectors the fastest travel path from event to this town sector
// calculate across how many sectors the fastest travel path from event to this town sector
iThisDistance = FindStratPath( sEventSector, ( INT16 )pTownLocationsList[ uiIndex ], ubTempGroupId, FALSE );
if (iThisDistance < iShortestDistance[ bTownId ])
@@ -1737,7 +1725,7 @@ void AffectAllTownsLoyaltyByDistanceFrom( INT32 iLoyaltyChange, INT16 sSectorX,
{
continue;
}
// if event was underground, double effective distance
if (bSectorZ != 0)
{
@@ -1828,7 +1816,7 @@ void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSec
void CheckIfEntireTownHasBeenLost( INT8 bTownId, INT16 sSectorX, INT16 sSectorY )
{
// NOTE: only towns which allow you to train militia are important enough to get
// NOTE: only towns which allow you to train militia are important enough to get
// reported here (and they're the only ones you can protect)
if ( MilitiaTrainingAllowedInSector( sSectorX, sSectorY, 0 ) && IsTownUnderCompleteControlByEnemy(bTownId) )
{
@@ -1873,7 +1861,7 @@ void HandleLoyaltyChangeForNPCAction( UINT8 ubNPCProfileId )
case YANNI:
// Chalice of Chance returned to Chitzena
IncrementTownLoyalty( CHITZENA, LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_LOCAL );
// NOTE: This affects Chitzena,too, a second time, so first value is discounted for it
// NOTE: This affects Chitzena,too, a second time, so first value is discounted for it
IncrementTownLoyaltyEverywhere( LOYALTY_BONUS_YANNI_WHEN_CHALICE_RETURNED_GLOBAL );
break;
@@ -1910,7 +1898,7 @@ BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId )
// get town id for sector
bTownBattleId = GetTownIdForSector( ( INT16 ) ( sWorldSectorLocationOfFirstBattle % MAP_WORLD_X ), ( INT16 ) ( sWorldSectorLocationOfFirstBattle / MAP_WORLD_X ) );
return( bTownId == bTownBattleId );
}
@@ -1925,10 +1913,10 @@ UINT32 PlayerStrength( void )
pSoldier = MercPtrs[ ubLoop ];
if ( pSoldier->bActive )
{
if ( pSoldier->bInSector || ( pSoldier->fBetweenSectors && ((pSoldier->ubPrevSectorID % 16) + 1) == gWorldSectorX && ((pSoldier->ubPrevSectorID / 16) + 1) == gWorldSectorY && ( pSoldier->bSectorZ == gbWorldSectorZ ) ) )
if ( pSoldier->bInSector || ( pSoldier->flags.fBetweenSectors && ((pSoldier->ubPrevSectorID % 16) + 1) == gWorldSectorX && ((pSoldier->ubPrevSectorID / 16) + 1) == gWorldSectorY && ( pSoldier->bSectorZ == gbWorldSectorZ ) ) )
{
// count this person's strength (condition), calculated as life reduced up to half according to maxbreath
uiStrength = pSoldier->bLife * ( pSoldier->bBreathMax + 100 ) / 200;
uiStrength = pSoldier->stats.bLife * ( pSoldier->bBreathMax + 100 ) / 200;
uiTotal += uiStrength;
}
}
@@ -1945,10 +1933,10 @@ UINT32 EnemyStrength( void )
for ( ubLoop = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ )
{
pSoldier = MercPtrs[ ubLoop ];
if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->bNeutral )
if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral )
{
// count this person's strength (condition), calculated as life reduced up to half according to maxbreath
uiStrength = pSoldier->bLife * ( pSoldier->bBreathMax + 100 ) / 200;
uiStrength = pSoldier->stats.bLife * ( pSoldier->bBreathMax + 100 ) / 200;
uiTotal += uiStrength;
}
}
@@ -1956,7 +1944,7 @@ UINT32 EnemyStrength( void )
return( uiTotal );
}
//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat
//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat
//which slightly demoralizes the mercs, the other handles abandonment of militia forces which poses
//as a serious loyalty penalty.
void HandleLoyaltyImplicationsOfMercRetreat( INT8 bRetreatCode, INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
@@ -1975,7 +1963,7 @@ void HandleLoyaltyImplicationsOfMercRetreat( INT8 bRetreatCode, INT16 sSectorX,
HandleMoraleEvent( NULL, MORALE_RAN_AWAY, sSectorX, sSectorY, (INT8)sSectorZ );
}
}
else
else
{
HandleMoraleEvent( NULL, MORALE_RAN_AWAY, sSectorX, sSectorY, (INT8)sSectorZ );
}
+5 -5
View File
@@ -49,7 +49,7 @@
typedef enum
{
// There are only for distance-adjusted global loyalty effects. Others go into list above instead!
// There are only for distance-adjusted global loyalty effects. Others go into list above instead!
GLOBAL_LOYALTY_BATTLE_WON,
GLOBAL_LOYALTY_BATTLE_LOST,
GLOBAL_LOYALTY_ENEMY_KILLED,
@@ -72,7 +72,7 @@ typedef struct TOWN_LOYALTY
UINT8 ubRating;
INT16 sChange;
BOOLEAN fStarted; // starting loyalty of each town is initialized only when player first enters that town
UINT8 UNUSEDubRebelSentiment; // current rebel sentiment. Events could change the starting value...
UINT8 UNUSEDubRebelSentiment; // current rebel sentiment. Events could change the starting value...
BOOLEAN fLiberatedAlready;
BYTE filler[19]; // reserved for expansion
@@ -153,7 +153,7 @@ void BuildListOfTownSectors( void );
void ReadInDistancesBetweenTowns( void );
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
/* Delayed loyalty effects elimininated. Sep.12/98. ARM
// delayed town loyalty event
void HandleDelayedTownLoyaltyEvent( UINT32 uiValue );
// build loyalty event value
@@ -187,13 +187,13 @@ void CheckIfEntireTownHasBeenLost( INT8 bTownId, INT16 sSectorX, INT16 sSectorY
void HandleLoyaltyChangeForNPCAction( UINT8 ubNPCProfileId );
BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId );
BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId );
void SetTheFirstBattleSector( INT16 sSectorValue );
// gte number of whole towns but exclude this one
INT32 GetNumberOfWholeTownsUnderControlButExcludeCity( INT8 bCityToExclude );
//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat
//Function assumes that mercs have retreated already. Handles two cases, one for general merc retreat
//which slightly demoralizes the mercs, the other handles abandonment of militia forces which poses
//as a serious loyalty penalty.
+4 -4
View File
@@ -40,8 +40,8 @@ void StrategicTurnsNewGame( )
void SyncStrategicTurnTimes( )
{
guiLastStrategicTime = GetWorldTotalSeconds( );
guiLastTacticalRealTime = GetJA2Clock( );
guiLastStrategicTime = GetWorldTotalSeconds( );
guiLastTacticalRealTime = GetJA2Clock( );
}
void HandleStrategicTurn( )
@@ -90,7 +90,7 @@ void HandleStrategicTurn( )
// OK, if we have compressed time...., adjust our check value to be faster....
if( giTimeCompressSpeeds[ giTimeCompressMode ] > 0 )
{
uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN / ( giTimeCompressSpeeds[ giTimeCompressMode ] * RT_COMPRESSION_TACTICAL_TURN_MODIFIER );
uiCheckTime = NUM_REAL_SEC_PER_TACTICAL_TURN / ( giTimeCompressSpeeds[ giTimeCompressMode ] * RT_COMPRESSION_TACTICAL_TURN_MODIFIER );
}
}
@@ -110,4 +110,4 @@ void HandleStrategicTurnImplicationsOfExitingCombatMode( void )
{
SyncStrategicTurnTimes();
HandleTacticalEndTurn( /*GetWorldTotalSeconds()*/ ); // doesn't take parameters
}
}
+66 -4
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="Strategic_2005Express"
ProjectGUID="{AB8837DB-0435-40C7-916A-0AACF5CFF1C4}"
RootNamespace="Strategic_2005Express"
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;&#x0D;&#x0A;"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
MinimalRebuild="true"
@@ -103,7 +103,6 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
@@ -139,6 +138,69 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="MapEditor|Win32"
OutputDirectory="MapEditor"
IntermediateDirectory="MapEditor"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_2005Express.vsprops;..\ja2_2005ExpressEditor.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
+52 -55
View File
@@ -100,7 +100,6 @@ void VerifyTownTrainingIsPaidFor( void );
void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
UINT8 ubMilitiaTrained = 0;
BOOLEAN fFoundOne;
INT16 sNeighbourX, sNeighbourY;
@@ -121,7 +120,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
// force tactical to update militia status
gfStrategicMilitiaChangesMade = FALSE;
// ok, so what do we do with all this training? Well, in order of decreasing priority:
// ok, so what do we do with all this training? Well, in order of decreasing priority:
// 1) If there's room in training sector, create new GREEN militia guys there
// 2) If not enough room there, create new GREEN militia guys in friendly sectors of the same town
// 3) If not enough room anywhere in town, promote a number of GREENs in this sector into regulars
@@ -133,8 +132,8 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
// If we're not training roaming militia,
// then we will handle everything as normal.
if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer, ELITE_MILITIA ))
&& (gGameExternalOptions.gfmusttrainroaming)
if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer, ELITE_MILITIA ))
&& (gGameExternalOptions.gfmusttrainroaming)
&&(GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay))
{
CreateMilitiaSquads(sMapX, sMapY );
@@ -148,7 +147,6 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
{
// great! Create a new GREEN militia guy in the training sector
StrategicAddMilitiaToSector(sMapX, sMapY, GREEN_MILITIA, 1);
if (sMapX == gWorldSectorX && sMapY == gWorldSectorY)
{
gfStrategicMilitiaChangesMade = TRUE;
@@ -185,7 +183,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
// if we still haven't been able to train anyone
if (!fFoundOne)
{
// alrighty, then. We'll have to *promote* guys instead.
// alrighty, then. We'll have to *promote* guys instead.
// are there any GREEN militia men in the training sector itself?
if (MilitiaInSectorOfRank(sMapX, sMapY, GREEN_MILITIA) > 0)
@@ -200,7 +198,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
}
else
{
if( ubTownId != BLANK_SECTOR )
if( ubTownId != BLANK_SECTOR )
{
// dammit! Last chance - try to find other eligible sectors in the same town with a Green guy to be promoted
InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY);
@@ -228,7 +226,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
// Kaiden: Veteran militia training
// This is essentially copy/pasted from above
// But the names have been changed to protect the innocent
if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia)
if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia)
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
{
// are there any REGULAR militia men in the training sector itself?
@@ -236,7 +234,6 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
{
// great! Promote a REGULAR militia guy in the training sector to a VETERAN
StrategicPromoteMilitiaInSector(sMapX, sMapY, REGULAR_MILITIA, 1);
if (sMapX == gWorldSectorX && sMapY == gWorldSectorY)
{
gfStrategicMilitiaChangesMade = TRUE;
@@ -269,14 +266,14 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
break;
}
}
}
}
}
}
// if we still haven't been able to train anyone
if (!fFoundOne)
{
// Well, that's it. All eligible sectors of this town are full of REGULARs or ELITEs.
// Well, that's it. All eligible sectors of this town are full of REGULARs or ELITEs.
// The training goes to waste in this situation.
break; // the main while loop
}
@@ -308,7 +305,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
}
}
// the trainer announces to player that he's finished his assignment. Make his sector flash!
// the trainer announces to player that he's finished his assignment. Make his sector flash!
AssignmentDone( pTrainer, TRUE, FALSE );
// handle completion of town by training group
@@ -390,7 +387,7 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa
return;
}
pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] -= ubHowMany;
pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] -= ubHowMany;
pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank + 1 ] += ubHowMany;
if (ubHowMany && sMapX == gWorldSectorX && sMapY == gWorldSectorY )
@@ -507,10 +504,10 @@ void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY)
return;
}
// roll the bones; should I stay or should I go now? (for you music fans out there)
// roll the bones; should I stay or should I go now? (for you music fans out there)
if (Random(100) < uiChanceToDefect)
{
//B'bye! (for you SNL fans out there)
//B'bye! (for you SNL fans out there)
StrategicRemoveMilitiaFromSector(sMapX, sMapY, ubRank, 1);
}
}
@@ -601,7 +598,7 @@ BOOLEAN ServeNextFriendlySectorInTown( INT16 *sNeighbourX, INT16 *sNeighbourY )
// if this sector is in the town we're looking for
if( StrategicMap[ iTownSector ].bNameId == gubTownSectorServerTownId )
{
// A sector in the specified town. Calculate its X & Y sector compotents
// A sector in the specified town. Calculate its X & Y sector compotents
sMapX = iTownSector % MAP_WORLD_X;
sMapY = iTownSector / MAP_WORLD_X;
@@ -650,31 +647,31 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2");
// We want to charge more for Roaming
// get total cost
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )
&& (gGameExternalOptions.gfmusttrainroaming)
&& (GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay))
{
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors;
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors;
Assert( giTotalCostOfTraining > 0 );
gfAreWeTrainingMobile = TRUE;
}
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA )
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA )
&& (gGameExternalOptions.gfTrainVeteranMilitia)
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
{
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iVeteranCostModifier) * iNumberOfSectors;
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iVeteranCostModifier) * iNumberOfSectors;
Assert( giTotalCostOfTraining > 0 );
gfAreWePromotingRegular = TRUE;
}
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, GREEN_MILITIA ))
{
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iRegularCostModifier) * iNumberOfSectors;
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iRegularCostModifier) * iNumberOfSectors;
Assert( giTotalCostOfTraining > 0 );
gfAreWePromotingGreen = TRUE;
}
else
{
giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors;
giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors;
Assert( giTotalCostOfTraining > 0 );
}
@@ -780,7 +777,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3");
{
// wilderness SAM site
GetSectorIDString( sSectorX, sSectorY, 0, sStringB, TRUE );
void (*tempFptr)(INT16 , INT16 , INT8 , CHAR16 *, BOOLEAN) = GetSectorIDString;
void (*tempFptr)(INT16 , INT16 , INT8 , CHAR16 *, BOOLEAN) = GetSectorIDString;
swprintf( sString, pMilitiaConfirmStrings[ 10 ], sStringB, tempFptr, iMinLoyaltyToTrain );
}
else
@@ -796,14 +793,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3");
// Charging more to train Roaming Militia
// Also Charging more for promotions over Training
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )
if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )
&& (gGameExternalOptions.gfmusttrainroaming)
&&(GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay))
{
giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier);
gfAreWeTrainingMobile = TRUE;
}
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA )
else if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA )
&& (gGameExternalOptions.gfTrainVeteranMilitia)
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
{
@@ -850,7 +847,7 @@ void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue )
Assert( giTotalCostOfTraining > 0 );
// yes
if( bExitValue == MSG_BOX_RETURN_YES )
if( bExitValue == MSG_BOX_RETURN_YES )
{
// does the player have enough
if( LaptopSaveInfo.iCurrentBalance >= giTotalCostOfTraining )
@@ -991,7 +988,7 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType )
BOOLEAN fIncreaseCost = FALSE;
while( pTownNamesList[ iCounter ] != 0 )
{
{
if( pTownNamesList[ iCounter ] == bTownId )
{
// get the sector x and y
@@ -1001,7 +998,7 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType )
// if sector is ours get number of militia here
if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) )
{
//Kaiden: Checking for Price Hikes.
if (iMilitiaType == GREEN_MILITIA)
{
@@ -1010,8 +1007,8 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType )
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
iMaxNumber += iMaxMilitiaPerSector;
if (MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0)
fIncreaseCost = TRUE;
if (MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0)
fIncreaseCost = TRUE;
}
else if (iMilitiaType == REGULAR_MILITIA)
{
@@ -1020,11 +1017,11 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType )
iMaxNumber += iMaxMilitiaPerSector;
if (MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ) > 0)
fIncreaseCost = TRUE;
fIncreaseCost = TRUE;
}
//Kaiden: OK So iMilitiaType should be ELITE_MILITIA
// and we're just checking sectors for purposes
//Kaiden: OK So iMilitiaType should be ELITE_MILITIA
// and we're just checking sectors for purposes
// of training mobile militia or ending training
// don't count GREEN militia, they can be trained into regulars first
@@ -1050,7 +1047,7 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType )
if (iMilitiaType == GREEN_MILITIA)
{
if (( iNumberOfMilitia == iMaxNumber ) && (fIncreaseCost))
if (( iNumberOfMilitia == iMaxNumber ) && (fIncreaseCost))
return( TRUE );
else
return( FALSE );
@@ -1083,7 +1080,7 @@ BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY, INT8 iMilitiaTyp
INT32 iMaxMilitiaPerSector = gGameExternalOptions.iMaxMilitiaPerSector;
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5");
// check if SAM site is ours?
fSamSitePresent = IsThisSectorASAMSector( sSectorX, sSectorY, 0 );
fSamSitePresent = IsThisSectorASAMSector( sSectorX, sSectorY, 0 );
if( fSamSitePresent == FALSE )
{
@@ -1093,14 +1090,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5");
if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) )
{
//Kaiden: If we're checking for specific Militia for Price Hikes:
//Kaiden: If we're checking for specific Militia for Price Hikes:
if (iMilitiaType == GREEN_MILITIA)
{
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA );
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
if (( iNumberOfMilitia == iMaxMilitiaPerSector) &&
if (( iNumberOfMilitia == iMaxMilitiaPerSector) &&
(MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA ) > 0))
return( TRUE );
else
@@ -1112,14 +1109,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5");
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
if (( iNumberOfMilitia == iMaxMilitiaPerSector) &&
if (( iNumberOfMilitia == iMaxMilitiaPerSector) &&
(MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ) > 0))
return( TRUE );
else
return( FALSE );
}
// Kaiden: Ok we're not checking for militia promotions now,
// so MilitiaType should be ELITE_MILITIA for purposes
// Kaiden: Ok we're not checking for militia promotions now,
// so MilitiaType should be ELITE_MILITIA for purposes
// of training Roaming or not.
// don't count GREEN militia, they can be trained into regulars first
@@ -1209,7 +1206,7 @@ void AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( SOLDIERTYPE
// get the current sector value
sCurrentSector = pCurrentSoldier->sSectorX + pCurrentSoldier->sSectorY * MAP_WORLD_X;
// is the merc's sector already in the list?
if( sCurrentSector == sSector )
{
@@ -1224,7 +1221,7 @@ void AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( SOLDIERTYPE
// add merc to the list
giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] = pSoldier->ubID;
return;
}
@@ -1271,18 +1268,18 @@ void HandleContinueOfTownTraining( void )
ClearSectorListForCompletedTrainingOfMilitia( );
if( fContinueEventPosted )
{
// ATE: If this event happens in tactical mode we will be switching at some time to mapscreen...
if ( guiCurrentScreen == GAME_SCREEN )
{
gfEnteringMapScreen = TRUE;
}
{
// ATE: If this event happens in tactical mode we will be switching at some time to mapscreen...
if ( guiCurrentScreen == GAME_SCREEN )
{
gfEnteringMapScreen = TRUE;
}
//If the militia view isn't currently active, then turn it on when prompting to continue training.
if ( !fShowMilitia )
{
ToggleShowMilitiaMode();
}
{
ToggleShowMilitiaMode();
}
}
return;
@@ -1371,7 +1368,7 @@ INT32 GetNumberOfUnpaidTrainableSectors( void )
}
}
// return the result
// return the result
return( iNumberOfSectors );
}
@@ -1463,14 +1460,14 @@ void ResetDoneFlagForAllMilitiaTrainersInSector( UINT8 ubSector )
for( iCounter = 0; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ )
{
pSoldier = &Menptr[ iCounter ];
if( pSoldier->bActive )
{
if( pSoldier->bAssignment == TRAIN_TOWN )
{
if( ( SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) == ubSector ) && ( pSoldier->bSectorZ == 0 ) )
{
pSoldier->fDoneAssignmentAndNothingToDoFlag = FALSE;
pSoldier->flags.fDoneAssignmentAndNothingToDoFlag = FALSE;
pSoldier->usQuoteSaidExtFlags &= ~SOLDIER_QUOTE_SAID_DONE_ASSIGNMENT;
}
}
@@ -1572,7 +1569,7 @@ void BuildMilitiaPromotionsString( STR16 str )
wcscat( str, gzLateLocalizedString[31] );
fAddSpace = TRUE;
}
//Clear the fields
gbGreenToElitePromotions = 0;
gbGreenToRegPromotions = 0;
+46 -45
View File
@@ -45,7 +45,7 @@ typedef struct
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
garrisonInfo curGarrisonInfo;
UINT32 uiGarrisonCount;
UINT32 currentDepth;
UINT32 maxReadDepth;
} garrisonParseData;
@@ -115,7 +115,7 @@ garrisonEndElementHandle(void *userData, const XML_Char *name)
if ( pData->curGarrisonInfo.fValidSector && pData->uiGarrisonCount < MAX_GARRISON_GROUPS )
{
gOrigGarrisonGroup[ pData->uiGarrisonCount ].ubSectorID = pData->curGarrisonInfo.ubSectorID;
gOrigGarrisonGroup[ pData->uiGarrisonCount ].ubSectorID = pData->curGarrisonInfo.ubSectorID;
gOrigGarrisonGroup[ pData->uiGarrisonCount ].ubComposition = pData->curGarrisonInfo.ubComposition;
pData->uiGarrisonCount++;
}
@@ -127,10 +127,10 @@ garrisonEndElementHandle(void *userData, const XML_Char *name)
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
{
pData->curGarrisonInfo.fValidSector = TRUE;
pData->curGarrisonInfo.ubSectorID = SECTOR(x,y);
pData->curGarrisonInfo.ubSectorID = SECTOR(x,y);
}
else
{
@@ -155,7 +155,7 @@ BOOLEAN ReadInGarrisonInfo(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
garrisonParseData pData;
@@ -163,7 +163,7 @@ BOOLEAN ReadInGarrisonInfo(STR fileName)
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -178,16 +178,16 @@ BOOLEAN ReadInGarrisonInfo(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, garrisonStartElementHandle, garrisonEndElementHandle);
XML_SetCharacterDataHandler(parser, garrisonCharacterDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
iOrigGarrisonArraySize = 0;
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
@@ -209,11 +209,11 @@ BOOLEAN ReadInGarrisonInfo(STR fileName)
BOOLEAN WriteInGarrisonInfo(STR fileName)
{
HWFILE hFile;
hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if ( !hFile )
return( FALSE );
{
INT8 cnt;
@@ -270,7 +270,7 @@ typedef struct
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
patrolInfo curPatrolInfo;
UINT32 uiPatrolCount;
UINT32 currentDepth;
UINT32 maxReadDepth;
} patrolParseData;
@@ -365,8 +365,8 @@ patrolEndElementHandle(void *userData, const XML_Char *name)
if ( !pData->curPatrolInfo.fErrorState && pData->uiPatrolCount < MAX_PATROL_GROUPS )
{
gOrigPatrolGroup[ pData->uiPatrolCount ].bSize = pData->curPatrolInfo.bSize;
gOrigPatrolGroup[ pData->uiPatrolCount ].bPriority = pData->curPatrolInfo.bPriority;
gOrigPatrolGroup[ pData->uiPatrolCount ].bSize = pData->curPatrolInfo.bSize;
gOrigPatrolGroup[ pData->uiPatrolCount ].bPriority = pData->curPatrolInfo.bPriority;
gOrigPatrolGroup[ pData->uiPatrolCount ].ubSectorID[0] = pData->curPatrolInfo.ubSectorID[0];
gOrigPatrolGroup[ pData->uiPatrolCount ].ubSectorID[1] = pData->curPatrolInfo.ubSectorID[1];
gOrigPatrolGroup[ pData->uiPatrolCount ].ubSectorID[2] = pData->curPatrolInfo.ubSectorID[2];
@@ -406,7 +406,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name)
UINT8 x, y;
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
{
pData->curPatrolInfo.ubSectorID[0] = SECTOR(x,y);
}
@@ -429,7 +429,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name)
UINT8 x, y;
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
{
pData->curPatrolInfo.ubSectorID[1] = SECTOR(x,y);
}
@@ -452,7 +452,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name)
UINT8 x, y;
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
{
pData->curPatrolInfo.ubSectorID[2] = SECTOR(x,y);
}
@@ -475,7 +475,7 @@ patrolEndElementHandle(void *userData, const XML_Char *name)
UINT8 x, y;
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
{
pData->curPatrolInfo.ubSectorID[3] = SECTOR(x,y);
}
@@ -499,7 +499,7 @@ BOOLEAN ReadInPatrolInfo(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
patrolParseData pData;
@@ -507,7 +507,7 @@ BOOLEAN ReadInPatrolInfo(STR fileName)
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -522,16 +522,16 @@ BOOLEAN ReadInPatrolInfo(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, patrolStartElementHandle, patrolEndElementHandle);
XML_SetCharacterDataHandler(parser, patrolCharacterDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
iOrigPatrolArraySize = 0;
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
@@ -553,11 +553,11 @@ BOOLEAN ReadInPatrolInfo(STR fileName)
BOOLEAN WriteInPatrolInfo(STR fileName)
{
HWFILE hFile;
hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if ( !hFile )
return( FALSE );
{
INT8 cnt, i;
@@ -620,12 +620,12 @@ typedef enum
typedef struct
{
INT32 iIndex;
INT8 bPriority;
INT8 bElitePercentage;
INT8 bTroopPercentage;
INT8 bAdminPercentage;
INT8 bDesiredPopulation;
INT8 bStartPopulation;
INT8 bPriority;
INT8 bElitePercentage;
INT8 bTroopPercentage;
INT8 bAdminPercentage;
INT8 bDesiredPopulation;
INT8 bStartPopulation;
} compositionInfo;
typedef struct
@@ -635,7 +635,7 @@ typedef struct
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
compositionInfo curCompositionInfo;
INT32 iHighestIndex;
UINT32 currentDepth;
UINT32 maxReadDepth;
} compositionParseData;
@@ -730,13 +730,13 @@ compositionEndElementHandle(void *userData, const XML_Char *name)
if ( pData->curCompositionInfo.iIndex < MAX_ARMY_COMPOSITIONS )
{
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].iReadability = pData->curCompositionInfo.iIndex;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bPriority = pData->curCompositionInfo.bPriority;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bElitePercentage = pData->curCompositionInfo.bElitePercentage;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bTroopPercentage = pData->curCompositionInfo.bTroopPercentage;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bAdminPercentage = pData->curCompositionInfo.bAdminPercentage;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].iReadability = pData->curCompositionInfo.iIndex;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bPriority = pData->curCompositionInfo.bPriority;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bElitePercentage = pData->curCompositionInfo.bElitePercentage;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bTroopPercentage = pData->curCompositionInfo.bTroopPercentage;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bAdminPercentage = pData->curCompositionInfo.bAdminPercentage;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bDesiredPopulation = pData->curCompositionInfo.bDesiredPopulation;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bStartPopulation = pData->curCompositionInfo.bStartPopulation;
gOrigArmyComp[ pData->curCompositionInfo.iIndex ].bStartPopulation = pData->curCompositionInfo.bStartPopulation;
}
}
else if(strcmp(name, "Index") == 0 && pData->curElement == COMPOSITION_ELEMENT_INDEX)
@@ -814,14 +814,14 @@ BOOLEAN ReadInArmyCompositionInfo(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
compositionParseData pData;
// Open weapons file
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -836,16 +836,16 @@ BOOLEAN ReadInArmyCompositionInfo(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, compositionStartElementHandle, compositionEndElementHandle);
XML_SetCharacterDataHandler(parser, compositionCharacterDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
NUM_ARMY_COMPOSITIONS = 0;
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
@@ -867,11 +867,11 @@ BOOLEAN ReadInArmyCompositionInfo(STR fileName)
BOOLEAN WriteInArmyCompositionInfo(STR fileName)
{
HWFILE hFile;
hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if ( !hFile )
return( FALSE );
{
INT8 cnt;
@@ -905,3 +905,4 @@ BOOLEAN WriteInArmyCompositionInfo(STR fileName)
}
+9 -9
View File
@@ -15,7 +15,7 @@
#define MAX_CHAR_DATA_LENGTH 500
extern INT32 iRestrictedSectorArraySize;
extern INT32 iRestrictedSectorArraySize;
extern UINT32 gRestrictMilitia[256];
@@ -105,10 +105,10 @@ RoamingEndElementHandle(void *userData, const XML_Char *name)
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
if ( x > 0 && x <= 16 && y > 0 && y <= 16 )
{
pData->curRoamingInfo.fValidSector = TRUE;
pData->curRoamingInfo.ubSectorID = SECTOR(x,y);
pData->curRoamingInfo.ubSectorID = SECTOR(x,y);
gRestrictMilitia[pData->uiSectorCount] = pData->curRoamingInfo.ubSectorID;
pData->uiSectorCount++;
}
@@ -131,13 +131,13 @@ BOOLEAN ReadInRoamingInfo(STR fileName)
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
RoamingParseData pData;
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
@@ -152,16 +152,16 @@ BOOLEAN ReadInRoamingInfo(STR fileName)
FileClose( hFile );
XML_SetElementHandler(parser, RoamingStartElementHandle, RoamingEndElementHandle);
XML_SetCharacterDataHandler(parser, RoamingCharacterDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
iRestrictedSectorArraySize = 0;
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
sprintf(errorBuf, "XML Parser Error in RestrictedRoamingMilitia.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
@@ -176,4 +176,4 @@ BOOLEAN ReadInRoamingInfo(STR fileName)
XML_ParserFree(parser);
return TRUE;
}
}
+2000 -1089
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -84,5 +84,9 @@ BOOLEAN CanChangeSleepStatusForSoldier( SOLDIERTYPE *pSoldier );
BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber );
// CHRISL: New functions to handle initialization of inventory coordinates
BOOLEAN InitializeInvPanelCoordsOld( );
BOOLEAN InitializeInvPanelCoordsNew( );
BOOLEAN InitializeInvPanelCoordsVehicle( );
#endif
+4 -4
View File
@@ -19,7 +19,7 @@
// the max and min town opinion of an individual merc can be
#define MAX_TOWN_OPINION 50
#define MIN_TOWN_OPINION -50
#define MIN_TOWN_OPINION -50
// town reputation is currently updated 4x per day: at 9am, noon, 3pm, and 6pm
@@ -80,7 +80,7 @@ UINT8 GetTownOpinionOfMercForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubTownId )
Assert(ubTownId < NUM_TOWNS);
// pass on to
// pass on to
return( GetTownOpinionOfMerc( pSoldier->ubProfile, ubTownId ) );
}
@@ -104,7 +104,7 @@ void UpdateTownOpinionOfThisMerc( UINT8 ubProfileId, UINT8 ubTownId, INT8 bAmoun
else
{
// update amount
gMercProfiles[ ubProfileId ].bMercTownReputation[ ubTownId ] += bAmount;
gMercProfiles[ ubProfileId ].bMercTownReputation[ ubTownId ] += bAmount;
}
}
@@ -135,7 +135,7 @@ void HandleSpreadOfAllTownsOpinion( void )
for( ubProfileId = 0; ubProfileId < FIRST_NPC; ubProfileId++ )
{
HandleSpreadOfTownOpinionForMerc( ubProfileId );
}
}
}
+15 -15
View File
@@ -29,12 +29,12 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier )
// add the guy to the dead list
//AddCharacterToDeadList( pSoldier );
// If in a vehicle, remove them!
// If in a vehicle, remove them!
if( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier->iVehicleId != -1 ) )
{
// remove from vehicle
TakeSoldierOutOfVehicle( pSoldier );
}
}
// if not in mapscreen
if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
@@ -47,10 +47,10 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier )
ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_DEAD );
}
else if( ( pSoldier -> bLife == 0 )&&( pSoldier->bAssignment != ASSIGNMENT_DEAD ) )
else if( ( pSoldier->stats.bLife == 0 )&&( pSoldier->bAssignment != ASSIGNMENT_DEAD ) )
{
// died in mapscreen
fReDrawFace = TRUE;
// dead
@@ -62,22 +62,22 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier )
ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_DEAD );
//s et breath and breath max to 0
pSoldier -> bBreath = pSoldier->bBreathMax = 0;
pSoldier->bBreath = pSoldier->bBreathMax = 0;
// rebuild list
ReBuildCharactersList( );
// ste merc as dead
// pSoldier->fUIdeadMerc = TRUE;
// attempt o remove character from squad
// pSoldier->flags.fUIdeadMerc = TRUE;
// attempt to remove character from squad
RemoveCharacterFromSquads( pSoldier );
// handle any passign comments by grunts
HandleSoldierDeadComments( pSoldier );
// put the dead guys down
AddDeadSoldierToUnLoadedSector( ( UINT8 ) ( pSoldier->sSectorX ), ( UINT8 )( pSoldier->sSectorY ), pSoldier->bSectorZ, pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT );
AddDeadSoldierToUnLoadedSector( ( UINT8 ) ( pSoldier->sSectorX ), ( UINT8 )( pSoldier->sSectorY ), pSoldier->bSectorZ, pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT );
fTeamPanelDirty = TRUE;
fMapPanelDirty = TRUE;
@@ -99,11 +99,11 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier )
// IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED!
cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID;
// see if this was the friend of a living merc
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++)
{
if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive )
{
if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive )
{
bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile );
switch( bBuddyIndex )
@@ -128,4 +128,4 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier )
return;
}
}
+5 -5
View File
@@ -7,12 +7,12 @@
struct strategicmapelement{
UINT8 UNUSEDuiFootEta[4]; // eta/mvt costs for feet
UINT8 UNUSEDuiVehicleEta[4]; // eta/mvt costs for vehicles
UINT8 uiBadFootSector[4]; // blocking mvt for foot
UINT8 UNUSEDuiFootEta[4]; // eta/mvt costs for feet
UINT8 UNUSEDuiVehicleEta[4]; // eta/mvt costs for vehicles
UINT8 uiBadFootSector[4]; // blocking mvt for foot
UINT8 uiBadVehicleSector[4]; // blocking mvt from vehicles
INT8 bNameId;
BOOLEAN fEnemyControlled; // enemy controlled or not
INT8 bNameId;
BOOLEAN fEnemyControlled; // enemy controlled or not
BOOLEAN fEnemyAirControlled;
BOOLEAN UNUSEDfLostControlAtSomeTime;
INT8 bSAMCondition; // SAM Condition .. 0 - 100, just like an item's status
+293 -290
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -5,7 +5,7 @@
#include "soldier control.h"
#include "FileMan.h"
//The maximum size for any team strategically speaking. For example, we can't have more than 20 enemies, militia, or creatures at a time.
//The maximum size for any team strategically speaking. For example, we can't have more than 20 enemies, militia, or creatures at a time.
//#define MAX_STRATEGIC_TEAM_SIZE 20
// Codes for jumoing into adjacent sectors..
@@ -63,12 +63,12 @@ extern BOOLEAN gfUseAlternateMap;
// get index into aray
#define CALCULATE_STRATEGIC_INDEX( x, y ) ( x + ( y * MAP_WORLD_X ) )
#define GET_X_FROM_STRATEGIC_INDEX( i ) ( i % MAP_WORLD_X )
#define GET_Y_FROM_STRATEGIC_INDEX( i ) ( i / MAP_WORLD_X )
#define GET_X_FROM_STRATEGIC_INDEX( i ) ( i % MAP_WORLD_X )
#define GET_Y_FROM_STRATEGIC_INDEX( i ) ( i / MAP_WORLD_X )
// macros to convert between the 2 different sector numbering systems
#define SECTOR_INFO_TO_STRATEGIC_INDEX( i ) ( CALCULATE_STRATEGIC_INDEX ( SECTORX( i ), SECTORY( i ) ) )
#define STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ( SECTOR( GET_X_FROM_STRATEGIC_INDEX( i ), GET_Y_FROM_STRATEGIC_INDEX( i ) ) )
#define STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ( SECTOR( GET_X_FROM_STRATEGIC_INDEX( i ), GET_Y_FROM_STRATEGIC_INDEX( i ) ) )
// grab the town id value
@@ -171,7 +171,7 @@ void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier );
BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( );
//Used for determining the type of error message that comes up when you can't traverse to
//an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED!
//an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED!
extern BOOLEAN gfInvalidTraversal;
extern BOOLEAN gfLoneEPCAttemptingTraversal;
extern BOOLEAN gfRobotWithoutControllerAttemptingTraversal;