diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index c6698792..18e812c3 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -1018,6 +1018,11 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier ) // if the merc is not dead if( gMercProfiles[ pSoldier->ubProfile ].bMercStatus != MERC_IS_DEAD ) { + //shadooow: this allows RPCs to re-appear in the areas we recruited them initially after being fired + if (pSoldier->ubProfile != SLAY || gGameExternalOptions.fEnableSlayForever) + { + gMercProfiles[pSoldier->ubProfile].ubMiscFlags &= (~PROFILE_MISC_FLAG_RECRUITED); + } //Set the status to returning home ( delay the merc for rehire ) gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_RETURNING_HOME; diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 550b71bb..df8c57b6 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -60,6 +60,8 @@ #include "GameInitOptionsScreen.h" +extern INT32 GetTheStateOfDepartedMerc(INT32 iId); + // THESE 3 DIFFICULTY FACTORS MUST ALWAYS ADD UP TO 100% EXACTLY!!! #define DIFF_FACTOR_PLAYER_PROGRESS 50 #define DIFF_FACTOR_PALACE_DISTANCE 30 @@ -750,7 +752,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * } // Copy the items over for the soldier, only if we have a valid profile id! - if ( pCreateStruct->ubProfile != NO_PROFILE ) + if ( pCreateStruct->ubProfile != NO_PROFILE && (gMercProfiles[pCreateStruct->ubProfile].Type != PROFILETYPE_RPC || GetTheStateOfDepartedMerc(pCreateStruct->ubProfile) == -1)) { CopyProfileItems( &Soldier, pCreateStruct ); //CHRISL: make sure nails gets his jacket no matter what diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 258d9357..8f660195 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -2649,6 +2649,8 @@ void AddProfilesUsingProfileInsertionData() if( gMercProfiles[ i ].sSectorX != gWorldSectorX || gMercProfiles[ i ].sSectorY != gWorldSectorY || gMercProfiles[ i ].bSectorZ != gbWorldSectorZ || + gMercProfiles[ i ].bMercStatus == MERC_RETURNING_HOME || + gMercProfiles[ i ].bMercStatus == MERC_FIRED_AS_A_POW || gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED || gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE || // gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR || diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 63bb1959..fc1aeeba 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -77,6 +77,8 @@ extern BOOLEAN gfProfileDataLoaded; #endif +extern INT32 GetTheStateOfDepartedMerc(INT32 iId); + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -1732,6 +1734,8 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) return( FALSE ); } + bool first_time_recruited = GetTheStateOfDepartedMerc(ubCharNum) == -1; + // OK, set recruit flag.. gMercProfiles[ ubCharNum ].ubMiscFlags |= PROFILE_MISC_FLAG_RECRUITED; @@ -1760,12 +1764,12 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) KickOutWheelchair( pNewSoldier ); } - else if ( ubCharNum == DYNAMO && gubQuest[ QUEST_FREE_DYNAMO ] == QUESTINPROGRESS ) + else if ( ubCharNum == DYNAMO && gubQuest[ QUEST_FREE_DYNAMO ] == QUESTINPROGRESS && first_time_recruited) { EndQuest( QUEST_FREE_DYNAMO, pSoldier->sSectorX, pSoldier->sSectorY ); } // SANDRO - give exp and records quest point, if finally recruiting Miguel - else if ( ubCharNum == MIGUEL ) + else if ( ubCharNum == MIGUEL && first_time_recruited) { GiveQuestRewardPoint( pSoldier->sSectorX, pSoldier->sSectorY, 6, MIGUEL ); } @@ -1784,7 +1788,8 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) } // handle town loyalty adjustment - HandleTownLoyaltyForNPCRecruitment( pNewSoldier ); + if(first_time_recruited) + HandleTownLoyaltyForNPCRecruitment( pNewSoldier ); // Try putting them into the current squad if ( AddCharacterToSquad( pNewSoldier, (INT8)CurrentSquad( ) ) == FALSE ) @@ -1820,7 +1825,7 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) #ifdef JA2UB // no Ja25 UB #else - if ( ubCharNum == IRA ) + if ( ubCharNum == IRA && first_time_recruited) { // trigger 0th PCscript line TriggerNPCRecord( IRA, 0 ); @@ -1852,7 +1857,8 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) AdditionalTacticalCharacterDialogue_AllInSectorRadiusCall( ubCharNum, ADE_DIALOGUE_RPC_RECRUIT_SUCCESS, ubCharNum ); // Flugente: external scripts might have extra functionality on recruiting someone - LuaRecruitRPCAdditionalHandling( ubCharNum ); + if (first_time_recruited) + LuaRecruitRPCAdditionalHandling( ubCharNum ); return( TRUE ); }