mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 06:07:56 +03:00
Fixes and expansions for Lost/FoundEnemySound on NPCs
This commit is contained in:
parent
8ef090c963
commit
a5c754dd00
@ -6110,7 +6110,11 @@ bool CAI_BaseNPC::UpdateEnemyMemory( CBaseEntity *pEnemy, const Vector &position
|
||||
// If the was eluding me and allow the NPC to play a sound
|
||||
if (GetEnemies()->HasEludedMe(pEnemy))
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
FoundEnemySound( pEnemy );
|
||||
#else
|
||||
FoundEnemySound();
|
||||
#endif
|
||||
}
|
||||
float reactionDelay = ( !pInformer || pInformer == this ) ? GetReactionDelay( pEnemy ) : 0.0;
|
||||
bool result = GetEnemies()->UpdateMemory(GetNavigator()->GetNetwork(), pEnemy, position, reactionDelay, firstHand);
|
||||
@ -11734,7 +11738,11 @@ bool CAI_BaseNPC::ChooseEnemy( void )
|
||||
if ( fEnemyEluded )
|
||||
{
|
||||
SetCondition( COND_LOST_ENEMY );
|
||||
#ifdef MAPBASE
|
||||
LostEnemySound( pInitialEnemy );
|
||||
#else
|
||||
LostEnemySound();
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( fEnemyWasPlayer )
|
||||
|
@ -1401,6 +1401,11 @@ public:
|
||||
virtual void FearSound( void ) { return; };
|
||||
virtual void LostEnemySound( void ) { return; };
|
||||
virtual void FoundEnemySound( void ) { return; };
|
||||
#ifdef MAPBASE
|
||||
// New versions of the above functions which pass the enemy in question as a parameter. Chains to the original by default
|
||||
virtual void LostEnemySound( CBaseEntity *pEnemy ) { LostEnemySound(); };
|
||||
virtual void FoundEnemySound( CBaseEntity *pEnemy ) { FoundEnemySound(); };
|
||||
#endif
|
||||
virtual void BarnacleDeathSound( void ) { CTakeDamageInfo info; PainSound( info ); }
|
||||
|
||||
virtual void SpeakSentence( int sentenceType ) { return; };
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "gameinterface.h"
|
||||
#ifdef MAPBASE
|
||||
#include "mapbase/matchers.h"
|
||||
#include "ai_memory.h"
|
||||
#endif
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
@ -133,6 +134,8 @@ ConceptInfo_t g_ConceptInfos[] =
|
||||
{ TLK_TAKING_FIRE, SPEECH_IMPORTANT,-1, -1, -1, -1, -1, -1, AICF_DEFAULT, },
|
||||
{ TLK_NEW_ENEMY, SPEECH_IMPORTANT,-1, -1, -1, -1, -1, -1, AICF_DEFAULT, },
|
||||
{ TLK_COMBAT_IDLE, SPEECH_IMPORTANT,-1, -1, -1, -1, -1, -1, AICF_DEFAULT, },
|
||||
{ TLK_LOSTENEMY, SPEECH_IMPORTANT,-1, -1, -1, -1, -1, -1, AICF_DEFAULT, },
|
||||
{ TLK_REFINDENEMY, SPEECH_IMPORTANT,-1, -1, -1, -1, -1, -1, AICF_DEFAULT, },
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1426,6 +1429,28 @@ void CAI_PlayerAlly::PainSound( const CTakeDamageInfo &info )
|
||||
SpeakIfAllowed( TLK_WOUND );
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_PlayerAlly::LostEnemySound( CBaseEntity *pEnemy )
|
||||
{
|
||||
AI_CriteriaSet modifiers;
|
||||
ModifyOrAppendEnemyCriteria( modifiers, pEnemy );
|
||||
|
||||
modifiers.AppendCriteria( "lastseenenemy", gpGlobals->curtime - GetEnemies()->LastTimeSeen( pEnemy ) );
|
||||
|
||||
SpeakIfAllowed( TLK_LOSTENEMY, modifiers );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_PlayerAlly::FoundEnemySound( CBaseEntity *pEnemy )
|
||||
{
|
||||
AI_CriteriaSet modifiers;
|
||||
ModifyOrAppendEnemyCriteria( modifiers, pEnemy );
|
||||
|
||||
SpeakIfAllowed( TLK_REFINDENEMY, modifiers );
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Implemented to look at talk target
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -137,6 +137,8 @@
|
||||
#define TLK_TAKING_FIRE "TLK_TAKING_FIRE" // Someone fired at me (regardless of whether I was hit)
|
||||
#define TLK_NEW_ENEMY "TLK_NEW_ENEMY" // A new enemy appeared while combat was already in progress
|
||||
#define TLK_COMBAT_IDLE "TLK_COMBAT_IDLE" // Similar to TLK_ATTACKING, but specifically for when *not* currently attacking (e.g. when in cover or reloading)
|
||||
#define TLK_LOSTENEMY "TLK_LOSTENEMY" // Current enemy has eluded squad
|
||||
#define TLK_REFINDENEMY "TLK_REFINDENEMY" // Found a previously eluded enemy
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -339,6 +341,11 @@ public:
|
||||
|
||||
virtual void PainSound( const CTakeDamageInfo &info );
|
||||
|
||||
#ifdef MAPBASE
|
||||
virtual void LostEnemySound( CBaseEntity *pEnemy );
|
||||
virtual void FoundEnemySound( CBaseEntity *pEnemy );
|
||||
#endif
|
||||
|
||||
//---------------------------------
|
||||
// Speech & Acting
|
||||
//---------------------------------
|
||||
|
@ -3145,13 +3145,22 @@ void CNPC_Combine::PainSound ( void )
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef MAPBASE
|
||||
void CNPC_Combine::LostEnemySound( CBaseEntity *pEnemy )
|
||||
#else
|
||||
void CNPC_Combine::LostEnemySound( void)
|
||||
#endif
|
||||
{
|
||||
if ( gpGlobals->curtime <= m_flNextLostSoundTime )
|
||||
return;
|
||||
|
||||
#ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM
|
||||
if (SpeakIfAllowed( TLK_CMB_LOSTENEMY, UTIL_VarArgs("lastseenenemy:%d", GetEnemyLastTimeSeen()) ))
|
||||
AI_CriteriaSet modifiers;
|
||||
ModifyOrAppendEnemyCriteria( modifiers, pEnemy );
|
||||
|
||||
modifiers.AppendCriteria( "lastseenenemy", gpGlobals->curtime - GetEnemies()->LastTimeSeen( pEnemy ) );
|
||||
|
||||
if (SpeakIfAllowed( TLK_CMB_LOSTENEMY, modifiers ))
|
||||
{
|
||||
m_flNextLostSoundTime = gpGlobals->curtime + random->RandomFloat(5.0,15.0);
|
||||
}
|
||||
@ -3179,10 +3188,17 @@ void CNPC_Combine::LostEnemySound( void)
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef MAPBASE
|
||||
void CNPC_Combine::FoundEnemySound( CBaseEntity *pEnemy )
|
||||
#else
|
||||
void CNPC_Combine::FoundEnemySound( void)
|
||||
#endif
|
||||
{
|
||||
#ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM
|
||||
SpeakIfAllowed( TLK_CMB_REFINDENEMY, SENTENCE_PRIORITY_HIGH );
|
||||
AI_CriteriaSet modifiers;
|
||||
ModifyOrAppendEnemyCriteria( modifiers, pEnemy );
|
||||
|
||||
SpeakIfAllowed( TLK_CMB_REFINDENEMY, modifiers, SENTENCE_PRIORITY_HIGH );
|
||||
#else
|
||||
m_Sentences.Speak( "COMBINE_REFIND_ENEMY", SENTENCE_PRIORITY_HIGH );
|
||||
#endif
|
||||
|
@ -181,8 +181,13 @@ public:
|
||||
#endif
|
||||
void IdleSound( void );
|
||||
void AlertSound( void );
|
||||
#ifdef MAPBASE
|
||||
void LostEnemySound( CBaseEntity *pEnemy );
|
||||
void FoundEnemySound( CBaseEntity *pEnemy );
|
||||
#else
|
||||
void LostEnemySound( void );
|
||||
void FoundEnemySound( void );
|
||||
#endif
|
||||
void AnnounceAssault( void );
|
||||
void AnnounceEnemyType( CBaseEntity *pEnemy );
|
||||
void AnnounceEnemyKill( CBaseEntity *pEnemy );
|
||||
|
@ -2938,7 +2938,11 @@ void CNPC_MetroPolice::DeathSound( const CTakeDamageInfo &info )
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef MAPBASE
|
||||
void CNPC_MetroPolice::LostEnemySound( CBaseEntity *pEnemy )
|
||||
#else
|
||||
void CNPC_MetroPolice::LostEnemySound( void)
|
||||
#endif
|
||||
{
|
||||
// Don't announce enemies when the player isn't a criminal
|
||||
if ( !PlayerIsCriminal() )
|
||||
@ -2948,7 +2952,12 @@ void CNPC_MetroPolice::LostEnemySound( void)
|
||||
return;
|
||||
|
||||
#ifdef METROPOLICE_USES_RESPONSE_SYSTEM
|
||||
if (SpeakIfAllowed(TLK_COP_LOSTENEMY))
|
||||
AI_CriteriaSet modifiers;
|
||||
ModifyOrAppendEnemyCriteria( modifiers, pEnemy );
|
||||
|
||||
modifiers.AppendCriteria( "lastseenenemy", gpGlobals->curtime - GetEnemies()->LastTimeSeen( pEnemy ) );
|
||||
|
||||
if (SpeakIfAllowed(TLK_COP_LOSTENEMY, modifiers ))
|
||||
{
|
||||
m_flNextLostSoundTime = gpGlobals->curtime + random->RandomFloat(5.0,15.0);
|
||||
}
|
||||
@ -2977,14 +2986,21 @@ void CNPC_MetroPolice::LostEnemySound( void)
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef MAPBASE
|
||||
void CNPC_MetroPolice::FoundEnemySound( CBaseEntity *pEnemy )
|
||||
#else
|
||||
void CNPC_MetroPolice::FoundEnemySound( void)
|
||||
#endif
|
||||
{
|
||||
// Don't announce enemies when I'm in arrest behavior
|
||||
if ( HasSpawnFlags( SF_METROPOLICE_ARREST_ENEMY ) )
|
||||
return;
|
||||
|
||||
#ifdef METROPOLICE_USES_RESPONSE_SYSTEM
|
||||
SpeakIfAllowed( TLK_COP_REFINDENEMY, SENTENCE_PRIORITY_HIGH );
|
||||
AI_CriteriaSet modifiers;
|
||||
ModifyOrAppendEnemyCriteria( modifiers, pEnemy );
|
||||
|
||||
SpeakIfAllowed( TLK_COP_REFINDENEMY, modifiers, SENTENCE_PRIORITY_HIGH );
|
||||
#else
|
||||
m_Sentences.Speak( "METROPOLICE_REFIND_ENEMY", SENTENCE_PRIORITY_HIGH );
|
||||
#endif
|
||||
|
@ -170,8 +170,13 @@ private:
|
||||
void SpeakAssaultSentence( int nSentenceType );
|
||||
void SpeakStandoffSentence( int nSentenceType );
|
||||
|
||||
#ifdef MAPBASE
|
||||
virtual void LostEnemySound( CBaseEntity *pEnemy );
|
||||
virtual void FoundEnemySound( CBaseEntity *pEnemy );
|
||||
#else
|
||||
virtual void LostEnemySound( void );
|
||||
virtual void FoundEnemySound( void );
|
||||
#endif
|
||||
virtual void AlertSound( void );
|
||||
virtual void PainSound( const CTakeDamageInfo &info );
|
||||
virtual void DeathSound( const CTakeDamageInfo &info );
|
||||
|
Loading…
x
Reference in New Issue
Block a user