mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Work has begun to enable strategic movement for other teams than just player and enemy.
- I've changed the GROUP struct - instead of BOOLEAN fPlayer we now have UINT8 usGroupTeam. - To further simplify the code, I've replaced UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); with UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam ); In the next days, more strategic functions will be simplified, merged and replaced. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7707 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+2
-1
@@ -21,6 +21,7 @@ extern CHAR16 zTrackingNumber[16];
|
|||||||
// Keeps track of the saved game version. Increment the saved game version whenever
|
// Keeps track of the saved game version. Increment the saved game version whenever
|
||||||
// you will invalidate the saved game file
|
// you will invalidate the saved game file
|
||||||
|
|
||||||
|
#define STRATEGIC_TEAM_GROUPS 161 // Flugente: a change to the GROUP-structure allows any team to have strategic movement groups
|
||||||
#define PMC_WEBSITE 160 // Flugente: a new PMC allows us to hire trained militia
|
#define PMC_WEBSITE 160 // Flugente: a new PMC allows us to hire trained militia
|
||||||
#define DISEASE_SYSTEM 159 // Flugente: mercs can get diseases
|
#define DISEASE_SYSTEM 159 // Flugente: mercs can get diseases
|
||||||
#define PRISONER_EXPANSION 158 // Flugente: more types of prisoners
|
#define PRISONER_EXPANSION 158 // Flugente: more types of prisoners
|
||||||
@@ -79,7 +80,7 @@ extern CHAR16 zTrackingNumber[16];
|
|||||||
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
|
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
|
||||||
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
|
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
|
||||||
|
|
||||||
#define SAVE_GAME_VERSION PMC_WEBSITE
|
#define SAVE_GAME_VERSION STRATEGIC_TEAM_GROUPS
|
||||||
|
|
||||||
//#define RUSSIANGOLD
|
//#define RUSSIANGOLD
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ void RenderMovingGroupsAndMercs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
ubIconType = (UINT8) (( pGroup->uiTraverseTime ) ? ICON_TYPE_ASSAULT : ICON_TYPE_STOPPED);
|
ubIconType = (UINT8) (( pGroup->uiTraverseTime ) ? ICON_TYPE_ASSAULT : ICON_TYPE_STOPPED);
|
||||||
ubIconColor = ICON_COLOR_GREEN;
|
ubIconColor = ICON_COLOR_GREEN;
|
||||||
@@ -625,7 +625,7 @@ void RenderMovingGroupsAndMercs()
|
|||||||
SetFontForeground( ubFontColor );
|
SetFontForeground( ubFontColor );
|
||||||
|
|
||||||
//Print the group size
|
//Print the group size
|
||||||
if( pGroup->fPlayer && !pGroup->uiTraverseTime )
|
if ( pGroup->usGroupTeam == OUR_TEAM && !pGroup->uiTraverseTime )
|
||||||
// stationary player - count all mercs there, not just the group
|
// stationary player - count all mercs there, not just the group
|
||||||
mprintf( x+11, y+11, L"%d", PlayerMercsInSector( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ ) );
|
mprintf( x+11, y+11, L"%d", PlayerMercsInSector( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ ) );
|
||||||
else
|
else
|
||||||
@@ -731,7 +731,7 @@ void RenderInfoInSector()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY )
|
||||||
{
|
{
|
||||||
ubNumTroops += pGroup->pEnemyGroup->ubNumTroops;
|
ubNumTroops += pGroup->pEnemyGroup->ubNumTroops;
|
||||||
ubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
ubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
||||||
@@ -1570,7 +1570,7 @@ void PrintEnemyPopTable()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fDebugGroup )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fDebugGroup )
|
||||||
{
|
{
|
||||||
Assert( pGroup->pEnemyGroup != NULL );
|
Assert( pGroup->pEnemyGroup != NULL );
|
||||||
|
|
||||||
@@ -1952,7 +1952,7 @@ void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubS
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle )
|
||||||
{
|
{
|
||||||
if ( ( pGroup->ubSectorX == ubSectorX ) && ( pGroup->ubSectorY == ubSectorY ) )
|
if ( ( pGroup->ubSectorX == ubSectorX ) && ( pGroup->ubSectorY == ubSectorY ) )
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-18
@@ -840,7 +840,7 @@ BOOLEAN CanCharacterDoctorButDoesntHaveMedKit( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -1143,7 +1143,7 @@ BOOLEAN BasicCanCharacterRepair( SOLDIERTYPE * pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -1254,7 +1254,7 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -1348,7 +1348,7 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -1676,7 +1676,7 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -1857,7 +1857,7 @@ BOOLEAN CanCharacterOnDuty( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
if( gGameExternalOptions.ubSkyriderHotLZ == 0 )
|
if( gGameExternalOptions.ubSkyriderHotLZ == 0 )
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
@@ -1940,7 +1940,7 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -2191,7 +2191,7 @@ BOOLEAN CanCharacterVehicle( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -5615,7 +5615,7 @@ void HandleRadioScanInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
|||||||
|
|
||||||
detect_rangefactor = 1.01f - detect_rangefactor;
|
detect_rangefactor = 1.01f - detect_rangefactor;
|
||||||
|
|
||||||
patrolsize = NumEnemiesInSector( sX, sY );
|
patrolsize = NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM );
|
||||||
|
|
||||||
// no or single enemies -> skip this
|
// no or single enemies -> skip this
|
||||||
if ( patrolsize < 2 )
|
if ( patrolsize < 2 )
|
||||||
@@ -5957,7 +5957,7 @@ void HandleGatheringInformationBySoldier( SOLDIERTYPE* pSoldier )
|
|||||||
// only passable sectors matter
|
// only passable sectors matter
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
usPatrolSize = NumEnemiesInSector( sX, sY );
|
usPatrolSize = NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM );
|
||||||
|
|
||||||
// no enemies
|
// no enemies
|
||||||
if ( usPatrolSize < 1 )
|
if ( usPatrolSize < 1 )
|
||||||
@@ -11333,7 +11333,7 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
|||||||
pSoldier->bOldAssignment = pSoldier->bAssignment;
|
pSoldier->bOldAssignment = pSoldier->bAssignment;
|
||||||
|
|
||||||
// silversurfer: This guy was in the heli and gets out in a hostile sector. Everyone else get out of the heli and start combat!
|
// silversurfer: This guy was in the heli and gets out in a hostile sector. Everyone else get out of the heli and start combat!
|
||||||
if ( pSoldier->bOldAssignment == VEHICLE && pSoldier->iVehicleId == iHelicopterVehicleId && NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( pSoldier->bOldAssignment == VEHICLE && pSoldier->iVehicleId == iHelicopterVehicleId && NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
UINT8 ubGroupID = MoveAllInHelicopterToFootMovementGroup( iValue );
|
UINT8 ubGroupID = MoveAllInHelicopterToFootMovementGroup( iValue );
|
||||||
CheckConditionsForBattle( GetGroup( ubGroupID ) );
|
CheckConditionsForBattle( GetGroup( ubGroupID ) );
|
||||||
@@ -16221,9 +16221,8 @@ BOOLEAN AnyMercInGroupCantContinueMoving( GROUP *pGroup )
|
|||||||
BOOLEAN fMeToo = FALSE;
|
BOOLEAN fMeToo = FALSE;
|
||||||
BOOLEAN fGroupMustStop = FALSE;
|
BOOLEAN fGroupMustStop = FALSE;
|
||||||
|
|
||||||
|
|
||||||
AssertNotNIL( pGroup );
|
AssertNotNIL( pGroup );
|
||||||
AssertT( pGroup->fPlayer );
|
AssertT( pGroup->usGroupTeam == OUR_TEAM );
|
||||||
|
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
|
|
||||||
@@ -18119,7 +18118,7 @@ BOOLEAN BasicCanCharacterTrainMobileMilitia( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -18285,7 +18284,7 @@ BOOLEAN CanCharacterTrainMobileMilitia( SOLDIERTYPE *pSoldier )
|
|||||||
pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] );
|
pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] );
|
||||||
// if sector has enemies or hasn't already been taken at least once, then
|
// if sector has enemies or hasn't already been taken at least once, then
|
||||||
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
||||||
NumEnemiesInSector( sCurrentX, sCurrentY ) > 0 )
|
NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
// skip the rest. This sector cannot generate militia anyway.
|
// skip the rest. This sector cannot generate militia anyway.
|
||||||
iCounter++;
|
iCounter++;
|
||||||
@@ -18630,7 +18629,7 @@ BOOLEAN CanCharacterTrainMobileMilitiaWithErrorReport( SOLDIERTYPE *pSoldier )
|
|||||||
pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] );
|
pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] );
|
||||||
// if sector has enemies or hasn't already been taken at least once, then
|
// if sector has enemies or hasn't already been taken at least once, then
|
||||||
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
||||||
NumEnemiesInSector( sCurrentX, sCurrentY ) > 0 )
|
NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
// skip the rest. This sector cannot generate militia anyway.
|
// skip the rest. This sector cannot generate militia anyway.
|
||||||
iCounter++;
|
iCounter++;
|
||||||
@@ -18685,7 +18684,7 @@ BOOLEAN CanCharacterTrainMobileMilitiaWithErrorReport( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
// if sector has enemies or hasn't already been taken at least once, then
|
// if sector has enemies or hasn't already been taken at least once, then
|
||||||
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
||||||
NumEnemiesInSector( sCurrentX, sCurrentY ) > 0 )
|
NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
// skip the rest. This sector cannot generate militia anyway.
|
// skip the rest. This sector cannot generate militia anyway.
|
||||||
iCounter++;
|
iCounter++;
|
||||||
@@ -18806,7 +18805,7 @@ BOOLEAN BasicCanCharacterFacility( SOLDIERTYPE *pSoldier )
|
|||||||
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) )
|
||||||
{
|
{
|
||||||
// enemies in sector
|
// enemies in sector
|
||||||
if( NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY )
|
|||||||
//Remove the mobile forces here, but only if battle is over.
|
//Remove the mobile forces here, but only if battle is over.
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY )
|
||||||
{
|
{
|
||||||
ClearPreviousAIGroupAssignment( pGroup );
|
ClearPreviousAIGroupAssignment( pGroup );
|
||||||
pDeleteGroup = pGroup;
|
pDeleteGroup = pGroup;
|
||||||
@@ -826,7 +826,7 @@ void AssociateEnemiesWithStrategicGroups()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && pGroup->ubSectorX == gpAR->ubSectorX && pGroup->ubSectorY == gpAR->ubSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && pGroup->ubSectorX == gpAR->ubSectorX && pGroup->ubSectorY == gpAR->ubSectorY )
|
||||||
{
|
{
|
||||||
ubNumElitesInGroup = pGroup->pEnemyGroup->ubNumElites;
|
ubNumElitesInGroup = pGroup->pEnemyGroup->ubNumElites;
|
||||||
ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops;
|
ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops;
|
||||||
@@ -874,8 +874,9 @@ void AssociateEnemiesWithStrategicGroups()
|
|||||||
|
|
||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{ // Don't process road block. It'll be processed as static
|
{
|
||||||
if( pGroup->ubGroupID && !pGroup->fPlayer && IsGroupInARightSectorToReinforce( pGroup, gpAR->ubSectorX, gpAR->ubSectorY ) )
|
// Don't process road block. It'll be processed as static
|
||||||
|
if ( pGroup->ubGroupID && pGroup->usGroupTeam != OUR_TEAM && IsGroupInARightSectorToReinforce( pGroup, gpAR->ubSectorX, gpAR->ubSectorY ) )
|
||||||
{
|
{
|
||||||
ubNumElitesInGroup = pGroup->pEnemyGroup->ubNumElites;
|
ubNumElitesInGroup = pGroup->pEnemyGroup->ubNumElites;
|
||||||
ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops;
|
ubNumTroopsInGroup = pGroup->pEnemyGroup->ubNumTroops;
|
||||||
@@ -2871,7 +2872,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //The enemy won, so repoll movement.
|
{ //The enemy won, so repoll movement.
|
||||||
ResetMovementForEnemyGroupsInLocation( gpAR->ubSectorX, gpAR->ubSectorY );
|
ResetMovementForNonPlayerGroupsInLocation( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Physically delete the soldiers now.
|
//Physically delete the soldiers now.
|
||||||
@@ -3607,7 +3608,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
|
|||||||
{
|
{
|
||||||
PlayAutoResolveSample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
PlayAutoResolveSample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||||
// this is not very accurate, any enemies already dead will be counted as killed twice
|
// this is not very accurate, any enemies already dead will be counted as killed twice
|
||||||
gStrategicStatus.usPlayerKills += NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY );
|
gStrategicStatus.usPlayerKills += NumNonPlayerTeamMembersInSector( gpAR->ubSectorX, gpAR->ubSectorY, ENEMY_TEAM );
|
||||||
EliminateAllEnemies( gpAR->ubSectorX, gpAR->ubSectorY );
|
EliminateAllEnemies( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4166,9 +4167,9 @@ void CalculateAttackValues()
|
|||||||
pCell->usNextAttack += (UINT32)( ( i - 4 ) * 1000 );
|
pCell->usNextAttack += (UINT32)( ( i - 4 ) * 1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i >= NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY ) && !(pCell->uiFlags & CELL_CREATURE) )
|
if ( i >= NumNonPlayerTeamMembersInSector( gpAR->ubSectorX, gpAR->ubSectorY, ENEMY_TEAM ) && !(pCell->uiFlags & CELL_CREATURE) )
|
||||||
{ //Extra delay if it's a reinforcement
|
{ //Extra delay if it's a reinforcement
|
||||||
pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * NumEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY );
|
pCell->usNextAttack += REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR * NumNonPlayerTeamMembersInSector( gpAR->ubSectorX, gpAR->ubSectorY, ENEMY_TEAM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5659,7 +5660,7 @@ void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors()
|
|||||||
for(int sX = 1; sX < ( MAP_WORLD_X - 1 ); sX++ ) {
|
for(int sX = 1; sX < ( MAP_WORLD_X - 1 ); sX++ ) {
|
||||||
for(int sY = 1; sY < ( MAP_WORLD_Y - 1); sY++ ) {
|
for(int sY = 1; sY < ( MAP_WORLD_Y - 1); sY++ ) {
|
||||||
// Check if there is a sector where enemies retreated to and there are also militia present
|
// Check if there is a sector where enemies retreated to and there are also militia present
|
||||||
if ((NumEnemiesInSector(sX, sY) > 0) &&
|
if ( (NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM ) > 0) &&
|
||||||
(CountAllMilitiaInSector(sX, sY) > 0) &&
|
(CountAllMilitiaInSector(sX, sY) > 0) &&
|
||||||
(!gTacticalStatus.fEnemyInSector)) {
|
(!gTacticalStatus.fEnemyInSector)) {
|
||||||
unsigned mercCnt = 0;
|
unsigned mercCnt = 0;
|
||||||
|
|||||||
@@ -2617,7 +2617,7 @@ void HandleSayingDontStayToLongWarningInSectorH8()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if there are no enemies in the sector, leave
|
//if there are no enemies in the sector, leave
|
||||||
if( NumEnemiesInSector( 8, 8 ) > 0 )
|
if ( NumNonPlayerTeamMembersInSector( 8, 8, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -662,9 +662,6 @@ BOOLEAN RemoveSoldierFromHelicopter( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
||||||
{
|
{
|
||||||
UINT8 ubNumEnemies;
|
|
||||||
|
|
||||||
|
|
||||||
// check for SAM attack upon the chopper. If it's destroyed by the attack, do nothing else here
|
// check for SAM attack upon the chopper. If it's destroyed by the attack, do nothing else here
|
||||||
if( HandleSAMSiteAttackOfHelicopterInSector( sX, sY ) == TRUE )
|
if( HandleSAMSiteAttackOfHelicopterInSector( sX, sY ) == TRUE )
|
||||||
{
|
{
|
||||||
@@ -672,9 +669,8 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
|||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// count how many enemies are camped there or passing through
|
// count how many enemies are camped there or passing through
|
||||||
ubNumEnemies = NumEnemiesInSector( sX, sY );
|
UINT8 ubNumEnemies = NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM );
|
||||||
|
|
||||||
// any baddies?
|
// any baddies?
|
||||||
if( ubNumEnemies > 0 )
|
if( ubNumEnemies > 0 )
|
||||||
@@ -780,7 +776,7 @@ BOOLEAN CheckIfHelicopterHasEnoughFuelToReturn( INT16 sX, INT16 sY )
|
|||||||
HeliCharacterDialogue( pSkyRider, RETURN_TO_BASE );
|
HeliCharacterDialogue( pSkyRider, RETURN_TO_BASE );
|
||||||
|
|
||||||
// If the sector is safe
|
// If the sector is safe
|
||||||
if ( NumEnemiesInSector( pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY ) == 0 )
|
if ( NumNonPlayerTeamMembersInSector( pVehicleList[iHelicopterVehicleId].sSectorX, pVehicleList[iHelicopterVehicleId].sSectorY, ENEMY_TEAM ) == 0 )
|
||||||
{
|
{
|
||||||
// kick everyone out!
|
// kick everyone out!
|
||||||
// anv: possibly show prompt, if option is on, and heli has any passengers
|
// anv: possibly show prompt, if option is on, and heli has any passengers
|
||||||
@@ -1399,7 +1395,7 @@ void HandleHeliHoverTooLong( void )
|
|||||||
HeliCharacterDialogue( pSkyRider, RETURN_TO_BASE );
|
HeliCharacterDialogue( pSkyRider, RETURN_TO_BASE );
|
||||||
|
|
||||||
// If the sector is safe
|
// If the sector is safe
|
||||||
if ( NumEnemiesInSector( pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY ) == 0 )
|
if ( NumNonPlayerTeamMembersInSector( pVehicleList[iHelicopterVehicleId].sSectorX, pVehicleList[iHelicopterVehicleId].sSectorY, ENEMY_TEAM ) == 0 )
|
||||||
{
|
{
|
||||||
// anv: possibly show prompt, if option is on, and heli has any passengers
|
// anv: possibly show prompt, if option is on, and heli has any passengers
|
||||||
if( gHelicopterSettings.fAskBeforeKickingPassengersOut == FALSE || GetNumberInVehicle( iHelicopterVehicleId ) == 0 )
|
if( gHelicopterSettings.fAskBeforeKickingPassengersOut == FALSE || GetNumberInVehicle( iHelicopterVehicleId ) == 0 )
|
||||||
|
|||||||
@@ -1808,7 +1808,7 @@ void CancelPathForGroup( GROUP *pGroup )
|
|||||||
INT32 iVehicleId;
|
INT32 iVehicleId;
|
||||||
|
|
||||||
// if it's the chopper, but player can't redirect it
|
// if it's the chopper, but player can't redirect it
|
||||||
if ( pGroup->fPlayer && IsGroupTheHelicopterGroup( pGroup ) && ( CanHelicopterFly( ) == FALSE ) )
|
if ( pGroup->usGroupTeam == OUR_TEAM && IsGroupTheHelicopterGroup( pGroup ) && (CanHelicopterFly( ) == FALSE) )
|
||||||
{
|
{
|
||||||
// explain & ignore
|
// explain & ignore
|
||||||
ExplainWhySkyriderCantFly();
|
ExplainWhySkyriderCantFly();
|
||||||
@@ -1816,7 +1816,7 @@ void CancelPathForGroup( GROUP *pGroup )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is it a non-vehicle group?
|
// is it a non-vehicle group?
|
||||||
if( ( pGroup->fPlayer ) && ( pGroup->fVehicle == FALSE ) )
|
if ( (pGroup->usGroupTeam == OUR_TEAM) && (pGroup->fVehicle == FALSE) )
|
||||||
{
|
{
|
||||||
if( pGroup->pPlayerList )
|
if( pGroup->pPlayerList )
|
||||||
{
|
{
|
||||||
@@ -3031,7 +3031,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
|||||||
// If so, is any of the groups in the sector able to retreat in the current direction?
|
// If so, is any of the groups in the sector able to retreat in the current direction?
|
||||||
while (curr)
|
while (curr)
|
||||||
{
|
{
|
||||||
if (curr->fPlayer == TRUE && // Player group
|
if ( curr->usGroupTeam == OUR_TEAM && // Player group
|
||||||
curr->ubSectorX == sX && curr->ubSectorY == sY && // Group is in the battle sector
|
curr->ubSectorX == sX && curr->ubSectorY == sY && // Group is in the battle sector
|
||||||
curr->ubPrevX == tXD && curr->ubPrevY == tYD) // Group came from the examined destination
|
curr->ubPrevX == tXD && curr->ubPrevY == tYD) // Group came from the examined destination
|
||||||
{
|
{
|
||||||
@@ -3052,7 +3052,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while (curr)
|
while (curr)
|
||||||
{
|
{
|
||||||
if (curr->fPlayer == TRUE && // Player group
|
if ( curr->usGroupTeam == OUR_TEAM && // Player group
|
||||||
curr->ubSectorX == tXD && curr->ubSectorY == tYD && // Group is in the battle sector
|
curr->ubSectorX == tXD && curr->ubSectorY == tYD && // Group is in the battle sector
|
||||||
curr->ubPrevX == sX && curr->ubPrevY == sY) // Group came from the examined source
|
curr->ubPrevX == sX && curr->ubPrevY == sY) // Group came from the examined source
|
||||||
{
|
{
|
||||||
@@ -3073,7 +3073,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while (curr)
|
while (curr)
|
||||||
{
|
{
|
||||||
if (curr->fPlayer == TRUE && // Player group
|
if ( curr->usGroupTeam == OUR_TEAM && // Player group
|
||||||
curr->ubNextX == tXS && curr->ubNextY == tYS && // Heading into this sector
|
curr->ubNextX == tXS && curr->ubNextY == tYS && // Heading into this sector
|
||||||
!IsGroupTheHelicopterGroup( curr ) ) // Not a helicopter group!
|
!IsGroupTheHelicopterGroup( curr ) ) // Not a helicopter group!
|
||||||
{
|
{
|
||||||
@@ -3227,7 +3227,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if (curr->fPlayer == TRUE && // Player group
|
if ( curr->usGroupTeam == OUR_TEAM && // Player group
|
||||||
curr->fBetweenSectors == TRUE && // Currently in motion
|
curr->fBetweenSectors == TRUE && // Currently in motion
|
||||||
SECTOR(curr->ubSectorX, curr->ubSectorY) == sSourceSector && // Heading out of this sector
|
SECTOR(curr->ubSectorX, curr->ubSectorY) == sSourceSector && // Heading out of this sector
|
||||||
SECTOR(curr->ubNextX, curr->ubNextY) == sDestSector ) // Heading to the destination we're examining
|
SECTOR(curr->ubNextX, curr->ubNextY) == sDestSector ) // Heading to the destination we're examining
|
||||||
@@ -3339,7 +3339,7 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
|||||||
dLastTravelProgress = 10000.0f;
|
dLastTravelProgress = 10000.0f;
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if (curr->fPlayer == TRUE && // Player group
|
if ( curr->usGroupTeam == OUR_TEAM && // Player group
|
||||||
curr->fBetweenSectors == TRUE && // Currently in motion
|
curr->fBetweenSectors == TRUE && // Currently in motion
|
||||||
SECTOR(curr->ubSectorX, curr->ubSectorY) == sSourceSector && // Heading out of this sector
|
SECTOR(curr->ubSectorX, curr->ubSectorY) == sSourceSector && // Heading out of this sector
|
||||||
SECTOR(curr->ubNextX, curr->ubNextY) == sDestSector ) // Heading to the destination we're examining
|
SECTOR(curr->ubNextX, curr->ubNextY) == sDestSector ) // Heading to the destination we're examining
|
||||||
@@ -3500,7 +3500,6 @@ void ShowEnemyGroupsInMotion( INT16 sX, INT16 sY )
|
|||||||
INT32 iWidth = 0, iHeight = 0;
|
INT32 iWidth = 0, iHeight = 0;
|
||||||
INT32 iDeltaXForError = 0, iDeltaYForError = 0;
|
INT32 iDeltaXForError = 0, iDeltaYForError = 0;
|
||||||
|
|
||||||
|
|
||||||
if( iCurrentMapSectorZ != 0 )
|
if( iCurrentMapSectorZ != 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -3512,7 +3511,7 @@ void ShowEnemyGroupsInMotion( INT16 sX, INT16 sY )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while( curr->next )
|
while( curr->next )
|
||||||
{
|
{
|
||||||
if (!curr->fPlayer && curr->ubSectorX == sX && curr->ubSectorY == sY && curr->ubSectorZ == 0)
|
if ( curr->usGroupTeam != OUR_TEAM && curr->ubSectorX == sX && curr->ubSectorY == sY && curr->ubSectorZ == 0 )
|
||||||
{
|
{
|
||||||
if (curr->ubNextX != sX || curr->ubNextY != sY)
|
if (curr->ubNextX != sX || curr->ubNextY != sY)
|
||||||
{
|
{
|
||||||
@@ -6385,7 +6384,7 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
|||||||
ShowMilitiaInMotion( sSectorX, sSectorY );
|
ShowMilitiaInMotion( sSectorX, sSectorY );
|
||||||
|
|
||||||
// get total number of badguys here
|
// get total number of badguys here
|
||||||
sNumberOfEnemies = NumEnemiesInSector( sSectorX, sSectorY );
|
sNumberOfEnemies = NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||||
|
|
||||||
// Flugente: tanks get a special icon, so we need to count them separately
|
// Flugente: tanks get a special icon, so we need to count them separately
|
||||||
usNumTanks = NumEnemyTanksInSector( sSectorX, sSectorY );
|
usNumTanks = NumEnemyTanksInSector( sSectorX, sSectorY );
|
||||||
|
|||||||
@@ -883,9 +883,10 @@ void AddCommonInfoToBox(void)
|
|||||||
AddMonoString( &hStringHandle, wString );
|
AddMonoString( &hStringHandle, wString );
|
||||||
|
|
||||||
// how many are there, really?
|
// how many are there, really?
|
||||||
ubNumEnemies = NumEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
|
ubNumEnemies = NumNonPlayerTeamMembersInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, ENEMY_TEAM );
|
||||||
AssertGE(gGameExternalOptions.ubGameMaximumNumberOfEnemies, NumFreeEnemySlots());
|
UINT8 enemyfreeslots = NumFreeSlots( ENEMY_TEAM );
|
||||||
unsigned numEnemiesOnMap = gGameExternalOptions.ubGameMaximumNumberOfEnemies - NumFreeEnemySlots();
|
AssertGE( gGameExternalOptions.ubGameMaximumNumberOfEnemies, enemyfreeslots );
|
||||||
|
unsigned numEnemiesOnMap = gGameExternalOptions.ubGameMaximumNumberOfEnemies - enemyfreeslots;
|
||||||
|
|
||||||
switch ( WhatPlayerKnowsAboutEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
|
switch ( WhatPlayerKnowsAboutEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
|
||||||
{
|
{
|
||||||
|
|||||||
+15
-15
@@ -102,7 +102,7 @@ BOOLEAN PlayerMercsInSector_MSE( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fDont
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )// && !pGroup->fBetweenSectors)
|
if ( pGroup->usGroupTeam == OUR_TEAM )// && !pGroup->fBetweenSectors)
|
||||||
{
|
{
|
||||||
if ( ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == 0 ) ||
|
if ( ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == 0 ) ||
|
||||||
( !fDontConsiderNextSector && ( pGroup->ubNextX == ubSectorX && pGroup->ubNextY == ubSectorY && pGroup->ubSectorZ == 0 ) ) )
|
( !fDontConsiderNextSector && ( pGroup->ubNextX == ubSectorX && pGroup->ubNextY == ubSectorY && pGroup->ubSectorZ == 0 ) ) )
|
||||||
@@ -134,7 +134,7 @@ UINT8 GetEnemyGroupIdInSector( INT16 sMapX, INT16 sMapY )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && !curr->fPlayer )
|
if ( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && curr->usGroupTeam != OUR_TEAM )
|
||||||
if( !curr->ubGroupID )
|
if( !curr->ubGroupID )
|
||||||
return curr->ubGroupID;
|
return curr->ubGroupID;
|
||||||
else
|
else
|
||||||
@@ -865,7 +865,7 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
|
|||||||
for( sLMY = MINIMUM_VALID_Y_COORDINATE; sLMY <= MAXIMUM_VALID_Y_COORDINATE ; ++sLMY )
|
for( sLMY = MINIMUM_VALID_Y_COORDINATE; sLMY <= MAXIMUM_VALID_Y_COORDINATE ; ++sLMY )
|
||||||
{
|
{
|
||||||
// SECTORINFO *pSectorInfo = &( SectorInfo[ uiSector ] );
|
// SECTORINFO *pSectorInfo = &( SectorInfo[ uiSector ] );
|
||||||
UINT8 uiSumOfEnemyTroops = NumEnemiesInSector( sLMX, sLMY );
|
UINT8 uiSumOfEnemyTroops = NumNonPlayerTeamMembersInSector( sLMX, sLMY, ENEMY_TEAM );
|
||||||
//pSectorInfo->ubNumAdmins + pSectorInfo->ubNumTroops + pSectorInfo->ubNumElites;
|
//pSectorInfo->ubNumAdmins + pSectorInfo->ubNumTroops + pSectorInfo->ubNumElites;
|
||||||
|
|
||||||
// there's an enemy
|
// there's an enemy
|
||||||
@@ -935,7 +935,7 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
|
|||||||
|
|
||||||
UINT16 usSourceEnemiesInFiveSectors = NumEnemiesInFiveSectors( sMapX, sMapY );
|
UINT16 usSourceEnemiesInFiveSectors = NumEnemiesInFiveSectors( sMapX, sMapY );
|
||||||
UINT16 usTargetEnemiesInFiveSectors = NumEnemiesInFiveSectors( sDMapX, sDMapY );
|
UINT16 usTargetEnemiesInFiveSectors = NumEnemiesInFiveSectors( sDMapX, sDMapY );
|
||||||
UINT8 ubTargetEnemies = NumEnemiesInSector( sDMapX, sDMapY );
|
UINT8 ubTargetEnemies = NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM );
|
||||||
|
|
||||||
UINT16 usSourceMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sMapX, sMapY );
|
UINT16 usSourceMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sMapX, sMapY );
|
||||||
UINT16 usTargetMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sDMapX, sDMapY );
|
UINT16 usTargetMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sDMapX, sDMapY );
|
||||||
@@ -1030,7 +1030,7 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"M %ld, E%ld,%ld %ld, Diff %ld", CountAllMilitiaInSector( sMapX, sMapY ), sDMapX, sDMapY, NumEnemiesInSector( sDMapX, sDMapY ), ((INT32)CountAllMilitiaInSector( sMapX, sMapY )) - ((INT32)NumEnemiesInSector( sDMapX, sDMapY )) );
|
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"M %ld, E%ld,%ld %ld, Diff %ld", CountAllMilitiaInSector( sMapX, sMapY ), sDMapX, sDMapY, NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM ), ((INT32)CountAllMilitiaInSector( sMapX, sMapY )) - ((INT32)NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM )) );
|
||||||
|
|
||||||
return iRes;
|
return iRes;
|
||||||
}
|
}
|
||||||
@@ -1089,7 +1089,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s
|
|||||||
// If militia aren't set-up for battle, they can't move into an enemy sector. This prevents combat ever
|
// If militia aren't set-up for battle, they can't move into an enemy sector. This prevents combat ever
|
||||||
// being instigated by militia unless specifically requested to do so by setting all the appropriate "ready!"
|
// being instigated by militia unless specifically requested to do so by setting all the appropriate "ready!"
|
||||||
// flags earlier in the code.
|
// flags earlier in the code.
|
||||||
if( !fForBattle && gfMSBattle && NumEnemiesInSector( sMapX, sMapY ) )
|
if ( !fForBattle && gfMSBattle && NumNonPlayerTeamMembersInSector( sMapX, sMapY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
fReadyForBattle = FALSE;
|
fReadyForBattle = FALSE;
|
||||||
}
|
}
|
||||||
@@ -1253,7 +1253,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s
|
|||||||
// Wilderness->Sam/Town.
|
// Wilderness->Sam/Town.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!NumEnemiesInSector( sMapX, sMapY ) && // Is the sector under our control at the moment?
|
if ( !NumNonPlayerTeamMembersInSector( sMapX, sMapY, ENEMY_TEAM ) && // Is the sector under our control at the moment?
|
||||||
pTargetSector->fSurfaceWasEverPlayerControlled && // Has it ever been under control?
|
pTargetSector->fSurfaceWasEverPlayerControlled && // Has it ever been under control?
|
||||||
CountMilitia(pTargetSector) < gGameExternalOptions.iMaxMilitiaPerSector ) // Is there room here for more militia?
|
CountMilitia(pTargetSector) < gGameExternalOptions.iMaxMilitiaPerSector ) // Is there room here for more militia?
|
||||||
{
|
{
|
||||||
@@ -1288,7 +1288,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s
|
|||||||
{
|
{
|
||||||
// This should ONLY be possible if we are explicitly training new militia groups.
|
// This should ONLY be possible if we are explicitly training new militia groups.
|
||||||
// Also, militia can no longer spawn directly into enemy-controlled territory.
|
// Also, militia can no longer spawn directly into enemy-controlled territory.
|
||||||
if (fForTraining && !(NumEnemiesInSector( sMapX, sMapY )))
|
if ( fForTraining && !NumNonPlayerTeamMembersInSector( sMapX, sMapY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
fCanSimpleMove = TRUE;
|
fCanSimpleMove = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1493,7 +1493,7 @@ void MilitiaMovementOrder(UINT8 sector)
|
|||||||
if ( gfStrategicMilitiaChangesMade)
|
if ( gfStrategicMilitiaChangesMade)
|
||||||
ResetMilitia();
|
ResetMilitia();
|
||||||
|
|
||||||
if( NumEnemiesInSector( targetX, targetY ) )
|
if ( NumNonPlayerTeamMembersInSector( targetX, targetY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
//Moa: handle deserters before moving in hostile territory
|
//Moa: handle deserters before moving in hostile territory
|
||||||
MobileMilitiaDeserters( targetX, targetY, TRUE, TRUE );
|
MobileMilitiaDeserters( targetX, targetY, TRUE, TRUE );
|
||||||
@@ -1641,7 +1641,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
|||||||
ResetMilitia();
|
ResetMilitia();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NumEnemiesInSector( targetX, targetY ) )
|
if ( NumNonPlayerTeamMembersInSector( targetX, targetY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
extern GROUP *gpBattleGroup;
|
extern GROUP *gpBattleGroup;
|
||||||
gpBattleGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) );
|
gpBattleGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) );
|
||||||
@@ -1751,10 +1751,10 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
|||||||
|
|
||||||
// if sector has enemies or hasn't already been taken at least once, then
|
// if sector has enemies or hasn't already been taken at least once, then
|
||||||
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
||||||
NumEnemiesInSector( sCurrentX, sCurrentY ) > 0 )
|
NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
// skip the rest. Generate no militia from this sector.
|
// skip the rest. Generate no militia from this sector.
|
||||||
iCounter++;
|
++iCounter;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,7 +1802,7 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
|||||||
AddToBlockMoveList( sTMapX, sTMapY );
|
AddToBlockMoveList( sTMapX, sTMapY );
|
||||||
|
|
||||||
// Check for enemies in target sector
|
// Check for enemies in target sector
|
||||||
if( NumEnemiesInSector( sTMapX, sTMapY ) )
|
if ( NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
// Initiave battle
|
// Initiave battle
|
||||||
gfMSBattle = TRUE;
|
gfMSBattle = TRUE;
|
||||||
@@ -1819,7 +1819,7 @@ void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
|||||||
AddToBlockMoveList( sTMapX, sTMapY );
|
AddToBlockMoveList( sTMapX, sTMapY );
|
||||||
|
|
||||||
// Check for enemies in target sector
|
// Check for enemies in target sector
|
||||||
if( NumEnemiesInSector( sTMapX, sTMapY ) )
|
if ( NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
// Initiave battle
|
// Initiave battle
|
||||||
gfMSBattle = TRUE;
|
gfMSBattle = TRUE;
|
||||||
@@ -2309,7 +2309,7 @@ BOOLEAN IsSectorRoamingAllowed( UINT32 uiSector )
|
|||||||
// HEADROCK HAM 4: Take player restrictions into account
|
// HEADROCK HAM 4: Take player restrictions into account
|
||||||
if ( gubManualRestrictMilitia[ uiSector ] == MANUAL_MOBILE_NO_ENTER )
|
if ( gubManualRestrictMilitia[ uiSector ] == MANUAL_MOBILE_NO_ENTER )
|
||||||
{
|
{
|
||||||
if ( !NumEnemiesInSector( SECTORX(uiSector), SECTORY(uiSector) ) )
|
if ( !NumNonPlayerTeamMembersInSector( SECTORX( uiSector ), SECTORY( uiSector ), ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
// The player has disallowed movement into this sector, manually. As the condition above
|
// The player has disallowed movement into this sector, manually. As the condition above
|
||||||
// dictates, this only takes effect if there are no enemies in the target sector. Otherwise,
|
// dictates, this only takes effect if there are no enemies in the target sector. Otherwise,
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->ubSectorX == pLocGroup->ubSectorX && pGroup->ubSectorY == pLocGroup->ubSectorY )
|
if( pGroup->ubSectorX == pLocGroup->ubSectorX && pGroup->ubSectorY == pLocGroup->ubSectorY )
|
||||||
{
|
{
|
||||||
@@ -373,7 +373,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
|||||||
gubPBSectorZ = gpBattleGroup->ubSectorZ;
|
gubPBSectorZ = gpBattleGroup->ubSectorZ;
|
||||||
|
|
||||||
// get number of enemies thought to be here
|
// get number of enemies thought to be here
|
||||||
SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = NumEnemiesInSector( gubPBSectorX, gubPBSectorY );
|
SectorInfo[SECTOR( gubPBSectorX, gubPBSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM );
|
||||||
fMapPanelDirty = TRUE;
|
fMapPanelDirty = TRUE;
|
||||||
}
|
}
|
||||||
else if( gfPersistantPBI )
|
else if( gfPersistantPBI )
|
||||||
@@ -408,7 +408,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
|||||||
gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pBattleGroup && !pBattleGroup->fPlayer && CountAllMilitiaInSector( pBattleGroup->ubSectorX, pBattleGroup->ubSectorY ) > 0)
|
else if ( pBattleGroup && pBattleGroup->usGroupTeam != OUR_TEAM && CountAllMilitiaInSector( pBattleGroup->ubSectorX, pBattleGroup->ubSectorY ) > 0 )
|
||||||
{
|
{
|
||||||
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
|
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
|
||||||
}
|
}
|
||||||
@@ -572,7 +572,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
|||||||
{ //creature's attacking!
|
{ //creature's attacking!
|
||||||
gubEnemyEncounterCode = CREATURE_ATTACK_CODE;
|
gubEnemyEncounterCode = CREATURE_ATTACK_CODE;
|
||||||
}
|
}
|
||||||
else if( gpBattleGroup->fPlayer )
|
else if ( gpBattleGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE && gubEnemyEncounterCode != ENTERING_BLOODCAT_LAIR_CODE )
|
if( gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE && gubEnemyEncounterCode != ENTERING_BLOODCAT_LAIR_CODE )
|
||||||
{
|
{
|
||||||
@@ -1256,7 +1256,7 @@ void RenderPreBattleInterface()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// know exactly how many
|
// know exactly how many
|
||||||
i = NumEnemiesInSector( gubPBSectorX, gubPBSectorY );
|
i = NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM );
|
||||||
swprintf( str, L"%d", i );
|
swprintf( str, L"%d", i );
|
||||||
SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = (INT8)i;
|
SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = (INT8)i;
|
||||||
}
|
}
|
||||||
@@ -1419,7 +1419,7 @@ void AutoResolveBattleCallback( GUI_BUTTON *btn, INT32 reason )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayJA2Sample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
PlayJA2Sample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||||
gStrategicStatus.usPlayerKills += NumEnemiesInSector( gubPBSectorX, gubPBSectorY );
|
gStrategicStatus.usPlayerKills += NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM );
|
||||||
EliminateAllEnemies( gubPBSectorX, gubPBSectorY );
|
EliminateAllEnemies( gubPBSectorX, gubPBSectorY );
|
||||||
SetMusicMode( MUSIC_TACTICAL_VICTORY );
|
SetMusicMode( MUSIC_TACTICAL_VICTORY );
|
||||||
btn->uiFlags &= ~BUTTON_CLICKED_ON;
|
btn->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||||
@@ -1455,7 +1455,7 @@ void GoToSectorCallback( GUI_BUTTON *btn, INT32 reason )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayJA2Sample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
PlayJA2Sample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||||
gStrategicStatus.usPlayerKills += NumEnemiesInSector( gubPBSectorX, gubPBSectorY );
|
gStrategicStatus.usPlayerKills += NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM );
|
||||||
EliminateAllEnemies( gubPBSectorX, gubPBSectorY );
|
EliminateAllEnemies( gubPBSectorX, gubPBSectorY );
|
||||||
SetMusicMode( MUSIC_TACTICAL_VICTORY );
|
SetMusicMode( MUSIC_TACTICAL_VICTORY );
|
||||||
btn->uiFlags &= ~BUTTON_CLICKED_ON;
|
btn->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||||
@@ -1469,7 +1469,7 @@ void GoToSectorCallback( GUI_BUTTON *btn, INT32 reason )
|
|||||||
SetMusicMode( MUSIC_TACTICAL_NOTHING );
|
SetMusicMode( MUSIC_TACTICAL_NOTHING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( gfPersistantPBI && gpBattleGroup && gpBattleGroup->fPlayer &&
|
if ( gfPersistantPBI && gpBattleGroup && gpBattleGroup->usGroupTeam == OUR_TEAM &&
|
||||||
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
|
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
|
||||||
gubEnemyEncounterCode != CREATURE_ATTACK_CODE &&
|
gubEnemyEncounterCode != CREATURE_ATTACK_CODE &&
|
||||||
gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE )
|
gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE )
|
||||||
@@ -1541,7 +1541,7 @@ void RetreatMercsCallback( GUI_BUTTON *btn, INT32 reason )
|
|||||||
|
|
||||||
//Warp time by 5 minutes so that player can't just go back into the sector he left.
|
//Warp time by 5 minutes so that player can't just go back into the sector he left.
|
||||||
//WarpGameTime( 300, WARPTIME_NO_PROCESSING_OF_EVENTS );
|
//WarpGameTime( 300, WARPTIME_NO_PROCESSING_OF_EVENTS );
|
||||||
ResetMovementForEnemyGroupsInLocation( gubPBSectorX, gubPBSectorY );
|
ResetMovementForNonPlayerGroupsInLocation( gubPBSectorX, gubPBSectorY );
|
||||||
|
|
||||||
btn->uiFlags &= ~BUTTON_CLICKED_ON;
|
btn->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||||
DrawButton( btn->IDNum );
|
DrawButton( btn->IDNum );
|
||||||
@@ -1728,7 +1728,7 @@ SOLDIERTYPE* UninvolvedSoldier( INT32 index )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup && !fFound )
|
while( pGroup && !fFound )
|
||||||
{
|
{
|
||||||
if ( pGroup->fPlayer && !PlayerGroupInvolvedInThisCombat( pGroup ) )
|
if ( pGroup->usGroupTeam == OUR_TEAM && !PlayerGroupInvolvedInThisCombat( pGroup ) )
|
||||||
{
|
{
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -2056,7 +2056,7 @@ BOOLEAN PlayerGroupInvolvedInThisCombat( GROUP *pGroup )
|
|||||||
|
|
||||||
// player group, non-empty, not between sectors, in the right sector, isn't a group of in transit, dead, or POW mercs,
|
// player group, non-empty, not between sectors, in the right sector, isn't a group of in transit, dead, or POW mercs,
|
||||||
// and either not the helicopter group, or the heli is on the ground
|
// and either not the helicopter group, or the heli is on the ground
|
||||||
if( pGroup->fPlayer && pGroup->ubGroupSize &&
|
if ( pGroup->usGroupTeam == OUR_TEAM && pGroup->ubGroupSize &&
|
||||||
!pGroup->fBetweenSectors &&
|
!pGroup->fBetweenSectors &&
|
||||||
!GroupHasInTransitDeadOrPOWMercs( pGroup ) &&
|
!GroupHasInTransitDeadOrPOWMercs( pGroup ) &&
|
||||||
( !IsGroupTheHelicopterGroup( pGroup ) || !fHelicopterIsAirBorne ) )
|
( !IsGroupTheHelicopterGroup( pGroup ) || !fHelicopterIsAirBorne ) )
|
||||||
|
|||||||
+58
-42
@@ -177,7 +177,7 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY)
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
ubNumHostiles += pGroup->ubGroupSize;
|
ubNumHostiles += pGroup->ubGroupSize;
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
ubNumEnemies += pGroup->ubGroupSize;
|
ubNumEnemies += pGroup->ubGroupSize;
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,8 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
|||||||
return ubNumEnemies;
|
return ubNumEnemies;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
// returns how many members of a team are in a sector - not intended for OUR_TEAM!
|
||||||
|
UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam )
|
||||||
{
|
{
|
||||||
SECTORINFO *pSector;
|
SECTORINFO *pSector;
|
||||||
GROUP *pGroup;
|
GROUP *pGroup;
|
||||||
@@ -254,20 +255,29 @@ UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
|||||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||||
|
|
||||||
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
|
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
|
||||||
ubNumTroops = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks);
|
|
||||||
|
|
||||||
if (is_networked)
|
if ( ubTeam == ENEMY_TEAM )
|
||||||
ubNumTroops += numenemyLAN((UINT8)sSectorX,(UINT8)sSectorY ); //hayden
|
{
|
||||||
|
ubNumTroops = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks);
|
||||||
|
|
||||||
|
if ( is_networked )
|
||||||
|
ubNumTroops += numenemyLAN((UINT8)sSectorX,(UINT8)sSectorY ); //hayden
|
||||||
|
}
|
||||||
|
else if ( ubTeam == MILITIA_TEAM )
|
||||||
|
{
|
||||||
|
ubNumTroops = (UINT8)(pSector->ubNumberOfCivsAtLevel[0] + pSector->ubNumberOfCivsAtLevel[1] + pSector->ubNumberOfCivsAtLevel[2]);
|
||||||
|
}
|
||||||
|
|
||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam == ubTeam && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
ubNumTroops += pGroup->ubGroupSize;
|
ubNumTroops += pGroup->ubGroupSize;
|
||||||
}
|
}
|
||||||
pGroup = pGroup->next;
|
pGroup = pGroup->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ubNumTroops;
|
return ubNumTroops;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +312,7 @@ UINT16 NumEnemyTanksInSector( INT16 sSectorX, INT16 sSectorY )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while ( pGroup )
|
while ( pGroup )
|
||||||
{
|
{
|
||||||
if ( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
ubNum += pGroup->pEnemyGroup->ubNumTanks;
|
ubNum += pGroup->pEnemyGroup->ubNumTanks;
|
||||||
}
|
}
|
||||||
@@ -353,7 +363,7 @@ UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
ubNumTroops += pGroup->ubGroupSize;
|
ubNumTroops += pGroup->ubGroupSize;
|
||||||
}
|
}
|
||||||
@@ -383,7 +393,7 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
*pubNumTroops += pGroup->pEnemyGroup->ubNumTroops;
|
*pubNumTroops += pGroup->pEnemyGroup->ubNumTroops;
|
||||||
*pubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
*pubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
||||||
@@ -417,7 +427,7 @@ void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSe
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
*pubNumTroops += pGroup->pEnemyGroup->ubNumTroops;
|
*pubNumTroops += pGroup->pEnemyGroup->ubNumTroops;
|
||||||
*pubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
*pubNumElites += pGroup->pEnemyGroup->ubNumElites;
|
||||||
@@ -496,7 +506,7 @@ void EndTacticalBattleForEnemy()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY )
|
||||||
{
|
{
|
||||||
pGroup->pEnemyGroup->ubTroopsInBattle = 0;
|
pGroup->pEnemyGroup->ubTroopsInBattle = 0;
|
||||||
pGroup->pEnemyGroup->ubElitesInBattle = 0;
|
pGroup->pEnemyGroup->ubElitesInBattle = 0;
|
||||||
@@ -527,18 +537,17 @@ void EndTacticalBattleForEnemy()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 NumFreeEnemySlots()
|
UINT8 NumFreeSlots( UINT8 ubTeam )
|
||||||
{
|
{
|
||||||
UINT8 ubNumFreeSlots = 0;
|
UINT8 ubNumFreeSlots = 0;
|
||||||
INT32 i;
|
|
||||||
SOLDIERTYPE *pSoldier;
|
|
||||||
//Count the number of free enemy slots. It is possible to have multiple groups exceed the maximum.
|
//Count the number of free enemy slots. It is possible to have multiple groups exceed the maximum.
|
||||||
for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM].bLastID; i++ )
|
for ( INT32 i = gTacticalStatus.Team[ubTeam].bFirstID; i <= gTacticalStatus.Team[ubTeam].bLastID; ++i )
|
||||||
{
|
{
|
||||||
pSoldier = &Menptr[ i ];
|
if ( !Menptr[i].bActive )
|
||||||
if( !pSoldier->bActive )
|
++ubNumFreeSlots;
|
||||||
ubNumFreeSlots++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ubNumFreeSlots;
|
return ubNumFreeSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,7 +572,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
return PrepareEnemyForUndergroundBattle();
|
return PrepareEnemyForUndergroundBattle();
|
||||||
|
|
||||||
// Add the invading group
|
// Add the invading group
|
||||||
if (gpBattleGroup && !gpBattleGroup->fPlayer )
|
if ( gpBattleGroup && gpBattleGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
//The enemy has instigated the battle which means they are the ones entering the conflict.
|
//The enemy has instigated the battle which means they are the ones entering the conflict.
|
||||||
//The player was actually in the sector first, and the enemy doesn't use reinforced placements
|
//The player was actually in the sector first, and the enemy doesn't use reinforced placements
|
||||||
@@ -602,7 +611,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup != gpBattleGroup && !pGroup->fPlayer && !pGroup->fVehicle &&
|
if ( pGroup != gpBattleGroup && pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle &&
|
||||||
pGroup->ubSectorX == gpBattleGroup->ubSectorX &&
|
pGroup->ubSectorX == gpBattleGroup->ubSectorX &&
|
||||||
pGroup->ubSectorY == gpBattleGroup->ubSectorY &&
|
pGroup->ubSectorY == gpBattleGroup->ubSectorY &&
|
||||||
!pGroup->pEnemyGroup->ubAdminsInBattle &&
|
!pGroup->pEnemyGroup->ubAdminsInBattle &&
|
||||||
@@ -638,7 +647,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
if (mapMaximumNumberOfEnemies > gGameExternalOptions.ubGameMaximumNumberOfEnemies)
|
if (mapMaximumNumberOfEnemies > gGameExternalOptions.ubGameMaximumNumberOfEnemies)
|
||||||
mapMaximumNumberOfEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
|
mapMaximumNumberOfEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
|
||||||
|
|
||||||
gfPendingEnemies = (NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) > mapMaximumNumberOfEnemies );
|
gfPendingEnemies = (NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) > mapMaximumNumberOfEnemies);
|
||||||
|
|
||||||
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||||
|
|
||||||
@@ -741,7 +750,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Search for movement groups that happen to be in the sector.
|
//Search for movement groups that happen to be in the sector.
|
||||||
sNumSlots = NumFreeEnemySlots();
|
sNumSlots = NumFreeSlots( ENEMY_TEAM );
|
||||||
if (sNumSlots > (int)mapMaximumNumberOfEnemies)
|
if (sNumSlots > (int)mapMaximumNumberOfEnemies)
|
||||||
sNumSlots = mapMaximumNumberOfEnemies;
|
sNumSlots = mapMaximumNumberOfEnemies;
|
||||||
|
|
||||||
@@ -771,7 +780,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
pGroup;
|
pGroup;
|
||||||
pGroup = pGroup->next)
|
pGroup = pGroup->next)
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle &&
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle &&
|
||||||
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
{ //Process enemy group in sector.
|
{ //Process enemy group in sector.
|
||||||
if( sNumSlots > 0 )
|
if( sNumSlots > 0 )
|
||||||
@@ -834,7 +843,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
//no provisions for profile troop leader or retreat groups yet.
|
//no provisions for profile troop leader or retreat groups yet.
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pGroup->fPlayer && !pGroup->fVehicle && !pGroup->fBetweenSectors &&
|
if ( pGroup->usGroupTeam == OUR_TEAM && !pGroup->fVehicle && !pGroup->fBetweenSectors &&
|
||||||
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
{ //TEMP: The player path needs to get destroyed, otherwise, it'll be impossible to move the
|
{ //TEMP: The player path needs to get destroyed, otherwise, it'll be impossible to move the
|
||||||
// group after the battle is resolved.
|
// group after the battle is resolved.
|
||||||
@@ -865,7 +874,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup && sNumSlots > 0 )
|
while( pGroup && sNumSlots > 0 )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle &&
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle &&
|
||||||
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
{
|
{
|
||||||
ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
|
ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
|
||||||
@@ -1123,7 +1132,7 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier )
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
CHAR16 str[256];
|
CHAR16 str[256];
|
||||||
@@ -1470,7 +1479,7 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier )
|
|||||||
if( !pSoldier->bSectorZ )
|
if( !pSoldier->bSectorZ )
|
||||||
{
|
{
|
||||||
pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ];
|
pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ];
|
||||||
iNumEnemiesInSector = NumEnemiesInSector( pSoldier->sSectorX, pSoldier->sSectorY );
|
iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM );
|
||||||
if( iNumEnemiesInSector )
|
if( iNumEnemiesInSector )
|
||||||
{
|
{
|
||||||
if( pSector->bLastKnownEnemies >= 0 )
|
if( pSector->bLastKnownEnemies >= 0 )
|
||||||
@@ -1520,9 +1529,10 @@ void AddPossiblePendingEnemiesToBattle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( ( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) && !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) )
|
if( ( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) && !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) )
|
||||||
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
|
|| !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) )
|
||||||
|
return;
|
||||||
|
|
||||||
ubSlots = NumFreeEnemySlots();
|
ubSlots = NumFreeSlots( ENEMY_TEAM );
|
||||||
if(gGameExternalOptions.sMinDelayEnemyReinforcements)//dnl ch68 080913
|
if(gGameExternalOptions.sMinDelayEnemyReinforcements)//dnl ch68 080913
|
||||||
{
|
{
|
||||||
if(gTacticalStatus.Team[ENEMY_TEAM].bAwareOfOpposition == TRUE)
|
if(gTacticalStatus.Team[ENEMY_TEAM].bAwareOfOpposition == TRUE)
|
||||||
@@ -1557,8 +1567,10 @@ void AddPossiblePendingEnemiesToBattle()
|
|||||||
guiReinforceTurn = guiArrived = 0;
|
guiReinforceTurn = guiArrived = 0;
|
||||||
//SendFmtMsg("Enemy reinforcements: guiTurnCnt=%d guiReinforceTurn=%d guiArrived=%d", guiTurnCnt, guiReinforceTurn, guiArrived);
|
//SendFmtMsg("Enemy reinforcements: guiTurnCnt=%d guiReinforceTurn=%d guiArrived=%d", guiTurnCnt, guiReinforceTurn, guiArrived);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ubSlots )
|
if( !ubSlots )
|
||||||
{ //no available slots to add enemies to. Try again later...
|
{
|
||||||
|
//no available slots to add enemies to. Try again later...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1641,13 +1653,13 @@ void AddPossiblePendingEnemiesToBattle()
|
|||||||
|
|
||||||
if( ubStrategicInsertionCode == 255 )
|
if( ubStrategicInsertionCode == 255 )
|
||||||
{
|
{
|
||||||
if( NumEnemiesInSector( gWorldSectorX + 1, gWorldSectorY ) )
|
if ( NumNonPlayerTeamMembersInSector( gWorldSectorX + 1, gWorldSectorY, ENEMY_TEAM ) )
|
||||||
ubStrategicInsertionCode = INSERTION_CODE_EAST;
|
ubStrategicInsertionCode = INSERTION_CODE_EAST;
|
||||||
else if( NumEnemiesInSector( gWorldSectorX - 1, gWorldSectorY ) )
|
else if ( NumNonPlayerTeamMembersInSector( gWorldSectorX - 1, gWorldSectorY, ENEMY_TEAM ) )
|
||||||
ubStrategicInsertionCode = INSERTION_CODE_WEST;
|
ubStrategicInsertionCode = INSERTION_CODE_WEST;
|
||||||
else if( NumEnemiesInSector( gWorldSectorX, gWorldSectorY + 1 ) )
|
else if ( NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY + 1, ENEMY_TEAM ) )
|
||||||
ubStrategicInsertionCode = INSERTION_CODE_SOUTH;
|
ubStrategicInsertionCode = INSERTION_CODE_SOUTH;
|
||||||
else if( NumEnemiesInSector( gWorldSectorX, gWorldSectorY - 1 ) )
|
else if ( NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY - 1, ENEMY_TEAM ) )
|
||||||
ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
else if( gsGridNoForMapEdgePointInfo != -1 )
|
else if( gsGridNoForMapEdgePointInfo != -1 )
|
||||||
@@ -1684,13 +1696,13 @@ void AddPossiblePendingEnemiesToBattle()
|
|||||||
// Figure out which groups are in the sector, so we can have reinforcements arrive at random
|
// Figure out which groups are in the sector, so we can have reinforcements arrive at random
|
||||||
for (ubNumGroupsInSector = 0, pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
for (ubNumGroupsInSector = 0, pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
ubNumGroupsInSector++;
|
ubNumGroupsInSector++;
|
||||||
}
|
}
|
||||||
pGroupInSectorList = (GROUP**) MemAlloc( ubNumGroupsInSector * sizeof( GROUP*));
|
pGroupInSectorList = (GROUP**) MemAlloc( ubNumGroupsInSector * sizeof( GROUP*));
|
||||||
for (ubNumGroupsInSector = 0, pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
for (ubNumGroupsInSector = 0, pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
{
|
{
|
||||||
pGroupInSectorList[ ubNumGroupsInSector++] = pGroup;
|
pGroupInSectorList[ ubNumGroupsInSector++] = pGroup;
|
||||||
}
|
}
|
||||||
@@ -2296,7 +2308,7 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
|
|
||||||
|
|
||||||
// Are there enemies in ALMA? ( I13 )
|
// Are there enemies in ALMA? ( I13 )
|
||||||
iNumEnemiesInSector = NumEnemiesInSector( gModSettings.ubInitialPOWSectorX, gModSettings.ubInitialPOWSectorY ); //(13, 9)
|
iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( gModSettings.ubInitialPOWSectorX, gModSettings.ubInitialPOWSectorY, ENEMY_TEAM ); //(13, 9)
|
||||||
|
|
||||||
// IF there are no enemies, and we need to do alma, skip!
|
// IF there are no enemies, and we need to do alma, skip!
|
||||||
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED && iNumEnemiesInSector == 0 )
|
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED && iNumEnemiesInSector == 0 )
|
||||||
@@ -2533,13 +2545,17 @@ BOOLEAN PlayerSectorDefended( UINT8 ubSectorID )
|
|||||||
if( pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] +
|
if( pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] +
|
||||||
pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] +
|
pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] +
|
||||||
pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] )
|
pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] )
|
||||||
{ //militia in sector
|
{
|
||||||
|
//militia in sector
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if( FindMovementGroupInSector( (UINT8)SECTORX( ubSectorID ), (UINT8)SECTORY( ubSectorID ), TRUE ) )
|
|
||||||
{ //player in sector
|
if ( FindMovementGroupInSector( (UINT8)SECTORX( ubSectorID ), (UINT8)SECTORY( ubSectorID ), OUR_TEAM ) || FindMovementGroupInSector( (UINT8)SECTORX( ubSectorID ), (UINT8)SECTORY( ubSectorID ), MILITIA_TEAM ) )
|
||||||
|
{
|
||||||
|
// player/militia in sector
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2613,7 +2629,7 @@ BOOLEAN CheckPendingEnemies()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
for (GROUP *pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
for (GROUP *pGroup = gpGroupList; pGroup; pGroup = pGroup->next)
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer
|
if ( pGroup->usGroupTeam != OUR_TEAM
|
||||||
&& !pGroup->fVehicle
|
&& !pGroup->fVehicle
|
||||||
&& pGroup->ubSectorX == gWorldSectorX
|
&& pGroup->ubSectorX == gWorldSectorX
|
||||||
&& pGroup->ubSectorY == gWorldSectorY
|
&& pGroup->ubSectorY == gWorldSectorY
|
||||||
|
|||||||
@@ -12,14 +12,16 @@
|
|||||||
extern BOOLEAN gfPendingEnemies;
|
extern BOOLEAN gfPendingEnemies;
|
||||||
|
|
||||||
|
|
||||||
UINT8 NumFreeEnemySlots();
|
UINT8 NumFreeSlots( UINT8 ubTeam );
|
||||||
|
|
||||||
//Counts enemies and crepitus, but not bloodcats.
|
//Counts enemies and crepitus, but not bloodcats.
|
||||||
UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
|
UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
|
||||||
|
|
||||||
UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
|
UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
|
||||||
|
|
||||||
UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
// 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 NumEnemyTanksInSector( INT16 sSectorX, INT16 sSectorY );
|
UINT16 NumEnemyTanksInSector( INT16 sSectorX, INT16 sSectorY );
|
||||||
UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
||||||
UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ GROUP* GetEnemyGroupInSector( INT16 sMapX, INT16 sMapY )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && !curr->fPlayer && curr->ubGroupID )
|
if ( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && curr->usGroupTeam != OUR_TEAM && curr->ubGroupID )
|
||||||
return curr;
|
return curr;
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
|||||||
{
|
{
|
||||||
ubIndex = Random(ubDirNumber);
|
ubIndex = Random(ubDirNumber);
|
||||||
|
|
||||||
if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize )
|
if ( NumNonPlayerTeamMembersInSector( SECTORX( pusMoveDir[ubIndex][0] ), SECTORY( pusMoveDir[ubIndex][0] ), ENEMY_TEAM ) > gubReinforcementMinEnemyStaticGroupSize )
|
||||||
{
|
{
|
||||||
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ];
|
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ];
|
||||||
|
|
||||||
@@ -412,10 +412,10 @@ void AddPossiblePendingMilitiaToBattle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
|
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
|
||||||
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
|
// || !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) ) return;
|
||||||
if( (PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) == 0)
|
if( (PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) == 0)
|
||||||
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|
||||||
|| (NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) == 0)
|
|| (NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) == 0)
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
|
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
|
||||||
|
|||||||
+47
-37
@@ -727,7 +727,7 @@ void ValidatePendingGroups()
|
|||||||
if( ubGroupID )
|
if( ubGroupID )
|
||||||
{
|
{
|
||||||
pGroup = GetGroup( ubGroupID );
|
pGroup = GetGroup( ubGroupID );
|
||||||
if( !pGroup || pGroup->fPlayer )
|
if( !pGroup || pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
iErrorsForInvalidPendingGroup++;
|
iErrorsForInvalidPendingGroup++;
|
||||||
gPatrolGroup[ i ].ubPendingGroupID = 0;
|
gPatrolGroup[ i ].ubPendingGroupID = 0;
|
||||||
@@ -740,7 +740,7 @@ void ValidatePendingGroups()
|
|||||||
if( ubGroupID )
|
if( ubGroupID )
|
||||||
{
|
{
|
||||||
pGroup = GetGroup( ubGroupID );
|
pGroup = GetGroup( ubGroupID );
|
||||||
if( !pGroup || pGroup->fPlayer )
|
if ( !pGroup || pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
iErrorsForInvalidPendingGroup++;
|
iErrorsForInvalidPendingGroup++;
|
||||||
gGarrisonGroup[ i ].ubPendingGroupID = 0;
|
gGarrisonGroup[ i ].ubPendingGroupID = 0;
|
||||||
@@ -824,7 +824,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic2");
|
|||||||
}
|
}
|
||||||
if( !pGroup->ubNextX || !pGroup->ubNextY )
|
if( !pGroup->ubNextX || !pGroup->ubNextY )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && pGroup->pEnemyGroup->ubIntention != STAGING
|
if ( pGroup->usGroupTeam != OUR_TEAM && pGroup->pEnemyGroup->ubIntention != STAGING
|
||||||
&& pGroup->pEnemyGroup->ubIntention != REINFORCEMENTS )
|
&& pGroup->pEnemyGroup->ubIntention != REINFORCEMENTS )
|
||||||
{
|
{
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
@@ -874,7 +874,7 @@ void RemovePlayersFromAllMismatchGroups( SOLDIERTYPE *pSoldier )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -938,7 +938,7 @@ void ValidatePlayersAreInOneGroupOnly()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -976,7 +976,7 @@ void ValidatePlayersAreInOneGroupOnly()
|
|||||||
pOtherGroup = NULL;
|
pOtherGroup = NULL;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -1023,7 +1023,7 @@ void ValidatePlayersAreInOneGroupOnly()
|
|||||||
pOtherGroup = NULL;
|
pOtherGroup = NULL;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -2208,7 +2208,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5");
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Assert( !pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam != OUR_TEAM );
|
||||||
if( pGroup->pEnemyGroup->ubIntention == PURSUIT )
|
if( pGroup->pEnemyGroup->ubIntention == PURSUIT )
|
||||||
{ //Lost the player group that he was going to attack. Return to original position.
|
{ //Lost the player group that he was going to attack. Return to original position.
|
||||||
SetThisSectorAsEnemyControlled( pGroup->ubSectorX, pGroup->ubSectorY, 0, TRUE );
|
SetThisSectorAsEnemyControlled( pGroup->ubSectorX, pGroup->ubSectorY, 0, TRUE );
|
||||||
@@ -2412,9 +2412,9 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
UINT8 ubNumEnemies;
|
UINT8 ubNumEnemies;
|
||||||
UINT8 ubSectorID;
|
UINT8 ubSectorID;
|
||||||
if( !gfQueenAIAwake )
|
if( !gfQueenAIAwake )
|
||||||
{ //The queen isn't aware the player's presence yet, so she is oblivious to any situations.
|
{//The queen isn't aware the player's presence yet, so she is oblivious to any situations.
|
||||||
|
|
||||||
if( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == ENEMY_TEAM )
|
||||||
{
|
{
|
||||||
//Exception case!
|
//Exception case!
|
||||||
//In the beginning of the game, a group is sent to A9 after the first battle. If you leave A9, when they arrive,
|
//In the beginning of the game, a group is sent to A9 after the first battle. If you leave A9, when they arrive,
|
||||||
@@ -2441,8 +2441,10 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !pGroup->fPlayer )
|
|
||||||
{ //The enemy group has arrived at a new sector and now controls it.
|
if ( pGroup->usGroupTeam == ENEMY_TEAM )
|
||||||
|
{
|
||||||
|
//The enemy group has arrived at a new sector and now controls it.
|
||||||
//Look in each of the four directions, and the alertness rating will
|
//Look in each of the four directions, and the alertness rating will
|
||||||
//determine the chance to detect any players that may exist in that sector.
|
//determine the chance to detect any players that may exist in that sector.
|
||||||
pEnemyGroup = pGroup;
|
pEnemyGroup = pGroup;
|
||||||
@@ -2451,9 +2453,10 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
return EvaluateGroupSituation( pEnemyGroup );
|
return EvaluateGroupSituation( pEnemyGroup );
|
||||||
}
|
}
|
||||||
ubSectorID = (UINT8)SECTOR( pEnemyGroup->ubSectorX, pEnemyGroup->ubSectorY );
|
ubSectorID = (UINT8)SECTOR( pEnemyGroup->ubSectorX, pEnemyGroup->ubSectorY );
|
||||||
|
|
||||||
if( pEnemyGroup && pEnemyGroup->ubSectorY > 1 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID - 16) ) )
|
if( pEnemyGroup && pEnemyGroup->ubSectorY > 1 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID - 16) ) )
|
||||||
{
|
{
|
||||||
pPlayerGroup = FindMovementGroupInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY-1), TRUE );
|
pPlayerGroup = FindMovementGroupInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY - 1), OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2468,9 +2471,10 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID-16) );
|
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID-16) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pEnemyGroup && pEnemyGroup->ubSectorX > 1 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID - 1) ) )
|
if( pEnemyGroup && pEnemyGroup->ubSectorX > 1 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID - 1) ) )
|
||||||
{
|
{
|
||||||
pPlayerGroup = FindMovementGroupInSector( (UINT8)(pEnemyGroup->ubSectorX-1), pEnemyGroup->ubSectorY, TRUE );
|
pPlayerGroup = FindMovementGroupInSector( (UINT8)(pEnemyGroup->ubSectorX - 1), pEnemyGroup->ubSectorY, OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2485,9 +2489,10 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID-1) );
|
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID-1) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pEnemyGroup && pEnemyGroup->ubSectorY < 16 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID + 16) ) )
|
if( pEnemyGroup && pEnemyGroup->ubSectorY < 16 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID + 16) ) )
|
||||||
{
|
{
|
||||||
pPlayerGroup = FindMovementGroupInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY+1), TRUE );
|
pPlayerGroup = FindMovementGroupInSector( pEnemyGroup->ubSectorX, (UINT8)(pEnemyGroup->ubSectorY + 1), OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2502,9 +2507,10 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID+16) );
|
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID+16) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pEnemyGroup && pEnemyGroup->ubSectorX < 16 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID + 1) ) )
|
if( pEnemyGroup && pEnemyGroup->ubSectorX < 16 && EnemyPermittedToAttackSector( &pEnemyGroup, (UINT8)(ubSectorID + 1) ) )
|
||||||
{
|
{
|
||||||
pPlayerGroup = FindMovementGroupInSector( (UINT8)(pEnemyGroup->ubSectorX+1), pEnemyGroup->ubSectorY, TRUE );
|
pPlayerGroup = FindMovementGroupInSector( (UINT8)(pEnemyGroup->ubSectorX + 1), pEnemyGroup->ubSectorY, OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
return HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2519,13 +2525,16 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID+1) );
|
return HandleEmptySectorNoticedByPatrolGroup( pEnemyGroup, (UINT8)(ubSectorID+1) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pEnemyGroup )
|
if( !pEnemyGroup )
|
||||||
{ //group deleted.
|
{
|
||||||
|
//group deleted.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if ( pGroup->usGroupTeam == OUR_TEAM || pGroup->usGroupTeam == MILITIA_TEAM )
|
||||||
{ //The player group has arrived at a new sector and now controls it.
|
{
|
||||||
|
//The player group has arrived at a new sector and now controls it.
|
||||||
//Look in each of the four directions, and the enemy alertness rating will
|
//Look in each of the four directions, and the enemy alertness rating will
|
||||||
//determine if the enemy notices that the player is here.
|
//determine if the enemy notices that the player is here.
|
||||||
//Additionally, there are also stationary enemy groups that may also notice the
|
//Additionally, there are also stationary enemy groups that may also notice the
|
||||||
@@ -2540,7 +2549,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
// WDS BAD BUG FIX - 12/25/2008 - some of the +1/-1 in the following were goofed up
|
// WDS BAD BUG FIX - 12/25/2008 - some of the +1/-1 in the following were goofed up
|
||||||
if( pPlayerGroup->ubSectorY > 1 )
|
if( pPlayerGroup->ubSectorY > 1 )
|
||||||
{
|
{
|
||||||
pEnemyGroup = FindMovementGroupInSector( pPlayerGroup->ubSectorX, (UINT8)(pPlayerGroup->ubSectorY-1), FALSE );
|
pEnemyGroup = FindMovementGroupInSector( pPlayerGroup->ubSectorX, (UINT8)(pPlayerGroup->ubSectorY - 1), ENEMY_TEAM );
|
||||||
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2556,7 +2565,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
}
|
}
|
||||||
if( pPlayerGroup->ubSectorX < 16 )
|
if( pPlayerGroup->ubSectorX < 16 )
|
||||||
{
|
{
|
||||||
pEnemyGroup = FindMovementGroupInSector( (UINT8)(pPlayerGroup->ubSectorX+1), pPlayerGroup->ubSectorY, FALSE );
|
pEnemyGroup = FindMovementGroupInSector( (UINT8)(pPlayerGroup->ubSectorX + 1), pPlayerGroup->ubSectorY, ENEMY_TEAM );
|
||||||
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2572,7 +2581,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
}
|
}
|
||||||
if( pPlayerGroup->ubSectorY < 16 )
|
if( pPlayerGroup->ubSectorY < 16 )
|
||||||
{
|
{
|
||||||
pEnemyGroup = FindMovementGroupInSector( pPlayerGroup->ubSectorX, (UINT8)(pPlayerGroup->ubSectorY+1), FALSE );
|
pEnemyGroup = FindMovementGroupInSector( pPlayerGroup->ubSectorX, (UINT8)(pPlayerGroup->ubSectorY + 1), ENEMY_TEAM );
|
||||||
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2588,7 +2597,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
|||||||
}
|
}
|
||||||
if( pPlayerGroup->ubSectorX > 1 )
|
if( pPlayerGroup->ubSectorX > 1 )
|
||||||
{
|
{
|
||||||
pEnemyGroup = FindMovementGroupInSector( (UINT8)(pPlayerGroup->ubSectorX-1), pPlayerGroup->ubSectorY, FALSE );
|
pEnemyGroup = FindMovementGroupInSector( (UINT8)(pPlayerGroup->ubSectorX-1), pPlayerGroup->ubSectorY, ENEMY_TEAM );
|
||||||
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pEnemyGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||||
@@ -2668,7 +2677,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID )
|
|||||||
if( ubSectorY > 1 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID - 16) ) )
|
if( ubSectorY > 1 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID - 16) ) )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
pPlayerGroup = FindMovementGroupInSector( ubSectorX, (UINT8)(ubSectorY-1), TRUE );
|
pPlayerGroup = FindMovementGroupInSector( ubSectorX, (UINT8)(ubSectorY-1), OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
||||||
@@ -2685,7 +2694,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID )
|
|||||||
if( ubSectorX < 16 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID + 1) ) )
|
if( ubSectorX < 16 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID + 1) ) )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
pPlayerGroup = FindMovementGroupInSector( (UINT8)(ubSectorX+1), ubSectorY, TRUE );
|
pPlayerGroup = FindMovementGroupInSector( (UINT8)(ubSectorX+1), ubSectorY, OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
||||||
@@ -2702,7 +2711,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID )
|
|||||||
if( ubSectorY < 16 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID + 16) ) )
|
if( ubSectorY < 16 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID + 16) ) )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
pPlayerGroup = FindMovementGroupInSector( ubSectorX, (UINT8)(ubSectorY+1), TRUE );
|
pPlayerGroup = FindMovementGroupInSector( ubSectorX, (UINT8)(ubSectorY+1), OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
||||||
@@ -2719,7 +2728,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID )
|
|||||||
if( ubSectorX > 1 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID - 1) ) )
|
if( ubSectorX > 1 && EnemyPermittedToAttackSector( NULL, (UINT8)(ubSectorID - 1) ) )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
pPlayerGroup = FindMovementGroupInSector( (UINT8)(ubSectorX-1), ubSectorY, TRUE );
|
pPlayerGroup = FindMovementGroupInSector( (UINT8)(ubSectorX-1), ubSectorY, OUR_TEAM );
|
||||||
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
if( pPlayerGroup && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||||
{
|
{
|
||||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, ubSectorID );
|
||||||
@@ -3842,7 +3851,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && pGroup->ubGroupSize >= 16 )
|
if ( pGroup->usGroupTeam != OUR_TEAM && pGroup->ubGroupSize >= 16 )
|
||||||
{ //accident in patrol groups being too large
|
{ //accident in patrol groups being too large
|
||||||
UINT8 ubGetRidOfXTroops = pGroup->ubGroupSize - 10;
|
UINT8 ubGetRidOfXTroops = pGroup->ubGroupSize - 10;
|
||||||
if( gbWorldSectorZ || pGroup->ubSectorX != gWorldSectorX || pGroup->ubSectorY != gWorldSectorY )
|
if( gbWorldSectorZ || pGroup->ubSectorX != gWorldSectorX || pGroup->ubSectorY != gWorldSectorY )
|
||||||
@@ -4112,7 +4121,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
|
|||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
pNext = pGroup->next;
|
pNext = pGroup->next;
|
||||||
if( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->ubSectorX == gModSettings.ubSAISpawnSectorX && pGroup->ubSectorY == gModSettings.ubSAISpawnSectorY && !pGroup->ubPrevX && !pGroup->ubPrevY )
|
if( pGroup->ubSectorX == gModSettings.ubSAISpawnSectorX && pGroup->ubSectorY == gModSettings.ubSAISpawnSectorY && !pGroup->ubPrevX && !pGroup->ubPrevY )
|
||||||
{
|
{
|
||||||
@@ -4141,7 +4150,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
|
|||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
next = pGroup->next; //store the next node as pGroup could be deleted!
|
next = pGroup->next; //store the next node as pGroup could be deleted!
|
||||||
if( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( !pGroup->fBetweenSectors )
|
if( !pGroup->fBetweenSectors )
|
||||||
{
|
{
|
||||||
@@ -5087,7 +5096,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
|
|||||||
//enemies will simply check it out, then leave.
|
//enemies will simply check it out, then leave.
|
||||||
if( pSector->ubGarrisonID != NO_GARRISON )
|
if( pSector->ubGarrisonID != NO_GARRISON )
|
||||||
{ //sector has a garrison
|
{ //sector has a garrison
|
||||||
if( !NumEnemiesInSector( (INT16)SECTORX( ubSectorID ), (INT16)SECTORY( ubSectorID ) ) )
|
if ( !NumNonPlayerTeamMembersInSector( (INT16)SECTORX( ubSectorID ), (INT16)SECTORY( ubSectorID ), ENEMY_TEAM ) )
|
||||||
{ //no enemies are here
|
{ //no enemies are here
|
||||||
if( gArmyComp[ !gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bPriority )
|
if( gArmyComp[ !gGarrisonGroup[ pSector->ubGarrisonID ].ubComposition ].bPriority )
|
||||||
{ //the garrison is important
|
{ //the garrison is important
|
||||||
@@ -6308,7 +6317,7 @@ void UpgradeAdminsToTroops()
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->ubGroupSize && !pGroup->fPlayer && !pGroup->fVehicle)
|
if ( pGroup->ubGroupSize && pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle )
|
||||||
{
|
{
|
||||||
Assert ( pGroup->pEnemyGroup );
|
Assert ( pGroup->pEnemyGroup );
|
||||||
|
|
||||||
@@ -6603,9 +6612,9 @@ BOOLEAN PermittedToFillPatrolGroup( INT32 iPatrolID )
|
|||||||
void RepollSAIGroup( GROUP *pGroup )
|
void RepollSAIGroup( GROUP *pGroup )
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
Assert( !pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam != OUR_TEAM );
|
||||||
|
|
||||||
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
|
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
|
||||||
if( GroupAtFinalDestination( pGroup ) )
|
if( GroupAtFinalDestination( pGroup ) )
|
||||||
{
|
{
|
||||||
EvaluateGroupSituation( pGroup );
|
EvaluateGroupSituation( pGroup );
|
||||||
@@ -6701,7 +6710,7 @@ void CalcNumTroopsBasedOnComposition( UINT8 *pubNumTroops, UINT8 *pubNumElites,
|
|||||||
void ConvertGroupTroopsToComposition( GROUP *pGroup, INT32 iCompositionID )
|
void ConvertGroupTroopsToComposition( GROUP *pGroup, INT32 iCompositionID )
|
||||||
{
|
{
|
||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
Assert( !pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam != OUR_TEAM );
|
||||||
CalcNumTroopsBasedOnComposition( &pGroup->pEnemyGroup->ubNumTroops, &pGroup->pEnemyGroup->ubNumElites, pGroup->ubGroupSize, iCompositionID );
|
CalcNumTroopsBasedOnComposition( &pGroup->pEnemyGroup->ubNumTroops, &pGroup->pEnemyGroup->ubNumElites, pGroup->ubGroupSize, iCompositionID );
|
||||||
pGroup->pEnemyGroup->ubNumAdmins = 0;
|
pGroup->pEnemyGroup->ubNumAdmins = 0;
|
||||||
pGroup->ubGroupSize = pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites;
|
pGroup->ubGroupSize = pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites;
|
||||||
@@ -6843,8 +6852,9 @@ UINT8 RedirectEnemyGroupsMovingThroughSector( UINT8 ubSectorX, UINT8 ubSectorY )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && pGroup->ubMoveType == ONE_WAY )
|
if ( pGroup->usGroupTeam != OUR_TEAM && pGroup->ubMoveType == ONE_WAY )
|
||||||
{ //check the waypoint list
|
{
|
||||||
|
//check the waypoint list
|
||||||
if( GroupWillMoveThroughSector( pGroup, ubSectorX, ubSectorY ) )
|
if( GroupWillMoveThroughSector( pGroup, ubSectorX, ubSectorY ) )
|
||||||
{
|
{
|
||||||
//extract the group's destination.
|
//extract the group's destination.
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ UINT8 CreateNewPlayerGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY
|
|||||||
pNew->ubSectorX = pNew->ubNextX = ubSectorX;
|
pNew->ubSectorX = pNew->ubNextX = ubSectorX;
|
||||||
pNew->ubSectorY = pNew->ubNextY = ubSectorY;
|
pNew->ubSectorY = pNew->ubNextY = ubSectorY;
|
||||||
pNew->ubOriginalSector = (UINT8)SECTOR( ubSectorX, ubSectorY );
|
pNew->ubOriginalSector = (UINT8)SECTOR( ubSectorX, ubSectorY );
|
||||||
pNew->fPlayer = TRUE;
|
pNew->usGroupTeam = OUR_TEAM;
|
||||||
pNew->ubMoveType = ONE_WAY;
|
pNew->ubMoveType = ONE_WAY;
|
||||||
pNew->ubNextWaypointID = 0;
|
pNew->ubNextWaypointID = 0;
|
||||||
pNew->ubFatigueLevel = 100;
|
pNew->ubFatigueLevel = 100;
|
||||||
@@ -206,7 +206,7 @@ UINT8 CreateNewVehicleGroupDepartingFromSector( UINT8 ubSectorX, UINT8 ubSectorY
|
|||||||
pNew->ubFatigueLevel = 100;
|
pNew->ubFatigueLevel = 100;
|
||||||
pNew->ubRestAtFatigueLevel = 0;
|
pNew->ubRestAtFatigueLevel = 0;
|
||||||
pNew->fVehicle = TRUE;
|
pNew->fVehicle = TRUE;
|
||||||
pNew->fPlayer = TRUE;
|
pNew->usGroupTeam = OUR_TEAM;
|
||||||
pNew->pPlayerList = NULL;
|
pNew->pPlayerList = NULL;
|
||||||
pNew->ubCreatedSectorID = pNew->ubOriginalSector;
|
pNew->ubCreatedSectorID = pNew->ubOriginalSector;
|
||||||
pNew->ubSectorIDOfLastReassignment = 255;
|
pNew->ubSectorIDOfLastReassignment = 255;
|
||||||
@@ -226,7 +226,7 @@ BOOLEAN AddPlayerToGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier )
|
|||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
pPlayer = (PLAYERGROUP*)MemAlloc( sizeof( PLAYERGROUP ) );
|
pPlayer = (PLAYERGROUP*)MemAlloc( sizeof( PLAYERGROUP ) );
|
||||||
Assert( pPlayer );
|
Assert( pPlayer );
|
||||||
AssertMsg( pGroup->fPlayer, "Attempting AddPlayerToGroup() on an ENEMY group!");
|
AssertMsg( pGroup->usGroupTeam == OUR_TEAM, "Attempting AddPlayerToGroup() on an ENEMY group!" );
|
||||||
pPlayer->pSoldier = pSoldier;
|
pPlayer->pSoldier = pSoldier;
|
||||||
pPlayer->ubProfileID = pSoldier->ubProfile;
|
pPlayer->ubProfileID = pSoldier->ubProfile;
|
||||||
pPlayer->ubID = pSoldier->ubID;
|
pPlayer->ubID = pSoldier->ubID;
|
||||||
@@ -289,7 +289,7 @@ BOOLEAN RemoveAllPlayersFromPGroup( GROUP *pGroup )
|
|||||||
{
|
{
|
||||||
PLAYERGROUP *curr;
|
PLAYERGROUP *curr;
|
||||||
|
|
||||||
AssertMsg( pGroup->fPlayer, "Attempting RemovePlayerFromGroup() on an ENEMY group!");
|
AssertMsg( pGroup->usGroupTeam == OUR_TEAM, "Attempting RemovePlayerFromGroup() on an ENEMY group!" );
|
||||||
|
|
||||||
curr = pGroup->pPlayerList;
|
curr = pGroup->pPlayerList;
|
||||||
while( curr )
|
while( curr )
|
||||||
@@ -320,7 +320,7 @@ BOOLEAN RemoveAllPlayersFromPGroup( GROUP *pGroup )
|
|||||||
BOOLEAN RemovePlayerFromPGroup( GROUP *pGroup, SOLDIERTYPE *pSoldier )
|
BOOLEAN RemovePlayerFromPGroup( GROUP *pGroup, SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
PLAYERGROUP *prev, *curr;
|
PLAYERGROUP *prev, *curr;
|
||||||
AssertMsg( pGroup->fPlayer, "Attempting RemovePlayerFromGroup() on an ENEMY group!" );
|
AssertMsg( pGroup->usGroupTeam == OUR_TEAM, "Attempting RemovePlayerFromGroup() on an ENEMY group!" );
|
||||||
|
|
||||||
curr = pGroup->pPlayerList;
|
curr = pGroup->pPlayerList;
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX,
|
|||||||
pGroup->ubSectorX = pGroup->ubPrevX;
|
pGroup->ubSectorX = pGroup->ubPrevX;
|
||||||
pGroup->ubSectorY = pGroup->ubPrevY;
|
pGroup->ubSectorY = pGroup->ubPrevY;
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
// ARM: because we've changed the group's ubSectoryX and ubSectorY, we must now also go and change the sSectorX and
|
// ARM: because we've changed the group's ubSectoryX and ubSectorY, we must now also go and change the sSectorX and
|
||||||
// sSectorY of all the soldiers in this group so that they stay in synch. Otherwise pathing and movement problems
|
// sSectorY of all the soldiers in this group so that they stay in synch. Otherwise pathing and movement problems
|
||||||
@@ -451,7 +451,7 @@ BOOLEAN GroupReversingDirectionsBetweenSectors( GROUP *pGroup, UINT8 ubSectorX,
|
|||||||
//Post the replacement event to move back to the previous sector!
|
//Post the replacement event to move back to the previous sector!
|
||||||
AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID );
|
AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID );
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( ( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY ) > GetWorldTotalMin( ) )
|
if( ( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY ) > GetWorldTotalMin( ) )
|
||||||
{
|
{
|
||||||
@@ -551,7 +551,7 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) /
|
|||||||
{
|
{
|
||||||
if( GroupReversingDirectionsBetweenSectors( pGroup, ubSectorX, ubSectorY, TRUE ) )
|
if( GroupReversingDirectionsBetweenSectors( pGroup, ubSectorX, ubSectorY, TRUE ) )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
// because we reversed, we must add the new current sector back at the head of everyone's mercpath
|
// because we reversed, we must add the new current sector back at the head of everyone's mercpath
|
||||||
AddSectorToFrontOfMercPathForAllSoldiersInGroup( pGroup, pGroup->ubSectorX, pGroup->ubSectorY );
|
AddSectorToFrontOfMercPathForAllSoldiersInGroup( pGroup, pGroup->ubSectorX, pGroup->ubSectorY );
|
||||||
@@ -640,7 +640,7 @@ BOOLEAN AddWaypointToPGroup( GROUP* pGroup, UINT8 ubSectorX, UINT8 ubSectorY ) /
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
PLAYERGROUP *curr;
|
PLAYERGROUP *curr;
|
||||||
//Also, nuke any previous "tactical traversal" information.
|
//Also, nuke any previous "tactical traversal" information.
|
||||||
@@ -731,7 +731,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
|||||||
pNew->ubSectorX = (UINT8)SECTORX( uiSector );
|
pNew->ubSectorX = (UINT8)SECTORX( uiSector );
|
||||||
pNew->ubSectorY = (UINT8)SECTORY( uiSector );
|
pNew->ubSectorY = (UINT8)SECTORY( uiSector );
|
||||||
pNew->ubOriginalSector = (UINT8)uiSector;
|
pNew->ubOriginalSector = (UINT8)uiSector;
|
||||||
pNew->fPlayer = FALSE;
|
pNew->usGroupTeam = ENEMY_TEAM;
|
||||||
pNew->ubMoveType = CIRCULAR;
|
pNew->ubMoveType = CIRCULAR;
|
||||||
pNew->ubNextWaypointID = 0;
|
pNew->ubNextWaypointID = 0;
|
||||||
pNew->ubFatigueLevel = 100;
|
pNew->ubFatigueLevel = 100;
|
||||||
@@ -979,7 +979,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating
|
|||||||
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
|
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
|
||||||
|
|
||||||
if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup ||
|
if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup ||
|
||||||
pInitiatingBattleGroup && !pInitiatingBattleGroup->fPlayer &&
|
pInitiatingBattleGroup && pInitiatingBattleGroup->usGroupTeam != OUR_TEAM &&
|
||||||
pInitiatingBattleGroup->ubSectorX == gWorldSectorX &&
|
pInitiatingBattleGroup->ubSectorX == gWorldSectorX &&
|
||||||
pInitiatingBattleGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
pInitiatingBattleGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||||
{ // At least say quote....
|
{ // At least say quote....
|
||||||
@@ -1058,12 +1058,15 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
|||||||
BOOLEAN fBloodCatAmbush = FALSE;
|
BOOLEAN fBloodCatAmbush = FALSE;
|
||||||
|
|
||||||
if( gfWorldLoaded )
|
if( gfWorldLoaded )
|
||||||
{ //look for people arriving in the currently loaded sector. This handles reinforcements.
|
{
|
||||||
curr = FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, TRUE );
|
//look for people arriving in the currently loaded sector. This handles reinforcements.
|
||||||
|
curr = FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, OUR_TEAM );
|
||||||
|
|
||||||
if( !gbWorldSectorZ && PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, gbWorldSectorZ ) &&
|
if( !gbWorldSectorZ && PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, gbWorldSectorZ ) &&
|
||||||
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY &&
|
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY &&
|
||||||
curr )
|
curr )
|
||||||
{ //Reinforcements have arrived!
|
{
|
||||||
|
//Reinforcements have arrived!
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
if( guiCurrentScreen == AIVIEWER_SCREEN )
|
if( guiCurrentScreen == AIVIEWER_SCREEN )
|
||||||
{
|
{
|
||||||
@@ -1088,7 +1091,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
|||||||
curr = gpGroupList;
|
curr = gpGroupList;
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if( curr->fPlayer && curr->ubGroupSize )
|
if ( curr->usGroupTeam == OUR_TEAM && curr->ubGroupSize )
|
||||||
{
|
{
|
||||||
if( !curr->fBetweenSectors )
|
if( !curr->fBetweenSectors )
|
||||||
{
|
{
|
||||||
@@ -1134,11 +1137,11 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
|||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pPlayerDialogGroup = pGroup;
|
pPlayerDialogGroup = pGroup;
|
||||||
|
|
||||||
if( NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) &&
|
if ( NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM ) &&
|
||||||
(!IsGroupTheHelicopterGroup( pGroup ) || (gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE)))
|
(!IsGroupTheHelicopterGroup( pGroup ) || (gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE)))
|
||||||
{
|
{
|
||||||
fBattlePending = TRUE;
|
fBattlePending = TRUE;
|
||||||
@@ -1276,7 +1279,7 @@ void TriggerPrebattleInterface( UINT8 ubResult )
|
|||||||
void DeployGroupToSector( GROUP *pGroup )
|
void DeployGroupToSector( GROUP *pGroup )
|
||||||
{
|
{
|
||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
//Update the sector positions of the players...
|
//Update the sector positions of the players...
|
||||||
return;
|
return;
|
||||||
@@ -1384,7 +1387,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
#if 0
|
#if 0
|
||||||
//First, make sure that we have a player group that isn't empty
|
//First, make sure that we have a player group that isn't empty
|
||||||
if( !pGroup->fPlayer || !pGroup->ubGroupSize )
|
if( pGroup->usGroupTeam != OUR_TEAM || !pGroup->ubGroupSize )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
//If our group doesn't have any traversals left to be allowed to merge, then no chance.
|
//If our group doesn't have any traversals left to be allowed to merge, then no chance.
|
||||||
if( !pGroup->pPlayerList->pSoldier->ubNumTraversalsAllowedToMerge )
|
if( !pGroup->pPlayerList->pSoldier->ubNumTraversalsAllowedToMerge )
|
||||||
@@ -1417,7 +1420,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
|||||||
{ //This group is looking for another group to merge with.
|
{ //This group is looking for another group to merge with.
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if( curr != pGroup && curr->fPlayer && curr->ubGroupSize )
|
if( curr != pGroup && curr->usGroupTeam == OUR_TEAM && curr->ubGroupSize )
|
||||||
{ //We have a player group with members
|
{ //We have a player group with members
|
||||||
if( curr->pPlayerList->pSoldier->ubNumTraversalsAllowedToMerge )
|
if( curr->pPlayerList->pSoldier->ubNumTraversalsAllowedToMerge )
|
||||||
{ //This group is allowed to merge
|
{ //This group is allowed to merge
|
||||||
@@ -1473,10 +1476,11 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pGroup->ubGroupSize < NUMBER_OF_SOLDIERS_PER_SQUAD )
|
else if( pGroup->ubGroupSize < NUMBER_OF_SOLDIERS_PER_SQUAD )
|
||||||
{ //Search for other groups looking to join our group.
|
{
|
||||||
|
//Search for other groups looking to join our group.
|
||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
if( curr != pGroup && curr->fPlayer && curr->ubGroupSize )
|
if( curr != pGroup && curr->usGroupTeam == OUR_TEAM && curr->ubGroupSize )
|
||||||
{ //We have a player group with members
|
{ //We have a player group with members
|
||||||
if( curr->pPlayerList->pSoldier->ubNumTraversalsAllowedToMerge )
|
if( curr->pPlayerList->pSoldier->ubNumTraversalsAllowedToMerge )
|
||||||
{ //This group is allowed to merge
|
{ //This group is allowed to merge
|
||||||
@@ -1540,7 +1544,7 @@ void AwardExperienceForTravelling( GROUP * pGroup )
|
|||||||
UINT32 uiPoints;
|
UINT32 uiPoints;
|
||||||
UINT32 uiCarriedPercent;
|
UINT32 uiCarriedPercent;
|
||||||
|
|
||||||
if ( !pGroup || !pGroup->fPlayer )
|
if ( !pGroup || pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1674,7 +1678,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
//Set the fact we have visited the sector
|
//Set the fact we have visited the sector
|
||||||
curr = pGroup->pPlayerList;
|
curr = pGroup->pPlayerList;
|
||||||
@@ -1721,7 +1725,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
//Check for exception cases which
|
//Check for exception cases which
|
||||||
if( gTacticalStatus.bBoxingState != NOT_BOXING )
|
if( gTacticalStatus.bBoxingState != NOT_BOXING )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer && pGroup->ubNextX == 5 && pGroup->ubNextY == 4 && pGroup->ubSectorZ == 0 )
|
if ( pGroup->usGroupTeam != OUR_TEAM && pGroup->ubNextX == 5 && pGroup->ubNextY == 4 && pGroup->ubSectorZ == 0 )
|
||||||
{
|
{
|
||||||
fExceptionQueue = TRUE;
|
fExceptionQueue = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1730,7 +1734,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
//First check if the group arriving is going to queue another battle.
|
//First check if the group arriving is going to queue another battle.
|
||||||
//NOTE: We can't have more than one battle ongoing at a time.
|
//NOTE: We can't have more than one battle ongoing at a time.
|
||||||
if( fExceptionQueue || fCheckForBattle && gTacticalStatus.fEnemyInSector &&
|
if( fExceptionQueue || fCheckForBattle && gTacticalStatus.fEnemyInSector &&
|
||||||
FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, TRUE ) &&
|
FindMovementGroupInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, OUR_TEAM ) &&
|
||||||
(pGroup->ubNextX != gWorldSectorX || pGroup->ubNextY != gWorldSectorY || gbWorldSectorZ > 0 ) ||
|
(pGroup->ubNextX != gWorldSectorX || pGroup->ubNextY != gWorldSectorY || gbWorldSectorZ > 0 ) ||
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
//Ja25: NO meanwhiles
|
//Ja25: NO meanwhiles
|
||||||
@@ -1764,7 +1768,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
if( !AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ) )
|
if( !AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ) )
|
||||||
AssertMsg( 0, "Failed to add movement event." );
|
AssertMsg( 0, "Failed to add movement event." );
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) )
|
if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) )
|
||||||
{
|
{
|
||||||
@@ -1776,7 +1780,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Flugente: disease
|
// Flugente: disease
|
||||||
if ( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
PopulationMove( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, pGroup->ubGroupSize );
|
PopulationMove( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, pGroup->ubGroupSize );
|
||||||
}
|
}
|
||||||
@@ -1789,11 +1793,11 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
pGroup->ubNextX = 0;
|
pGroup->ubNextX = 0;
|
||||||
pGroup->ubNextY = 0;
|
pGroup->ubNextY = 0;
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->ubSectorZ == 0 )
|
if( pGroup->ubSectorZ == 0 )
|
||||||
{
|
{
|
||||||
SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ].bLastKnownEnemies = NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY );
|
SectorInfo[SECTOR( pGroup->ubSectorX, pGroup->ubSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM );
|
||||||
}
|
}
|
||||||
|
|
||||||
// award life 'experience' for travelling, based on travel time!
|
// award life 'experience' for travelling, based on travel time!
|
||||||
@@ -1835,7 +1839,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
fMapScreenBottomDirty = TRUE;
|
fMapScreenBottomDirty = TRUE;
|
||||||
|
|
||||||
// if a player group
|
// if a player group
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
// if this is the last sector along player group's movement path (no more waypoints)
|
// if this is the last sector along player group's movement path (no more waypoints)
|
||||||
if ( GroupAtFinalDestination( pGroup ) )
|
if ( GroupAtFinalDestination( pGroup ) )
|
||||||
@@ -2115,7 +2119,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
|||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
/*
|
/*
|
||||||
//if the enemy group is at its final destination
|
//if the enemy group is at its final destination
|
||||||
if( !pGroup->fPlayer && GroupAtFinalDestination( pGroup ) )
|
if( pGroup->usGroupTeam != OUR_TEAM && GroupAtFinalDestination( pGroup ) )
|
||||||
{
|
{
|
||||||
// Check to see if this is an AI sector
|
// Check to see if this is an AI sector
|
||||||
INT16 sJa25SaiSectorValue = GetJA25SectorID( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ );
|
INT16 sJa25SaiSectorValue = GetJA25SectorID( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ );
|
||||||
@@ -2165,7 +2169,7 @@ void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNe
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
//The group will always exist after the AI was processed.
|
//The group will always exist after the AI was processed.
|
||||||
|
|
||||||
@@ -2271,7 +2275,7 @@ void PrepareGroupsForSimultaneousArrival()
|
|||||||
while( pGroup )
|
while( pGroup )
|
||||||
{ //For all of the groups that haven't arrived yet, determine which one is going to take the longest.
|
{ //For all of the groups that haven't arrived yet, determine which one is going to take the longest.
|
||||||
if( pGroup != gpPendingSimultaneousGroup
|
if( pGroup != gpPendingSimultaneousGroup
|
||||||
&& pGroup->fPlayer
|
&& pGroup->usGroupTeam == OUR_TEAM
|
||||||
&& pGroup->fBetweenSectors
|
&& pGroup->fBetweenSectors
|
||||||
&& pGroup->ubNextX == gpPendingSimultaneousGroup->ubSectorX
|
&& pGroup->ubNextX == gpPendingSimultaneousGroup->ubSectorX
|
||||||
&& pGroup->ubNextY == gpPendingSimultaneousGroup->ubSectorY &&
|
&& pGroup->ubNextY == gpPendingSimultaneousGroup->ubSectorY &&
|
||||||
@@ -2295,7 +2299,7 @@ void PrepareGroupsForSimultaneousArrival()
|
|||||||
SetGroupArrivalTime( pGroup, uiLatestArrivalTime );
|
SetGroupArrivalTime( pGroup, uiLatestArrivalTime );
|
||||||
AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID );
|
AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID );
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) )
|
if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) )
|
||||||
{
|
{
|
||||||
@@ -2338,7 +2342,7 @@ void PrepareGroupsForSimultaneousArrival()
|
|||||||
|
|
||||||
AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID );
|
AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID );
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) )
|
if( pGroup->uiArrivalTime - ABOUT_TO_ARRIVE_DELAY > GetWorldTotalMin( ) )
|
||||||
{
|
{
|
||||||
@@ -2373,7 +2377,7 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup != pFirstGroup && pGroup->fPlayer && pGroup->fBetweenSectors &&
|
if ( pGroup != pFirstGroup && pGroup->usGroupTeam == OUR_TEAM && pGroup->fBetweenSectors &&
|
||||||
pGroup->ubNextX == pFirstGroup->ubSectorX && pGroup->ubNextY == pFirstGroup->ubSectorY &&
|
pGroup->ubNextX == pFirstGroup->ubSectorX && pGroup->ubNextY == pFirstGroup->ubSectorY &&
|
||||||
!(pGroup->uiFlags & GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) &&
|
!(pGroup->uiFlags & GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) &&
|
||||||
!IsGroupTheHelicopterGroup( pGroup ) )
|
!IsGroupTheHelicopterGroup( pGroup ) )
|
||||||
@@ -2454,7 +2458,7 @@ void DelayEnemyGroupsIfPathsCross( GROUP *pPlayerGroup )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
//then check to see if this group will arrive in next sector before the player group.
|
//then check to see if this group will arrive in next sector before the player group.
|
||||||
if( pGroup->uiArrivalTime < pPlayerGroup->uiArrivalTime )
|
if( pGroup->uiArrivalTime < pPlayerGroup->uiArrivalTime )
|
||||||
@@ -2581,7 +2585,7 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup )
|
|||||||
if ( !pGroup->ubSectorZ )
|
if ( !pGroup->ubSectorZ )
|
||||||
{
|
{
|
||||||
BOOLEAN fCalcRegularTime = TRUE;
|
BOOLEAN fCalcRegularTime = TRUE;
|
||||||
if ( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
//Determine if the enemy group is "sleeping". If so, then simply delay their arrival time by the amount of time
|
//Determine if the enemy group is "sleeping". If so, then simply delay their arrival time by the amount of time
|
||||||
//they are going to be sleeping for.
|
//they are going to be sleeping for.
|
||||||
@@ -2611,7 +2615,7 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup )
|
|||||||
if ( pGroup->uiTraverseTime == 0xffffffff )
|
if ( pGroup->uiTraverseTime == 0xffffffff )
|
||||||
{
|
{
|
||||||
AssertMsg( 0, String( "Group %d (%s) attempting illegal move from %c%d to %c%d (%s).",
|
AssertMsg( 0, String( "Group %d (%s) attempting illegal move from %c%d to %c%d (%s).",
|
||||||
pGroup->ubGroupID, (pGroup->fPlayer) ? "Player" : "AI",
|
pGroup->ubGroupID, (pGroup->usGroupTeam == OUR_TEAM) ? "Player" : "AI",
|
||||||
pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, pGroup->ubNextY + 'A' - 1, pGroup->ubNextX,
|
pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX, pGroup->ubNextY + 'A' - 1, pGroup->ubNextX,
|
||||||
gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) );
|
gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) );
|
||||||
}
|
}
|
||||||
@@ -2675,7 +2679,7 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup )
|
|||||||
AssertMsg( 0, "Failed to add movement event." );
|
AssertMsg( 0, "Failed to add movement event." );
|
||||||
|
|
||||||
//For the case of player groups, we need to update the information of the soldiers.
|
//For the case of player groups, we need to update the information of the soldiers.
|
||||||
if ( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
PLAYERGROUP *curr;
|
PLAYERGROUP *curr;
|
||||||
|
|
||||||
@@ -2803,7 +2807,7 @@ void RemovePGroup( GROUP *pGroup )
|
|||||||
DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->ubGroupID );
|
DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->ubGroupID );
|
||||||
|
|
||||||
//Determine what type of group we have (because it requires different methods)
|
//Determine what type of group we have (because it requires different methods)
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{ //Remove player group
|
{ //Remove player group
|
||||||
PLAYERGROUP *pPlayer;
|
PLAYERGROUP *pPlayer;
|
||||||
while( pGroup->pPlayerList )
|
while( pGroup->pPlayerList )
|
||||||
@@ -3084,7 +3088,7 @@ INT32 FindTravelTimeBetweenWaypoints( WAYPOINT * pSource, WAYPOINT * pDest, GROU
|
|||||||
if( iThisCostInTime == 0xffffffff )
|
if( iThisCostInTime == 0xffffffff )
|
||||||
{
|
{
|
||||||
AssertMsg( 0, String("Group %d (%s) attempting illegal move from sector %d, dir %d (%s).",
|
AssertMsg( 0, String("Group %d (%s) attempting illegal move from sector %d, dir %d (%s).",
|
||||||
pGroup->ubGroupID, ( pGroup->fPlayer ) ? "Player" : "AI",
|
pGroup->ubGroupID, (pGroup->usGroupTeam == OUR_TEAM) ? "Player" : "AI",
|
||||||
ubCurrentSector, ubDirection,
|
ubCurrentSector, ubDirection,
|
||||||
gszTerrain[SectorInfo[ubCurrentSector].ubTraversability[ubDirection]] ) );
|
gszTerrain[SectorInfo[ubCurrentSector].ubTraversability[ubDirection]] ) );
|
||||||
}
|
}
|
||||||
@@ -3164,7 +3168,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup
|
|||||||
if( iTraverseTime < iBestTraverseTime )
|
if( iTraverseTime < iBestTraverseTime )
|
||||||
iBestTraverseTime = iTraverseTime;
|
iBestTraverseTime = iTraverseTime;
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
curr = pGroup->pPlayerList;
|
curr = pGroup->pPlayerList;
|
||||||
while( curr )
|
while( curr )
|
||||||
@@ -3248,7 +3252,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// SANDRO - STOMP traits - ranger reduces time needed for travelling around
|
// SANDRO - STOMP traits - ranger reduces time needed for travelling around
|
||||||
if( pGroup->fPlayer && !fAir && gGameOptions.fNewTraitSystem)
|
if ( pGroup->usGroupTeam == OUR_TEAM && !fAir && gGameOptions.fNewTraitSystem )
|
||||||
{
|
{
|
||||||
// see if we have any ranger here
|
// see if we have any ranger here
|
||||||
UINT8 ubRangerHere = 0;
|
UINT8 ubRangerHere = 0;
|
||||||
@@ -3302,7 +3306,7 @@ INT32 GetSectorMvtTimeForGroup( UINT8 ubSector, UINT8 ubDirection, GROUP *pGroup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !pGroup->fPlayer )
|
else if ( pGroup->usGroupTeam == ENEMY_TEAM )
|
||||||
{
|
{
|
||||||
// Flugente: enemy generals can speed up the AI decision process (justification: the generals are the ones planning the military operations, so if theay are around, the army is more efficient)
|
// Flugente: enemy generals can speed up the AI decision process (justification: the generals are the ones planning the military operations, so if theay are around, the army is more efficient)
|
||||||
FLOAT dEnemyGeneralsSpeedupFactor = 1.0f;
|
FLOAT dEnemyGeneralsSpeedupFactor = 1.0f;
|
||||||
@@ -3329,7 +3333,7 @@ UINT8 PlayerMercsInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer && !pGroup->fBetweenSectors)
|
if ( pGroup->usGroupTeam == OUR_TEAM && !pGroup->fBetweenSectors )
|
||||||
{
|
{
|
||||||
if ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == ubSectorZ )
|
if ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == ubSectorZ )
|
||||||
{
|
{
|
||||||
@@ -3359,7 +3363,7 @@ UINT8 PlayerGroupsInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer && !pGroup->fBetweenSectors)
|
if ( pGroup->usGroupTeam == OUR_TEAM && !pGroup->fBetweenSectors )
|
||||||
{
|
{
|
||||||
if ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == ubSectorZ )
|
if ( pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && pGroup->ubSectorZ == ubSectorZ )
|
||||||
{
|
{
|
||||||
@@ -3442,8 +3446,9 @@ void HandleArrivalOfReinforcements( GROUP *pGroup )
|
|||||||
INT32 iNumEnemiesInSector;
|
INT32 iNumEnemiesInSector;
|
||||||
INT32 cnt;
|
INT32 cnt;
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{ //We don't have to worry about filling up the player slots, because it is impossible
|
{
|
||||||
|
//We don't have to worry about filling up the player slots, because it is impossible
|
||||||
//to have more players in the game than the number of slots available for the player.
|
//to have more players in the game than the number of slots available for the player.
|
||||||
PLAYERGROUP *pPlayer;
|
PLAYERGROUP *pPlayer;
|
||||||
UINT8 ubStrategicInsertionCode;
|
UINT8 ubStrategicInsertionCode;
|
||||||
@@ -3490,9 +3495,10 @@ void HandleArrivalOfReinforcements( GROUP *pGroup )
|
|||||||
ResetNumSquadleadersInArmyGroup(); // added by SANDRO
|
ResetNumSquadleadersInArmyGroup(); // added by SANDRO
|
||||||
AddPossiblePendingEnemiesToBattle();
|
AddPossiblePendingEnemiesToBattle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the known number of enemies in the sector.
|
//Update the known number of enemies in the sector.
|
||||||
pSector = &SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ];
|
pSector = &SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ];
|
||||||
iNumEnemiesInSector = NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY );
|
iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM );
|
||||||
if( iNumEnemiesInSector )
|
if( iNumEnemiesInSector )
|
||||||
{
|
{
|
||||||
if( pSector->bLastKnownEnemies >= 0 )
|
if( pSector->bLastKnownEnemies >= 0 )
|
||||||
@@ -3539,7 +3545,7 @@ BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnt
|
|||||||
while( curr )
|
while( curr )
|
||||||
{
|
{
|
||||||
// if player group
|
// if player group
|
||||||
if( curr->fPlayer == TRUE )
|
if ( curr->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
fHelicopterGroup = IsGroupTheHelicopterGroup( curr );
|
fHelicopterGroup = IsGroupTheHelicopterGroup( curr );
|
||||||
|
|
||||||
@@ -3618,7 +3624,7 @@ void MoveAllGroupsInCurrentSectorToSector( UINT8 ubSectorX, UINT8 ubSectorY, UIN
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY &&
|
if ( pGroup->usGroupTeam == OUR_TEAM && pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY &&
|
||||||
pGroup->ubSectorZ == gbWorldSectorZ && !pGroup->fBetweenSectors )
|
pGroup->ubSectorZ == gbWorldSectorZ && !pGroup->fBetweenSectors )
|
||||||
{ //This player group is in the currently loaded sector...
|
{ //This player group is in the currently loaded sector...
|
||||||
pGroup->ubSectorX = ubSectorX;
|
pGroup->ubSectorX = ubSectorX;
|
||||||
@@ -3697,7 +3703,7 @@ void SetGroupPosition( UINT8 ubNextX, UINT8 ubNextY, UINT8 ubPrevX, UINT8 ubPrev
|
|||||||
|
|
||||||
AddWaypointToPGroup( pGroup, pGroup->ubNextX, pGroup->ubNextY );
|
AddWaypointToPGroup( pGroup, pGroup->ubNextX, pGroup->ubNextY );
|
||||||
//now, if player group set all grunts in the group to be between secotrs
|
//now, if player group set all grunts in the group to be between secotrs
|
||||||
if( pGroup->fPlayer == TRUE )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -3749,7 +3755,7 @@ BOOLEAN SaveStrategicMovementGroupsToSaveGameFile( HWFILE hFile )
|
|||||||
//
|
//
|
||||||
|
|
||||||
// If its a player group
|
// If its a player group
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
//if there is a player list, add it
|
//if there is a player list, add it
|
||||||
if( pGroup->ubGroupSize )
|
if( pGroup->ubGroupSize )
|
||||||
@@ -3784,7 +3790,8 @@ BOOLEAN SaveStrategicMovementGroupsToSaveGameFile( HWFILE hFile )
|
|||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "SaveLoadGame.h"
|
||||||
|
#include "GameVersion.h"
|
||||||
|
|
||||||
BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile )
|
BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile )
|
||||||
{
|
{
|
||||||
@@ -3815,7 +3822,7 @@ BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
|
|
||||||
//loop through all the nodes and add them to the LL
|
//loop through all the nodes and add them to the LL
|
||||||
for( cnt=0; cnt< uiNumberOfGroups; cnt++ )
|
for( cnt=0; cnt< uiNumberOfGroups; ++cnt )
|
||||||
{
|
{
|
||||||
//allocate memory for the node
|
//allocate memory for the node
|
||||||
pTemp = (GROUP *) MemAlloc( sizeof( GROUP ));
|
pTemp = (GROUP *) MemAlloc( sizeof( GROUP ));
|
||||||
@@ -3831,11 +3838,28 @@ BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile )
|
|||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flugente: Up to now, GROUPs were either player-controlled (fPlayer = TRUE) or enemy-controlled (fPlayer = FALSE).
|
||||||
|
// As a result, no other team could have any travelling groups (militia, civilians, creatures...)
|
||||||
|
// I've changed this - instead of BOOLEAN fPlayer; there now is UINT8 usGroupTeam;
|
||||||
|
// This doesn't mess with the struct size, as BOOLEAN has the same size as UINT8 here.
|
||||||
|
// However,
|
||||||
|
if ( guiCurrentSaveGameVersion < STRATEGIC_TEAM_GROUPS )
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
if ( pTemp->usGroupTeam == 0 )
|
||||||
|
pTemp->usGroupTeam = ENEMY_TEAM;
|
||||||
|
else if ( pTemp->usGroupTeam == 1 )
|
||||||
|
pTemp->usGroupTeam = OUR_TEAM;
|
||||||
|
//this shouldn't be happening...
|
||||||
|
else
|
||||||
|
Assert( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add either the pointer or the linked list.
|
// Add either the pointer or the linked list.
|
||||||
//
|
//
|
||||||
|
|
||||||
if( pTemp->fPlayer )
|
if ( pTemp->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
//if there is a player list, add it
|
//if there is a player list, add it
|
||||||
if( pTemp->ubGroupSize )
|
if( pTemp->ubGroupSize )
|
||||||
@@ -3878,7 +3902,7 @@ BOOLEAN LoadStrategicMovementGroupsFromSavedGameFile( HWFILE hFile )
|
|||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->ubGroupSize )
|
if( pGroup->ubGroupSize )
|
||||||
{
|
{
|
||||||
@@ -4097,7 +4121,7 @@ void CheckMembersOfMvtGroupAndComplainAboutBleeding( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// player controlled group?
|
// player controlled group?
|
||||||
if( pGroup->fPlayer == FALSE )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4271,8 +4295,9 @@ void CalculateGroupRetreatSector( GROUP *pGroup )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{ //update the previous sector for the mercs
|
{
|
||||||
|
//update the previous sector for the mercs
|
||||||
PLAYERGROUP *pPlayer;
|
PLAYERGROUP *pPlayer;
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -4327,7 +4352,7 @@ void RetreatGroupToPreviousSector( GROUP *pGroup )
|
|||||||
if( pGroup->uiTraverseTime == 0xffffffff )
|
if( pGroup->uiTraverseTime == 0xffffffff )
|
||||||
{
|
{
|
||||||
AssertMsg( 0, String("Group %d (%s) attempting illegal move from %c%d to %c%d (%s).",
|
AssertMsg( 0, String("Group %d (%s) attempting illegal move from %c%d to %c%d (%s).",
|
||||||
pGroup->ubGroupID, ( pGroup->fPlayer ) ? "Player" : "AI",
|
pGroup->ubGroupID, (pGroup->usGroupTeam == OUR_TEAM) ? "Player" : "AI",
|
||||||
pGroup->ubSectorY+'A', pGroup->ubSectorX, pGroup->ubNextY+'A', pGroup->ubNextX,
|
pGroup->ubSectorY+'A', pGroup->ubSectorX, pGroup->ubNextY+'A', pGroup->ubNextX,
|
||||||
gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) );
|
gszTerrain[SectorInfo[ubSector].ubTraversability[ubDirection]] ) );
|
||||||
}
|
}
|
||||||
@@ -4355,7 +4380,7 @@ void RetreatGroupToPreviousSector( GROUP *pGroup )
|
|||||||
AssertMsg( 0, "Failed to add movement event." );
|
AssertMsg( 0, "Failed to add movement event." );
|
||||||
|
|
||||||
//For the case of player groups, we need to update the information of the soldiers.
|
//For the case of player groups, we need to update the information of the soldiers.
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
PLAYERGROUP *curr;
|
PLAYERGROUP *curr;
|
||||||
curr = pGroup->pPlayerList;
|
curr = pGroup->pPlayerList;
|
||||||
@@ -4377,25 +4402,28 @@ void RetreatGroupToPreviousSector( GROUP *pGroup )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fPlayer )
|
GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubTeam )
|
||||||
{
|
{
|
||||||
GROUP *pGroup;
|
GROUP *pGroup;
|
||||||
pGroup = gpGroupList;
|
pGroup = gpGroupList;
|
||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == ubTeam && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && !pGroup->ubSectorZ )
|
||||||
{
|
{
|
||||||
// NOTE: These checks must always match the INVOLVED group checks in PBI!!!
|
// special checks for player groups
|
||||||
if( fPlayer && pGroup->ubGroupSize && !pGroup->fBetweenSectors &&
|
if ( ubTeam == OUR_TEAM )
|
||||||
pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && !pGroup->ubSectorZ &&
|
|
||||||
!GroupHasInTransitDeadOrPOWMercs( pGroup ) &&
|
|
||||||
( !IsGroupTheHelicopterGroup( pGroup ) || !fHelicopterIsAirBorne ) )
|
|
||||||
{
|
{
|
||||||
return pGroup;
|
// NOTE: These checks must always match the INVOLVED group checks in PBI!!!
|
||||||
|
if ( pGroup->ubGroupSize && !pGroup->fBetweenSectors &&
|
||||||
|
!GroupHasInTransitDeadOrPOWMercs( pGroup ) &&
|
||||||
|
(!IsGroupTheHelicopterGroup( pGroup ) || !fHelicopterIsAirBorne) )
|
||||||
|
{
|
||||||
|
return pGroup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return pGroup;
|
||||||
}
|
}
|
||||||
else if( !fPlayer && pGroup->ubSectorX == ubSectorX && pGroup->ubSectorY == ubSectorY && !pGroup->ubSectorZ )
|
|
||||||
return pGroup;
|
|
||||||
|
|
||||||
pGroup = pGroup->next;
|
pGroup = pGroup->next;
|
||||||
}
|
}
|
||||||
@@ -4449,8 +4477,8 @@ WAYPOINT *GetFinalWaypoint( GROUP *pGroup )
|
|||||||
|
|
||||||
|
|
||||||
//The sector supplied resets ALL enemy groups in the sector specified. See comments in
|
//The sector supplied resets ALL enemy groups in the sector specified. See comments in
|
||||||
//ResetMovementForEnemyGroup() for more details on what the resetting does.
|
//ResetMovementForNonPlayerGroup() for more details on what the resetting does.
|
||||||
void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY )
|
void ResetMovementForNonPlayerGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||||
{
|
{
|
||||||
GROUP *pGroup, *next;
|
GROUP *pGroup, *next;
|
||||||
INT16 sSectorX, sSectorY, sSectorZ;
|
INT16 sSectorX, sSectorY, sSectorZ;
|
||||||
@@ -4460,11 +4488,11 @@ void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY )
|
|||||||
while( pGroup )
|
while( pGroup )
|
||||||
{
|
{
|
||||||
next = pGroup->next;
|
next = pGroup->next;
|
||||||
if( !pGroup->fPlayer )
|
if ( pGroup->usGroupTeam != OUR_TEAM )
|
||||||
{
|
{
|
||||||
if( pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if( pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
ResetMovementForEnemyGroup( pGroup );
|
ResetMovementForNonPlayerGroup( pGroup );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pGroup = next;
|
pGroup = next;
|
||||||
@@ -4477,13 +4505,14 @@ void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY )
|
|||||||
//then after this function is called, then that group would be 0% of the way from
|
//then after this function is called, then that group would be 0% of the way from
|
||||||
//sector A10 to A11. In no way does this function effect the strategic path for
|
//sector A10 to A11. In no way does this function effect the strategic path for
|
||||||
//the group.
|
//the group.
|
||||||
void ResetMovementForEnemyGroup( GROUP *pGroup )
|
void ResetMovementForNonPlayerGroup( GROUP *pGroup )
|
||||||
{
|
{
|
||||||
//Validate that the group is an enemy group and that it is moving.
|
//Validate that the group is an enemy group and that it is moving.
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pGroup->fBetweenSectors || !pGroup->ubNextX || !pGroup->ubNextY )
|
if( !pGroup->fBetweenSectors || !pGroup->ubNextX || !pGroup->ubNextY )
|
||||||
{ //Reset the group's assignment by moving it to the group's original sector as it's pending group.
|
{ //Reset the group's assignment by moving it to the group's original sector as it's pending group.
|
||||||
|
|
||||||
@@ -4527,7 +4556,7 @@ void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion )
|
|||||||
// create mvt groups
|
// create mvt groups
|
||||||
pGroup = GetGroup( (UINT8)cnt );
|
pGroup = GetGroup( (UINT8)cnt );
|
||||||
|
|
||||||
if( pGroup != NULL && pGroup->fPlayer )
|
if ( pGroup != NULL && pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
pGroup->fPersistant = TRUE;
|
pGroup->fPersistant = TRUE;
|
||||||
}
|
}
|
||||||
@@ -4826,7 +4855,7 @@ void RandomizePatrolGroupLocation( GROUP *pGroup )
|
|||||||
|
|
||||||
//return; //disabled for now
|
//return; //disabled for now
|
||||||
|
|
||||||
Assert( !pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam != OUR_TEAM );
|
||||||
Assert( pGroup->ubMoveType == ENDTOEND_FORWARDS );
|
Assert( pGroup->ubMoveType == ENDTOEND_FORWARDS );
|
||||||
Assert( pGroup->pEnemyGroup->ubIntention == PATROL );
|
Assert( pGroup->pEnemyGroup->ubIntention == PATROL );
|
||||||
|
|
||||||
@@ -5012,7 +5041,7 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup )
|
|||||||
|
|
||||||
// An ambush is occuring?
|
// An ambush is occuring?
|
||||||
if( !fAlreadyAmbushed && PlacementType != BLOODCAT_PLACEMENT_STATIC && pSector->bBloodCats > 0 &&
|
if( !fAlreadyAmbushed && PlacementType != BLOODCAT_PLACEMENT_STATIC && pSector->bBloodCats > 0 &&
|
||||||
!pGroup->fVehicle && !NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) )
|
!pGroup->fVehicle && !NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM ) )
|
||||||
{
|
{
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// SANDRO - STOMP traits - Scouting prevents the ambush of bloodcats
|
// SANDRO - STOMP traits - Scouting prevents the ambush of bloodcats
|
||||||
@@ -5206,7 +5235,7 @@ void PlayerGroupArrivedSafelyInSector( GROUP *pGroup, BOOLEAN fCheckForNPCs )
|
|||||||
|
|
||||||
|
|
||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
Assert( pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam == OUR_TEAM );
|
||||||
|
|
||||||
|
|
||||||
// if we haven't already checked for NPCs, and the group isn't empty
|
// if we haven't already checked for NPCs, and the group isn't empty
|
||||||
@@ -5257,7 +5286,7 @@ BOOLEAN HandlePlayerGroupEnteringSectorToCheckForNPCsOfNote( GROUP *pGroup )
|
|||||||
|
|
||||||
|
|
||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
Assert( pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam == OUR_TEAM );
|
||||||
|
|
||||||
// nobody in the group (perfectly legal with the chopper)
|
// nobody in the group (perfectly legal with the chopper)
|
||||||
if ( pGroup->pPlayerList == NULL )
|
if ( pGroup->pPlayerList == NULL )
|
||||||
@@ -5514,7 +5543,7 @@ BOOLEAN ValidateGroups( GROUP *pGroup )
|
|||||||
ValidatePlayersAreInOneGroupOnly();
|
ValidatePlayersAreInOneGroupOnly();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !pGroup->fPlayer && !pGroup->ubGroupSize )
|
if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->ubGroupSize )
|
||||||
{
|
{
|
||||||
isValid = FALSE;
|
isValid = FALSE;
|
||||||
|
|
||||||
@@ -5585,7 +5614,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8
|
|||||||
pNew->ubSectorY = (UINT8)SECTORY( uiSector );
|
pNew->ubSectorY = (UINT8)SECTORY( uiSector );
|
||||||
pNew->ubSectorZ = ubSectorZ;
|
pNew->ubSectorZ = ubSectorZ;
|
||||||
pNew->ubOriginalSector = (UINT8)uiSector;
|
pNew->ubOriginalSector = (UINT8)uiSector;
|
||||||
pNew->fPlayer = FALSE;
|
pNew->usGroupTeam = ENEMY_TEAM;
|
||||||
pNew->ubMoveType = CIRCULAR;
|
pNew->ubMoveType = CIRCULAR;
|
||||||
pNew->ubNextWaypointID = 0;
|
pNew->ubNextWaypointID = 0;
|
||||||
pNew->ubFatigueLevel = 100;
|
pNew->ubFatigueLevel = 100;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ typedef struct ENEMYGROUP
|
|||||||
typedef struct GROUP
|
typedef struct GROUP
|
||||||
{
|
{
|
||||||
BOOLEAN fDebugGroup; //for testing purposes -- handled differently in certain cases.
|
BOOLEAN fDebugGroup; //for testing purposes -- handled differently in certain cases.
|
||||||
BOOLEAN fPlayer; //set if this is a player controlled group.
|
UINT8 usGroupTeam; // the team that controls this group - 0 for OUR_TEAM, 1 for ENEMY_TEAM..
|
||||||
BOOLEAN fVehicle; //vehicle controlled group?
|
BOOLEAN fVehicle; //vehicle controlled group?
|
||||||
BOOLEAN fPersistant; //This flag when set prevents the group from being automatically deleted when it becomes empty.
|
BOOLEAN fPersistant; //This flag when set prevents the group from being automatically deleted when it becomes empty.
|
||||||
UINT8 ubGroupID; //the unique ID of the group (used for hooking into events and SOLDIERTYPE)
|
UINT8 ubGroupID; //the unique ID of the group (used for hooking into events and SOLDIERTYPE)
|
||||||
@@ -266,7 +266,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
|||||||
//blindly determines where to move the group.
|
//blindly determines where to move the group.
|
||||||
void RetreatGroupToPreviousSector( GROUP *pGroup );
|
void RetreatGroupToPreviousSector( GROUP *pGroup );
|
||||||
|
|
||||||
GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fPlayer );
|
GROUP* FindMovementGroupInSector( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubTeam );
|
||||||
|
|
||||||
BOOLEAN GroupAtFinalDestination( GROUP *pGroup );
|
BOOLEAN GroupAtFinalDestination( GROUP *pGroup );
|
||||||
|
|
||||||
@@ -280,8 +280,8 @@ void RemoveGroupFromList( GROUP *pGroup );
|
|||||||
|
|
||||||
WAYPOINT *GetFinalWaypoint( GROUP *pGroup );
|
WAYPOINT *GetFinalWaypoint( GROUP *pGroup );
|
||||||
|
|
||||||
void ResetMovementForEnemyGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY );
|
void ResetMovementForNonPlayerGroupsInLocation( UINT8 ubSectorX, UINT8 ubSectorY );
|
||||||
void ResetMovementForEnemyGroup( GROUP *pGroup );
|
void ResetMovementForNonPlayerGroup( GROUP *pGroup );
|
||||||
|
|
||||||
//Determines if any particular group WILL be moving through a given sector given it's current
|
//Determines if any particular group WILL be moving through a given sector given it's current
|
||||||
//position in the route and TREATS the pGroup->ubMoveType as ONE_WAY EVEN IF IT ISN'T. If the
|
//position in the route and TREATS the pGroup->ubMoveType as ONE_WAY EVEN IF IT ISN'T. If the
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ INT32 FindStratPath(INT16 sStart, INT16 sDestination, INT16 sMvtGroupNumber, BOO
|
|||||||
|
|
||||||
// for player groups only!
|
// for player groups only!
|
||||||
pGroup = GetGroup( ( UINT8 )sMvtGroupNumber );
|
pGroup = GetGroup( ( UINT8 )sMvtGroupNumber );
|
||||||
if ( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
// if player is holding down SHIFT key, find the shortest route instead of the quickest route!
|
// if player is holding down SHIFT key, find the shortest route instead of the quickest route!
|
||||||
if ( _KeyDown( SHIFT ) )
|
if ( _KeyDown( SHIFT ) )
|
||||||
@@ -1569,7 +1569,7 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup )
|
|||||||
RemoveGroupWaypoints( ( UINT8 )sMvtGroup );
|
RemoveGroupWaypoints( ( UINT8 )sMvtGroup );
|
||||||
|
|
||||||
|
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
#ifdef BETA_VERSION
|
#ifdef BETA_VERSION
|
||||||
VerifyAllMercsInGroupAreOnSameSquad( pGroup );
|
VerifyAllMercsInGroupAreOnSameSquad( pGroup );
|
||||||
@@ -1592,7 +1592,7 @@ void RebuildWayPointsForGroupPath( PathStPtr pHeadOfPath, INT16 sMvtGroup )
|
|||||||
{
|
{
|
||||||
// and it's a player group, and it's between sectors
|
// and it's a player group, and it's between sectors
|
||||||
// NOTE: AI groups never reverse direction between sectors, Kris cheats & teleports them back to their current sector!
|
// NOTE: AI groups never reverse direction between sectors, Kris cheats & teleports them back to their current sector!
|
||||||
if( pGroup->fPlayer && pGroup->fBetweenSectors )
|
if ( pGroup->usGroupTeam == OUR_TEAM && pGroup->fBetweenSectors )
|
||||||
{
|
{
|
||||||
// send the group right back to its current sector by reversing directions
|
// send the group right back to its current sector by reversing directions
|
||||||
GroupReversingDirectionsBetweenSectors( pGroup, pGroup->ubSectorX, pGroup->ubSectorY, FALSE );
|
GroupReversingDirectionsBetweenSectors( pGroup, pGroup->ubSectorX, pGroup->ubSectorY, FALSE );
|
||||||
@@ -1916,7 +1916,7 @@ PathStPtr GetGroupMercPathPtr( GROUP *pGroup )
|
|||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
|
|
||||||
// must be a player group!
|
// must be a player group!
|
||||||
Assert( pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam == OUR_TEAM );
|
||||||
|
|
||||||
if( pGroup->fVehicle )
|
if( pGroup->fVehicle )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -924,7 +924,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3");
|
|||||||
pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] );
|
pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] );
|
||||||
// if sector has enemies or hasn't already been taken at least once, then
|
// if sector has enemies or hasn't already been taken at least once, then
|
||||||
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
||||||
NumEnemiesInSector( sCurrentX, sCurrentY ) > 0 )
|
NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
// skip the rest. This sector cannot generate militia anyway.
|
// skip the rest. This sector cannot generate militia anyway.
|
||||||
iCounter++;
|
iCounter++;
|
||||||
@@ -981,7 +981,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3");
|
|||||||
|
|
||||||
// if sector has enemies or hasn't already been taken at least once, then
|
// if sector has enemies or hasn't already been taken at least once, then
|
||||||
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled ||
|
||||||
NumEnemiesInSector( sCurrentX, sCurrentY ) > 0 )
|
NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 )
|
||||||
{
|
{
|
||||||
// skip the rest. This sector cannot generate militia anyway.
|
// skip the rest. This sector cannot generate militia anyway.
|
||||||
iCounter++;
|
iCounter++;
|
||||||
|
|||||||
@@ -15228,7 +15228,7 @@ void HandleNewDestConfirmation( INT16 sMapX, INT16 sMapY )
|
|||||||
if( fPlotForHelicopter )
|
if( fPlotForHelicopter )
|
||||||
{
|
{
|
||||||
// if there are no enemies in destination sector, or we don't know
|
// if there are no enemies in destination sector, or we don't know
|
||||||
if ( ( NumEnemiesInSector( sMapX, sMapY ) == 0 ) ||
|
if ( (NumNonPlayerTeamMembersInSector( sMapX, sMapY, ENEMY_TEAM ) == 0) ||
|
||||||
( WhatPlayerKnowsAboutEnemiesInSector( sMapX, sMapY ) == KNOWS_NOTHING ) )
|
( WhatPlayerKnowsAboutEnemiesInSector( sMapX, sMapY ) == KNOWS_NOTHING ) )
|
||||||
{
|
{
|
||||||
// no problem
|
// no problem
|
||||||
|
|||||||
+26
-25
@@ -1890,7 +1890,7 @@ UINT8 GetTownSectorsUnderControl( INT8 bTownId )
|
|||||||
|
|
||||||
if( ( StrategicMap[ usSector ].bNameId == bTownId ) &&
|
if( ( StrategicMap[ usSector ].bNameId == bTownId ) &&
|
||||||
( StrategicMap[ usSector ].fEnemyControlled == FALSE ) &&
|
( StrategicMap[ usSector ].fEnemyControlled == FALSE ) &&
|
||||||
( NumEnemiesInSector( ( INT16 )iCounterA, ( INT16 )iCounterB ) == 0 ) )
|
(NumNonPlayerTeamMembersInSector( (INT16)iCounterA, (INT16)iCounterB, ENEMY_TEAM ) == 0) )
|
||||||
{
|
{
|
||||||
++ubSectorsControlled;
|
++ubSectorsControlled;
|
||||||
}
|
}
|
||||||
@@ -4006,7 +4006,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
|
|||||||
pValidSoldier->ubNumTraversalsAllowedToMerge = 2;
|
pValidSoldier->ubNumTraversalsAllowedToMerge = 2;
|
||||||
pGroup = GetGroup( ubPrevGroupID );
|
pGroup = GetGroup( ubPrevGroupID );
|
||||||
Assert( pGroup );
|
Assert( pGroup );
|
||||||
Assert( pGroup->fPlayer );
|
Assert( pGroup->usGroupTeam == OUR_TEAM );
|
||||||
Assert( pGroup->ubGroupSize );
|
Assert( pGroup->ubGroupSize );
|
||||||
pPlayer = pGroup->pPlayerList;
|
pPlayer = pGroup->pPlayerList;
|
||||||
while( pPlayer )
|
while( pPlayer )
|
||||||
@@ -4085,8 +4085,9 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Give guy(s) orders to walk off sector...
|
// Give guy(s) orders to walk off sector...
|
||||||
if( pGroup->fPlayer )
|
if ( pGroup->usGroupTeam == OUR_TEAM )
|
||||||
{ //For player groups, update the soldier information
|
{
|
||||||
|
//For player groups, update the soldier information
|
||||||
PLAYERGROUP *curr;
|
PLAYERGROUP *curr;
|
||||||
INT32 sGridNo;
|
INT32 sGridNo;
|
||||||
UINT8 ubNum = 0;
|
UINT8 ubNum = 0;
|
||||||
@@ -4120,33 +4121,33 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
|
|||||||
}
|
}
|
||||||
|
|
||||||
curr->pSoldier->EVENT_GetNewSoldierPath( sGridNo, WALKING );
|
curr->pSoldier->EVENT_GetNewSoldierPath( sGridNo, WALKING );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Here, get closest location for exit grid....
|
// Here, get closest location for exit grid....
|
||||||
sGridNo = FindGridNoFromSweetSpotCloseToExitGrid( curr->pSoldier, sAdditionalData, 10, &ubDirection );
|
sGridNo = FindGridNoFromSweetSpotCloseToExitGrid( curr->pSoldier, sAdditionalData, 10, &ubDirection );
|
||||||
|
|
||||||
if (!TileIsOutOfBounds(sGridNo))
|
if (!TileIsOutOfBounds(sGridNo))
|
||||||
{
|
{
|
||||||
// Save wait code - this will make buddy walk off screen into oblivion
|
// Save wait code - this will make buddy walk off screen into oblivion
|
||||||
// curr->pSoldier->ubWaitActionToDo = 2;
|
// curr->pSoldier->ubWaitActionToDo = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssertMsg( 0, String( "Failed to get good exit location for adjacentmove" ) );
|
AssertMsg( 0, String( "Failed to get good exit location for adjacentmove" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't worry about walk off screen, just stay at gridno...
|
// Don't worry about walk off screen, just stay at gridno...
|
||||||
curr->pSoldier->ubWaitActionToDo = 1;
|
curr->pSoldier->ubWaitActionToDo = 1;
|
||||||
|
|
||||||
// Set buddy go!
|
// Set buddy go!
|
||||||
gfPlotPathToExitGrid = TRUE;
|
gfPlotPathToExitGrid = TRUE;
|
||||||
curr->pSoldier->EVENT_GetNewSoldierPath( sGridNo, WALKING );
|
curr->pSoldier->EVENT_GetNewSoldierPath( sGridNo, WALKING );
|
||||||
gfPlotPathToExitGrid = FALSE;
|
gfPlotPathToExitGrid = FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
ubNum++;
|
|
||||||
|
++ubNum;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4519,7 +4520,7 @@ void AllMercsHaveWalkedOffSector( )
|
|||||||
//of the tactical placement gui to get into better position. Additionally, if there are any
|
//of the tactical placement gui to get into better position. Additionally, if there are any
|
||||||
//enemies in this sector that are part of a movement group, reset that movement group so that they
|
//enemies in this sector that are part of a movement group, reset that movement group so that they
|
||||||
//are "in" the sector rather than 75% of the way to the next sector if that is the case.
|
//are "in" the sector rather than 75% of the way to the next sector if that is the case.
|
||||||
ResetMovementForEnemyGroupsInLocation( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY );
|
ResetMovementForNonPlayerGroupsInLocation( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY );
|
||||||
|
|
||||||
if( guiAdjacentTraverseTime > 5 )
|
if( guiAdjacentTraverseTime > 5 )
|
||||||
{
|
{
|
||||||
@@ -4612,7 +4613,7 @@ void DoneFadeOutAdjacentSector( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OK, give our guys new orders...
|
// OK, give our guys new orders...
|
||||||
if( gpAdjacentGroup->fPlayer )
|
if ( gpAdjacentGroup->usGroupTeam == OUR_TEAM )
|
||||||
{
|
{
|
||||||
//For player groups, update the soldier information
|
//For player groups, update the soldier information
|
||||||
PLAYERGROUP *curr;
|
PLAYERGROUP *curr;
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ void HandleDisease()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// the bulk of doctoring will come from the military
|
// the bulk of doctoring will come from the military
|
||||||
doctors += NumEnemiesInSector( sX, sY ) * GetMilitaryPopulationDoctorRate( );
|
doctors += NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM ) * GetMilitaryPopulationDoctorRate( );
|
||||||
|
|
||||||
UINT32 doctorpower = doctors * GetPopulationDoctorPoints( );
|
UINT32 doctorpower = doctors * GetPopulationDoctorPoints( );
|
||||||
|
|
||||||
@@ -479,8 +479,7 @@ UINT16 GetSectorPopulation( INT16 sX, INT16 sY, BOOLEAN fWithMilitary )
|
|||||||
if ( fWithMilitary )
|
if ( fWithMilitary )
|
||||||
{
|
{
|
||||||
// add number of enemies...
|
// add number of enemies...
|
||||||
UINT16 sNumberOfEnemies = NumEnemiesInSector( sX, sY );
|
population += NumNonPlayerTeamMembersInSector( sX, sY, ENEMY_TEAM );
|
||||||
population += sNumberOfEnemies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return population;
|
return population;
|
||||||
|
|||||||
@@ -4460,7 +4460,7 @@ void MilitiaChangesSides( )
|
|||||||
{
|
{
|
||||||
if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife)
|
if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife)
|
||||||
{
|
{
|
||||||
if ( (gWorldSectorX ==0 && gWorldSectorY == 0) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
if ( (gWorldSectorX == 0 && gWorldSectorY == 0) || !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) )
|
||||||
MakeCivHostile( pSoldier, 2 );
|
MakeCivHostile( pSoldier, 2 );
|
||||||
RecalculateOppCntsDueToNoLongerNeutral( pSoldier );
|
RecalculateOppCntsDueToNoLongerNeutral( pSoldier );
|
||||||
}
|
}
|
||||||
@@ -7070,7 +7070,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
|||||||
{
|
{
|
||||||
if( !gbWorldSectorZ )
|
if( !gbWorldSectorZ )
|
||||||
{
|
{
|
||||||
SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY) ].bLastKnownEnemies = NumEnemiesInSector( gWorldSectorX, gWorldSectorY );
|
SectorInfo[SECTOR( gWorldSectorX, gWorldSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flugente: note number of wounded for campaign stats
|
// Flugente: note number of wounded for campaign stats
|
||||||
@@ -10906,7 +10906,7 @@ BOOLEAN GetRandomEnemyTownSector(INT8 bTownId, UINT16& aSector)
|
|||||||
{
|
{
|
||||||
usSector = CALCULATE_STRATEGIC_INDEX( iCounterA, iCounterB );
|
usSector = CALCULATE_STRATEGIC_INDEX( iCounterA, iCounterB );
|
||||||
|
|
||||||
if ( StrategicMap[usSector].bNameId == bTownId && NumEnemiesInSector( iCounterA, iCounterB ) > 0 && !SectorHasVIP( iCounterA, iCounterB ) )
|
if ( StrategicMap[usSector].bNameId == bTownId && NumNonPlayerTeamMembersInSector( iCounterA, iCounterB, ENEMY_TEAM ) > 0 && !SectorHasVIP( iCounterA, iCounterB ) )
|
||||||
{
|
{
|
||||||
possiblesectors.push_back( usSector );
|
possiblesectors.push_back( usSector );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17914,7 +17914,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN
|
|||||||
GROUP *pGroup = gpGroupList;
|
GROUP *pGroup = gpGroupList;
|
||||||
while ( pGroup )
|
while ( pGroup )
|
||||||
{
|
{
|
||||||
if ( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
if ( pGroup->usGroupTeam == bTeam && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||||
{
|
{
|
||||||
nummortars += pGroup->ubGroupSize;
|
nummortars += pGroup->ubGroupSize;
|
||||||
numshells += gSkillTraitValues.usVOMortarPointsTroop * pGroup->ubGroupSize;
|
numshells += gSkillTraitValues.usVOMortarPointsTroop * pGroup->ubGroupSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user