mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
New feature: enemy combat jeeps fill the role between infantry and tanks. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=344628&#msg_344628
This is savegame compatible. GameDir >= r2305 required. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8114 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+21
-17
@@ -162,7 +162,7 @@ void ViewCreaturesCallback( GUI_BUTTON *btn, INT32 reason );
|
||||
void ExtractAndUpdatePopulations();
|
||||
void PrintEnemyPopTable();
|
||||
void PrintEnemiesKilledTable();
|
||||
UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT8 ubTanks );
|
||||
UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT8 ubTanks, UINT8 ubJeeps );
|
||||
void BlitGroupIcon( UINT8 ubIconType, UINT8 ubIconColor, UINT32 uiX, UINT32 uiY, HVOBJECT hVObject );
|
||||
void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubSectorX, UINT8 ubSectorY );
|
||||
|
||||
@@ -495,7 +495,7 @@ void RenderStationaryGroups()
|
||||
else if( pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks )
|
||||
{
|
||||
// show enemies
|
||||
ubIconColor = ChooseEnemyIconColor( pSector->ubNumAdmins, pSector->ubNumTroops, pSector->ubNumElites, pSector->ubNumTanks );
|
||||
ubIconColor = ChooseEnemyIconColor( pSector->ubNumAdmins, pSector->ubNumTroops, pSector->ubNumElites, pSector->ubNumTanks, pSector->ubNumJeeps );
|
||||
ubGroupSize = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks;
|
||||
|
||||
if( pSector->ubGarrisonID != NO_GARRISON )
|
||||
@@ -541,14 +541,13 @@ void RenderMovingGroupsAndMercs()
|
||||
GROUP *pGroup;
|
||||
HVOBJECT hVObject;
|
||||
INT32 x, y;
|
||||
UINT8 ubNumTroops, ubNumAdmins, ubNumElites, ubNumTanks;
|
||||
UINT8 ubNumTroops, ubNumAdmins, ubNumElites, ubNumTanks, ubNumJeeps;
|
||||
float ratio;
|
||||
INT32 minX, maxX, minY, maxY;
|
||||
UINT8 ubIconType;
|
||||
UINT8 ubIconColor;
|
||||
UINT8 ubFontColor;
|
||||
|
||||
|
||||
SetFont( FONT10ARIAL );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
|
||||
@@ -597,12 +596,13 @@ void RenderMovingGroupsAndMercs()
|
||||
ubNumTroops = pGroup->pEnemyGroup->ubNumTroops;//+ pGroup->pEnemyGroup->ubTroopsInBattle;
|
||||
ubNumElites = pGroup->pEnemyGroup->ubNumElites;// + pGroup->pEnemyGroup->ubElitesInBattle;
|
||||
ubNumTanks = pGroup->pEnemyGroup->ubNumTanks;
|
||||
ubNumJeeps = pGroup->pEnemyGroup->ubNumJeeps;
|
||||
|
||||
// must have one of the three, already checked groupsize!
|
||||
Assert( ubNumAdmins || ubNumTroops || ubNumElites || ubNumTanks );
|
||||
Assert( ubNumAdmins || ubNumTroops || ubNumElites || ubNumTanks || ubNumJeeps );
|
||||
|
||||
//determine icon color
|
||||
ubIconColor = ChooseEnemyIconColor( ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
ubIconColor = ChooseEnemyIconColor( ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
// must have a valid intention
|
||||
Assert( pGroup->pEnemyGroup->ubIntention < NUM_ENEMY_INTENTIONS );
|
||||
@@ -727,7 +727,7 @@ void RenderInfoInSector()
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
GROUP *pGroup;
|
||||
UINT8 ubNumAdmins=0, ubNumTroops=0, ubNumElites=0, ubNumTanks=0, ubAdminsInBattle=0, ubTroopsInBattle=0, ubElitesInBattle=0, ubTanksInBattle=0, ubNumGroups=0;
|
||||
UINT8 ubNumAdmins = 0, ubNumTroops = 0, ubNumElites = 0, ubNumTanks = 0, ubNumJeeps = 0, ubAdminsInBattle = 0, ubTroopsInBattle = 0, ubElitesInBattle = 0, ubTanksInBattle = 0, ubJeepsInBattle = 0,ubNumGroups = 0;
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( ubSectorX, ubSectorY ) ];
|
||||
|
||||
@@ -741,10 +741,12 @@ void RenderInfoInSector()
|
||||
ubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
||||
ubNumAdmins += pGroup->pEnemyGroup->ubNumAdmins;
|
||||
ubNumTanks += pGroup->pEnemyGroup->ubNumTanks;
|
||||
ubNumJeeps += pGroup->pEnemyGroup->ubNumJeeps;
|
||||
ubTroopsInBattle += pGroup->pEnemyGroup->ubTroopsInBattle;
|
||||
ubElitesInBattle += pGroup->pEnemyGroup->ubElitesInBattle;
|
||||
ubAdminsInBattle += pGroup->pEnemyGroup->ubAdminsInBattle;
|
||||
ubTanksInBattle += pGroup->pEnemyGroup->ubTanksInBattle;
|
||||
ubJeepsInBattle += pGroup->pEnemyGroup->ubJeepsInBattle;
|
||||
ubNumGroups++;
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
@@ -761,17 +763,19 @@ void RenderInfoInSector()
|
||||
MilitiaInSectorOfRank( ubSectorX, ubSectorY, GREEN_MILITIA ), MilitiaInSectorOfRank( ubSectorX, ubSectorY, REGULAR_MILITIA ), MilitiaInSectorOfRank( ubSectorX, ubSectorY, ELITE_MILITIA ) );
|
||||
yp += 10;
|
||||
SetFontForeground( FONT_ORANGE );
|
||||
mprintf( 280, yp, L"Garrison: (%d:%d Admins, %d:%d Troops, %d:%d Elites, %d:%d Tanks)",
|
||||
mprintf( 280, yp, L"Garrison: (%d:%d Admins, %d:%d Troops, %d:%d Elites, %d:%d Tanks, %d:%d Jeeps)",
|
||||
pSector->ubAdminsInBattle, pSector->ubNumAdmins,
|
||||
pSector->ubTroopsInBattle, pSector->ubNumTroops,
|
||||
pSector->ubElitesInBattle, pSector->ubNumElites,
|
||||
pSector->ubTanksInBattle, pSector->ubNumTanks );
|
||||
pSector->ubTanksInBattle, pSector->ubNumTanks,
|
||||
pSector->ubJeepsInBattle, pSector->ubNumJeeps );
|
||||
yp += 10;
|
||||
mprintf( 280, yp, L"%d Groups: (%d:%d Admins, %d:%d Troops, %d:%d Elites, %d:%d Tanks)", ubNumGroups,
|
||||
mprintf( 280, yp, L"%d Groups: (%d:%d Admins, %d:%d Troops, %d:%d Elites, %d:%d Tanks, %d:%d Jeeps)", ubNumGroups,
|
||||
ubAdminsInBattle, ubNumAdmins,
|
||||
ubTroopsInBattle, ubNumTroops,
|
||||
ubElitesInBattle, ubNumElites,
|
||||
ubTanksInBattle, ubNumTanks );
|
||||
ubTanksInBattle, ubNumTanks,
|
||||
ubJeepsInBattle, ubNumJeeps );
|
||||
yp += 10;
|
||||
SetFontForeground( FONT_WHITE );
|
||||
|
||||
@@ -1274,7 +1278,7 @@ void TestIncoming4SidesCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
gfRenderViewer = TRUE;
|
||||
if( gsSelSectorY > 1 )
|
||||
{
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector-16, 0, 11, 5, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector-16, 0, 11, 5, 0, 0 );
|
||||
pGroup->ubNextX = (UINT8)gsSelSectorX;
|
||||
pGroup->ubNextY = (UINT8)gsSelSectorY;
|
||||
pGroup->uiTraverseTime = 10;
|
||||
@@ -1286,7 +1290,7 @@ void TestIncoming4SidesCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
}
|
||||
if( gsSelSectorY < 16 )
|
||||
{
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+16, 0, 8, 8, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+16, 0, 8, 8, 0, 0 );
|
||||
pGroup->ubNextX = (UINT8)gsSelSectorX;
|
||||
pGroup->ubNextY = (UINT8)gsSelSectorY;
|
||||
pGroup->uiTraverseTime = 12;
|
||||
@@ -1298,7 +1302,7 @@ void TestIncoming4SidesCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
}
|
||||
if( gsSelSectorX > 1 )
|
||||
{
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector-1, 0, 11, 5, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector-1, 0, 11, 5, 0, 0 );
|
||||
pGroup->ubNextX = (UINT8)gsSelSectorX;
|
||||
pGroup->ubNextY = (UINT8)gsSelSectorY;
|
||||
pGroup->uiTraverseTime = 11;
|
||||
@@ -1310,7 +1314,7 @@ void TestIncoming4SidesCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
}
|
||||
if( gsSelSectorX < 16 )
|
||||
{
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+1, 0, 14, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+1, 0, 14, 0, 0, 0 );
|
||||
pGroup->ubNextX = (UINT8)gsSelSectorX;
|
||||
pGroup->ubNextY = (UINT8)gsSelSectorY;
|
||||
pGroup->uiTraverseTime = 13;
|
||||
@@ -1833,7 +1837,7 @@ void PrintEnemiesKilledTable()
|
||||
|
||||
|
||||
|
||||
UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT8 ubTanks )
|
||||
UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT8 ubTanks, UINT8 ubJeeps )
|
||||
{
|
||||
UINT8 ubIconColor;
|
||||
|
||||
@@ -1844,7 +1848,7 @@ UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT
|
||||
// Orange Mixed, no elites (Admins + Troops)
|
||||
// Burgundy Mixed, with elites (Elites + (Admins OR Troops))
|
||||
|
||||
Assert( ubAdmins || ubTroops || ubElites ||ubTanks );
|
||||
Assert( ubAdmins || ubTroops || ubElites || ubTanks || ubJeeps );
|
||||
|
||||
if ( ubElites )
|
||||
{
|
||||
|
||||
+34
-10
@@ -196,6 +196,13 @@ void UpdateASD( )
|
||||
if ( !(gASD_Flags & ASDFACT_HELI_UNLOCKED) && HighestPlayerProgressPercentage( ) >= gGameExternalOptions.usEnemyHeliMinimumProgress )
|
||||
SetASDFlag( ASDFACT_HELI_UNLOCKED );
|
||||
|
||||
if ( !(gASD_Flags & ASDFACT_JEEP_UNLOCKED) && HighestPlayerProgressPercentage( ) >= gGameExternalOptions.usJeepMinimumProgress )
|
||||
SetASDFlag( ASDFACT_JEEP_UNLOCKED );
|
||||
|
||||
if ( !(gASD_Flags & ASDFACT_TANK_UNLOCKED) && HighestPlayerProgressPercentage( ) >= gGameExternalOptions.usTankMinimumProgress )
|
||||
SetASDFlag( ASDFACT_TANK_UNLOCKED );
|
||||
|
||||
|
||||
// determine whether we need to buy new toys
|
||||
ASDDecideOnPurchases();
|
||||
|
||||
@@ -250,10 +257,10 @@ void ASDDecideOnPurchases()
|
||||
// how many would we like to have? Note that this refers to the ones in our pool, the vehicles awarded to enemy groups are no longer accounted for
|
||||
needed_jeep = min( 10, 2 + highestplayerprogress / 10 );
|
||||
|
||||
// if we already unlocked tanks, we want less jeeps
|
||||
// if we already unlocked tanks, we no longer want jeeps - they are replaced by tanks
|
||||
if ( gASD_Flags & ASDFACT_TANK_UNLOCKED )
|
||||
{
|
||||
needed_jeep = max( 4, 12 - highestplayerprogress / 10 );
|
||||
needed_jeep = 0;
|
||||
}
|
||||
|
||||
// how many are needed?
|
||||
@@ -1411,20 +1418,16 @@ void UpdateAndDamageEnemyHeliIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSec
|
||||
}
|
||||
|
||||
//////////////////////////////////////////// enemy tanks /////////////////////////////////////////////////////////
|
||||
// TODO: ini this
|
||||
INT32 gASDResource_Cost_Fuel_Tank = 100; // how many units of fuel a tank needs (used upon creation)
|
||||
INT32 gASDResource_Cost_Fuel_Jeep = 20;
|
||||
|
||||
UINT32 ASDResourceCostFuel( UINT8 aType )
|
||||
{
|
||||
switch ( aType )
|
||||
{
|
||||
case ASD_TANK:
|
||||
return gASDResource_Cost_Fuel_Tank;
|
||||
return gGameExternalOptions.gASDResource_Fuel_Tank;
|
||||
break;
|
||||
|
||||
case ASD_JEEP:
|
||||
return gASDResource_Cost_Fuel_Jeep;
|
||||
return gGameExternalOptions.gASDResource_Fuel_Jeep;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1434,8 +1437,7 @@ UINT32 ASDResourceCostFuel( UINT8 aType )
|
||||
// if ASD has tanks, it can allow the queen to upgrade soldiers to tanks
|
||||
BOOLEAN ASDSoldierUpgradeToTank( )
|
||||
{
|
||||
// TODO: ini val for feature
|
||||
if ( gGameExternalOptions.fASDActive && 0 )
|
||||
if ( gGameExternalOptions.fASDActive && gGameExternalOptions.fASDAssignsTanks )
|
||||
{
|
||||
if ( gASD_Flags & ASDFACT_TANK_UNLOCKED )
|
||||
{
|
||||
@@ -1454,3 +1456,25 @@ BOOLEAN ASDSoldierUpgradeToTank( )
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN ASDSoldierUpgradeToJeep( )
|
||||
{
|
||||
if ( gGameExternalOptions.fASDActive && gGameExternalOptions.fASDAssignsJeeps )
|
||||
{
|
||||
if ( gASD_Flags & ASDFACT_JEEP_UNLOCKED )
|
||||
{
|
||||
if ( gASDResource[ASD_JEEP] )
|
||||
{
|
||||
gASDResource[ASD_JEEP] = max( 0, gASDResource[ASD_JEEP] - 1 );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gASDResource[ASD_JEEP] = max( 0, gASDResource[ASD_JEEP] - 1 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -118,5 +118,6 @@ UINT32 ASDResourceCostFuel( UINT8 aType );
|
||||
|
||||
// if ASD is used, any tanks the queen uses in mobile attacks come from its pool, and we have to account for that
|
||||
BOOLEAN ASDSoldierUpgradeToTank( );
|
||||
BOOLEAN ASDSoldierUpgradeToJeep( );
|
||||
|
||||
#endif //__ASD_H
|
||||
|
||||
+90
-37
@@ -167,7 +167,7 @@ typedef struct AUTORESOLVE_STRUCT
|
||||
UINT8 ubEnemyLeadership;
|
||||
UINT8 ubPlayerLeadership;
|
||||
UINT8 ubMercs, ubCivs, ubEnemies;
|
||||
UINT8 ubAdmins, ubTroops, ubElites, ubTanks;
|
||||
UINT8 ubAdmins, ubTroops, ubElites, ubTanks, ubJeeps;
|
||||
UINT8 ubYMCreatures, ubYFCreatures, ubAMCreatures, ubAFCreatures;
|
||||
UINT8 ubAliveMercs, ubAliveCivs, ubAliveEnemies;
|
||||
UINT8 ubMercCols, ubMercRows;
|
||||
@@ -228,10 +228,11 @@ typedef struct AUTORESOLVE_STRUCT
|
||||
#define CELL_EPC 0x00100000
|
||||
#define CELL_ROBOT 0x00200000
|
||||
#define CELL_TANK 0x00400000
|
||||
#define CELL_JEEP 0x00800000
|
||||
|
||||
//Combined flags
|
||||
#define CELL_PLAYER ( CELL_MERC | CELL_MILITIA )
|
||||
#define CELL_ENEMY ( CELL_ELITE | CELL_TROOP | CELL_ADMIN | CELL_TANK )
|
||||
#define CELL_ENEMY ( CELL_ELITE | CELL_TROOP | CELL_ADMIN | CELL_TANK | CELL_JEEP )
|
||||
#define CELL_CREATURE ( CELL_AF_CREATURE | CELL_AM_CREATURE | CELL_YF_CREATURE | CELL_YM_CREATURE )
|
||||
#define CELL_FEMALECREATURE ( CELL_AF_CREATURE | CELL_YF_CREATURE )
|
||||
#define CELL_MALECREATURE ( CELL_AM_CREATURE | CELL_YM_CREATURE )
|
||||
@@ -290,6 +291,8 @@ enum
|
||||
MILITIA1F_FACE,
|
||||
MILITIA2F_FACE,
|
||||
MILITIA3F_FACE,
|
||||
JEEP_FACE,
|
||||
JEEP_WRECK,
|
||||
};
|
||||
|
||||
extern void CreateDestroyMapInvButton();
|
||||
@@ -434,6 +437,8 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||
SECTORINFO *pSector;
|
||||
INT32 i;
|
||||
UINT8 ubNumEnemies[ NUM_ENEMY_RANKS ];
|
||||
UINT8 ubNumTanks = 0;
|
||||
UINT8 ubNumJeeps = 0;
|
||||
UINT8 ubRankIndex;
|
||||
|
||||
//Clear any possible battle locator
|
||||
@@ -441,14 +446,12 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||
|
||||
pGroup = gpGroupList;
|
||||
pSector = &SectorInfo[ SECTOR( ubSectorX, ubSectorY ) ];
|
||||
|
||||
UINT8 ubNumTanks = 0;
|
||||
|
||||
|
||||
// if we're doing this from the Pre-Battle interface, gpAR is NULL, and RemoveAutoResolveInterface(0 won't happen, so
|
||||
// we must process the enemies killed right here & give out loyalty bonuses as if the battle had been fought & won
|
||||
if( !gpAR )
|
||||
{
|
||||
GetNumberOfEnemiesInSector( ubSectorX, ubSectorY, &ubNumEnemies[ 0 ], &ubNumEnemies[ 1 ], &ubNumEnemies[ 2 ], &ubNumTanks );
|
||||
GetNumberOfEnemiesInSector( ubSectorX, ubSectorY, &ubNumEnemies[0], &ubNumEnemies[1], &ubNumEnemies[2], &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
for ( ubRankIndex = 0; ubRankIndex < NUM_ENEMY_RANKS; ++ubRankIndex )
|
||||
{
|
||||
@@ -479,6 +482,7 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||
pSector->ubNumElites = 0;
|
||||
pSector->ubNumAdmins = 0;
|
||||
pSector->ubNumTanks = 0;
|
||||
pSector->ubNumJeeps = 0;
|
||||
pSector->ubNumCreatures = 0;
|
||||
pSector->bLastKnownEnemies = 0;
|
||||
//Remove the mobile forces here, but only if battle is over.
|
||||
@@ -764,9 +768,9 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
GROUP *pGroup;
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks; //how many soldiers of the type do we still have to assign to a group?
|
||||
UINT8 ubISNumAdmins, ubISNumTroops, ubISNumElites, ubISNumTanks;
|
||||
UINT8 ubNumElitesInGroup, ubNumTroopsInGroup, ubNumAdminsInGroup, ubNumTanksInGroup;
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps; //how many soldiers of the type do we still have to assign to a group?
|
||||
UINT8 ubISNumAdmins, ubISNumTroops, ubISNumElites, ubISNumTanks, ubISNumJeeps;
|
||||
UINT8 ubNumElitesInGroup, ubNumTroopsInGroup, ubNumAdminsInGroup, ubNumTanksInGroup, ubNumJeepsInGroup;
|
||||
INT32 i;
|
||||
UINT8 pSectors[4];
|
||||
UINT8 ubDirAmount;
|
||||
@@ -782,6 +786,7 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubNumTroops = pSector->ubNumTroops;
|
||||
ubNumElites = pSector->ubNumElites;
|
||||
ubNumTanks = pSector->ubNumTanks;
|
||||
ubNumJeeps = pSector->ubNumJeeps;
|
||||
|
||||
//Now go through our enemies in the autoresolve array, and assign the ubGroupID to the soldier
|
||||
//Stationary groups have a group ID of 0 - first assign enemies from those stationary groups
|
||||
@@ -793,6 +798,12 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
gpEnemies[i].uiFlags |= CELL_ASSIGNED;
|
||||
ubNumTanks--;
|
||||
}
|
||||
else if ( gpEnemies[i].uiFlags & CELL_JEEP && ubNumJeeps )
|
||||
{
|
||||
gpEnemies[i].pSoldier->ubGroupID = 0;
|
||||
gpEnemies[i].uiFlags |= CELL_ASSIGNED;
|
||||
ubNumJeeps--;
|
||||
}
|
||||
else if ( gpEnemies[i].uiFlags & CELL_ELITE && ubNumElites )
|
||||
{
|
||||
gpEnemies[ i ].pSoldier->ubGroupID = 0;
|
||||
@@ -817,8 +828,9 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubNumTroops = gpAR->ubTroops - pSector->ubNumTroops;
|
||||
ubNumElites = gpAR->ubElites - pSector->ubNumElites;
|
||||
ubNumTanks = gpAR->ubTanks - pSector->ubNumTanks;
|
||||
ubNumJeeps = gpAR->ubJeeps - pSector->ubNumJeeps;
|
||||
|
||||
if( !ubNumElites && !ubNumTroops && !ubNumAdmins && !ubNumTanks )
|
||||
if ( !ubNumElites && !ubNumTroops && !ubNumAdmins && !ubNumTanks && !ubNumJeeps )
|
||||
{ //All troops accounted for.
|
||||
return;
|
||||
}
|
||||
@@ -833,6 +845,7 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops;
|
||||
ubNumAdminsInGroup = pGroup->pEnemyGroup->ubNumAdmins;
|
||||
ubNumTanksInGroup = pGroup->pEnemyGroup->ubNumTanks;
|
||||
ubNumJeepsInGroup = pGroup->pEnemyGroup->ubNumJeeps;
|
||||
for( i = 0; i < gpAR->ubEnemies; i++ )
|
||||
{
|
||||
if( !(gpEnemies[ i ].uiFlags & CELL_ASSIGNED) ) //has this soldier already been assigned to a cell and therefore a group (while processing the static enemies above) ?
|
||||
@@ -844,6 +857,13 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubNumTanks--;
|
||||
ubNumTanksInGroup--;
|
||||
}
|
||||
else if ( ubNumJeeps && ubNumJeepsInGroup && gpEnemies[i].uiFlags & CELL_JEEP )
|
||||
{
|
||||
gpEnemies[i].pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
gpEnemies[i].uiFlags |= CELL_ASSIGNED;
|
||||
ubNumJeeps--;
|
||||
ubNumJeepsInGroup--;
|
||||
}
|
||||
else if (ubNumElites && ubNumElitesInGroup && gpEnemies[i].uiFlags & CELL_ELITE)
|
||||
{
|
||||
gpEnemies[ i ].pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -883,6 +903,7 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops;
|
||||
ubNumAdminsInGroup = pGroup->pEnemyGroup->ubNumAdmins;
|
||||
ubNumTanksInGroup = pGroup->pEnemyGroup->ubNumTanks;
|
||||
ubNumJeepsInGroup = pGroup->pEnemyGroup->ubNumJeeps;
|
||||
for( i = 0; i < gpAR->ubEnemies; i++ )
|
||||
{
|
||||
if( !(gpEnemies[ i ].uiFlags & CELL_ASSIGNED) )
|
||||
@@ -894,6 +915,13 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubNumTanks--;
|
||||
ubNumTanksInGroup--;
|
||||
}
|
||||
else if ( ubNumJeeps && ubNumJeepsInGroup && gpEnemies[i].uiFlags & CELL_JEEP )
|
||||
{
|
||||
gpEnemies[i].pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
gpEnemies[i].uiFlags |= CELL_ASSIGNED;
|
||||
ubNumJeeps--;
|
||||
ubNumJeepsInGroup--;
|
||||
}
|
||||
else if (ubNumElites && ubNumElitesInGroup && gpEnemies[i].uiFlags & CELL_ELITE)
|
||||
{
|
||||
gpEnemies[ i ].pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
@@ -932,10 +960,11 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubISNumTroops = pSector->ubNumTroops;
|
||||
ubISNumElites = pSector->ubNumElites;
|
||||
ubISNumTanks = pSector->ubNumTanks;
|
||||
ubISNumJeeps = pSector->ubNumJeeps;
|
||||
|
||||
for( i = 0; i < gpAR->ubEnemies; ++i )
|
||||
{
|
||||
if( ubISNumAdmins + ubISNumTroops + ubISNumElites + ubISNumTanks <= gubReinforcementMinEnemyStaticGroupSize ) break; //if group would be left understaffed, it wont reinforce - go chceck another sector (what if are there more groups here?)
|
||||
if ( ubISNumAdmins + ubISNumTroops + ubISNumElites + ubISNumTanks + ubISNumJeeps <= gubReinforcementMinEnemyStaticGroupSize ) break; //if group would be left understaffed, it wont reinforce - go chceck another sector (what if are there more groups here?)
|
||||
|
||||
if( !(gpEnemies[ i ].uiFlags & CELL_ASSIGNED) )
|
||||
{
|
||||
@@ -948,6 +977,15 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
ubISNumTanks--;
|
||||
ubNumTanks--;
|
||||
}
|
||||
else if ( gpEnemies[i].uiFlags & CELL_JEEP && ubISNumJeeps && ubNumJeeps )
|
||||
{
|
||||
gpEnemies[i].pSoldier->ubGroupID = 0;
|
||||
gpEnemies[i].uiFlags |= CELL_ASSIGNED;
|
||||
gpEnemies[i].pSoldier->sSectorX = SECTORX( pSectors[ubCurrSI] );
|
||||
gpEnemies[i].pSoldier->sSectorY = SECTORY( pSectors[ubCurrSI] );
|
||||
ubISNumJeeps--;
|
||||
ubNumJeeps--;
|
||||
}
|
||||
else if ( gpEnemies[i].uiFlags & CELL_ELITE && ubISNumElites && ubNumElites )
|
||||
{
|
||||
gpEnemies[ i ].pSoldier->ubGroupID = 0;
|
||||
@@ -980,7 +1018,7 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
}
|
||||
/*at this point, all enemies should have been assigned to their cell and group. If not, there is a bug around
|
||||
Because number and type of cells should be computed for the same composition of enemies as the one we see in this function, it should not happen though*/
|
||||
AssertMsg(!(ubISNumAdmins & ubISNumTroops & ubISNumElites & ubISNumTanks), "Mapping between actual enemies and autoresolve cells is wrong.");
|
||||
AssertMsg( !(ubISNumAdmins & ubISNumTroops & ubISNumElites & ubISNumTanks & ubISNumJeeps), "Mapping between actual enemies and autoresolve cells is wrong." );
|
||||
|
||||
}
|
||||
|
||||
@@ -1090,14 +1128,16 @@ void CalculateSoldierCells( BOOLEAN fReset )
|
||||
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
if ( index < gpAR->ubTanks )
|
||||
gpEnemies[index].uiFlags = CELL_TANK;
|
||||
else if ( index < gpAR->ubTanks + gpAR->ubElites )
|
||||
gpEnemies[ index ].uiFlags = CELL_ELITE;
|
||||
else if ( index < gpAR->ubTanks + gpAR->ubElites + gpAR->ubTroops )
|
||||
gpEnemies[ index ].uiFlags = CELL_TROOP;
|
||||
else
|
||||
if ( index < gpAR->ubElites )
|
||||
gpEnemies[index].uiFlags = CELL_ELITE;
|
||||
else if ( index < gpAR->ubElites + gpAR->ubTroops )
|
||||
gpEnemies[index].uiFlags = CELL_TROOP;
|
||||
else if ( index < gpAR->ubElites + gpAR->ubTroops + gpAR->ubAdmins )
|
||||
gpEnemies[index].uiFlags = CELL_ADMIN;
|
||||
else if ( index < gpAR->ubElites + gpAR->ubTroops + gpAR->ubAdmins + gpAR->ubTanks )
|
||||
gpEnemies[index].uiFlags = CELL_TANK;
|
||||
else
|
||||
gpEnemies[index].uiFlags = CELL_JEEP;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1177,6 +1217,8 @@ void RenderSoldierCell( SOLDIERCELL *pCell )
|
||||
BltVideoObjectFromIndex( FRAME_BUFFER, gpAR->iFaces, CREATURE_SKULL, pCell->xp + 3 + x, pCell->yp + 3, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
else if ( (pCell->uiFlags & CELL_TANK) )
|
||||
BltVideoObjectFromIndex( FRAME_BUFFER, gpAR->iFaces, TANK_WRECK, pCell->xp + 3 + x, pCell->yp + 3, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
else if ( (pCell->uiFlags & CELL_JEEP) )
|
||||
BltVideoObjectFromIndex( FRAME_BUFFER, gpAR->iFaces, JEEP_WRECK, pCell->xp + 3 + x, pCell->yp + 3, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
else
|
||||
BltVideoObjectFromIndex( FRAME_BUFFER, gpAR->iFaces, HUMAN_SKULL, pCell->xp+3+x, pCell->yp+3, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
@@ -2182,6 +2224,7 @@ void CreateAutoResolveInterface()
|
||||
gpEnemies[index].pSoldier->sSectorY = gpAR->ubSectorY;
|
||||
swprintf( gpEnemies[index].pSoldier->name, gpStrategicString[ STR_AR_ADMINISTRATOR_NAME ] );
|
||||
}
|
||||
|
||||
for ( i = 0; i < gpAR->ubTanks; ++i, ++index )
|
||||
{
|
||||
gpEnemies[index].pSoldier = TacticalCreateEnemyTank();
|
||||
@@ -2191,6 +2234,17 @@ void CreateAutoResolveInterface()
|
||||
gpEnemies[index].pSoldier->sSectorY = gpAR->ubSectorY;
|
||||
swprintf( gpEnemies[index].pSoldier->name, gpStrategicString[STR_AR_TANK_NAME] );
|
||||
}
|
||||
|
||||
for ( i = 0; i < gpAR->ubJeeps; ++i, ++index )
|
||||
{
|
||||
gpEnemies[index].pSoldier = TacticalCreateEnemyJeep( );
|
||||
gpEnemies[index].uiVObjectID = gpAR->iFaces;
|
||||
gpEnemies[index].usIndex = JEEP_FACE;
|
||||
gpEnemies[index].pSoldier->sSectorX = gpAR->ubSectorX;
|
||||
gpEnemies[index].pSoldier->sSectorY = gpAR->ubSectorY;
|
||||
swprintf( gpEnemies[index].pSoldier->name, gpStrategicString[STR_AR_JEEP_NAME] );
|
||||
}
|
||||
|
||||
AssociateEnemiesWithStrategicGroups();
|
||||
}
|
||||
else
|
||||
@@ -2900,8 +2954,8 @@ void CalculateAutoResolveInfo()
|
||||
{
|
||||
// GetNumberOfEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY,
|
||||
GetNumberOfEnemiesInFiveSectors( gpAR->ubSectorX, gpAR->ubSectorY,
|
||||
&gpAR->ubAdmins, &gpAR->ubTroops, &gpAR->ubElites, &gpAR->ubTanks );
|
||||
gpAR->ubEnemies = (UINT8)min( gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubElites + gpAR->ubTanks, MAX_AR_TEAM_SIZE );
|
||||
&gpAR->ubAdmins, &gpAR->ubTroops, &gpAR->ubElites, &gpAR->ubTanks, &gpAR->ubJeeps );
|
||||
gpAR->ubEnemies = (UINT8)min( gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubElites + gpAR->ubTanks + gpAR->ubJeeps, MAX_AR_TEAM_SIZE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2987,20 +3041,22 @@ void ResetAutoResolveInterface()
|
||||
|
||||
//Make sure the number of enemy portraits is the same as needed.
|
||||
//The debug keypresses may add or remove more than one at a time.
|
||||
while ( gpAR->ubElites + gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubTanks > gpAR->ubEnemies )
|
||||
while ( gpAR->ubElites + gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubTanks + gpAR->ubJeeps > gpAR->ubEnemies )
|
||||
{
|
||||
switch( PreRandom( 5 ) )
|
||||
{
|
||||
case 0: if( gpAR->ubElites ) { gpAR->ubElites--; break; }
|
||||
case 1: case 2: if( gpAR->ubAdmins ) { gpAR->ubAdmins--; break; }
|
||||
case 3: case 4: if( gpAR->ubTroops ) { gpAR->ubTroops--; break; }
|
||||
case 0: if ( gpAR->ubElites ) { gpAR->ubElites--; break; }
|
||||
case 1: if ( gpAR->ubAdmins ) { gpAR->ubAdmins--; break; }
|
||||
case 2: if ( gpAR->ubTroops ) { gpAR->ubTroops--; break; }
|
||||
case 3: if ( gpAR->ubTanks ) { gpAR->ubTanks--; break; }
|
||||
case 4: if ( gpAR->ubJeeps ) { gpAR->ubJeeps--; break; }
|
||||
}
|
||||
}
|
||||
while ( gpAR->ubElites + gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubTanks < gpAR->ubEnemies )
|
||||
while ( gpAR->ubElites + gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubTanks + gpAR->ubJeeps< gpAR->ubEnemies )
|
||||
{
|
||||
switch( PreRandom( 5 ) )
|
||||
{
|
||||
case 0: gpAR->ubElites++; break;
|
||||
case 0: gpAR->ubElites++; break;
|
||||
case 1: case 2: gpAR->ubAdmins++; break;
|
||||
case 3: case 4: gpAR->ubTroops++; break;
|
||||
}
|
||||
@@ -4066,7 +4122,7 @@ BOOLEAN FireTankCannon( SOLDIERCELL *pAttacker )
|
||||
pSoldier = pAttacker->pSoldier;
|
||||
|
||||
// we need to be a tank to do this...
|
||||
if ( !pSoldier || (pAttacker->uiFlags & CELL_TANK) == 0 || pSoldier->ubSoldierClass != SOLDIER_CLASS_TANK )
|
||||
if ( !pSoldier || (pAttacker->uiFlags & CELL_TANK) == 0 || pSoldier->ubSoldierClass != SOLDIER_CLASS_TANK || COMBAT_JEEP( pSoldier ) )
|
||||
return FALSE;
|
||||
|
||||
// a tank has several guns, don't fire the main gun all the time
|
||||
@@ -4296,7 +4352,7 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget )
|
||||
usAttack *= 1.5;
|
||||
}
|
||||
// if our target is a tank, we use heavy weapons if we have any
|
||||
else if ( TANK( pTarget->pSoldier ) && FireAntiTankWeapon( pAttacker ) )
|
||||
else if ( ARMED_VEHICLE( pTarget->pSoldier ) && FireAntiTankWeapon( pAttacker ) )
|
||||
{
|
||||
fAntiTank = TRUE;
|
||||
|
||||
@@ -4454,10 +4510,7 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget )
|
||||
|
||||
UINT8 ubAmmoType = Magazine[Item[(&pAttacker->pSoldier->inv[pAttacker->bWeaponSlot])->usItem].ubClassIndex].ubAmmoType;
|
||||
|
||||
if ( AmmoTypes[ubAmmoType].antiTank )
|
||||
{
|
||||
ubImpact *= 2;
|
||||
}
|
||||
ubImpact *= AmmoTypes[ubAmmoType].dDamageModifierTank;
|
||||
|
||||
iRandom = Random( 100 );
|
||||
if ( iRandom < 15 )
|
||||
@@ -4646,7 +4699,7 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget )
|
||||
default :
|
||||
if ( CREATURE_OR_BLOODCAT( pTarget->pSoldier ) )
|
||||
gMercProfiles[ pAttacker->pSoldier->ubProfile ].records.usKillsCreatures++;
|
||||
else if ( TANK( pTarget->pSoldier ) ) // we hardly can kill a tank in autoresolve, but well.. who knows..
|
||||
else if ( ARMED_VEHICLE( pTarget->pSoldier ) ) // we hardly can kill a tank in autoresolve, but well.. who knows..
|
||||
gMercProfiles[ pAttacker->pSoldier->ubProfile ].records.usKillsTanks++;
|
||||
else if ( pTarget->pSoldier->bTeam == CIV_TEAM && !pTarget->pSoldier->aiData.bNeutral && pTarget->pSoldier->bSide != gbPlayerNum )
|
||||
gMercProfiles[ pAttacker->pSoldier->ubProfile ].records.usKillsHostiles++;
|
||||
@@ -4794,7 +4847,7 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index )
|
||||
}
|
||||
|
||||
//bullet hit -- play an impact sound and a merc hit sound
|
||||
if ( TANK( pTarget->pSoldier ) )
|
||||
if ( ARMED_VEHICLE( pTarget->pSoldier ) )
|
||||
PlayAutoResolveSample( (UINT8)(S_METAL_IMPACT1 + PreRandom( 3 )), RATE_11025, 50, 1, MIDDLEPAN );
|
||||
else
|
||||
PlayAutoResolveSample( (UINT8)(BULLET_IMPACT_1+PreRandom(3)), RATE_11025, 50, 1, MIDDLEPAN );
|
||||
@@ -4860,7 +4913,7 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index )
|
||||
default :
|
||||
if ( CREATURE_OR_BLOODCAT( pTarget->pSoldier ) )
|
||||
gMercProfiles[ pKiller->pSoldier->ubProfile ].records.usKillsCreatures++;
|
||||
else if ( TANK( pTarget->pSoldier ) ) // we hardly can kill a tank in autoresolve, but well.. who knows..
|
||||
else if ( ARMED_VEHICLE( pTarget->pSoldier ) ) // we hardly can kill a tank in autoresolve, but well.. who knows..
|
||||
gMercProfiles[ pKiller->pSoldier->ubProfile ].records.usKillsTanks++;
|
||||
else if ( pTarget->pSoldier->bTeam == CIV_TEAM && !pTarget->pSoldier->aiData.bNeutral && pTarget->pSoldier->bSide != gbPlayerNum )
|
||||
gMercProfiles[ pKiller->pSoldier->ubProfile ].records.usKillsHostiles++;
|
||||
@@ -4949,7 +5002,7 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index )
|
||||
{ //Normal death
|
||||
if( gpAR->fSound )
|
||||
{
|
||||
if ( TANK( pTarget->pSoldier ) )
|
||||
if ( ARMED_VEHICLE( pTarget->pSoldier ) )
|
||||
PlayAutoResolveSample( (UINT8)(S_RAID_TB_BOMB), RATE_11025, 50, 1, MIDDLEPAN );
|
||||
else
|
||||
pTarget->pSoldier->DoMercBattleSound( BATTLE_SOUND_DIE1 );
|
||||
|
||||
@@ -339,25 +339,25 @@ void GeneratePatrolGroups()
|
||||
GROUP *pGroup;
|
||||
UINT8 ubNumTroops;
|
||||
ubNumTroops = (UINT8)(3 + gGameOptions.ubDifficultyLevel + Random( 3 ));
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_C7, 0, ubNumTroops, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_C7, 0, ubNumTroops, 0, 0, 0 );
|
||||
pGroup->ubTransportationMask = CAR;
|
||||
AddWaypointToPGroup( pGroup, 8, 3 ); //C8
|
||||
AddWaypointToPGroup( pGroup, 7, 3 ); //C7
|
||||
|
||||
ubNumTroops = (UINT8)(3 + gGameOptions.ubDifficultyLevel + Random( 3 ));
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_D9, 0, ubNumTroops, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_D9, 0, ubNumTroops, 0, 0, 0 );
|
||||
AddWaypointToPGroup( pGroup, 9, 5 ); //E9
|
||||
AddWaypointToPGroup( pGroup, 9, 4 ); //D9
|
||||
pGroup->ubTransportationMask = TRUCK;
|
||||
|
||||
ubNumTroops = (UINT8)(3 + gGameOptions.ubDifficultyLevel + Random( 3 ));
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_B9, 0, ubNumTroops, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_B9, 0, ubNumTroops, 0, 0, 0 );
|
||||
AddWaypointToPGroup( pGroup, 12, 2 ); //B12
|
||||
AddWaypointToPGroup( pGroup, 9, 2 ); //B9
|
||||
pGroup->ubTransportationMask = FOOT;
|
||||
|
||||
ubNumTroops = (UINT8)(3 + gGameOptions.ubDifficultyLevel + Random( 3 ));
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_A14, 0, ubNumTroops, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_A14, 0, ubNumTroops, 0, 0, 0 );
|
||||
pGroup->ubMoveType = ENDTOEND_FORWARDS;
|
||||
AddWaypointToPGroup( pGroup, 13, 1 ); //A13
|
||||
AddWaypointToPGroup( pGroup, 15, 1 ); //A15
|
||||
@@ -368,13 +368,13 @@ void GeneratePatrolGroups()
|
||||
pGroup->ubTransportationMask = TRACKED;
|
||||
|
||||
ubNumTroops = (UINT8)(5 + gGameOptions.ubDifficultyLevel * 2 + Random( 4 ));
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_N6, 0, ubNumTroops, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_N6, 0, ubNumTroops, 0, 0, 0 );
|
||||
AddWaypointToPGroup( pGroup, 9, 14 ); //N9
|
||||
AddWaypointToPGroup( pGroup, 6, 14 ); //N6
|
||||
pGroup->ubTransportationMask = CAR;
|
||||
|
||||
ubNumTroops = (UINT8)(5 + gGameOptions.ubDifficultyLevel * 2 + Random( 4 ));
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_N10, 0, ubNumTroops, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_N10, 0, ubNumTroops, 0, 0, 0 );
|
||||
AddWaypointToPGroup( pGroup, 10, 11 ); //K10
|
||||
AddWaypointToPGroup( pGroup, 10, 14 ); //N10
|
||||
pGroup->ubTransportationMask = CAR;
|
||||
|
||||
@@ -528,7 +528,10 @@ typedef struct SECTORINFO
|
||||
FLOAT dFortification_MaxPossible; // the amount of fortification that can still be done in this sector, given the current layout plans. Is updated every time we unload a sector
|
||||
FLOAT dFortification_UnappliedProgress; // progress done via assignment work. As we cannot update unloaded sectors, update happens once sector is loaded
|
||||
|
||||
INT8 bPadding[ 4 ];
|
||||
UINT8 ubNumJeeps;
|
||||
UINT8 ubJeepsInBattle;
|
||||
|
||||
INT8 bPadding[ 22 ];
|
||||
|
||||
}SECTORINFO;
|
||||
|
||||
@@ -574,7 +577,10 @@ typedef struct UNDERGROUND_SECTORINFO
|
||||
FLOAT dFortification_MaxPossible; // the amount of fortification that can still be done in this sector, given the current layout plans. Is updated every time we unload a sector
|
||||
FLOAT dFortification_UnappliedProgress; // progress done via assignment work. As we cannot update unloaded sectors, update happens once sector is loaded
|
||||
|
||||
INT8 bPadding[16];
|
||||
UINT8 ubNumJeeps;
|
||||
UINT8 ubJeepsInBattle;
|
||||
|
||||
INT8 bPadding[14];
|
||||
//no padding left!
|
||||
}UNDERGROUND_SECTORINFO;
|
||||
|
||||
|
||||
@@ -126,13 +126,13 @@ BOOLEAN AddEnemiesToInitialSectorH7();
|
||||
UINT32 GetNumberOfJA25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 *pNumAdmins, UINT8 *pNumTroops, UINT8 *pNumElites, UINT8 *pubNumTanks );
|
||||
void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
|
||||
void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
|
||||
void InitJa25InitialEnemiesInSector();
|
||||
void InitJa25UnderGroundSectors();
|
||||
void InitNumberOfEnemiesInAboveGroundSectors( );
|
||||
void InitNumberOfEnemiesInUnderGroundSectors( );
|
||||
void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCats, INT8 bBloodCatPlacements );
|
||||
void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
void SetNumberJa25EnemiesInUnderGroundSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
|
||||
|
||||
void ResetJa25SectorProbabilities();
|
||||
BOOLEAN InitJa25StrategicSectorAI( BOOLEAN fReset );
|
||||
@@ -281,17 +281,18 @@ BOOLEAN AddEnemiesToInitialSectorH7()
|
||||
UINT8 ubNumTroops;
|
||||
UINT8 ubNumElites;
|
||||
UINT8 ubNumTanks;
|
||||
UINT8 ubNumJeeps;
|
||||
|
||||
UINT8 ubNumRemovedAdmins=0;
|
||||
UINT8 ubNumRemovedTroops=0;
|
||||
UINT8 ubNumRemovedElites=0;
|
||||
UINT8 ubNumRemovedTanks=0;
|
||||
UINT8 ubNumRemovedJeeps=0;
|
||||
|
||||
ubSector = SECTOR( JA2_5_START_SECTOR_X, JA2_5_START_SECTOR_Y );
|
||||
|
||||
//Get the number of enemies in the guard post sector
|
||||
GetNumberOfJA25EnemiesInSector( 8, MAP_ROW_H, 0, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
|
||||
GetNumberOfJA25EnemiesInSector( 8, MAP_ROW_H, 0, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
//determine the #of enemies to travel to the initial heli sector
|
||||
if( ubNumAdmins > 1 )
|
||||
@@ -306,13 +307,17 @@ BOOLEAN AddEnemiesToInitialSectorH7()
|
||||
if( ubNumTanks > 1 )
|
||||
ubNumRemovedTanks = ubNumTanks / 3 + + Random( 3 );
|
||||
|
||||
if( ubNumJeeps > 1 )
|
||||
ubNumRemovedJeeps = ubNumJeeps / 3 + + Random( 3 );
|
||||
|
||||
//deduct the # that are moving from the # in the guard post sector
|
||||
// SetNumberJa25EnemiesInSurfaceSector( SEC_H8, (UINT8)(ubNumAdmins-ubNumRemovedAdmins), (UINT8)(ubNumTroops-ubNumRemovedTroops), (UINT8)(ubNumElites-ubNumRemovedElites) );
|
||||
SetNumberJa25EnemiesInSector( 8, MAP_ROW_H, 0, (UINT8)(ubNumAdmins-ubNumRemovedAdmins), (UINT8)(ubNumTroops-ubNumRemovedTroops), (UINT8)(ubNumElites-ubNumRemovedElites), (UINT8)(ubNumTanks-ubNumRemovedTanks) );
|
||||
SetNumberJa25EnemiesInSector( 8, MAP_ROW_H, 0, (UINT8)(ubNumAdmins-ubNumRemovedAdmins), (UINT8)(ubNumTroops-ubNumRemovedTroops), (UINT8)(ubNumElites-ubNumRemovedElites),
|
||||
(UINT8)(ubNumTanks-ubNumRemovedTanks), (UINT8)(ubNumJeeps-ubNumRemovedJeeps) );
|
||||
|
||||
uiWorldMin = GetWorldTotalMin();
|
||||
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+1, ubNumRemovedAdmins, ubNumRemovedTroops, ubNumRemovedElites, ubNumRemovedTanks );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( ubSector+1, ubNumRemovedAdmins, ubNumRemovedTroops, ubNumRemovedElites, ubNumRemovedTanks, ubNumRemovedJeeps );
|
||||
|
||||
if( pGroup == NULL )
|
||||
{
|
||||
@@ -403,19 +408,19 @@ void InitJa25UnderGroundSectors()
|
||||
*/
|
||||
}
|
||||
|
||||
void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks )
|
||||
void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps )
|
||||
{
|
||||
//if its a ground level
|
||||
|
||||
if( bSectorZ == 0 )
|
||||
{
|
||||
SetNumberJa25EnemiesInSurfaceSector( SECTOR( sSectorX, sSectorY ), ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSurfaceSector( SECTOR( sSectorX, sSectorY ), ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
}
|
||||
|
||||
//its an underground level
|
||||
else
|
||||
{
|
||||
SetNumberJa25EnemiesInUnderGroundSector( sSectorX, sSectorY, bSectorZ, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInUnderGroundSector( sSectorX, sSectorY, bSectorZ, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -857,6 +862,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
UINT8 ubNumTroops=0;
|
||||
UINT8 ubNumElites=0;
|
||||
UINT8 ubNumTanks;
|
||||
UINT8 ubNumJeeps;
|
||||
|
||||
//Mine Sector Level 1
|
||||
switch( gGameOptions.ubDifficultyLevel )
|
||||
@@ -877,7 +883,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 0 + Random( 0 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 13, 9, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 13, 9, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
//Power Generator Level 1
|
||||
@@ -899,7 +905,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 0 + Random( 0 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 13, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 13, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
//Tunnel First Part, Level 1
|
||||
@@ -921,7 +927,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 0 + Random( 0 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 14, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 14, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
//Tunnel Second Part, Level 1
|
||||
@@ -943,7 +949,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 0 + Random( 0 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 14, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 14, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
|
||||
@@ -966,7 +972,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 6 + Random( 4 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 15, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 15, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
//Complex, Level 2, K15
|
||||
@@ -988,7 +994,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 10 + Random( 2 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 15, 11, 2, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 15, 11, 2, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
//Complex, Level 2, L15
|
||||
@@ -1010,7 +1016,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 14 + Random( 2 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 15, 12, 2, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 15, 12, 2, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
|
||||
|
||||
//Complex, Level 3, L15
|
||||
@@ -1032,7 +1038,7 @@ void InitNumberOfEnemiesInUnderGroundSectors( )
|
||||
ubNumElites = 15 + Random( 0 );
|
||||
break;
|
||||
}
|
||||
SetNumberJa25EnemiesInSector( 15, 12, 3, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 15, 12, 3, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
}
|
||||
|
||||
void InitJa25SaveStruct()
|
||||
@@ -1325,10 +1331,11 @@ void AddEnemiesToFirstTunnelSector()
|
||||
UINT8 ubNumTroops=0;
|
||||
UINT8 ubNumElites=0;
|
||||
UINT8 ubNumTanks=0;
|
||||
UINT8 ubNumJeeps=0;
|
||||
|
||||
NumEnemiesToAttackFirstTunnelSector( &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
NumEnemiesToAttackFirstTunnelSector( &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
SetNumberJa25EnemiesInSector( 14, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 14, 10, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
}
|
||||
|
||||
void AddEnemiesToSecondTunnelSector()
|
||||
@@ -1337,17 +1344,19 @@ void AddEnemiesToSecondTunnelSector()
|
||||
UINT8 ubNumTroops=0;
|
||||
UINT8 ubNumElites=0;
|
||||
UINT8 ubNumTanks=0;
|
||||
UINT8 ubNumJeeps=0;
|
||||
|
||||
NumEnemiesToAttackSecondTunnelSector( &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
SetNumberJa25EnemiesInSector( 14, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
|
||||
NumEnemiesToAttackSecondTunnelSector( &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
SetNumberJa25EnemiesInSector( 14, 11, 1, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps );
|
||||
}
|
||||
|
||||
UINT8 NumEnemiesToAttackFirstTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites, UINT8 *pTanks )
|
||||
UINT8 NumEnemiesToAttackFirstTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites, UINT8 *pTanks, UINT8 *pJeeps )
|
||||
{
|
||||
UINT8 ubNumAdmins=0;
|
||||
UINT8 ubNumTroops=0;
|
||||
UINT8 ubNumElites=0;
|
||||
UINT8 ubNumTanks=0;
|
||||
UINT8 ubNumJeeps=0;
|
||||
|
||||
//if the player blew up the fan, add a ton of enemies to the sector
|
||||
//1st Tunnel Sector
|
||||
@@ -1382,15 +1391,19 @@ UINT8 NumEnemiesToAttackFirstTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8
|
||||
if( pTanks )
|
||||
*pTanks = ubNumTanks;
|
||||
|
||||
return( ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks );
|
||||
if( pJeeps )
|
||||
*pJeeps = ubNumJeeps;
|
||||
|
||||
return( ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps );
|
||||
}
|
||||
|
||||
UINT8 NumEnemiesToAttackSecondTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites, UINT8 *pTanks )
|
||||
UINT8 NumEnemiesToAttackSecondTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT8 *pElites, UINT8 *pTanks, UINT8 *pJeeps )
|
||||
{
|
||||
UINT8 ubNumAdmins=0;
|
||||
UINT8 ubNumTroops=0;
|
||||
UINT8 ubNumElites=0;
|
||||
UINT8 ubNumTanks=0;
|
||||
UINT8 ubNumJeeps=0;
|
||||
|
||||
//if the player blew up the fan, add a ton of enemies to the sector
|
||||
//1st Tunnel Sector
|
||||
@@ -1422,8 +1435,10 @@ UINT8 NumEnemiesToAttackSecondTunnelSector( UINT8 *pAdmins, UINT8 *pTroops, UINT
|
||||
*pElites = ubNumElites;
|
||||
if( pTanks )
|
||||
*pTanks = ubNumTanks;
|
||||
if( pJeeps )
|
||||
*pJeeps = ubNumJeeps;
|
||||
|
||||
return( ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks );
|
||||
return( ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps );
|
||||
}
|
||||
|
||||
|
||||
@@ -2186,7 +2201,7 @@ BOOLEAN HandleAddEnemiesToSectorPlayerIsntIn( INT16 sSaiSector, UINT8 ubNumEnemi
|
||||
gubEnemyEncounterCode = ENEMY_INVASION_CODE;
|
||||
}
|
||||
|
||||
SetNumberJa25EnemiesInSector( sSectorX, sSectorY, bSectorZ, 0, ubNumEnemies, 0, 0 );
|
||||
SetNumberJa25EnemiesInSector( sSectorX, sSectorY, bSectorZ, 0, ubNumEnemies, 0, 0, 0 );
|
||||
|
||||
SetThisSectorAsEnemyControlled( sSectorX, sSectorY, bSectorZ, FALSE );
|
||||
|
||||
@@ -2231,7 +2246,7 @@ if ( gGameUBOptions.pJA2UB == TRUE )
|
||||
|
||||
if( gJa25AiSectorStruct[ sSaiSector ].bSectorZ == 0 )
|
||||
{
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( sSector, 0, ubNumEnemies, 0, 0 );
|
||||
pGroup = CreateNewEnemyGroupDepartingFromSector( sSector, 0, ubNumEnemies, 0, 0, 0 );
|
||||
|
||||
if( sGridNo != -1 )
|
||||
{
|
||||
|
||||
@@ -188,12 +188,12 @@ BOOLEAN ShouldEnemiesBeAddedToInitialSector();
|
||||
|
||||
void InitJa25StrategicAi();
|
||||
|
||||
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
|
||||
|
||||
void InitJa25SaveStruct();
|
||||
|
||||
void InitJa25StrategicAiBloodcats( );
|
||||
extern void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
extern void SetNumberJa25EnemiesInSurfaceSector( INT32 iSectorID, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
|
||||
|
||||
BOOLEAN SaveJa25SaveInfoToSaveGame( HWFILE hFile );
|
||||
BOOLEAN LoadJa25SaveInfoFromSavedGame( HWFILE hFile );
|
||||
@@ -305,7 +305,7 @@ enum
|
||||
extern BOOLEAN gfEnemyShouldImmediatelySeekThePlayer;
|
||||
//extern INT32 giNumJA25Sectors;
|
||||
|
||||
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
|
||||
void SetJa25SectorOwnedStatus( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fPlayerOwned );
|
||||
INT8 GetTheFurthestSectorPlayerOwns();
|
||||
void Ja25_UpdateTimeOfEndOfLastBattle( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
|
||||
@@ -317,7 +317,7 @@ void JA25_HandleUpdateOfStrategicAi();
|
||||
void SetEnemiesToFindThePlayerMercs();
|
||||
|
||||
void HandleSayingDontStayToLongWarningInSectorH8();
|
||||
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
extern void SetNumberJa25EnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubJeeps );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
BOOLEAN InitJa25StrategicAiDecisions( BOOLEAN fLoadedGame );
|
||||
|
||||
@@ -562,7 +562,7 @@ void ShowSAMSitesOnStrategicMap( void );
|
||||
void MilitiaBoxMaskBtnCallback(MOUSE_REGION * pRegion, INT32 iReason );
|
||||
|
||||
// display potential path, yes or no?
|
||||
void ShowEnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sNumberOfEnemies, UINT16 usNumTanks, UINT8 ubIconPosition );
|
||||
void ShowEnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sNumberOfEnemies, UINT16 usNumEnemyArmedVehicles, UINT8 ubIconPosition );
|
||||
void ShowUncertainNumberEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
||||
void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubIconPosition );
|
||||
|
||||
@@ -1256,7 +1256,7 @@ INT32 ShowVehicles(INT16 sMapX, INT16 sMapY, INT32 iCount)
|
||||
}
|
||||
|
||||
|
||||
void ShowEnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sNumberOfEnemies, UINT16 usNumTanks, UINT8 ubIconPosition )
|
||||
void ShowEnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sNumberOfEnemies, UINT16 usNumEnemyArmedVehicles, UINT8 ubIconPosition )
|
||||
{
|
||||
HVOBJECT hIconHandle;
|
||||
INT16 sEnemy, s10xEnemy, sEnemyLessTank;
|
||||
@@ -1264,7 +1264,7 @@ void ShowEnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sNumberOfEnemies
|
||||
// get the video object
|
||||
GetVideoObject(&hIconHandle, guiCHARICONS);
|
||||
|
||||
sEnemyLessTank = sNumberOfEnemies - usNumTanks;
|
||||
sEnemyLessTank = sNumberOfEnemies - usNumEnemyArmedVehicles;
|
||||
|
||||
// no 10x icon for easy enemy quantity gauge in low resolution
|
||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
@@ -1285,17 +1285,17 @@ void ShowEnemiesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sNumberOfEnemies
|
||||
{
|
||||
// Flugente: the tank icon has is 4 icons wide and 2 rows high, thus this odd code bit
|
||||
// if we want to display a tank and have not yet done so, pick the first position that still has enough space to the right
|
||||
if ( usNumTanks && secondtankrowstart < 0 && ( ubIconPosition % MERC_ICONS_PER_LINE ) < 3 )
|
||||
if ( usNumEnemyArmedVehicles && secondtankrowstart < 0 && (ubIconPosition % MERC_ICONS_PER_LINE) < 3 )
|
||||
{
|
||||
DrawMapBoxIcon( hIconHandle, ENEMY_TANK_BIG, sSectorX, sSectorY, ubIconPosition );
|
||||
secondtankrowstart = ubIconPosition + 6;
|
||||
ubIconPosition += 4;
|
||||
}
|
||||
// if this is the second row of a tank, don't draw anything
|
||||
else if ( usNumTanks && secondtankrowstart > -1 && ubIconPosition == secondtankrowstart )
|
||||
else if ( usNumEnemyArmedVehicles && secondtankrowstart > -1 && ubIconPosition == secondtankrowstart )
|
||||
{
|
||||
// for now display only one tank icon
|
||||
usNumTanks = 0;
|
||||
usNumEnemyArmedVehicles = 0;
|
||||
ubIconPosition += 4;
|
||||
sEnemy = max( 0, sEnemy - 1 );
|
||||
}
|
||||
@@ -6598,6 +6598,7 @@ BOOLEAN CanMercsScoutThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
|
||||
void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubIconPosition )
|
||||
{
|
||||
INT16 sNumberOfEnemies = 0;
|
||||
UINT16 usNumEnemyArmedVehicles = 0;
|
||||
|
||||
// ATE: If game has just started, don't do it!
|
||||
if ( DidGameJustStart() )
|
||||
@@ -6677,10 +6678,10 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
||||
case KNOWS_HOW_MANY:
|
||||
{
|
||||
// Flugente: tanks get a special icon, so we need to count them separately
|
||||
UINT16 usNumTanks = NumTanksInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
usNumEnemyArmedVehicles = NumEnemyArmedVehiclesInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
|
||||
// display individual icons for each enemy, starting at the received icon position index
|
||||
ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumTanks, ubIconPosition );
|
||||
ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumEnemyArmedVehicles, ubIconPosition );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -6688,10 +6689,10 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
||||
case KNOWS_HOW_MANY_AND_WHERE_GOING:
|
||||
{
|
||||
// Flugente: tanks get a special icon, so we need to count them separately
|
||||
UINT16 usNumTanks = NumTanksInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
usNumEnemyArmedVehicles = NumEnemyArmedVehiclesInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
|
||||
// display individual icons for each enemy, starting at the received icon position index
|
||||
ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumTanks, ubIconPosition );
|
||||
ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumEnemyArmedVehicles, ubIconPosition );
|
||||
|
||||
// display their direction of movement, if valid.
|
||||
ShowNonPlayerGroupsInMotion( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
|
||||
@@ -227,13 +227,14 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup )
|
||||
{
|
||||
if( pGroup->ubSectorX == pLocGroup->ubSectorX && pGroup->ubSectorY == pLocGroup->ubSectorY )
|
||||
{
|
||||
if( pGroup->pEnemyGroup->ubAdminsInBattle || pGroup->pEnemyGroup->ubTroopsInBattle || pGroup->pEnemyGroup->ubElitesInBattle || pGroup->pEnemyGroup->ubTanksInBattle )
|
||||
if ( pGroup->pEnemyGroup->ubAdminsInBattle || pGroup->pEnemyGroup->ubTroopsInBattle || pGroup->pEnemyGroup->ubElitesInBattle || pGroup->pEnemyGroup->ubTanksInBattle || pGroup->pEnemyGroup->ubJeepsInBattle )
|
||||
{
|
||||
++ubInvalidGroups;
|
||||
pGroup->pEnemyGroup->ubAdminsInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubTroopsInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubElitesInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubTanksInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubJeepsInBattle = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,19 +252,21 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup )
|
||||
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) Ta(%02d:%02d)",
|
||||
L"G(%02d:%c%d_b%d) A(%02d:%02d) T(%02d:%02d) E(%02d:%02d) C(%02d:%02d) Ta(%02d:%02d) J(%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,
|
||||
pSector->ubNumTanks, pSector->ubTanksInBattle );
|
||||
pSector->ubNumTanks, pSector->ubTanksInBattle,
|
||||
pSector->ubNumJeeps, pSector->ubJeepsInBattle );
|
||||
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
|
||||
pSector->ubAdminsInBattle = 0;
|
||||
pSector->ubTroopsInBattle = 0;
|
||||
pSector->ubElitesInBattle = 0;
|
||||
pSector->ubCreaturesInBattle = 0;
|
||||
pSector->ubTanksInBattle = 0;
|
||||
pSector->ubJeepsInBattle = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+138
-49
@@ -282,11 +282,11 @@ UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubT
|
||||
return ubNumTroops;
|
||||
}
|
||||
|
||||
UINT16 NumTanksInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam )
|
||||
UINT16 NumEnemyArmedVehiclesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam )
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
GROUP *pGroup;
|
||||
UINT8 ubNum;
|
||||
UINT16 ubNum;
|
||||
|
||||
// HEADROCK: This is a TEMPORARY fix to avoid the assertion error. Not sure this is the best solution,
|
||||
// probably isn't. But I need this bit to work.
|
||||
@@ -306,18 +306,14 @@ UINT16 NumTanksInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam )
|
||||
pSector = &SectorInfo[SECTOR( sSectorX, sSectorY )];
|
||||
|
||||
if ( usTeam == ENEMY_TEAM )
|
||||
ubNum = (UINT16)(pSector->ubNumTanks);
|
||||
|
||||
// TODO
|
||||
//if ( is_networked )
|
||||
//ubNumTroops += numenemyLAN( (UINT8)sSectorX, (UINT8)sSectorY ); //hayden
|
||||
|
||||
ubNum = (UINT16)(pSector->ubNumTanks + pSector->ubNumJeeps);
|
||||
|
||||
pGroup = gpGroupList;
|
||||
while ( pGroup )
|
||||
{
|
||||
if ( pGroup->usGroupTeam == usTeam && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||
{
|
||||
ubNum += pGroup->pEnemyGroup->ubNumTanks;
|
||||
ubNum += pGroup->pEnemyGroup->ubNumTanks + pGroup->pEnemyGroup->ubNumJeeps;
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
@@ -383,7 +379,7 @@ UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
return ubNumTroops;
|
||||
}
|
||||
|
||||
void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks )
|
||||
void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps )
|
||||
{
|
||||
GROUP *pGroup;
|
||||
SECTORINFO *pSector;
|
||||
@@ -393,7 +389,7 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
|
||||
//Now count the number of mobile groups in the sector.
|
||||
*pubNumTroops = *pubNumElites = *pubNumAdmins = *pubNumTanks = 0;
|
||||
*pubNumTroops = *pubNumElites = *pubNumAdmins = *pubNumTanks = *pubNumJeeps =0;
|
||||
pGroup = gpGroupList;
|
||||
while( pGroup )
|
||||
{
|
||||
@@ -403,6 +399,7 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu
|
||||
*pubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
||||
*pubNumAdmins += pGroup->pEnemyGroup->ubNumAdmins;
|
||||
*pubNumTanks += pGroup->pEnemyGroup->ubNumTanks;
|
||||
*pubNumJeeps += pGroup->pEnemyGroup->ubNumJeeps;
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
@@ -415,10 +412,11 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu
|
||||
*pubNumTroops += pSector->ubNumTroops;
|
||||
*pubNumElites += pSector->ubNumElites;
|
||||
*pubNumTanks += pSector->ubNumTanks;
|
||||
*pubNumJeeps += pSector->ubNumJeeps;
|
||||
}
|
||||
}
|
||||
|
||||
void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks )
|
||||
void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps )
|
||||
{
|
||||
GROUP *pGroup;
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
@@ -427,7 +425,7 @@ void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSe
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
|
||||
//Now count the number of mobile groups in the sector.
|
||||
*pubNumTroops = *pubNumElites = *pubNumAdmins = *pubNumTanks = 0;
|
||||
*pubNumTroops = *pubNumElites = *pubNumAdmins = *pubNumTanks = *pubNumJeeps = 0;
|
||||
pGroup = gpGroupList;
|
||||
while( pGroup )
|
||||
{
|
||||
@@ -437,13 +435,14 @@ void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSe
|
||||
*pubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
||||
*pubNumAdmins += pGroup->pEnemyGroup->ubNumAdmins;
|
||||
*pubNumTanks += pGroup->pEnemyGroup->ubNumTanks;
|
||||
*pubNumJeeps += pGroup->pEnemyGroup->ubNumJeeps;
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks )
|
||||
void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps )
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
@@ -457,20 +456,22 @@ void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8
|
||||
*pubNumTroops = pSector->ubNumTroops;
|
||||
*pubNumElites = pSector->ubNumElites;
|
||||
*pubNumTanks = pSector->ubNumTanks;
|
||||
*pubNumJeeps = pSector->ubNumJeeps;
|
||||
}
|
||||
|
||||
void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks )
|
||||
void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps )
|
||||
{
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks;
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps;
|
||||
|
||||
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites, pubNumTanks );
|
||||
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites, pubNumTanks, pubNumJeeps );
|
||||
|
||||
GetNumberOfMobileEnemiesInSector( sSectorX, sSectorY, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
GetNumberOfMobileEnemiesInSector( sSectorX, sSectorY, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
*pubNumAdmins += ubNumAdmins;
|
||||
*pubNumTroops += ubNumTroops;
|
||||
*pubNumElites += ubNumElites;
|
||||
*pubNumTanks += ubNumTanks;
|
||||
*pubNumJeeps += ubNumJeeps;
|
||||
}
|
||||
|
||||
void EndTacticalBattleForEnemy()
|
||||
@@ -487,6 +488,7 @@ void EndTacticalBattleForEnemy()
|
||||
pSector->ubTroopsInBattle = 0;
|
||||
pSector->ubElitesInBattle = 0;
|
||||
pSector->ubTanksInBattle = 0;
|
||||
pSector->ubJeepsInBattle = 0;
|
||||
}
|
||||
else if( !gbWorldSectorZ )
|
||||
{
|
||||
@@ -497,6 +499,7 @@ void EndTacticalBattleForEnemy()
|
||||
pSector->ubTroopsInBattle = 0;
|
||||
pSector->ubElitesInBattle = 0;
|
||||
pSector->ubTanksInBattle = 0;
|
||||
pSector->ubJeepsInBattle = 0;
|
||||
pSector->ubNumCreatures = 0;
|
||||
pSector->ubCreaturesInBattle = 0;
|
||||
}
|
||||
@@ -516,6 +519,7 @@ void EndTacticalBattleForEnemy()
|
||||
pGroup->pEnemyGroup->ubElitesInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubAdminsInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubTanksInBattle = 0;
|
||||
pGroup->pEnemyGroup->ubJeepsInBattle = 0;
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
@@ -570,8 +574,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
SECTORINFO *pSector;
|
||||
GROUP *pGroup;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
unsigned ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks;
|
||||
unsigned ubTotalAdmins, ubTotalElites, ubTotalTroops, ubTotalTanks = 0;
|
||||
unsigned ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps;
|
||||
unsigned ubTotalAdmins, ubTotalElites, ubTotalTroops, ubTotalTanks, ubTotalJeeps = 0;
|
||||
unsigned totalCountOfStationaryEnemies = 0;
|
||||
unsigned totalCountOfMobileEnemies = 0;
|
||||
int sNumSlots;
|
||||
@@ -627,7 +631,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
!pGroup->pEnemyGroup->ubAdminsInBattle &&
|
||||
!pGroup->pEnemyGroup->ubTroopsInBattle &&
|
||||
!pGroup->pEnemyGroup->ubElitesInBattle &&
|
||||
!pGroup->pEnemyGroup->ubTanksInBattle)
|
||||
!pGroup->pEnemyGroup->ubTanksInBattle &&
|
||||
!pGroup->pEnemyGroup->ubJeepsInBattle )
|
||||
{
|
||||
HandleArrivalOfReinforcements( pGroup );
|
||||
}
|
||||
@@ -665,12 +670,13 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
// OJW - 20090403 - override max ai in co-op
|
||||
if (is_networked && is_server && gMaxEnemiesEnabled == 1)
|
||||
{
|
||||
float totalEnemies = (float)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks);
|
||||
float totalEnemies = (float)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks + pSector->ubNumJeeps);
|
||||
ubTotalAdmins = (unsigned int)(((float)pSector->ubNumAdmins / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
ubTotalTroops = (unsigned int)(((float)pSector->ubNumTroops / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
ubTotalElites = (unsigned int)(((float)pSector->ubNumElites / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
ubTotalTanks = (unsigned int)(((float)pSector->ubNumTanks / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
totalEnemies = (float)(ubTotalAdmins + ubTotalTroops + ubTotalElites + ubTotalTanks);
|
||||
ubTotalJeeps = (unsigned int)(((float)pSector->ubNumJeeps / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
totalEnemies = (float)(ubTotalAdmins + ubTotalTroops + ubTotalElites + ubTotalTanks + ubTotalJeeps);
|
||||
|
||||
// take care of any rounding losses
|
||||
while (totalEnemies < mapMaximumNumberOfEnemies)
|
||||
@@ -684,10 +690,12 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
pSector->ubNumTroops = ubTotalTroops;
|
||||
pSector->ubNumElites = ubTotalElites;
|
||||
pSector->ubNumTanks = ubTotalTanks;
|
||||
pSector->ubNumJeeps = ubTotalJeeps;
|
||||
pSector->ubAdminsInBattle = 0;
|
||||
pSector->ubTroopsInBattle = 0;
|
||||
pSector->ubElitesInBattle = 0;
|
||||
pSector->ubTanksInBattle = 0;
|
||||
pSector->ubJeepsInBattle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -706,6 +714,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
case SOLDIER_CLASS_ARMY: ubTotalTroops++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubTotalElites++; break;
|
||||
case SOLDIER_CLASS_TANK: ubTotalTanks++; break;
|
||||
case SOLDIER_CLASS_JEEP: ubTotalJeeps++; break;
|
||||
}
|
||||
}
|
||||
curr = curr->next;
|
||||
@@ -714,10 +723,12 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
pSector->ubNumTroops = ubTotalTroops;
|
||||
pSector->ubNumElites = ubTotalElites;
|
||||
pSector->ubNumTanks = ubTotalTanks;
|
||||
pSector->ubNumJeeps = ubTotalJeeps;
|
||||
pSector->ubAdminsInBattle = 0;
|
||||
pSector->ubTroopsInBattle = 0;
|
||||
pSector->ubElitesInBattle = 0;
|
||||
pSector->ubTanksInBattle = 0;
|
||||
pSector->ubJeepsInBattle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -725,10 +736,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
ubTotalTroops = pSector->ubNumTroops - pSector->ubTroopsInBattle;
|
||||
ubTotalElites = pSector->ubNumElites - pSector->ubElitesInBattle;
|
||||
ubTotalTanks = pSector->ubNumTanks - pSector->ubTanksInBattle;
|
||||
ubTotalJeeps = pSector->ubNumJeeps - pSector->ubJeepsInBattle;
|
||||
}
|
||||
}
|
||||
|
||||
totalCountOfStationaryEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites + ubTotalTanks;
|
||||
totalCountOfStationaryEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites + ubTotalTanks + ubTotalJeeps;
|
||||
|
||||
if( totalCountOfStationaryEnemies > mapMaximumNumberOfEnemies )
|
||||
{
|
||||
@@ -743,20 +755,22 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
ubTotalTroops = min( mapMaximumNumberOfEnemies-ubTotalAdmins, ubTotalTroops );
|
||||
ubTotalElites = min( mapMaximumNumberOfEnemies-ubTotalAdmins-ubTotalTroops, ubTotalElites );
|
||||
ubTotalTanks = min( mapMaximumNumberOfEnemies-ubTotalAdmins-ubTotalTroops-ubTotalElites, ubTotalTanks );
|
||||
ubTotalJeeps = min( mapMaximumNumberOfEnemies - ubTotalAdmins - ubTotalTroops - ubTotalElites - ubTotalTanks, ubTotalJeeps );
|
||||
}
|
||||
|
||||
pSector->ubAdminsInBattle += ubTotalAdmins;
|
||||
pSector->ubTroopsInBattle += ubTotalTroops;
|
||||
pSector->ubElitesInBattle += ubTotalElites;
|
||||
pSector->ubTanksInBattle += ubTotalTanks;
|
||||
pSector->ubJeepsInBattle += ubTotalJeeps;
|
||||
|
||||
#ifdef JA2TESTVERSION
|
||||
if( gfOverrideSector )
|
||||
{
|
||||
//if there are no troops in the current groups, then we're done.
|
||||
if( !ubTotalAdmins && !ubTotalTroops && !ubTotalElites && !ubTotalTanks )
|
||||
if ( !ubTotalAdmins && !ubTotalTroops && !ubTotalElites && !ubTotalTanks && !ubTotalJeeps )
|
||||
return FALSE;
|
||||
AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites, ubTotalTanks );
|
||||
AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites, ubTotalTanks, ubTotalJeeps );
|
||||
ValidateEnemiesHaveWeapons();
|
||||
return TRUE;
|
||||
}
|
||||
@@ -783,7 +797,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
//Subtract the total number of stationary enemies from the available slots, as stationary forces take
|
||||
//precendence in combat. The mobile forces that could also be in the same sector are considered later if
|
||||
//all the slots fill up.
|
||||
sNumSlots -= ubTotalAdmins + ubTotalTroops + ubTotalElites + ubTotalTanks;
|
||||
sNumSlots -= ubTotalAdmins + ubTotalTroops + ubTotalElites + ubTotalTanks + ubTotalJeeps;
|
||||
|
||||
//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
|
||||
@@ -850,6 +864,21 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
pGroup->pEnemyGroup->ubTanksInBattle += ubNumTanks;
|
||||
ubTotalTanks += ubNumTanks;
|
||||
}
|
||||
if ( sNumSlots > 0 )
|
||||
{
|
||||
//Add jeeps
|
||||
AssertGE( pGroup->pEnemyGroup->ubNumJeeps, pGroup->pEnemyGroup->ubJeepsInBattle );
|
||||
ubNumJeeps = pGroup->pEnemyGroup->ubNumJeeps - pGroup->pEnemyGroup->ubJeepsInBattle;
|
||||
sNumSlots -= ubNumJeeps;
|
||||
if ( sNumSlots < 0 )
|
||||
{ //adjust the value to zero
|
||||
ubNumJeeps += sNumSlots;
|
||||
sNumSlots = 0;
|
||||
gfPendingNonPlayerTeam[ENEMY_TEAM] = TRUE;
|
||||
}
|
||||
pGroup->pEnemyGroup->ubJeepsInBattle += ubNumJeeps;
|
||||
ubTotalJeeps += ubNumJeeps;
|
||||
}
|
||||
//NOTE:
|
||||
//no provisions for profile troop leader or retreat groups yet.
|
||||
}
|
||||
@@ -871,12 +900,12 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
}
|
||||
|
||||
//if there are no troops in the current groups, then we're done.
|
||||
if( !ubTotalAdmins && !ubTotalTroops && !ubTotalElites && !ubTotalTanks )
|
||||
if ( !ubTotalAdmins && !ubTotalTroops && !ubTotalElites && !ubTotalTanks && !ubTotalJeeps )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites, ubTotalTanks );
|
||||
AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites, ubTotalTanks, ubTotalJeeps );
|
||||
|
||||
//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
|
||||
@@ -895,7 +924,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
ubNumTroops = pGroup->pEnemyGroup->ubTroopsInBattle;
|
||||
ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
|
||||
ubNumTanks = pGroup->pEnemyGroup->ubTanksInBattle;
|
||||
unsigned num = ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks;
|
||||
ubNumJeeps = pGroup->pEnemyGroup->ubJeepsInBattle;
|
||||
unsigned num = ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps;
|
||||
|
||||
unsigned firstSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
|
||||
unsigned lastSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bLastID;
|
||||
@@ -974,6 +1004,15 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
}
|
||||
break;
|
||||
case SOLDIER_CLASS_JEEP:
|
||||
if ( ubNumTanks )
|
||||
{
|
||||
num--;
|
||||
sNumSlots--;
|
||||
ubNumJeeps--;
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,6 +1022,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
AssertEQ( ubNumTroops , 0);
|
||||
AssertEQ( ubNumAdmins , 0);
|
||||
AssertEQ( ubNumTanks , 0);
|
||||
AssertEQ( ubNumJeeps , 0);
|
||||
AssertEQ( num , 0);*/
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
@@ -996,7 +1036,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
BOOLEAN PrepareEnemyForUndergroundBattle()
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pUnderground;
|
||||
unsigned ubTotalAdmins, ubTotalTroops, ubTotalElites, ubTotalTanks;
|
||||
unsigned ubTotalAdmins, ubTotalTroops, ubTotalElites, ubTotalTanks, ubTotalJeeps;
|
||||
|
||||
pUnderground = gpUndergroundSectorInfoHead;
|
||||
while( pUnderground )
|
||||
@@ -1011,14 +1051,16 @@ BOOLEAN PrepareEnemyForUndergroundBattle()
|
||||
ubTotalTroops = (UINT8)(pUnderground->ubNumTroops - pUnderground->ubTroopsInBattle);
|
||||
ubTotalElites = (UINT8)(pUnderground->ubNumElites - pUnderground->ubElitesInBattle);
|
||||
ubTotalTanks = (UINT8)(pUnderground->ubNumTanks - pUnderground->ubTanksInBattle);
|
||||
ubTotalJeeps = (UINT8)(pUnderground->ubNumJeeps - pUnderground->ubJeepsInBattle);
|
||||
pUnderground->ubAdminsInBattle += ubTotalAdmins;
|
||||
pUnderground->ubTroopsInBattle += ubTotalTroops;
|
||||
pUnderground->ubElitesInBattle += ubTotalElites;
|
||||
pUnderground->ubTanksInBattle += ubTotalTanks;
|
||||
AddSoldierInitListEnemyDefenceSoldiers( pUnderground->ubNumAdmins, pUnderground->ubNumTroops, pUnderground->ubNumElites, pUnderground->ubNumTanks );
|
||||
pUnderground->ubJeepsInBattle += ubTotalJeeps;
|
||||
AddSoldierInitListEnemyDefenceSoldiers( pUnderground->ubNumAdmins, pUnderground->ubNumTroops, pUnderground->ubNumElites, pUnderground->ubNumTanks, pUnderground->ubNumJeeps );
|
||||
ValidateEnemiesHaveWeapons();
|
||||
}
|
||||
return ( ( BOOLEAN) ( pUnderground->ubNumAdmins + pUnderground->ubNumTroops + pUnderground->ubNumElites + pUnderground->ubNumTanks > 0 ) );
|
||||
return ((BOOLEAN)(pUnderground->ubNumAdmins + pUnderground->ubNumTroops + pUnderground->ubNumElites + pUnderground->ubNumTanks + pUnderground->ubNumJeeps > 0));
|
||||
}
|
||||
pUnderground = pUnderground->next;
|
||||
}
|
||||
@@ -1544,7 +1586,7 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
#endif
|
||||
|
||||
UINT8 ubSlots, ubNumAvailable;
|
||||
UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumTanks;
|
||||
UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumTanks, ubNumJeeps;
|
||||
UINT8 ubNumGroupsInSector;
|
||||
UINT8 ubGroupIndex;
|
||||
GROUP *pGroup;
|
||||
@@ -1639,11 +1681,12 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
//return;
|
||||
}
|
||||
|
||||
if( pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumTanks )
|
||||
if ( pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumTanks + pSector->ubNumJeeps )
|
||||
{
|
||||
ubNumElites = ubNumTroops = ubNumAdmins = ubNumTanks = 0;
|
||||
ubNumElites = ubNumTroops = ubNumAdmins = ubNumTanks = ubNumJeeps = 0;
|
||||
|
||||
ubNumAvailable = pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumTanks - pSector->ubElitesInBattle - pSector->ubTroopsInBattle - pSector->ubAdminsInBattle - pSector->ubTanksInBattle;
|
||||
ubNumAvailable = pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumTanks + pSector->ubNumJeeps
|
||||
- pSector->ubElitesInBattle - pSector->ubTroopsInBattle - pSector->ubAdminsInBattle - pSector->ubTanksInBattle - pSector->ubJeepsInBattle;
|
||||
while( ubNumAvailable && ubSlots )
|
||||
{
|
||||
// So they just magically appear out of nowhere from the edge?
|
||||
@@ -1677,6 +1720,14 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
ubSlots--;
|
||||
ubNumTanks++;
|
||||
}
|
||||
else if ( pSector->ubJeepsInBattle < pSector->ubNumJeeps )
|
||||
{
|
||||
//Add a jeep
|
||||
pSector->ubJeepsInBattle++;
|
||||
ubNumAvailable--;
|
||||
ubSlots--;
|
||||
ubNumJeeps++;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertMsg( 0, "AddPossiblePendingEnemiesToBattle(): Logic Error -- by Kris" );
|
||||
@@ -1684,7 +1735,7 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
}
|
||||
|
||||
|
||||
if( ubNumAdmins || ubNumTroops || ubNumElites || ubNumTanks )
|
||||
if ( ubNumAdmins || ubNumTroops || ubNumElites || ubNumTanks || ubNumJeeps )
|
||||
{ //This group has contributed forces, then add them now, because different
|
||||
//groups appear on different sides of the map.
|
||||
UINT8 ubStrategicInsertionCode = ubPredefinedInsertionCode;
|
||||
@@ -1725,7 +1776,7 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
if( ubStrategicInsertionCode < INSERTION_CODE_NORTH ||ubStrategicInsertionCode > INSERTION_CODE_WEST )
|
||||
ubStrategicInsertionCode = INSERTION_CODE_NORTH + Random( 4 );
|
||||
|
||||
AddEnemiesToBattle( 0, ubStrategicInsertionCode, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, FALSE );
|
||||
AddEnemiesToBattle( 0, ubStrategicInsertionCode, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, FALSE );
|
||||
gfPendingNonPlayerTeam[ENEMY_TEAM] = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1755,7 +1806,8 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
pGroup = pGroupInSectorList[ ubGroupIndex];
|
||||
|
||||
// Flugente fix: check for underflow...
|
||||
UINT8 currentgroupsize = pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle + pGroup->pEnemyGroup->ubTanksInBattle;
|
||||
UINT8 currentgroupsize = pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle
|
||||
+ pGroup->pEnemyGroup->ubTanksInBattle + pGroup->pEnemyGroup->ubJeepsInBattle;
|
||||
if ( currentgroupsize > pGroup->ubGroupSize )
|
||||
ubNumAvailable = 0;
|
||||
else
|
||||
@@ -1816,25 +1868,32 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
{ //Add an elite troop
|
||||
pGroup->pEnemyGroup->ubElitesInBattle++;
|
||||
ubSlots--;
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 0, 1, 0, FALSE );
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 0, 1, 0, 0, FALSE );
|
||||
}
|
||||
else if( pGroup->pEnemyGroup->ubTroopsInBattle < pGroup->pEnemyGroup->ubNumTroops )
|
||||
{ //Add a regular troop.
|
||||
pGroup->pEnemyGroup->ubTroopsInBattle++;
|
||||
ubSlots--;
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 1, 0, 0, FALSE );
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 1, 0, 0, 0, FALSE );
|
||||
}
|
||||
else if( pGroup->pEnemyGroup->ubAdminsInBattle < pGroup->pEnemyGroup->ubNumAdmins )
|
||||
{ //Add an admin troop
|
||||
pGroup->pEnemyGroup->ubAdminsInBattle++;
|
||||
ubSlots--;
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 1, 0, 0, 0, FALSE );
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 1, 0, 0, 0, 0, FALSE );
|
||||
}
|
||||
else if( pGroup->pEnemyGroup->ubTanksInBattle < pGroup->pEnemyGroup->ubNumTanks )
|
||||
{ //Add a tank
|
||||
pGroup->pEnemyGroup->ubTanksInBattle++;
|
||||
ubSlots--;
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 0, 0, 1, FALSE );
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 0, 0, 1, 0, FALSE );
|
||||
}
|
||||
else if ( pGroup->pEnemyGroup->ubJeepsInBattle < pGroup->pEnemyGroup->ubNumJeeps )
|
||||
{
|
||||
//Add a jeep
|
||||
pGroup->pEnemyGroup->ubJeepsInBattle++;
|
||||
ubSlots--;
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 0, 0, 0, 1, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1843,7 +1902,7 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
|
||||
pGroup->pEnemyGroup->ubTroopsInBattle++;
|
||||
ubSlots--;
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 1, 0, 0, FALSE );
|
||||
AddEnemiesToBattle( pGroup, ubInsertionCode, 0, 1, 0, 0, 0, FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1913,7 +1972,7 @@ void NotifyPlayersOfNewEnemies()
|
||||
}
|
||||
}
|
||||
|
||||
void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, BOOLEAN fMagicallyAppeared )
|
||||
void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps, BOOLEAN fMagicallyAppeared )
|
||||
{
|
||||
SOLDIERTYPE *pSoldier;
|
||||
MAPEDGEPOINTINFO MapEdgepointInfo;
|
||||
@@ -1946,6 +2005,8 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
pSector->ubElitesInBattle += ubNumElites;
|
||||
pSector->ubNumTanks += ubNumTanks;
|
||||
pSector->ubTanksInBattle += ubNumTanks;
|
||||
pSector->ubNumJeeps += ubNumJeeps;
|
||||
pSector->ubJeepsInBattle += ubNumJeeps;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1960,13 +2021,15 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
pSector->ubElitesInBattle += ubNumElites;
|
||||
pSector->ubNumTanks += ubNumTanks;
|
||||
pSector->ubTanksInBattle += ubNumTanks;
|
||||
pSector->ubNumJeeps += ubNumJeeps;
|
||||
pSector->ubJeepsInBattle += ubNumJeeps;
|
||||
}
|
||||
}
|
||||
//Because the enemies magically appeared, have one of our soldiers say something...
|
||||
NotifyPlayersOfNewEnemies();
|
||||
}
|
||||
|
||||
ubTotalSoldiers = ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks;
|
||||
ubTotalSoldiers = ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps;
|
||||
|
||||
#ifdef JA2UB
|
||||
if( gsGridNoForMapEdgePointInfo != -1 )
|
||||
@@ -2093,6 +2156,30 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
|
||||
}
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
||||
}
|
||||
else if ( ubNumJeeps && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumTroops + ubNumAdmins + ubNumTanks + ubNumJeeps) && ubNumberOfVehicles < 9 )
|
||||
{
|
||||
ubNumJeeps--;
|
||||
ubTotalSoldiers--;
|
||||
Assert( pSoldier = TacticalCreateEnemyJeep( ) );
|
||||
if ( pGroup )
|
||||
{
|
||||
pSoldier->ubGroupID = pGroup->ubGroupID;
|
||||
}
|
||||
|
||||
pSoldier->ubInsertionDirection = bDesiredDirection;
|
||||
//Setup the position
|
||||
if ( ubCurrSlot < MapEdgepointInfo.ubNumPoints )
|
||||
{ //using an edgepoint
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ubCurrSlot++];
|
||||
}
|
||||
else
|
||||
{ //no edgepoints left, so put him at the entrypoint.
|
||||
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
|
||||
}
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
||||
}
|
||||
|
||||
// HEADROCK HAM 3.2: enemy reinforcements arrive with 0 APs.
|
||||
if (gGameExternalOptions.ubReinforcementsFirstTurnFreeze == 1 || gGameExternalOptions.ubReinforcementsFirstTurnFreeze == 2)
|
||||
{
|
||||
@@ -2808,7 +2895,8 @@ BOOLEAN CheckPendingNonPlayerTeam( UINT8 usTeam )
|
||||
|
||||
if ( usTeam == ENEMY_TEAM )
|
||||
{
|
||||
if( (pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumTanks) > ( pSector->ubElitesInBattle + pSector->ubTroopsInBattle + pSector->ubAdminsInBattle + pSector->ubTanksInBattle) )
|
||||
if ( (pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins + pSector->ubNumTanks + pSector->ubNumJeeps) >
|
||||
(pSector->ubElitesInBattle + pSector->ubTroopsInBattle + pSector->ubAdminsInBattle + pSector->ubTanksInBattle + pSector->ubJeepsInBattle) )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2821,7 +2909,8 @@ BOOLEAN CheckPendingNonPlayerTeam( UINT8 usTeam )
|
||||
{
|
||||
if ( usTeam == ENEMY_TEAM )
|
||||
{
|
||||
if ( pGroup->ubGroupSize > pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle + pGroup->pEnemyGroup->ubTanksInBattle )
|
||||
if ( pGroup->ubGroupSize > pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle
|
||||
+ pGroup->pEnemyGroup->ubTanksInBattle + pGroup->pEnemyGroup->ubJeepsInBattle )
|
||||
return TRUE;
|
||||
}
|
||||
else if ( usTeam == MILITIA_TEAM )
|
||||
|
||||
@@ -22,13 +22,13 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
|
||||
// returns how many members of a team are in a sector - not intended for OUR_TEAM!
|
||||
UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam );
|
||||
|
||||
UINT16 NumTanksInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam );
|
||||
UINT16 NumEnemyArmedVehiclesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam );
|
||||
UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
||||
UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
||||
void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks );
|
||||
void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks );
|
||||
void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks );
|
||||
void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks );
|
||||
void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps );
|
||||
void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps );
|
||||
void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps );
|
||||
void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps );
|
||||
|
||||
//Called when entering a sector so the campaign AI can automatically insert the
|
||||
//correct number of troops of each type based on the current number in the sector
|
||||
@@ -36,7 +36,7 @@ void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAd
|
||||
BOOLEAN PrepareEnemyForSectorBattle();
|
||||
BOOLEAN PrepareEnemyForUndergroundBattle();
|
||||
|
||||
void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, BOOLEAN fMagicallyAppeared );
|
||||
void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 abNumJeeps, BOOLEAN fMagicallyAppeared );
|
||||
void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumGreens, UINT8 ubNumRegulars, UINT8 ubNumElites, BOOLEAN fMagicallyAppeared );
|
||||
void AddPossiblePendingEnemiesToBattle();
|
||||
void EndTacticalBattleForEnemy();
|
||||
|
||||
+33
-17
@@ -33,20 +33,21 @@
|
||||
UINT8 gubReinforcementMinEnemyStaticGroupSize = 12;
|
||||
UINT32 guiMilitiaReinforceTurn = 0, guiMilitiaArrived = 0;//dnl ch68 090913
|
||||
|
||||
void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks )
|
||||
void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps )
|
||||
{
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks;
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps;
|
||||
UINT16 pusMoveDir[4][3]; //first column in this matrix is number of sector, except for 4th row
|
||||
UINT8 ubDirNumber, ubIndex;
|
||||
|
||||
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites, pubNumTanks );
|
||||
GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites, pubNumTanks, pubNumJeeps );
|
||||
|
||||
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( sSectorX, sSectorY, ENEMY_TEAM, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( sSectorX, sSectorY, ENEMY_TEAM, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
*pubNumAdmins += ubNumAdmins;
|
||||
*pubNumTroops += ubNumTroops;
|
||||
*pubNumElites += ubNumElites;
|
||||
*pubNumTanks += ubNumTanks;
|
||||
*pubNumJeeps += ubNumJeeps;
|
||||
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
return;
|
||||
@@ -56,21 +57,23 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
|
||||
|
||||
GenerateDirectionInfos( sSectorX, sSectorY, &ubDirNumber, pusMoveDir, FALSE, TRUE );
|
||||
|
||||
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
||||
for( ubIndex = 0; ubIndex < ubDirNumber; ++ubIndex )
|
||||
{ //take number of the involved sector, find its X and Y coordintes and then ask for number of troops there
|
||||
GetNumberOfStationaryEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
GetNumberOfStationaryEnemiesInSector( SECTORX( pusMoveDir[ubIndex][0] ), SECTORY( pusMoveDir[ubIndex][0] ), &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
while( ubNumElites + ubNumTroops + ubNumAdmins + ubNumTanks > gubReinforcementMinEnemyStaticGroupSize) //count how many of static group will reinforce the battle, but leave minimal group size to guard
|
||||
while ( ubNumElites + ubNumTroops + ubNumAdmins + ubNumTanks + ubNumJeeps > gubReinforcementMinEnemyStaticGroupSize ) //count how many of static group will reinforce the battle, but leave minimal group size to guard
|
||||
{
|
||||
if( ubNumElites )
|
||||
{
|
||||
*pubNumElites += 1;
|
||||
ubNumElites--;
|
||||
}else if( ubNumTroops )
|
||||
}
|
||||
else if( ubNumTroops )
|
||||
{
|
||||
*pubNumTroops += 1;
|
||||
ubNumTroops--;
|
||||
}else if( ubNumAdmins )
|
||||
}
|
||||
else if( ubNumAdmins )
|
||||
{
|
||||
*pubNumAdmins += 1;
|
||||
ubNumAdmins--;
|
||||
@@ -80,24 +83,30 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
|
||||
*pubNumTanks += 1;
|
||||
ubNumTanks--;
|
||||
}
|
||||
else if ( ubNumJeeps )
|
||||
{
|
||||
*pubNumJeeps += 1;
|
||||
ubNumJeeps--;
|
||||
}
|
||||
}
|
||||
|
||||
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ), ENEMY_TEAM, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( SECTORX( pusMoveDir[ubIndex][0] ), SECTORY( pusMoveDir[ubIndex][0] ), ENEMY_TEAM, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
*pubNumAdmins += ubNumAdmins;
|
||||
*pubNumTroops += ubNumTroops;
|
||||
*pubNumElites += ubNumElites;
|
||||
*pubNumTanks += ubNumTanks;
|
||||
*pubNumJeeps += ubNumJeeps;
|
||||
}
|
||||
}
|
||||
|
||||
UINT8 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks;
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps;
|
||||
|
||||
GetNumberOfEnemiesInFiveSectors( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks );
|
||||
GetNumberOfEnemiesInFiveSectors( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumTanks, &ubNumJeeps );
|
||||
|
||||
return ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks;
|
||||
return ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps;
|
||||
}
|
||||
|
||||
BOOLEAN IsGroupInARightSectorToReinforce( GROUP *pGroup, INT16 sSectorX, INT16 sSectorY )
|
||||
@@ -255,28 +264,35 @@ UINT8 DoReinforcementAsPendingNonPlayer( INT16 sMapX, INT16 sMapY, UINT8 usTeam
|
||||
(pThisSector->ubNumElites)++;
|
||||
(pSector->ubNumElites)--;
|
||||
(pThisSector->ubElitesInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 0, 1, 0, FALSE );
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 0, 1, 0, 0, FALSE );
|
||||
}
|
||||
else if( pSector->ubNumTroops )
|
||||
{
|
||||
(pThisSector->ubNumTroops)++;
|
||||
(pSector->ubNumTroops)--;
|
||||
(pThisSector->ubTroopsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 1, 0, 0, FALSE );
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 1, 0, 0, 0, FALSE );
|
||||
}
|
||||
else if( pSector->ubNumAdmins )
|
||||
{
|
||||
(pThisSector->ubNumAdmins)++;
|
||||
(pSector->ubNumAdmins)--;
|
||||
(pThisSector->ubAdminsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 1, 0, 0, 0, FALSE );
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 1, 0, 0, 0, 0, FALSE );
|
||||
}
|
||||
else if( pSector->ubNumTanks )
|
||||
{
|
||||
(pThisSector->ubNumTanks)++;
|
||||
(pSector->ubNumTanks)--;
|
||||
(pThisSector->ubTanksInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 0, 0, 1, FALSE );
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ ubIndex ][ 2 ], 0, 0, 0, 1, 0, FALSE );
|
||||
}
|
||||
else if ( pSector->ubNumJeeps )
|
||||
{
|
||||
(pThisSector->ubNumJeeps)++;
|
||||
(pSector->ubNumJeeps)--;
|
||||
(pThisSector->ubJeepsInBattle)++;
|
||||
AddEnemiesToBattle( NULL, (UINT8)pusMoveDir[ubIndex][2], 0, 0, 0, 0, 1, FALSE );
|
||||
}
|
||||
|
||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define __REINFORCEMENT_H__
|
||||
|
||||
//For Autoresolve (mostly)
|
||||
void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks );
|
||||
void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumTanks, UINT8 *pubNumJeeps );
|
||||
BOOLEAN IsGroupInARightSectorToReinforce( GROUP *pGroup, INT16 sSectorX, INT16 sSectorY );
|
||||
UINT8 GetAdjacentSectors( UINT8 pSectors[4], INT16 sSectorX, INT16 sSectorY );
|
||||
UINT8 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY);
|
||||
|
||||
+464
-232
File diff suppressed because it is too large
Load Diff
@@ -700,7 +700,7 @@ BOOLEAN AddWaypointStrategicIDToPGroup( GROUP *pGroup, UINT32 uiSectorID )
|
||||
|
||||
//Enemy grouping functions -- private use by the strategic AI.
|
||||
//............................................................
|
||||
GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks )
|
||||
GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks, UINT8 ubNumJeeps )
|
||||
{
|
||||
GROUP *pNew;
|
||||
AssertMsg( uiSector >= 0 && uiSector <= 255, String( "CreateNewEnemyGroup with out of range value of %d", uiSector ) );
|
||||
@@ -711,7 +711,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
||||
AssertMsg( pNew->pEnemyGroup, "MemAlloc failure during enemy group creation." );
|
||||
memset( pNew->pEnemyGroup, 0, sizeof( ENEMYGROUP ) );
|
||||
// Make sure group is not bigger than allowed!
|
||||
while (ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks > gGameExternalOptions.iMaxEnemyGroupSize)
|
||||
while ( ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps > gGameExternalOptions.iMaxEnemyGroupSize )
|
||||
{
|
||||
if (ubNumTroops)
|
||||
{
|
||||
@@ -729,6 +729,10 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
||||
{
|
||||
ubNumTanks--;
|
||||
}
|
||||
else if ( ubNumJeeps )
|
||||
{
|
||||
ubNumJeeps--;
|
||||
}
|
||||
}
|
||||
pNew->pWaypoints = NULL;
|
||||
pNew->ubSectorX = (UINT8)SECTORX( uiSector );
|
||||
@@ -743,7 +747,8 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
||||
pNew->pEnemyGroup->ubNumTroops = ubNumTroops;
|
||||
pNew->pEnemyGroup->ubNumElites = ubNumElites;
|
||||
pNew->pEnemyGroup->ubNumTanks = ubNumTanks;
|
||||
pNew->ubGroupSize = (UINT8)(ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks);
|
||||
pNew->pEnemyGroup->ubNumJeeps = ubNumJeeps;
|
||||
pNew->ubGroupSize = (UINT8)(ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps);
|
||||
pNew->ubTransportationMask = FOOT;
|
||||
pNew->fVehicle = FALSE;
|
||||
pNew->ubCreatedSectorID = pNew->ubOriginalSector;
|
||||
|
||||
@@ -73,7 +73,9 @@ typedef struct ENEMYGROUP
|
||||
// WDS - New AI
|
||||
UINT8 ubNumTanks;
|
||||
UINT8 ubTanksInBattle;
|
||||
INT8 bPadding[18];
|
||||
UINT8 ubNumJeeps;
|
||||
UINT8 ubJeepsInBattle;
|
||||
INT8 bPadding[16];
|
||||
}ENEMYGROUP;
|
||||
|
||||
//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE
|
||||
@@ -181,7 +183,7 @@ BOOLEAN SetGroupPatrolParameters( UINT8 ubGroupID, UINT8 ubRestAtFL, UINT8 ubRes
|
||||
|
||||
//Enemy grouping functions -- private use by the strategic AI.
|
||||
//............................................................
|
||||
GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks );
|
||||
GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanksm, UINT8 ubNumJeeps );
|
||||
|
||||
GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites );
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ BOOLEAN LuaUnderground::InitializeSectorList()
|
||||
sectorData.getValue("numTroops", s->ubNumTroops);
|
||||
sectorData.getValue("numElites", s->ubNumElites);
|
||||
sectorData.getValue("numTanks", s->ubNumTanks);
|
||||
sectorData.getValue("numJeeps", s->ubNumJeeps );
|
||||
|
||||
sectorData.getValue("numBloodcats", s->ubNumBloodcats);
|
||||
sectorData.getValue("numCreatures", s->ubNumCreatures);
|
||||
@@ -106,6 +107,7 @@ BOOLEAN LuaUnderground::InitializeSectorList()
|
||||
m_log << "\t\tTroops: " << static_cast<int>(s->ubNumTroops) << LF;
|
||||
m_log << "\t\tElites: " << static_cast<int>(s->ubNumElites) << LF;
|
||||
m_log << "\t\tTanks: " << static_cast<int>(s->ubNumTanks) << LF;
|
||||
m_log << "\t\tJeeps: " << static_cast<int>(s->ubNumJeeps) << LF;
|
||||
m_log << "\t- Creature population" << LF;
|
||||
m_log << "\t\tBloodcats: " << static_cast<int>(s->ubNumBloodcats) << LF;
|
||||
m_log << "\t\tCrepitus: " << static_cast<int>(s->ubNumCreatures) << LF;
|
||||
|
||||
+33
-42
@@ -5349,56 +5349,47 @@ BOOLEAN LoadStrategicInfoFromSavedFile( HWFILE hFile )
|
||||
UINT32 uiNumBytesRead = 0;
|
||||
|
||||
UINT32 uiSize = sizeof(StrategicMapElement);
|
||||
|
||||
if ( guiCurrentSaveGameVersion >= MILITIA_MOVEMENT )
|
||||
{
|
||||
for ( UINT16 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y; ++i )
|
||||
{
|
||||
// Load the strategic map information
|
||||
FileRead( hFile, &StrategicMap[i], uiSize, &uiNumBytesRead );
|
||||
if ( uiNumBytesRead != uiSize )
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( guiCurrentSaveGameVersion < MILITIA_MOVEMENT )
|
||||
uiSize = 41;
|
||||
|
||||
for ( UINT16 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y; ++i )
|
||||
{
|
||||
// Load the strategic map information
|
||||
FileRead( hFile, &StrategicMap[i], uiSize, &uiNumBytesRead );
|
||||
if ( uiNumBytesRead != uiSize )
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
StrategicMap[i].usFlags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Load the Sector Info
|
||||
for ( int sectorID = 0; sectorID <= 255; ++sectorID )
|
||||
for ( UINT16 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y; ++i )
|
||||
{
|
||||
FileRead( hFile, &SectorInfo[sectorID], sizeof(SECTORINFO), &uiNumBytesRead );
|
||||
if ( uiNumBytesRead != sizeof(SECTORINFO) )
|
||||
// Load the strategic map information
|
||||
FileRead( hFile, &StrategicMap[i], uiSize, &uiNumBytesRead );
|
||||
if ( uiNumBytesRead != uiSize )
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
// Flugente: changes in SECTORINFO require a weird-looking remapping
|
||||
if ( guiCurrentSaveGameVersion < PRISONER_EXPANSION )
|
||||
{
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_GENERAL] = 0;
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_CIVILIAN] = 0;
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_SECRET1] = 0;
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_SECRET2] = 0;
|
||||
SectorInfo[sectorID].ubNumTanks = SectorInfo[sectorID].uiInterrogationHundredsLeft[PRISONER_GENERAL];
|
||||
SectorInfo[sectorID].ubTanksInBattle = SectorInfo[sectorID].uiInterrogationHundredsLeft[PRISONER_CIVILIAN];
|
||||
}
|
||||
if ( guiCurrentSaveGameVersion < MILITIA_MOVEMENT )
|
||||
StrategicMap[i].usFlags = 0;
|
||||
}
|
||||
|
||||
// Load the Sector Info
|
||||
uiSize = sizeof(SECTORINFO);
|
||||
if ( guiCurrentSaveGameVersion < ENEMY_JEEPS )
|
||||
uiSize = 116;
|
||||
|
||||
for ( int sectorID = 0; sectorID <= 255; ++sectorID )
|
||||
{
|
||||
FileRead( hFile, &SectorInfo[sectorID], uiSize, &uiNumBytesRead );
|
||||
if ( uiNumBytesRead != uiSize )
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
// Flugente: changes in SECTORINFO require a weird-looking remapping
|
||||
if ( guiCurrentSaveGameVersion < PRISONER_EXPANSION )
|
||||
{
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_GENERAL] = 0;
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_CIVILIAN] = 0;
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_SECRET1] = 0;
|
||||
SectorInfo[sectorID].uiNumberOfPrisonersOfWar[PRISONER_SECRET2] = 0;
|
||||
SectorInfo[sectorID].ubNumTanks = SectorInfo[sectorID].uiInterrogationHundredsLeft[PRISONER_GENERAL];
|
||||
SectorInfo[sectorID].ubTanksInBattle = SectorInfo[sectorID].uiInterrogationHundredsLeft[PRISONER_CIVILIAN];
|
||||
}
|
||||
}
|
||||
|
||||
// uiSize = sizeof( SECTORINFO ) * 256;
|
||||
// FileRead( hFile, SectorInfo, uiSize, &uiNumBytesRead );
|
||||
// if( uiNumBytesRead != uiSize)
|
||||
|
||||
Reference in New Issue
Block a user