new feature: allowed to re-hire RPCs in case they are fired from team

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9052 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Shadooow
2021-05-26 04:32:06 +00:00
parent f53ab81cfb
commit 375008656d
4 changed files with 21 additions and 6 deletions
+5
View File
@@ -1018,6 +1018,11 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
// if the merc is not dead // if the merc is not dead
if( gMercProfiles[ pSoldier->ubProfile ].bMercStatus != MERC_IS_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 ) //Set the status to returning home ( delay the merc for rehire )
gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_RETURNING_HOME; gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_RETURNING_HOME;
+3 -1
View File
@@ -60,6 +60,8 @@
#include "GameInitOptionsScreen.h" #include "GameInitOptionsScreen.h"
extern INT32 GetTheStateOfDepartedMerc(INT32 iId);
// THESE 3 DIFFICULTY FACTORS MUST ALWAYS ADD UP TO 100% EXACTLY!!! // THESE 3 DIFFICULTY FACTORS MUST ALWAYS ADD UP TO 100% EXACTLY!!!
#define DIFF_FACTOR_PLAYER_PROGRESS 50 #define DIFF_FACTOR_PLAYER_PROGRESS 50
#define DIFF_FACTOR_PALACE_DISTANCE 30 #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! // 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 ); CopyProfileItems( &Soldier, pCreateStruct );
//CHRISL: make sure nails gets his jacket no matter what //CHRISL: make sure nails gets his jacket no matter what
+2
View File
@@ -2649,6 +2649,8 @@ void AddProfilesUsingProfileInsertionData()
if( gMercProfiles[ i ].sSectorX != gWorldSectorX || if( gMercProfiles[ i ].sSectorX != gWorldSectorX ||
gMercProfiles[ i ].sSectorY != gWorldSectorY || gMercProfiles[ i ].sSectorY != gWorldSectorY ||
gMercProfiles[ i ].bSectorZ != gbWorldSectorZ || 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_RECRUITED ||
gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE || gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE ||
// gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR || // gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR ||
+11 -5
View File
@@ -77,6 +77,8 @@
extern BOOLEAN gfProfileDataLoaded; extern BOOLEAN gfProfileDataLoaded;
#endif #endif
extern INT32 GetTheStateOfDepartedMerc(INT32 iId);
//forward declarations of common classes to eliminate includes //forward declarations of common classes to eliminate includes
class OBJECTTYPE; class OBJECTTYPE;
class SOLDIERTYPE; class SOLDIERTYPE;
@@ -1732,6 +1734,8 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum )
return( FALSE ); return( FALSE );
} }
bool first_time_recruited = GetTheStateOfDepartedMerc(ubCharNum) == -1;
// OK, set recruit flag.. // OK, set recruit flag..
gMercProfiles[ ubCharNum ].ubMiscFlags |= PROFILE_MISC_FLAG_RECRUITED; gMercProfiles[ ubCharNum ].ubMiscFlags |= PROFILE_MISC_FLAG_RECRUITED;
@@ -1760,12 +1764,12 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum )
KickOutWheelchair( pNewSoldier ); 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 ); EndQuest( QUEST_FREE_DYNAMO, pSoldier->sSectorX, pSoldier->sSectorY );
} }
// SANDRO - give exp and records quest point, if finally recruiting Miguel // 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 ); GiveQuestRewardPoint( pSoldier->sSectorX, pSoldier->sSectorY, 6, MIGUEL );
} }
@@ -1784,7 +1788,8 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum )
} }
// handle town loyalty adjustment // handle town loyalty adjustment
HandleTownLoyaltyForNPCRecruitment( pNewSoldier ); if(first_time_recruited)
HandleTownLoyaltyForNPCRecruitment( pNewSoldier );
// Try putting them into the current squad // Try putting them into the current squad
if ( AddCharacterToSquad( pNewSoldier, (INT8)CurrentSquad( ) ) == FALSE ) if ( AddCharacterToSquad( pNewSoldier, (INT8)CurrentSquad( ) ) == FALSE )
@@ -1820,7 +1825,7 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum )
#ifdef JA2UB #ifdef JA2UB
// no Ja25 UB // no Ja25 UB
#else #else
if ( ubCharNum == IRA ) if ( ubCharNum == IRA && first_time_recruited)
{ {
// trigger 0th PCscript line // trigger 0th PCscript line
TriggerNPCRecord( IRA, 0 ); TriggerNPCRecord( IRA, 0 );
@@ -1852,7 +1857,8 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum )
AdditionalTacticalCharacterDialogue_AllInSectorRadiusCall( ubCharNum, ADE_DIALOGUE_RPC_RECRUIT_SUCCESS, ubCharNum ); AdditionalTacticalCharacterDialogue_AllInSectorRadiusCall( ubCharNum, ADE_DIALOGUE_RPC_RECRUIT_SUCCESS, ubCharNum );
// Flugente: external scripts might have extra functionality on recruiting someone // Flugente: external scripts might have extra functionality on recruiting someone
LuaRecruitRPCAdditionalHandling( ubCharNum ); if (first_time_recruited)
LuaRecruitRPCAdditionalHandling( ubCharNum );
return( TRUE ); return( TRUE );
} }