From e40abfda85de2090664cdea0d3ff7ea9acf3fb0d Mon Sep 17 00:00:00 2001 From: "ALLEN-PC\\acj30" Date: Sun, 26 Jan 2025 12:19:44 -0600 Subject: [PATCH] Player response concepts for losing and refinding enemies --- sp/src/game/server/ez2/ez2_player.cpp | 38 +++++++++++++++++++++++++++ sp/src/game/server/ez2/ez2_player.h | 6 +++++ 2 files changed, 44 insertions(+) diff --git a/sp/src/game/server/ez2/ez2_player.cpp b/sp/src/game/server/ez2/ez2_player.cpp index 3f96e47471f..c889440fc70 100644 --- a/sp/src/game/server/ez2/ez2_player.cpp +++ b/sp/src/game/server/ez2/ez2_player.cpp @@ -2066,6 +2066,30 @@ void CEZ2_Player::Event_DisplacerPistolRelease( CBaseCombatWeapon *pWeapon, CBas } } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CEZ2_Player::LostEnemySound( CBaseEntity *pEnemy ) +{ + AI_CriteriaSet modifiers; + ModifyOrAppendEnemyCriteria( modifiers, pEnemy ); + + modifiers.AppendCriteria( "lastseenenemy", gpGlobals->curtime - GetNPCComponent()->GetEnemies()->LastTimeSeen( pEnemy ) ); + + SpeakIfAllowed( TLK_LOSTENEMY, modifiers ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CEZ2_Player::FoundEnemySound( CBaseEntity *pEnemy ) +{ + AI_CriteriaSet modifiers; + ModifyOrAppendEnemyCriteria( modifiers, pEnemy ); + + SpeakIfAllowed( TLK_REFINDENEMY, modifiers ); +} + //----------------------------------------------------------------------------- // Purpose: called when a game event is fired //----------------------------------------------------------------------------- @@ -2914,6 +2938,20 @@ bool CAI_PlayerNPCDummy::UpdateEnemyMemory( CBaseEntity *pEnemy, const Vector &p return false; } +//----------------------------------------------------------------------------- +void CAI_PlayerNPCDummy::LostEnemySound( CBaseEntity *pEnemy ) +{ + if (GetOuter()) + GetOuter()->LostEnemySound( pEnemy ); +} + +//----------------------------------------------------------------------------- +void CAI_PlayerNPCDummy::FoundEnemySound( CBaseEntity *pEnemy ) +{ + if (GetOuter()) + GetOuter()->FoundEnemySound( pEnemy ); +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/ez2/ez2_player.h b/sp/src/game/server/ez2/ez2_player.h index 6374663b16c..696c9b158d0 100644 --- a/sp/src/game/server/ez2/ez2_player.h +++ b/sp/src/game/server/ez2/ez2_player.h @@ -190,6 +190,9 @@ class CEZ2_Player : public CAI_ExpresserHost, public CGameEventList void Event_DisplacerPistolDisplace( CBaseCombatWeapon *pWeapon, CBaseEntity *pVictimEntity ); void Event_DisplacerPistolRelease( CBaseCombatWeapon *pWeapon, CBaseEntity *pReleaseEntity, CBaseEntity *pVictimEntity ); + void LostEnemySound( CBaseEntity *pEnemy ); + void FoundEnemySound( CBaseEntity *pEnemy ); + void FireGameEvent( IGameEvent *event ); void InputFinishBonusChallenge( inputdata_t &inputdata ); @@ -346,6 +349,9 @@ class CAI_PlayerNPCDummy : public CAI_SensingDummy bool UpdateEnemyMemory( CBaseEntity *pEnemy, const Vector &position, CBaseEntity *pInformer = NULL ); + void LostEnemySound( CBaseEntity *pEnemy ); + void FoundEnemySound( CBaseEntity *pEnemy ); + void DrawDebugGeometryOverlays( void ); // Special handling for info_remarkable