void HandleExtendMercsContract( SOLDIERTYPE *pSoldier ) { if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { gfEnteringMapScreen = TRUE; fEnterMapDueToContract = TRUE; pContractReHireSoldier = pSoldier; LeaveTacticalScreen( MAP_SCREEN ); uiContractTimeMode = TIME_COMPRESS_5MINS; } else { FindAndSetThisContractSoldier( pSoldier ); pContractReHireSoldier = pSoldier; uiContractTimeMode = giTimeCompressMode; } fTeamPanelDirty = TRUE; fCharacterInfoPanelDirty = TRUE; SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE, 1, MAP_SCREEN, 0, 0, 0 ); CheckIfSalaryIncreasedAndSayQuote( pSoldier, TRUE ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE, 0 ,MAP_SCREEN, 0, 0, 0 ); return; }
void EndQueenDeathEndgameBeginEndCimenatic( ) { INT32 cnt; SOLDIERTYPE *pSoldier; // Start end cimimatic.... gTacticalStatus.uiFlags |= IN_ENDGAME_SEQUENCE; // first thing is to loop through team and say end quote... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) { // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) { TacticalCharacterDialogue( pSoldier, QUOTE_END_GAME_COMMENT ); } } // Add queue event to proceed w/ smacker cimimatic SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING, 0,0,0,0 ); }
void HandleMercIsNotWillingToRenew( UINT8 ubID ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; // We wish to lock interface SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1,MAP_SCREEN,0,0,0 ); // Setup variable for this.... gfInContractMenuFromRenewSequence = TRUE; // Show contract menu TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_SHOW_CONTRACT_MENU, 0,0 ); // Unlock now SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); }
// ATE: This function deals with MERC MERC and NPC's leaving because of not getting paid... // NOT AIM renewals.... void MercsContractIsFinished( UINT8 ubID ) { SOLDIERTYPE *pSoldier; #ifndef JA2DEMO pSoldier = &Menptr[ ubID ]; //if the soldier was removed before getting into this function, return if( !pSoldier->bActive ) return; if( fShowContractMenu ) { fShowContractMenu = FALSE; } // go to mapscreen SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_ENTER_MAPSCREEN,0,0,0,0,0 ); if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { //if the players account status is invalid if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_INVALID ) { //Send the merc home InterruptTime( ); PauseGame(); LockPauseState( 9 ); // Say quote for wishing to leave TacticalCharacterDialogue( pSoldier, QUOTE_NOT_GETTING_PAID ); TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING_NO_ASK_EQUIP, 0, 0 ); pSoldier->ubLeaveHistoryCode = HISTORY_MERC_QUIT; } } else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__NPC ) { InterruptTime( ); PauseGame(); LockPauseState( 10 ); TacticalCharacterDialogue( pSoldier, QUOTE_AIM_SEEN_MIKE ); TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING_NO_ASK_EQUIP, 0, 0 ); pSoldier->ubLeaveHistoryCode = HISTORY_MERC_QUIT; } #endif }
void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT8 bLevel ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt; INT16 sDistVisible = FALSE; UINT8 ubKillerSoldierID = NOBODY; // Start victory music here... SetMusicMode( MUSIC_TACTICAL_VICTORY ); if ( pKillerSoldier ) { TacticalCharacterDialogue( pKillerSoldier, QUOTE_KILLING_DEIDRANNA ); ubKillerSoldierID = pKillerSoldier->ubID; } // STEP 1 ) START ALL QUOTES GOING! // OK - loop through all witnesses and see if they want to say something abou this... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) { if ( cnt != ubKillerSoldierID ) { if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) { if ( QuoteExp_WitnessDeidrannaDeath[ pTeamSoldier->ubProfile ] ) { // Can we see location? sDistVisible = DistanceVisible( pTeamSoldier, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, bLevel ); if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, (UINT8) sDistVisible, TRUE ) ) { TacticalCharacterDialogue( pTeamSoldier, QUOTE_KILLING_DEIDRANNA ); } } } } } // Set fact that she is dead! SetFactTrue( FACT_QUEEN_DEAD ); ExecuteStrategicAIAction( STRATEGIC_AI_ACTION_QUEEN_DEAD, 0, 0 ); // AFTER LAST ONE IS DONE - PUT SPECIAL EVENT ON QUEUE TO BEGIN FADE< ETC SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA, 0,0,0,0 ); }
void BeginContractRenewalSequence( ) { INT32 cnt; SOLDIERTYPE *pSoldier; BOOLEAN fFoundAtLeastOne = FALSE; if ( ubNumContractRenewals > 0) { for ( cnt = 0; cnt < ubNumContractRenewals; cnt++ ) { // Get soldier - if there is none, adavance to next pSoldier = FindSoldierByProfileID( ContractRenewalList[ cnt ].ubProfileID, FALSE ); // Steve Willis, 80 if ( pSoldier ) { if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { // no continue; } // Double check there are valid people here that still want to renew... //if the user hasnt renewed yet, and is still leaving today if ( ContractIsExpiring( pSoldier ) ) { fFoundAtLeastOne = TRUE; } } } if ( fFoundAtLeastOne ) { // Set sequence on... gfContractRenewalSquenceOn = TRUE; // Start at first one.... ubCurrentContractRenewal = 0; ubCurrentContractRenewalInProgress = 0; PauseGame( ); LockPauseState( 7 ); InterruptTime( ); // Go into mapscreen if not already... SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_ENTER_MAPSCREEN,0,0,0,0,0 ); } } }
void HandleContinueOfTownTraining( void ) { SOLDIERTYPE *pSoldier = NULL; INT32 iCounter = 0; BOOLEAN fContinueEventPosted = FALSE; while( giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] != -1 ) { // get the soldier pSoldier = &Menptr[ giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] ]; if( pSoldier->bActive ) { fContinueEventPosted = TRUE; SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTINUE_TRAINING_MILITIA, pSoldier->ubProfile, 0, 0, 0, 0 ); // now set all of these peoples assignment done too //HandleInterfaceMessageForContinuingTrainingMilitia( pSoldier ); } // next entry iCounter++; } // now clear the list ClearSectorListForCompletedTrainingOfMilitia( ); if( fContinueEventPosted ) { // ATE: If this event happens in tactical mode we will be switching at some time to mapscreen... if ( guiCurrentScreen == GAME_SCREEN ) { gfEnteringMapScreen = TRUE; } //If the militia view isn't currently active, then turn it on when prompting to continue training. if ( !fShowMilitia ) { ToggleShowMilitiaMode(); } } return; }
BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) { UINT8 i; UINT8 bMercID; BOOLEAN fBuddyAround = FALSE; BOOLEAN fUnhappy = FALSE; UINT16 usBuddyQuote=0; UINT16 usReasonQuote=0; BOOLEAN fSayPrecedent = FALSE; SOLDIERTYPE * pHated; if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) return( FALSE ); // Flugente: an unconscious merc can't say 'yes' to a contract renewal if ( pSoldier->stats.bLife < CONSCIOUSNESS ) return( FALSE ); // does the merc have another contract already lined up? if( pSoldier->flags.fSignedAnotherContract ) { // NOTE: Having a buddy around will NOT stop a merc from leaving on another contract (IC's call) if( fSayQuote == TRUE ) { SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); HandleImportantMercQuote( pSoldier, QUOTE_WONT_RENEW_CONTRACT_LAME_REFUSAL ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); } return( FALSE ); } // find out if the merc has a buddy working for the player // loop through the list of people the merc considers buddies for(i=0; i<6; i++) { if( i<5 ) { bMercID = gMercProfiles[ pSoldier->ubProfile ].bBuddy[i]; } else { bMercID = gMercProfiles[ pSoldier->ubProfile ].bLearnToLike; // ignore learn to like, if he's not a buddy yet if( gMercProfiles[ pSoldier->ubProfile ].bLearnToLikeCount > 0 ) continue; } if( bMercID < 0 ) continue; // is this buddy on the team? if( IsMercOnTeamAndAlive( (UINT8) bMercID) ) { fBuddyAround = TRUE; if( i == 0 ) usBuddyQuote = QUOTE_RENEWING_CAUSE_BUDDY_1_ON_TEAM; else if( i == 1 ) usBuddyQuote = QUOTE_RENEWING_CAUSE_BUDDY_2_ON_TEAM; else if( i == 2 ) usBuddyQuote = QUOTE_RENEWING_CAUSE_BUDDY_3_ON_TEAM; else if( i == 3 ) usBuddyQuote = QUOTE_RENEWING_CAUSE_BUDDY_4_ON_TEAM; else if( i == 4 ) usBuddyQuote = QUOTE_RENEWING_CAUSE_BUDDY_5_ON_TEAM; else usBuddyQuote = QUOTE_RENEWING_CAUSE_LEARNED_TO_LIKE_BUDDY_ON_TEAM; // use first buddy in case there are multiple break; } } // WE CHECK FOR SOURCES OF UNHAPPINESS IN ORDER OF IMPORTANCE, which is: // 1) Hated Mercs (Highest), 2) Death Rate, 3) Morale (lowest) // see if someone the merc hates is on the team // loop through the list of people the merc hates for(i=0; i<5; i++) { bMercID = gMercProfiles[ pSoldier->ubProfile ].bHated[ i ]; if( bMercID < 0 ) continue; if( IsMercOnTeamAndInOmertaAlreadyAndAlive( (UINT8) bMercID ) ) { if ( gMercProfiles[ pSoldier->ubProfile ].bHatedCount[ i ] == 0 ) { // our tolerance has run out! fUnhappy = TRUE; } else // else tolerance is > 0, only gripe if in same sector { pHated = FindSoldierByProfileID( bMercID, TRUE ); if ( pHated && pHated->sSectorX == pSoldier->sSectorX && pHated->sSectorY == pSoldier->sSectorY && pHated->bSectorZ == pSoldier->bSectorZ ) { fUnhappy = TRUE; } } if ( fUnhappy ) { if( i == 0 ) usReasonQuote = QUOTE_HATE_MERC_1_ON_TEAM_WONT_RENEW; else if( i == 1 ) usReasonQuote = QUOTE_HATE_MERC_2_ON_TEAM_WONT_RENEW; else if( i == 2 ) usReasonQuote = QUOTE_HATE_MERC_3_ON_TEAM_WONT_RENEW; else if( i == 3 ) usReasonQuote = QUOTE_HATE_MERC_4_ON_TEAM_WONT_RENEW; else if( i == 4 ) usReasonQuote = QUOTE_HATE_MERC_5_ON_TEAM_WONT_RENEW; // use first hated in case there are multiple break; } } } if ( !fUnhappy ) { // now check for learn to hate bMercID = gMercProfiles[ pSoldier->ubProfile ].bLearnToHate; if ( bMercID >= 0 ) { if ( IsMercOnTeamAndInOmertaAlreadyAndAlive( (UINT8) bMercID ) ) { if ( gMercProfiles[ pSoldier->ubProfile ].bLearnToHateCount == 0 ) { // our tolerance has run out! fUnhappy = TRUE; usReasonQuote = QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW; } else if ( gMercProfiles[ pSoldier->ubProfile ].bLearnToHateCount <= gMercProfiles[ pSoldier->ubProfile ].bLearnToHateTime / 2 ) { pHated = FindSoldierByProfileID( bMercID, TRUE ); if ( pHated && pHated->sSectorX == pSoldier->sSectorX && pHated->sSectorY == pSoldier->sSectorY && pHated->bSectorZ == pSoldier->bSectorZ ) { fUnhappy = TRUE; usReasonQuote = QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW; } } } } } // happy so far? if (!fUnhappy) { // check if death rate is too high if( MercThinksDeathRateTooHigh( pSoldier->ubProfile ) ) { fUnhappy = TRUE; usReasonQuote = QUOTE_DEATH_RATE_RENEWAL; } } // happy so far? if (!fUnhappy) { // check if morale is too low if( MercThinksHisMoraleIsTooLow( pSoldier ) ) { fUnhappy = TRUE; usReasonQuote = QUOTE_REFUSAL_RENEW_DUE_TO_MORALE; } } // say the precedent? fSayPrecedent = FALSE; // check if we say the precdent for merc if( fSayQuote ) { if (fUnhappy) { if (fBuddyAround) { if( GetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usBuddyQuote ) ) ) == TRUE ) { fSayPrecedent = TRUE; } else { SetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usBuddyQuote ) ) ); } } else { if( GetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usReasonQuote ) ) ) == TRUE ) { fSayPrecedent = TRUE; } else { SetMercPrecedentQuoteBitStatus( pSoldier->ubProfile , GetQuoteBitNumberFromQuoteID( ( UINT32 ) ( usReasonQuote ) ) ); } } } } SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); if( fSayPrecedent ) { HandleImportantMercQuote( pSoldier, QUOTE_PRECEDENT_TO_REPEATING_ONESELF_RENEW ); } SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); // OK, we got all our info, let's make some decisions! if (fUnhappy) { if (fBuddyAround) { // unhappy, but buddy's around, so will agree to renew, but tell us why we're doing it if( fSayQuote == TRUE ) { SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1,MAP_SCREEN,0,0,0 ); HandleImportantMercQuote( pSoldier, usBuddyQuote); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0,MAP_SCREEN,0,0,0 ); } return( TRUE ); } else { // unhappy, no buddies, will refuse to renew if( fSayQuote == TRUE ) { SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); /* ARM: Delay quote too vague, no longer to be used if( ( SoldierWantsToDelayRenewalOfContract( pSoldier ) ) ) { // has a new job lined up HandleImportantMercQuote( pSoldier, QUOTE_DELAY_CONTRACT_RENEWAL ); } else */ { Assert( usReasonQuote != 0 ); HandleImportantMercQuote( pSoldier, usReasonQuote ); } SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); } return(FALSE); } } else { // happy, no problem return( TRUE ); } }
// This is used only to EXTEND the contract of an AIM merc already on the team BOOLEAN MercContractHandling( SOLDIERTYPE *pSoldier, UINT8 ubDesiredAction ) { INT32 iContractCharge=0; INT32 iContractLength=0; UINT8 ubHistoryContractType=0; UINT8 ubFinancesContractType=0; INT32 iCostOfInsurance = 0; //determins what kind of merc the contract is being extended for (only aim mercs can extend contract) if( pSoldier->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC ) return(FALSE); switch( ubDesiredAction ) { case CONTRACT_EXTEND_1_DAY: //check to see if the merc has enough money iContractCharge = gMercProfiles[ pSoldier->ubProfile ].sSalary; //set the contract length and the charge iContractLength = 1; ubHistoryContractType = HISTORY_EXTENDED_CONTRACT_1_DAY; ubFinancesContractType = EXTENDED_CONTRACT_BY_1_DAY; break; case CONTRACT_EXTEND_1_WEEK: iContractCharge = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary; //set the contract length and the charge iContractLength = 7; ubHistoryContractType = HISTORY_EXTENDED_CONTRACT_1_WEEK; ubFinancesContractType = EXTENDED_CONTRACT_BY_1_WEEK; break; case CONTRACT_EXTEND_2_WEEK: iContractCharge = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary; //set the contract length and the charge iContractLength = 14; ubHistoryContractType = HISTORY_EXTENDED_CONTRACT_2_WEEK; ubFinancesContractType = EXTENDED_CONTRACT_BY_2_WEEKS; break; default: return(FALSE); break; } //check to see if the merc has enough money if( LaptopSaveInfo.iCurrentBalance < iContractCharge ) return(FALSE); //Check to see if merc will renew if( !WillMercRenew( pSoldier, TRUE ) ) { // Remove soldier.... ( if this is setup because normal contract ending dequence... ) if ( ContractIsExpiring( pSoldier ) ) { TacticalCharacterDialogueWithSpecialEvent( pSoldier, 0, DIALOGUE_SPECIAL_EVENT_CONTRACT_ENDING, 1,0 ); } return(FALSE); } fPausedTimeDuringQuote = TRUE; SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); // // These calcs need to be done before Getting/Calculating the insurance costs // //set the contract length and the charge pSoldier->iTotalContractLength += iContractLength; // pSoldier->iTotalContractCharge = iContractCharge; pSoldier->bTypeOfLastContract = ubDesiredAction; //determine the end of the contract pSoldier->iEndofContractTime += ( iContractLength * 1440 ); if( ( pSoldier->usLifeInsurance ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) ) // DEF: Removed cause they can extend a 1 day contract && ( iContractLength > 1 ) { // check if player can afford insurance, if not, tell them iCostOfInsurance = CalculateInsuranceContractCost( iContractLength, pSoldier->ubProfile ); HandleImportantMercQuote( pSoldier, QUOTE_ACCEPT_CONTRACT_RENEWAL ); if( iCostOfInsurance > LaptopSaveInfo.iCurrentBalance ) { // no can afford HandleNotifyPlayerCantAffordInsurance( ); // OK, handle ending of renew session if ( gfInContractMenuFromRenewSequence ) { EndCurrentContractRenewal( ); } } else { // can afford ask if they want it HandleNotifyPlayerCanAffordInsurance( pSoldier, ( UINT8 )( iContractLength ), iCostOfInsurance ); } } else { // no need to query for life insurance HandleImportantMercQuote( pSoldier, QUOTE_ACCEPT_CONTRACT_RENEWAL ); // OK, handle ending of renew session if ( gfInContractMenuFromRenewSequence ) { EndCurrentContractRenewal( ); } } SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); // ATE: Setup when they can be signed again! // If they are 2-weeks this can be extended // otherwise don't change from current if ( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) { pSoldier->iTimeCanSignElsewhere = pSoldier->iEndofContractTime; } // ARM: Do not reset because of renewal! The quote is for early dismissal from *initial* time of hiring // pSoldier->uiTimeOfLastContractUpdate = GetWorldTotalMin(); // ARM: Do not reset because of renewal! The deposit in the profile goes up when merc levels, but the one in the soldier // structure must always reflect the deposit actually paid (which does NOT change when a merc levels). // pSoldier->usMedicalDeposit = gMercProfiles[ pSoldier->ubProfile ].sMedicalDepositAmount; //add an entry in the finacial page for the extending of the mercs contract AddTransactionToPlayersBook( ubFinancesContractType, pSoldier->ubProfile, GetWorldTotalMin(), -iContractCharge ); //add an entry in the history page for the extending of the merc contract AddHistoryToPlayersLog( ubHistoryContractType, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->sSectorX, pSoldier->sSectorY ); return( TRUE ); }
void HandleContractRenewalSequence( ) { SOLDIERTYPE *pSoldier; if ( gfContractRenewalSquenceOn ) { // Should we stop now? if ( ubCurrentContractRenewal == ubNumContractRenewals ) { // Stop and clear any on list... ubNumContractRenewals = 0; gfContractRenewalSquenceOn = FALSE; } // Get soldier - if there is none, adavance to next pSoldier = FindSoldierByProfileID( ContractRenewalList[ ubCurrentContractRenewal ].ubProfileID, FALSE ); // Steve Willis, 80 if ( pSoldier == NULL ) { // Advance to next guy! EndCurrentContractRenewal( ); return; } // OK, check if it's in progress... if ( !ubCurrentContractRenewalInProgress ) { // Double check contract situation.... if ( ContractIsExpiring( pSoldier ) ) { // Set this one in motion! ubCurrentContractRenewalInProgress = 1; // Handle start here... // Determine what quote to use.... if( !WillMercRenew( pSoldier, FALSE ) ) { // OK, he does not want to renew....... HandleImportantMercQuote( pSoldier, QUOTE_MERC_LEAVING_ALSUCO_SOON ); // Do special dialogue event... SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW , pSoldier->ubID,0 ,0 ,0 ,0 ); } else { // OK check what dialogue to play // If we have not used this one before.... if ( pSoldier->ubContractRenewalQuoteCode == SOLDIER_CONTRACT_RENEW_QUOTE_NOT_USED ) { SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); HandleImportantMercQuote( pSoldier, QUOTE_CONTRACTS_OVER ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); } // Else if we have said 89 already...... else if ( pSoldier->ubContractRenewalQuoteCode == SOLDIER_CONTRACT_RENEW_QUOTE_89_USED ) { SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); HandleImportantMercQuote( pSoldier, QUOTE_MERC_LEAVING_ALSUCO_SOON ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); } // Do special dialogue event... SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_CONTRACT_WANTS_TO_RENEW , pSoldier->ubID,0 ,0 ,0 ,0 ); } } else { // Skip to next guy! EndCurrentContractRenewal( ); } } } }
void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) { // find out is something was said SOLDIERTYPE *pSoldier = NULL, *pSoldierWhoWillQuit = NULL; INT32 iCounter= 0, iNumberOnTeam = 0; // WDS - make number of mercenaries, etc. be configurable UINT8 ubPotentialMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; UINT8 ubNumMercs = 0; UINT8 ubChosenMerc; gfFirstMercSayQuote = FALSE; pSoldier = &Menptr[ 0 ]; iNumberOnTeam =gTacticalStatus.Team[ OUR_TEAM ].bLastID; // run through list of grunts whoose contract are up in the next 2 hours // ATE: AND - build list THEN choose one! // What we will do here is make a list of mercs that will want // to stay if offered. Durning that process, also check if there // is any merc that does not want to stay and only display that quote // if they are the only one here.... for( iCounter = 0; iCounter < iNumberOnTeam; iCounter++ ) { pSoldier = &Menptr[ iCounter ]; // valid soldier? if( ( pSoldier->bActive == FALSE ) || ( pSoldier->stats.bLife == 0 ) || ( pSoldier->bAssignment == IN_TRANSIT ) ||( pSoldier->bAssignment == ASSIGNMENT_POW ) ) { // no continue; } if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { //if the user hasnt renewed yet, and is still leaving today if ( ContractIsGoingToExpireSoon( pSoldier ) ) { // OK, default value for quote said pSoldier->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_NOT_USED; // Add this guy to the renewal list ContractRenewalList[ ubNumContractRenewals ].ubProfileID = pSoldier->ubProfile; ubNumContractRenewals++; if( WillMercRenew( pSoldier, FALSE ) ) { ubPotentialMercs[ ubNumMercs ] = pSoldier->ubID; ubNumMercs++; } else { pSoldierWhoWillQuit = pSoldier; } // Add to list! AddSoldierToWaitingListQueue( pSoldier ); } } else { if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { // Do nothing here for now... } } } // OK, check if we should display line for the guy who does not want // to stay if ( ubNumMercs == 0 && pSoldierWhoWillQuit != NULL ) { // OK, he does not want to renew....... HandleImportantMercQuote( pSoldierWhoWillQuit, QUOTE_MERC_LEAVING_ALSUCO_SOON ); AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); TacticalCharacterDialogueWithSpecialEvent( pSoldierWhoWillQuit, 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 ); pSoldierWhoWillQuit->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_115_USED; } else { // OK, pick one.... if ( ubNumMercs > 0 ) { ubChosenMerc = (UINT8)Random( ubNumMercs ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); HandleImportantMercQuote( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], QUOTE_CONTRACTS_OVER ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 ); MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ]->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_89_USED; } } }