mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Changes to covert operations feature (by sevenfm): If the new skill setting COVERT_STRIPIFUNCOVERED is FALSE,
- we can only disguise successfully if we haven't been seen recently (last 3 turns) - disabled automatic clothes stripping when uncovered - redisguise automatically if spy haven't been seen by enemy recently and wears correct clothes git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8210 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -155,7 +155,6 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo );
|
||||
void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel );
|
||||
void CleanWeapons( BOOLEAN fEntireTeam );
|
||||
void UpdateGear();
|
||||
void Strip( SOLDIERTYPE * pSoldier );
|
||||
void StartCorpseMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel );
|
||||
|
||||
BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, INT32 sTargetGridNo , INT8 bLevel )
|
||||
@@ -5177,12 +5176,6 @@ void UpdateGear()
|
||||
}
|
||||
}
|
||||
|
||||
// undisguise or take off custom clothes
|
||||
void Strip( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
pSoldier->Strip();
|
||||
}
|
||||
|
||||
void BombMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
if (gpTempSoldier)
|
||||
@@ -5331,7 +5324,7 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue )
|
||||
break;
|
||||
case 2:
|
||||
// undisguise or take off custom clothes
|
||||
Strip(gpTempSoldier);
|
||||
gpTempSoldier->Strip();
|
||||
break;
|
||||
case 3:
|
||||
// clean weapons - in realtime of the entire team, in turnbased only for the selected merc
|
||||
|
||||
+3
-38
@@ -60,6 +60,7 @@
|
||||
#include "CampaignStats.h" // added by Flugente
|
||||
#include "DisplayCover.h" // added by Flugente
|
||||
#include "Map Information.h"
|
||||
#include "ai.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -9782,44 +9783,8 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16 usPointsToUs
|
||||
pSoldier->CreateSoldierPalettes();
|
||||
}
|
||||
|
||||
if ( pSoldier->usSoldierFlagMask & SOLDIER_NEW_VEST && pSoldier->usSoldierFlagMask & SOLDIER_NEW_PANTS )
|
||||
{
|
||||
// first, remove the covert flags, and then reapply the correct ones, in case we switch between civilian and military clothes
|
||||
pSoldier->usSoldierFlagMask &= ~(SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER);
|
||||
|
||||
// we can onyl dsiguise sucessfully if we are not seen
|
||||
INT8 bCover = MAX_COVER;
|
||||
CalculateCoverForSoldier( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, bCover );
|
||||
if ( bCover == MAX_COVER )
|
||||
{
|
||||
// we now have to determine wether we are currently wearing civilian or military clothes
|
||||
for ( UINT8 i = UNIFORM_ENEMY_ADMIN; i <= UNIFORM_ENEMY_ELITE; ++i )
|
||||
{
|
||||
// both parts have to fit. We cant mix different uniforms and get soldier disguise
|
||||
if ( COMPARE_PALETTEREP_ID(pSoldier->VestPal, gUniformColors[ i ].vest) && COMPARE_PALETTEREP_ID(pSoldier->PantsPal, gUniformColors[ i ].pants) )
|
||||
{
|
||||
pSoldier->usSoldierFlagMask |= SOLDIER_COVERT_SOLDIER;
|
||||
|
||||
if ( pSoldier->bTeam == OUR_TEAM )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_SOLDIER], pSoldier->GetName() );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if not dressed as a soldier, we must be dressed as a civilian
|
||||
if ( !(pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
|
||||
{
|
||||
pSoldier->usSoldierFlagMask |= SOLDIER_COVERT_CIV;
|
||||
|
||||
if ( pSoldier->bTeam == OUR_TEAM )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_CIVILIAN], pSoldier->GetName() );
|
||||
}
|
||||
}
|
||||
|
||||
// reevaluate sight - otherwise we could hide by changing clothes in plain sight!
|
||||
OtherTeamsLookForMan(pSoldier);
|
||||
}
|
||||
// apply covert properties depending on our disguise
|
||||
pSoldier->ApplyCovert( TRUE );
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
|
||||
@@ -10591,7 +10591,8 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
MercPtrs[ gusSelectedSoldier ]->LooseDisguise();
|
||||
|
||||
MercPtrs[ gusSelectedSoldier ]->Strip();
|
||||
if ( gSkillTraitValues.fCOStripIfUncovered )
|
||||
MercPtrs[ gusSelectedSoldier ]->Strip();
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_SURRENDER_FAILED] );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVER_SINGLE], MercPtrs[ gusSelectedSoldier ]->GetName() );
|
||||
|
||||
@@ -15740,6 +15740,16 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT8 ubObserverID )
|
||||
}
|
||||
}
|
||||
|
||||
// uncover if merc is using flashlight and alert is raised
|
||||
if ( pSoldier->bTeam == ENEMY_TEAM &&
|
||||
pSoldier->aiData.bAlertStatus >= STATUS_RED &&
|
||||
(NightTime( ) || gbWorldSectorZ > 0) &&
|
||||
this->GetBestEquippedFlashLightRange( ) > 0 )
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s has flashlight!", this->GetName( ) );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -15810,11 +15820,12 @@ BOOLEAN SOLDIERTYPE::RecognizeAsCombatant( UINT8 ubTargetID )
|
||||
// aha, he/she's a spy! Blow cover
|
||||
if ( pSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER) )
|
||||
{
|
||||
pSoldier->LooseDisguise( );
|
||||
pSoldier->LooseDisguise();
|
||||
|
||||
pSoldier->Strip( );
|
||||
if ( gSkillTraitValues.fCOStripIfUncovered )
|
||||
pSoldier->Strip();
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], this->GetName( ), pSoldier->GetName( ) );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], this->GetName(), pSoldier->GetName() );
|
||||
|
||||
// we have uncovered a spy! Get alerted, if we aren't already
|
||||
if ( this->aiData.bAlertStatus < STATUS_BLACK )
|
||||
@@ -15853,9 +15864,67 @@ void SOLDIERTYPE::LooseDisguise( void )
|
||||
}
|
||||
}
|
||||
|
||||
void SOLDIERTYPE::Disguise()
|
||||
{
|
||||
// this will only work with the new trait system
|
||||
if (!gGameOptions.fNewTraitSystem)
|
||||
return;
|
||||
|
||||
// check if we already disguised
|
||||
if( this->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER | SOLDIER_COVERT_NPC_SPECIAL) )
|
||||
return;
|
||||
|
||||
// check that soldier is active and in sector
|
||||
if ( !this->bActive || !this->bInSector )
|
||||
return;
|
||||
|
||||
ApplyCovert( FALSE );
|
||||
}
|
||||
|
||||
void SOLDIERTYPE::ApplyCovert( BOOLEAN aWithMessage )
|
||||
{
|
||||
// check that we have correct clothes
|
||||
if ( this->usSoldierFlagMask & SOLDIER_NEW_VEST && this->usSoldierFlagMask & SOLDIER_NEW_PANTS )
|
||||
{
|
||||
// first, remove the covert flags, and then reapply the correct ones, in case we switch between civilian and military clothes
|
||||
this->usSoldierFlagMask &= ~(SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER);
|
||||
|
||||
// we can only disguise successfully if we are not seen
|
||||
if ( !EnemySeenSoldierRecently( this ) )
|
||||
{
|
||||
// we now have to determine wether we are currently wearing civilian or military clothes
|
||||
for ( UINT8 i = UNIFORM_ENEMY_ADMIN; i <= UNIFORM_ENEMY_ELITE; ++i )
|
||||
{
|
||||
// both parts have to fit. We cant mix different uniforms and get soldier disguise
|
||||
if ( COMPARE_PALETTEREP_ID( this->VestPal, gUniformColors[i].vest ) && COMPARE_PALETTEREP_ID( this->PantsPal, gUniformColors[i].pants ) )
|
||||
{
|
||||
this->usSoldierFlagMask |= SOLDIER_COVERT_SOLDIER;
|
||||
|
||||
if ( aWithMessage && this->bTeam == OUR_TEAM )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_SOLDIER], this->GetName( ) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if not dressed as a soldier, we must be dressed as a civilian
|
||||
if ( !(this->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
|
||||
{
|
||||
this->usSoldierFlagMask |= SOLDIER_COVERT_CIV;
|
||||
|
||||
if ( aWithMessage && this->bTeam == OUR_TEAM )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_CIVILIAN], this->GetName( ) );
|
||||
}
|
||||
}
|
||||
|
||||
// reevaluate sight - otherwise we could hide by changing clothes in plain sight!
|
||||
OtherTeamsLookForMan( this );
|
||||
}
|
||||
}
|
||||
|
||||
// undisguise or take off any clothes item and switch back to original clothes
|
||||
// no - this function does not do what you think it does. Leave Fox alone, you perv.
|
||||
void SOLDIERTYPE::Strip( )
|
||||
void SOLDIERTYPE::Strip()
|
||||
{
|
||||
// if covert, loose that ability
|
||||
if ( this->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER) )
|
||||
@@ -15863,9 +15932,9 @@ void SOLDIERTYPE::Strip( )
|
||||
LooseDisguise( );
|
||||
}
|
||||
// if already not covert, take off clothes
|
||||
else if ( this->usSoldierFlagMask & (SOLDIER_NEW_VEST | SOLDIER_NEW_PANTS) )
|
||||
else if ( this->usSoldierFlagMask & (SOLDIER_NEW_VEST|SOLDIER_NEW_PANTS) )
|
||||
{
|
||||
// if we have undamaged clothes, spawn them, the graphci will be removed anyway
|
||||
// if we have undamaged clothes, spawn them, the graphic will be removed anyway
|
||||
if ( (this->usSoldierFlagMask & SOLDIER_NEW_VEST) && !(this->usSoldierFlagMask & SOLDIER_DAMAGED_VEST) )
|
||||
{
|
||||
UINT16 vestitem = 0;
|
||||
@@ -17241,6 +17310,10 @@ void SOLDIERTYPE::SoldierPropertyUpkeep( )
|
||||
{
|
||||
this->usSoldierFlagMask &= ~SOLDIER_BATTLE_PARTICIPATION;
|
||||
}
|
||||
|
||||
// sevenfm: disguise automatically
|
||||
if ( !gSkillTraitValues.fCOStripIfUncovered )
|
||||
this->Disguise();
|
||||
}
|
||||
|
||||
// check if Soldier can use the spell skillwise, with fAPCheck = TRUE also check current APs
|
||||
@@ -19974,13 +20047,15 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection
|
||||
this->DoMercBattleSound( BATTLE_SOUND_CURSE1 );
|
||||
|
||||
// if we are disguised, there is a chance that he'll uncover us
|
||||
if ( this->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER) )
|
||||
if ( this->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
|
||||
{
|
||||
this->LooseDisguise( );
|
||||
this->Strip( );
|
||||
this->LooseDisguise();
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_ACTIVITIES], this->GetName( ) );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], pSoldier->GetName( ), this->GetName( ) );
|
||||
if ( gSkillTraitValues.fCOStripIfUncovered )
|
||||
this->Strip();
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_ACTIVITIES], this->GetName() );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], pSoldier->GetName(), this->GetName() );
|
||||
|
||||
// alert the soldier
|
||||
pSoldier->aiData.bAlertStatus = min( pSoldier->aiData.bAlertStatus, STATUS_RED );
|
||||
@@ -20033,13 +20108,15 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti
|
||||
success = FALSE;
|
||||
|
||||
// if we are disguised, there is a chance that he'll uncover us
|
||||
if ( this->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER) )
|
||||
if ( this->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
|
||||
{
|
||||
this->LooseDisguise( );
|
||||
this->Strip( );
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_APPLYITEM_STEAL_FAIL], this->GetName( ), pSoldier->GetName( ) );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], pSoldier->GetName( ), this->GetName( ) );
|
||||
this->LooseDisguise();
|
||||
|
||||
if ( gSkillTraitValues.fCOStripIfUncovered )
|
||||
this->Strip();
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_APPLYITEM_STEAL_FAIL], this->GetName(), pSoldier->GetName() );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], pSoldier->GetName(), this->GetName() );
|
||||
}
|
||||
|
||||
// alert the soldier
|
||||
|
||||
@@ -1788,6 +1788,11 @@ public:
|
||||
// loose covert property
|
||||
void LooseDisguise( void );
|
||||
|
||||
// sevenfm: auto disguise if have correct clothes
|
||||
void Disguise();
|
||||
|
||||
void ApplyCovert(BOOLEAN aWithMessage);
|
||||
|
||||
// lose disguise or take off any clothes item and switch back to original clothes
|
||||
void Strip();
|
||||
|
||||
|
||||
@@ -3404,7 +3404,9 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea
|
||||
if ( fUncovered )
|
||||
{
|
||||
pSoldier->LooseDisguise();
|
||||
pSoldier->Strip();
|
||||
|
||||
if ( gSkillTraitValues.fCOStripIfUncovered )
|
||||
pSoldier->Strip( );
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_STEAL_FAIL], pSoldier->GetName() );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVERED], pTargetSoldier->GetName(), pSoldier->GetName() );
|
||||
|
||||
Reference in New Issue
Block a user