Use SoldierID

This commit is contained in:
Asdow
2024-11-30 17:06:11 +02:00
parent 66f5156f03
commit 5bbbec18bb
3 changed files with 36 additions and 42 deletions
+20 -18
View File
@@ -6731,9 +6731,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
// player team character fixes // player team character fixes
SOLDIERTYPE *pTeamSoldier; SOLDIERTYPE *pTeamSoldier;
for (UINT16 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) for (SoldierID bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop)
{ {
pTeamSoldier=MercPtrs[bLoop]; pTeamSoldier = bLoop;
// silversurfer: added additional check to only remove the flags when there is no boxing activity going on at the moment. // silversurfer: added additional check to only remove the flags when there is no boxing activity going on at the moment.
// WANNE: This should fix the bug if any merc are still under PC control. This could happen after boxing in SAN MONA. // WANNE: This should fix the bug if any merc are still under PC control. This could happen after boxing in SAN MONA.
@@ -9277,20 +9277,20 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile )
gCamoFace[i].gSnowCamoface = FALSE; gCamoFace[i].gSnowCamoface = FALSE;
} }
SOLDIERTYPE * pSoldier; SoldierID Soldier = gTacticalStatus.Team[gbPlayerNum].bFirstID;
UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID;
UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; for ( ; Soldier <= bLastTeamID; ++Soldier)
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID,pSoldier++)
{ {
if ( pSoldier ) if ( Soldier )
{ {
gCamoFace[pSoldier->ubProfile].gCamoface = ( pSoldier->bCamo > 0 ); UINT8 profile = Soldier->ubProfile;
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = ( pSoldier->urbanCamo > 0 ); gCamoFace[profile].gCamoface = ( Soldier->bCamo > 0 );
gCamoFace[pSoldier->ubProfile].gDesertCamoface = ( pSoldier->desertCamo > 0 ); gCamoFace[profile].gUrbanCamoface = ( Soldier->urbanCamo > 0 );
gCamoFace[pSoldier->ubProfile].gSnowCamoface = ( pSoldier->snowCamo > 0 ); gCamoFace[profile].gDesertCamoface = ( Soldier->desertCamo > 0 );
gCamoFace[profile].gSnowCamoface = ( Soldier->snowCamo > 0 );
DeleteSoldierFace( pSoldier ); DeleteSoldierFace( Soldier );
pSoldier->iFaceIndex = InitSoldierFace( pSoldier ); Soldier->iFaceIndex = InitSoldierFace( Soldier );
} }
} }
} }
@@ -9511,18 +9511,19 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p
} }
else else
{ {
UINT16 sSoldierCnt; SoldierID sSoldierCnt;
SoldierID bLastTeamID;
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
UINT16 bLastTeamID; BOOLEAN fFoundAMerc = FALSE;
BOOLEAN fFoundAMerc=FALSE;
// Set locator to first merc // Set locator to first merc
sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
//loop through all the mercs on the players team to find the one that is not moving //loop through all the mercs on the players team to find the one that is not moving
for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) for ( ; sSoldierCnt <= bLastTeamID; ++sSoldierCnt )
{ {
pSoldier = sSoldierCnt;
// test for !NULL (if initilization fails and MercPtrs contains 'NULL's) // test for !NULL (if initilization fails and MercPtrs contains 'NULL's)
if( pSoldier && pSoldier->bActive ) if( pSoldier && pSoldier->bActive )
{ {
@@ -9546,8 +9547,9 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
//loop through all the mercs and find one that is moving //loop through all the mercs and find one that is moving
for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) for ( ; sSoldierCnt <= bLastTeamID; ++sSoldierCnt )
{ {
pSoldier = sSoldierCnt;
if( pSoldier && pSoldier->bActive ) if( pSoldier && pSoldier->bActive )
{ {
//we found an alive, merc that is not moving //we found an alive, merc that is not moving
+11 -19
View File
@@ -1030,10 +1030,7 @@ void DisableFPSOverlay( BOOLEAN fEnable )
void TacticalScreenLocateToSoldier( ) void TacticalScreenLocateToSoldier( )
{ {
INT32 cnt; BOOLEAN fPreferedGuyUsed = FALSE;
SOLDIERTYPE *pSoldier;
UINT16 bLastTeamID;
BOOLEAN fPreferedGuyUsed = FALSE;
if ( gubPreferredInitialSelectedGuy != NOBODY ) if ( gubPreferredInitialSelectedGuy != NOBODY )
{ {
@@ -1050,14 +1047,14 @@ void TacticalScreenLocateToSoldier( )
if ( !fPreferedGuyUsed ) if ( !fPreferedGuyUsed )
{ {
// Set locator to first merc // Set locator to first merc
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; SoldierID Soldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) for ( ; Soldier <= bLastTeamID; ++Soldier)
{ {
if ( OK_CONTROLLABLE_MERC( pSoldier ) && OK_INTERRUPT_MERC( pSoldier ) ) if ( OK_CONTROLLABLE_MERC( Soldier ) && OK_INTERRUPT_MERC( Soldier ) )
{ {
LocateSoldier( pSoldier->ubID, 10 ); LocateSoldier( Soldier, 10 );
SelectSoldier( pSoldier->ubID, FALSE, TRUE ); SelectSoldier( Soldier, FALSE, TRUE );
break; break;
} }
} }
@@ -1075,22 +1072,17 @@ void EnterMapScreen( )
void UpdateTeamPanelAssignments( ) void UpdateTeamPanelAssignments( )
{ {
INT32 cnt;
SOLDIERTYPE *pSoldier;
UINT16 bLastTeamID;
// Remove all players // Remove all players
RemoveAllPlayersFromSlot( ); RemoveAllPlayersFromSlot( );
// Set locator to first merc // Set locator to first merc
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; SoldierID Soldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) for ( ; Soldier <= bLastTeamID; ++Soldier)
{ {
// Setup team interface // Setup team interface
CheckForAndAddMercToTeamPanel( pSoldier ); CheckForAndAddMercToTeamPanel( Soldier );
} }
} }
+5 -5
View File
@@ -7541,16 +7541,15 @@ void HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap( )
//if the player made a 'noise' going through the gate at the end of the tunnel sector //if the player made a 'noise' going through the gate at the end of the tunnel sector
if ( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE ) if ( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE )
{ {
UINT8 cnt;
// //
//Move some of the enemies to be 'near' them player when the enter the room //Move some of the enemies to be 'near' them player when the enter the room
// //
// Loop through the list and move some of the enemies // Loop through the list and move some of the enemies
cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; SoldierID cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID;
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; cnt++, pSoldier++ ) for ( ; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; ++cnt)
{ {
pSoldier = cnt;
//if the soldier is active, //if the soldier is active,
if ( pSoldier->bActive ) if ( pSoldier->bActive )
{ {
@@ -7581,8 +7580,9 @@ void HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap( )
while ( ubNumEnemiesMoved < 3 ) while ( ubNumEnemiesMoved < 3 )
{ {
cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID;
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; cnt++, pSoldier++ ) for ( ; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; ++cnt )
{ {
pSoldier = cnt;
//if the soldier is active, //if the soldier is active,
if ( pSoldier->bActive && pSoldier->sGridNo != 15705 && pSoldier->sGridNo != 15712 && pSoldier->sGridNo != 15233 ) if ( pSoldier->bActive && pSoldier->sGridNo != 15705 && pSoldier->sGridNo != 15712 && pSoldier->sGridNo != 15233 )
{ {