Fix: possible underflow in UB code

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8605 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-08-28 20:44:16 +00:00
parent 5d04583e13
commit e205697804
12 changed files with 171 additions and 247 deletions
+2 -2
View File
@@ -66,11 +66,11 @@ typedef struct
BOOLEAN fEnemyShouldImmediatelySeekThePlayer;
INT8 bSectorTheEnemyWillSeekEnemy;
INT8 bNewMercProfileIDForSayingMorrisNote;
UINT8 usFiller1;
UINT8 ubDisplayCommanderMorrisNote;
UINT16 usFiller1;
INT16 bNewMercProfileIDForSayingMorrisNote;
UINT32 uiTurnLastSaidSeeEnemyQuote;
+56 -65
View File
@@ -6897,15 +6897,14 @@ typedef struct
void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
{
UINT32 uiCnt;
INT8 bNumValidMercs = -1;
UINT32 uiCnt;
UINT8 usNumValidMercs = 0;
INT32 iSectorID = SECTOR( sSectorX, sSectorY );
UINT8 ubValidMercProfileIDArray[NUM_MERCS_WITH_NEW_QUOTES];
SOLDIERTYPE *pSoldier = NULL;
#define NUM_VALID_SECTORS 6
#define DELAY_FOR_PLAYER_DESC_OF_SECTOR 2
#define NUM_VALID_SECTORS 6
#define DELAY_FOR_PLAYER_DESC_OF_SECTOR 2
ENTER_SECTOR_PLAYER_QUOTE PlayerSectorDescQuote[ NUM_VALID_SECTORS ] =
{
@@ -6929,7 +6928,7 @@ void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, I
};
//loop through all the sectors that have the quotes
for ( uiCnt = 0; uiCnt<NUM_VALID_SECTORS; uiCnt++ )
for ( uiCnt = 0; uiCnt<NUM_VALID_SECTORS; ++uiCnt )
{
//if this sector is the right x & y
if ( PlayerSectorDescQuote[uiCnt].sSectorID == iSectorID )
@@ -6937,69 +6936,67 @@ void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, I
//if is the right level
if ( PlayerSectorDescQuote[uiCnt].bSectorZ == sSectorZ )
{
// If the player has never said the "enter sector" desc before
if ( GetSectorFlagStatus( sSectorX, sSectorY, (UINT8)sSectorZ, SF_HAVE_SAID_PLAYER_QUOTE_NEW_SECTOR ) != TRUE )
{
//Get # of valid mercs
bNumValidMercs = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, ubValidMercProfileIDArray );
usNumValidMercs = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, ubValidMercProfileIDArray );
//if there isnt any valid mercs
if ( bNumValidMercs == 0 )
if ( usNumValidMercs == 0 )
{
//exit
return;
}
//Switch on the town ID
//I10
if ( iSectorID == SECTOR( gGameUBOptions.FristSectorTownX, gGameUBOptions.FristSectorTownY ) )
{
UINT8 cnt;
//I10
if ( iSectorID == SECTOR( gGameUBOptions.FristSectorTownX, gGameUBOptions.FristSectorTownY ) )
{
UINT8 cnt;
for( cnt=0; cnt<bNumValidMercs; cnt++ )
{
//Say the qoute in a couple of seconds
DelayedMercQuote( ubValidMercProfileIDArray[ cnt ], PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR + cnt );
}
}
//J13
else if ( iSectorID == SECTOR( gGameUBOptions.SectorFanX, gGameUBOptions.SectorFanY ) )
{
if( PlayerSectorDescQuote[ uiCnt ].bSectorZ == gGameUBOptions.SectorFanZ )
for( cnt=0; cnt<usNumValidMercs; ++cnt )
{
//Say the qoute in a couple of seconds
DelayedMercQuote( ubValidMercProfileIDArray[ cnt ], PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR + cnt );
}
}
//J13
else if ( iSectorID == SECTOR( gGameUBOptions.SectorFanX, gGameUBOptions.SectorFanY ) )
{
if( PlayerSectorDescQuote[ uiCnt ].bSectorZ == gGameUBOptions.SectorFanZ )
{
//See if Manuel is on the team
pSoldier = FindSoldierByProfileID( MANUEL_UB, TRUE );
//if he is ON the team
if( pSoldier != NULL )
{
//See if Manuel is on the team
pSoldier = FindSoldierByProfileID( MANUEL_UB, TRUE );
//get manuel to say the quote
DelayedMercQuote( MANUEL_UB, PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
//get manuel to say his additional quote
DelayedMercQuote( MANUEL_UB, QUOTE_ENTER_SECTOR_WITH_FAN_2, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
}
else
{
//else if Biggens is not on the team, check for biggens
pSoldier = FindSoldierByProfileID( BIGGENS_UB, TRUE );
//if he is ON the team
if( pSoldier != NULL )
{
//get manuel to say the quote
DelayedMercQuote( MANUEL_UB, PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
DelayedMercQuote( BIGGENS_UB, PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
//get manuel to say his additional quote
DelayedMercQuote( MANUEL_UB, QUOTE_ENTER_SECTOR_WITH_FAN_2, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
//Remember he said
SetJa25GeneralFlag( JA_GF__BIGGENS_SAID_QUOTE_117 );
}
else
{
//else if Biggens is not on the team, check for biggens
pSoldier = FindSoldierByProfileID( BIGGENS_UB, TRUE );
}
//if he is ON the team
if( pSoldier != NULL )
{
//get manuel to say the quote
DelayedMercQuote( BIGGENS_UB, PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
//Remember he said
SetJa25GeneralFlag( JA_GF__BIGGENS_SAID_QUOTE_117 );
}
}
//Remeber the quote was said
SetFactTrue( FACT_PLAYER_KNOWS_ABOUT_FAN_STOPPING );
}
//Remeber the quote was said
SetFactTrue( FACT_PLAYER_KNOWS_ABOUT_FAN_STOPPING );
}
}
//J14
else if ( iSectorID == SECTOR( gGameUBOptions.ExitForFanToPowerGenSectorX, gGameUBOptions.ExitForFanToPowerGenSectorY ) )
@@ -7009,12 +7006,12 @@ void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, I
}
else
{
//Get a random merc from the list
UINT8 ubMercToSayQuote = RandomProfileIdFromNewMercsOnPlayerTeam();
//Get a random merc from the list
INT16 sMercToSayQuote = RandomProfileIdFromNewMercsOnPlayerTeam();
//Say the qoute in a couple of seconds
DelayedMercQuote( ubMercToSayQuote, PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
//Say the qoute in a couple of seconds
if ( sMercToSayQuote > -1 )
DelayedMercQuote( (UINT16)sMercToSayQuote, PlayerSectorDescQuote[ uiCnt ].ubQuoteNum, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
}
/*
switch ( iSectorID )
@@ -7112,8 +7109,6 @@ void HandlePlayerTeamQuotesWhenEnteringSector( INT16 sSectorX, INT16 sSectorY, I
void HandlePlayerQuotesWhenEnteringFirstTunnelSector( )
{
UINT8 ubID;
//if the player got through using the timed method
if ( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_STOPPED_FAN_TO_GET_THROUGH )
{
@@ -7121,38 +7116,34 @@ void HandlePlayerQuotesWhenEnteringFirstTunnelSector( )
UINT8 ubNumPlayersOnTeam = NumberOfMercsOnPlayerTeam( );
//Get a random qualified merc to say the quote
ubID = RandomSoldierIdFromNewMercsOnPlayerTeam( );
INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam( );
//if there is no valid merc
if ( ubID == -1 )
if ( bID == -1 )
return;
//if not all the players made it through
if ( ubNumPlayersInSector < ubNumPlayersOnTeam )
{
// TacticalCharacterDialogue( &Menptr[ ubID ], QUOTE_CONTRACTS_OVER );
DelayedMercQuote( Menptr[ubID].ubProfile, QUOTE_CONTRACTS_OVER, GetWorldTotalSeconds( ) + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
DelayedMercQuote( Menptr[bID].ubProfile, QUOTE_CONTRACTS_OVER, GetWorldTotalSeconds( ) + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
}
//if ALL mercs made it through
else if ( ubNumPlayersInSector == ubNumPlayersOnTeam )
{
DelayedMercQuote( Menptr[ubID].ubProfile, QUOTE_CONTRACT_ACCEPTANCE, GetWorldTotalSeconds( ) + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
DelayedMercQuote( Menptr[bID].ubProfile, QUOTE_CONTRACT_ACCEPTANCE, GetWorldTotalSeconds( ) + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
// TacticalCharacterDialogue( &Menptr[ ubID ], QUOTE_CONTRACT_ACCEPTANCE );
}
}
else if ( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH )
/*else if ( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH )
{
/*
Chnaged to be played when fan blows up
//Get a random qualified merc to say the quote
ubID = RandomSoldierIdFromNewMercsOnPlayerTeam();
DelayedMercQuote( Menptr[ ubID ].ubProfile, QUOTE_ACCEPT_CONTRACT_RENEWAL, GetWorldTotalSeconds() + DELAY_FOR_PLAYER_DESC_OF_SECTOR );
*/
}
}*/
else
{
Assert( 0 );
+3 -6
View File
@@ -734,7 +734,7 @@ void HandleDialogue( )
if( ubNumQualifiedMercs != 0 )
{
//loop through all the mercs
for( ubCnt=0; ubCnt<ubNumQualifiedMercs; ubCnt++ )
for( ubCnt=0; ubCnt<ubNumQualifiedMercs; ++ubCnt )
{
pSoldier = MercPtrs[ ubQualifiedSoldierIDArray[ ubCnt ] ];
@@ -751,15 +751,13 @@ void HandleDialogue( )
gfMorrisShouldSayHi = FALSE;
}
}
return;
}
#else //Ja25: no mike
if ( iQSize == 0 )
{
if ( gfMikeShouldSayHi == TRUE )
{
SOLDIERTYPE * pMike;
@@ -1039,7 +1037,6 @@ void HandleDialogue( )
gubCurrentTalkingID = QItem->ubCharacterNum;
ExecuteCharacterDialogue( QItem->ubCharacterNum, QItem->usQuoteNum, QItem->iFaceIndex, QItem->bUIHandlerID, QItem->fFromSoldier );
}
if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_ENABLE_AI )
@@ -3911,7 +3908,7 @@ void HandlePlayerClosingMorrisNoteDisplayedOnScreen()
}
else
{
DelayedMercQuote( gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote, DQ__MORRIS_NOTE_DISPLAY_NOTE_1, GetWorldTotalSeconds() + 1 );
DelayedMercQuote( (UINT16)(gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote), DQ__MORRIS_NOTE_DISPLAY_NOTE_1, GetWorldTotalSeconds() + 1 );
}
}
#endif
+19 -40
View File
@@ -5188,39 +5188,22 @@ void CarmenLeavesSectorCallback( void )
#ifdef JA2UB
//JA25 UB
void PerformJerryMiloAction301()
{
UINT8 ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES];
INT8 bNumMercsPresent=-1;
UINT8 usNumMercsPresent;
SOLDIERTYPE *pSoldier=NULL;
INT32 cnt;
UINT8 ubId;
//Get the number and array of the new soldiers
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubMercsPresent, NULL );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubMercsPresent, NULL );
//Randomly choose one
/* //if there is at least 1 of the desired mercs found
if( bNumMercsPresent != -1 )
{
ubId = ubMercsPresent[ Random( bNumMercsPresent ) ];
pSoldier = MercPtrs[ ubId ];
TacticalCharacterDialogue( pSoldier, QUOTE_DEATH_RATE_REFUSAL );
}
*/
//Have them all say their quote
for( cnt=0; cnt<bNumMercsPresent; cnt++ )
for( UINT8 cnt=0; cnt<usNumMercsPresent; ++cnt )
{
ubId = ubMercsPresent[ cnt ];
pSoldier = MercPtrs[ ubId ];
TacticalCharacterDialogue( pSoldier, QUOTE_DEATH_RATE_REFUSAL );
TacticalCharacterDialogue( MercPtrs[ubId], QUOTE_DEATH_RATE_REFUSAL );
}
//Trigger Jerry Milo's script record 11 ( call action 302 )
@@ -5233,29 +5216,27 @@ void PerformJerryMiloAction301()
void PerformJerryMiloAction302()
{
UINT8 ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES];
INT8 bNumMercsPresent=-1;
SOLDIERTYPE *pSoldier=NULL;
UINT8 ubId;
UINT8 usNumMercsPresent;
//off jazz
//Get the number and array of the new soldiers
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubMercsPresent, NULL );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubMercsPresent, NULL );
//Randomly choose one
//if there is at least 1 of the desired mercs found
if( bNumMercsPresent != 0 )
if( usNumMercsPresent > 0 )
{
UINT8 ubProfileID = NO_PROFILE;
UINT8 ubIdOfMercWhoSaidQuote;
ubIdOfMercWhoSaidQuote = Random( bNumMercsPresent );
ubId = ubMercsPresent[ ubIdOfMercWhoSaidQuote ];
ubIdOfMercWhoSaidQuote = Random( usNumMercsPresent );
UINT8 ubId = ubMercsPresent[ ubIdOfMercWhoSaidQuote ];
pSoldier = MercPtrs[ ubId ];
SOLDIERTYPE* pSoldier = MercPtrs[ ubId ];
TacticalCharacterDialogue( pSoldier, QUOTE_LAME_REFUSAL );
if( bNumMercsPresent == 1 )
if( usNumMercsPresent == 1 )
ubProfileID = MercPtrs[ ubId ]->ubProfile;
else
{
@@ -5263,7 +5244,7 @@ void PerformJerryMiloAction302()
while( !fDone )
{
ubProfileID = Random( bNumMercsPresent );
ubProfileID = Random( usNumMercsPresent );
if( ubProfileID != ubIdOfMercWhoSaidQuote )
{
@@ -5276,8 +5257,7 @@ void PerformJerryMiloAction302()
}
//Say the quote in 15 seconds
DelayedMercQuote( ubProfileID, QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE, GetWorldTotalSeconds( ) + 15 );
DelayedMercQuote( ubProfileID, QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE, GetWorldTotalSeconds( ) + 15 );
}
//handle the merc arrives quotes now
@@ -5388,7 +5368,7 @@ void HandleSpecificQuoteWhenLeavingNpcTalkMenu()
void HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( UINT8 ubNpcProfileID, UINT32 uiQuoteNum )
{
INT8 bNumMercsPresent=-1;
UINT8 usNumMercsPresent;
UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
UINT8 ValidSoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES] = {0};
UINT8 ubNumValidSoldiers=0;
@@ -5403,17 +5383,16 @@ void HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( UINT8 ubNpcProfileI
}
//Get the number and array of the new soldiers
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
//if the player doesnt have any qualified players on the team
if( bNumMercsPresent == -1 )
if( !usNumMercsPresent )
{
return;
}
//loop through the mercs and see if there in range of the dealer
for( ubCnt=0; ubCnt<bNumMercsPresent; ubCnt++)
for( ubCnt=0; ubCnt<usNumMercsPresent; ++ubCnt )
{
pSoldier = &Menptr[ SoldierIdArray[ ubCnt ] ];
@@ -5422,7 +5401,7 @@ void HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( UINT8 ubNpcProfileI
SoldierTo3DLocationLineOfSightTest( pSoldier, pNPC->sGridNo, 0, 0, (UINT8)MaxDistanceVisible(), TRUE ) )
{
ValidSoldierIdArray[ ubNumValidSoldiers ] = pSoldier->ubID;
ubNumValidSoldiers++;
++ubNumValidSoldiers;
}
}
+49 -75
View File
@@ -259,7 +259,6 @@ void Old_UB_Inventory ()
MORRIS_INSTRUCTION_NOTE = 336;
}
void New_UB_Inventory ()
{
//inshy: chenge index of items to 1.13 version. Now we dont need Items.xml in UB-113 folder
@@ -390,7 +389,6 @@ void InitGridNoUB()
CALICO_950_UB = gGameUBOptions.ubCALICO_950_UB;
CALICO_900_UB = gGameUBOptions.ubCALICO_900_UB;
}
BOOLEAN IsSoldierQualifiedMerc( SOLDIERTYPE *pSoldier )
{
@@ -411,7 +409,6 @@ BOOLEAN IsSoldierQualifiedMerc( SOLDIERTYPE *pSoldier )
}
}
BOOLEAN IsSoldierQualifiedMercForSeeingPowerGenFan( SOLDIERTYPE *pSoldier )
{
if( pSoldier->ubProfile == MANUEL_UB ||//MANUEL ||
@@ -428,7 +425,6 @@ BOOLEAN IsSoldierQualifiedMercForSeeingPowerGenFan( SOLDIERTYPE *pSoldier )
}
}
BOOLEAN IsSoldierQualifiedGunCommenterMerc( SOLDIERTYPE *pSoldier )
{
if( pSoldier->ubProfile == GASTON_UB || // GASTON
@@ -445,7 +441,6 @@ BOOLEAN IsSoldierQualifiedGunCommenterMerc( SOLDIERTYPE *pSoldier )
}
}
BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier )
{
if( pSoldier->ubProfile == GASTON_UB || // GASTON
@@ -461,13 +456,10 @@ BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier )
}
}
INT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray )
UINT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray )
{
SOLDIERTYPE *pSoldier=NULL;
INT32 cnt;
INT8 bNumMercsPresent=0;
UINT8 usNumMercsPresent=0;
if( pSoldierIdArray )
memset( pSoldierIdArray, NOBODY, NUM_MERCS_WITH_NEW_QUOTES );
@@ -475,10 +467,10 @@ INT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArra
if( pProfileIdArray )
memset( pProfileIdArray, NO_PROFILE, NUM_MERCS_WITH_NEW_QUOTES );
cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
INT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
//Check to see if Gaston, Stogie or the PGC is on the team
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++)
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt, ++pSoldier )
{
//if the merc is alive, in sector, etc...
//Note: cant do the OK_CONTROLLABLE_MERC() cause it does bInSector which is not set when EnterSector is finshed ( we need it then )
@@ -506,30 +498,28 @@ INT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArra
pSoldierIdArray[ bNumMercsPresent ] = pSoldier->ubID;
}
bNumMercsPresent++;
++usNumMercsPresent;
}
}
}
return( bNumMercsPresent );
return usNumMercsPresent;
}
INT8 RandomProfileIdFromNewMercsOnPlayerTeam()
INT16 RandomProfileIdFromNewMercsOnPlayerTeam()
{
INT8 bNumMercsPresent=-1;
UINT8 ProfileIdArray[NUM_MERCS_WITH_NEW_QUOTES];
UINT8 usNumMercsPresent;
UINT8 ProfileIdArray[NUM_MERCS_WITH_NEW_QUOTES];
//Get the number and array of the new soldiers
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, ProfileIdArray );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, ProfileIdArray );
Assert( bNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES );
Assert( usNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES );
if( bNumMercsPresent != 0 )
if( usNumMercsPresent > 0 )
{
//return a random merc from the array
return( ProfileIdArray[ Random( bNumMercsPresent ) ] );
return( (INT16)(ProfileIdArray[ Random( usNumMercsPresent ) ]) );
}
else
{
@@ -537,21 +527,20 @@ INT8 RandomProfileIdFromNewMercsOnPlayerTeam()
}
}
INT8 RandomSoldierIdFromNewMercsOnPlayerTeam()
INT16 RandomSoldierIdFromNewMercsOnPlayerTeam()
{
INT8 bNumMercsPresent=-1;
UINT8 usNumMercsPresent;
UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
//Get the number and array of the new soldiers
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
Assert( bNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES );
Assert( usNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES );
if( bNumMercsPresent != 0 )
if( usNumMercsPresent > 0 )
{
//return a random merc from the array
return( SoldierIdArray[ Random( bNumMercsPresent ) ] );
return( (INT16)( SoldierIdArray[ Random( usNumMercsPresent ) ] ));
}
else
{
@@ -559,13 +548,11 @@ INT8 RandomSoldierIdFromNewMercsOnPlayerTeam()
}
}
INT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray )
UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray )
{
INT8 bNumMercsPresent=-1;
UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
UINT8 usNumMercsPresent;
UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
BOOLEAN UsedArray[NUM_MERCS_WITH_NEW_QUOTES];
UINT8 ubCnt;
BOOLEAN fFound=FALSE;
UINT8 ubRand;
@@ -573,21 +560,21 @@ INT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray )
memset( pRandomSoldierIdArray, NOBODY, NUM_MERCS_WITH_NEW_QUOTES );
//Get the number and array of the new soldiers
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
Assert( bNumMercsPresent < NUM_MERCS_WITH_NEW_QUOTES );
if( bNumMercsPresent != 0 )
if( usNumMercsPresent > 0 )
{
//loop through all the available mercs
for( ubCnt=0; ubCnt<bNumMercsPresent; ubCnt++ )
for( UINT8 ubCnt=0; ubCnt<usNumMercsPresent; ++ubCnt )
{
fFound = FALSE;
//loop
while( !fFound )
{
ubRand = Random( bNumMercsPresent );
ubRand = Random( usNumMercsPresent );
if( !UsedArray[ ubRand ] )
{
UsedArray[ ubRand ] = TRUE;
@@ -597,19 +584,19 @@ INT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray )
}
}
}
return( bNumMercsPresent );
}
return( usNumMercsPresent );
}
UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 )
{
UINT8 bNumMercs;
UINT8 usNumMercs;
UINT8 RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ];
UINT8 ubNumberDifMercsAssigned=0;
bNumMercs = RandomArrayOfQualifiedMercs( RandomSoldierIdArray );
usNumMercs = RandomArrayOfQualifiedMercs( RandomSoldierIdArray );
if( bNumMercs == 0 )
if( usNumMercs == 0 )
{
return( 0 );
}
@@ -622,15 +609,14 @@ UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *p
if( pSoldierId3 != NULL )
*pSoldierId3 = NOBODY;
if( bNumMercs >= 1 && pSoldierId1 != NULL )
if( usNumMercs >= 1 && pSoldierId1 != NULL )
{
*pSoldierId1 = RandomSoldierIdArray[ 0 ];
ubNumberDifMercsAssigned++;
}
if( bNumMercs >= 2 && pSoldierId2 != NULL )
if( usNumMercs >= 2 && pSoldierId2 != NULL )
{
*pSoldierId2 = RandomSoldierIdArray[ 1 ];
ubNumberDifMercsAssigned++;
@@ -642,12 +628,12 @@ UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *p
if( pSoldierId3 != NULL )
{
if( bNumMercs >= 3 )
if( usNumMercs >= 3 )
{
*pSoldierId3 = RandomSoldierIdArray[ 2 ];
ubNumberDifMercsAssigned++;
}
else if( bNumMercs >= 2 )
else if( usNumMercs >= 2 )
{
if( Chance( 50 ) )
*pSoldierId3 = RandomSoldierIdArray[ 1 ];
@@ -659,7 +645,6 @@ UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *p
return( ubNumberDifMercsAssigned );
}
void HandleWhenCertainPercentageOfEnemiesDie()
{
UINT32 uiPercentEnemiesKilled;
@@ -685,10 +670,10 @@ void HandleWhenCertainPercentageOfEnemiesDie()
//all enemies are dead and if the quote hasnt been said yet
if( uiPercentEnemiesKilled >= 100 && !( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX ) )
{
INT8 bProfile = RandomProfileIdFromNewMercsOnPlayerTeam();
INT16 bProfile = RandomProfileIdFromNewMercsOnPlayerTeam();
if( bProfile != -1 )
DelayedMercQuote( bProfile, QUOTE_WONT_RENEW_CONTRACT_LAME_REFUSAL, GetWorldTotalSeconds() + 5 );
DelayedMercQuote( (UINT16)bProfile, QUOTE_WONT_RENEW_CONTRACT_LAME_REFUSAL, GetWorldTotalSeconds() + 5 );
gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX;
}
@@ -885,7 +870,7 @@ void HandlePowerGenAlarm()
//
if( gubFact[ FACT_PLAYER_KNOWS_ABOUT_FAN_STOPPING ] )
{
INT8 bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
if( bID != -1 )
{
@@ -971,10 +956,8 @@ BOOLEAN HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( SOLDIERTYPE *pSold
{
INT8 bSlot;
UINT32 cnt;
UINT8 ubID;
SOLDIERTYPE *pSoldier;
//is this the right sector K14-1
if( !( gWorldSectorX == SECTOR_OPEN_GATE_IN_TUNNEL_X && gWorldSectorY == SECTOR_OPEN_GATE_IN_TUNNEL_Y && gbWorldSectorZ == SECTOR_OPEN_GATE_IN_TUNNEL_Z ) )
{
@@ -1008,12 +991,12 @@ BOOLEAN HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( SOLDIERTYPE *pSold
}
}
ubID = RandomSoldierIdFromNewMercsOnPlayerTeam();
INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
if( ubID != -1 )
if( bID != -1 )
{
//have the merc say the quote about the tough gate
TacticalCharacterDialogue( &Menptr[ ubID ], QUOTE_IMPATIENT_QUOTE );
TacticalCharacterDialogue( &Menptr[ bID ], QUOTE_IMPATIENT_QUOTE );
}
//remeber we said the quote
@@ -1077,26 +1060,23 @@ void HandlePlayingQuoteWhenHiringNpc( UINT8 ubProfile )
}
else if ( ubProfile == TEX_UB ) //TEX:
SayQuoteFromAllNewHiredMercButDoGastonLast( ubProfile, QUOTE_DEATH_RATE_RENEWAL );
}
BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQuoteNum )
{
INT8 bNumMercsPresent=-1;
UINT8 usNumMercsPresent;
UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES];
INT32 iCnt;
SOLDIERTYPE *pSoldier=NULL;
//Get an array of the mercs on the team
bNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL );
if( bNumMercsPresent == -1 )
if( !usNumMercsPresent )
{
return( FALSE );
}
for( iCnt=0; iCnt<bNumMercsPresent; iCnt++ )
for ( UINT8 iCnt=0; iCnt<usNumMercsPresent; ++iCnt )
{
//Do Gaston and the newly hired RPC last
if( Menptr[ SoldierIdArray[ iCnt ] ].ubProfile == GASTON_UB || Menptr[ SoldierIdArray[ iCnt ] ].ubProfile == ubProfile) // GASTON
@@ -1316,8 +1296,6 @@ void SetNewGunQuoteToBePlayedForThisGun( INT32 iItemIndex )
void HandlePickingUpMorrisInstructionNote( SOLDIERTYPE *pSoldier, INT32 iIndex )
{
INT8 bID=-1;
if( iIndex != MORRIS_INSTRUCTION_NOTE )
{
return;
@@ -1332,7 +1310,7 @@ void HandlePickingUpMorrisInstructionNote( SOLDIERTYPE *pSoldier, INT32 iIndex )
}
*/
bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
//if this is a qualified merc on the team
if( IsSoldierQualifiedMerc( pSoldier ) )
@@ -1343,7 +1321,6 @@ void HandlePickingUpMorrisInstructionNote( SOLDIERTYPE *pSoldier, INT32 iIndex )
//Delaying the merc to say the note
DelayedMercQuote( pSoldier->ubProfile, DQ__NEW_MERC_SAY_NOTE_QUOTES, GetWorldTotalSeconds()+1 );
}
//else if there is a new merc on the team
else if( bID != -1 )
{
@@ -1373,7 +1350,6 @@ void HandlePickingUpMorrisInstructionNote( SOLDIERTYPE *pSoldier, INT32 iIndex )
DelayedMercQuote( NOBODY, DQ__MORRIS_NOTE_NEW_MERC_DELAY, uiTime );
}
else
{
//
@@ -1897,8 +1873,6 @@ void DisplayCommanderMorrisNote( SOLDIERTYPE *pSoldier )
void HandleCommanderMorrisNewMercWantsNoteDelayedSpeech()
{
INT8 bID=-1;
//if the note has already been picked up by a new merc, or the note has been displayed
if( gJa25SaveStruct.ubMorrisNoteState == MN__PICKED_UP_BY_NEW_MERC ||
gJa25SaveStruct.ubMorrisNoteState == MN__FINISHED )
@@ -1907,7 +1881,7 @@ void HandleCommanderMorrisNewMercWantsNoteDelayedSpeech()
}
//if the original merc who said the quote is valid
bID = gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote;
INT16 bID = gJa25SaveStruct.bNewMercProfileIDForSayingMorrisNote;
if( bID != -1 && IsSoldierQualifiedMerc( &Menptr[ bID ] ) )
{
}
+4 -4
View File
@@ -36,9 +36,9 @@ typedef struct
*/
extern BOOLEAN gfFirstTimeInGameHeliCrash;
INT8 RandomProfileIdFromNewMercsOnPlayerTeam();
INT8 RandomSoldierIdFromNewMercsOnPlayerTeam();
INT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray );
INT16 RandomProfileIdFromNewMercsOnPlayerTeam();
INT16 RandomSoldierIdFromNewMercsOnPlayerTeam();
UINT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray );
BOOLEAN IsSoldierQualifiedMerc( SOLDIERTYPE *pSoldier );
BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier );
BOOLEAN IsSoldierQualifiedMercForSeeingPowerGenFan( SOLDIERTYPE *pSoldier );
@@ -47,7 +47,7 @@ BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQu
//Pass in an array of size NUM_MERCS_WITH_NEW_QUOTES, array will be filled with
//random soldier IDs of the qualified mercs
INT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray );
UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray );
extern UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 );
+23 -29
View File
@@ -414,7 +414,7 @@ UINT8 NumEnemyInSectorNotDeadOrDying( );
UINT8 NumBloodcatsInSectorNotDeadOrDying( );
UINT8 gubWaitingForAllMercsToExitCode = 0;
INT8 gbNumMercsUntilWaitingOver = 0;
UINT8 gusNumMercsUntilWaitingOver = 0;
UINT32 guiWaitingForAllMercsToExitData[3];
UINT32 guiWaitingForAllMercsToExitTimer = 0;
BOOLEAN gfKillingGuysForLosingBattle = FALSE;
@@ -1359,7 +1359,7 @@ BOOLEAN ExecuteOverhead( )
else if ( pSoldier->ubWaitActionToDo == 1 )
{
pSoldier->ubWaitActionToDo = 0;
gbNumMercsUntilWaitingOver--;
gusNumMercsUntilWaitingOver = max(0, gusNumMercsUntilWaitingOver - 1);
pSoldier->SoldierGotoStationaryStance( );
// If we are at an exit-grid, make disappear.....
if ( gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO )
@@ -1915,7 +1915,7 @@ BOOLEAN ExecuteOverhead( )
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_DEBUG, L"Waiting too long for Mercs to exit...forcing entry." );
#endif
gbNumMercsUntilWaitingOver = 0;
gusNumMercsUntilWaitingOver = 0;
// Reset all waitng codes
for ( cnt = 0; cnt < guiNumMercSlots; cnt++ )
@@ -1929,12 +1929,11 @@ BOOLEAN ExecuteOverhead( )
}
}
if ( gbNumMercsUntilWaitingOver == 0 )
if ( gusNumMercsUntilWaitingOver == 0 )
{
// ATE: Unset flag to ignore sight...
gTacticalStatus.uiFlags &= ( ~DISALLOW_SIGHT );
// OK cheif, do something here....
switch( gubWaitingForAllMercsToExitCode )
{
@@ -3807,28 +3806,24 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
#ifdef JA2UB
if ( pSoldierOld->ubProfile == MORRIS_UB )
{
{
INT8 bSoldierID;
SOLDIERTYPE * pOther;
INT16 bSoldierID;
SOLDIERTYPE* pOther = FindSoldierByProfileID( MORRIS_UB, FALSE );
if ( pOther )
{
OBJECTTYPE Object;
CreateItem( MORRIS_INSTRUCTION_NOTE, 100, &Object );
AutoPlaceObject( pOther, &Object, TRUE );
}
pOther = FindSoldierByProfileID( MORRIS_UB, FALSE );
if ( pOther )
{
OBJECTTYPE Object;
CreateItem( MORRIS_INSTRUCTION_NOTE, 100, &Object );
AutoPlaceObject( pOther, &Object, TRUE );
}
//Geta a random soldier ID
bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam();
//Geta a random soldier ID
bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam();
//if there is any
if( bSoldierID != -1 )
{
//say the MORRIS dead quote
TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_LEARNED_TO_HATE_ON_TEAM_WONT_RENEW );
}
}
//if there is any
if( bSoldierID != -1 )
{
//say the MORRIS dead quote
TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_LEARNED_TO_HATE_ON_TEAM_WONT_RENEW );
}
}
// Ja25no queen
#else
@@ -9682,10 +9677,10 @@ void ResetAllMercSpeeds( )
}
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 )
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, UINT8 uiNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 )
{
gubWaitingForAllMercsToExitCode = ubActionCode;
gbNumMercsUntilWaitingOver = bNumMercsWaiting;
gubWaitingForAllMercsToExitCode = ubActionCode;
gusNumMercsUntilWaitingOver = uiNumMercsWaiting;
guiWaitingForAllMercsToExitData[ 0 ] = uiData1;
guiWaitingForAllMercsToExitData[ 1 ] = uiData2;
guiWaitingForAllMercsToExitData[ 2 ] = uiData3;
@@ -9695,7 +9690,6 @@ void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWa
// ATE: Set flag to ignore sight...
gTacticalStatus.uiFlags |= ( DISALLOW_SIGHT );
}
void HandleBloodForNewGridNo( SOLDIERTYPE *pSoldier )
+1 -1
View File
@@ -282,7 +282,7 @@ void CycleThroughKnownEnemies( BOOLEAN backward = FALSE );
BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen );
SOLDIERTYPE * FreeUpAttacker( );
BOOLEAN PlayerTeamFull( );
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 );
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, UINT8 uiNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 );
void ResetAllMercSpeeds( );
BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLEAN fInitialMove, UINT16 usAnimState );
SOLDIERTYPE * ReduceAttackBusyCount( );
+4 -6
View File
@@ -1179,14 +1179,12 @@ BOOLEAN ExitShopKeeperInterface()
//if the laptop was just fixed
if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE && !( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__PLAYER_SAID_LAPTOP_FIXED_QUOTE ) )
{
INT8 bSoldierID=-1;
{
//Have a new merc say a quote
bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam();
if( bSoldierID != -1 )
INT16 bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam();
if( bSoldierID > -1 )
{
TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_JA2UB_LAPTOP_FIXED );
TacticalCharacterDialogue( &Menptr[bSoldierID], QUOTE_JA2UB_LAPTOP_FIXED );
}
gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__PLAYER_SAID_LAPTOP_FIXED_QUOTE;
-3
View File
@@ -51,15 +51,12 @@
#include "Soldier macros.h"
#endif
extern INT8 gbNumMercsUntilWaitingOver;
extern UINT8 gubWaitingForAllMercsToExitCode;
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#define NEXT_TILE_CHECK_DELAY 700
#ifdef JA2BETAVERSION
+6 -6
View File
@@ -2464,13 +2464,13 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo,
else if ( pSoldier->bTeam == gbPlayerNum )
{
#ifdef JA2UB
if( (pOpponent->ubProfile == MORRIS_UB ) &&
( GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, NULL ) != 0 ) &&
!( pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MORRIS ) &&
!( gMercProfiles[ MORRIS_UB ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
{
if ( (pOpponent->ubProfile == MORRIS_UB ) &&
( GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( NULL, NULL ) > 0 ) &&
!( pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MORRIS ) &&
!( gMercProfiles[ MORRIS_UB ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
{
gfMorrisShouldSayHi = TRUE;
}
}
#else
if ( (pOpponent->ubProfile == MIKE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC || pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) && !(pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MIKE) )
{
+4 -10
View File
@@ -5483,7 +5483,6 @@ BOOLEAN IsFanGraphicInSectorAtThisGridNo( UINT32 sGridNo )
void HandleDestructionOfPowerGenFan()
{
UINT8 ubShadeLevel=0;
INT8 bID;
//if we have already destroyed the fan
if( gJa25SaveStruct.ubHowPlayerGotThroughFan == PG__PLAYER_BLEW_UP_FAN_TO_GET_THROUGH )
@@ -5523,13 +5522,12 @@ void HandleDestructionOfPowerGenFan()
//Stop the fan sound
HandleRemovingPowerGenFanSound();
//
// Have a qualified merc say a quote
//
//Get a random qualified merc to say the quote
bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
if( bID != -1 )
{
DelayedMercQuote( Menptr[ bID ].ubProfile, QUOTE_ACCEPT_CONTRACT_RENEWAL, GetWorldTotalSeconds() + 2 );
@@ -5552,8 +5550,6 @@ void HandleExplosionsInTunnelSector( UINT32 sGridNo )
void HandleSeeingFortifiedDoor( UINT32 sGridNo )
{
INT32 sID=0;
//if this isnt the First level of the complex K15-1
if( !( gWorldSectorX == gGameUBOptions.SectorDoorInTunnelX && gWorldSectorY == gGameUBOptions.SectorDoorInTunnelY && gbWorldSectorZ == gGameUBOptions.SectorDoorInTunnelZ ) )
{
@@ -5572,7 +5568,7 @@ void HandleSeeingFortifiedDoor( UINT32 sGridNo )
gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__PLAYER_HAS_SEEN_FORTIFIED_DOOR;
//find out whos is the one walking across the trap
sID = WhoIsThere2( sGridNo, 0 );
INT16 sID = WhoIsThere2( sGridNo, 0 );
if( sID != NOBODY && IsSoldierQualifiedMerc( &Menptr[ sID ] ) )
{
}
@@ -5591,8 +5587,6 @@ void HandleSeeingFortifiedDoor( UINT32 sGridNo )
void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo )
{
INT8 bID;
//if the door is already opened
if( gJa25SaveStruct.ubStatusOfFortifiedDoor == FD__OPEN )
{
@@ -5602,7 +5596,7 @@ void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo )
//remeber that the switch to open the forified door on level 1, has been pulled
gJa25SaveStruct.ubStatusOfFortifiedDoor = FD__OPEN;
bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
if( bID != -1 )
{