Skip to content

Commit

Permalink
Play terror's sounds only on alert.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Jan 10, 2024
1 parent 93022fc commit e34b1f0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dlls/clcampaign/terror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class CTerror : public CBaseMonster

float m_flNextFlinch;

void IdleSound( void );
void AlertSound( void );

static const char *pIdleSounds[];
static const char *pAlertSounds[];

// No range attacks
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
Expand All @@ -54,7 +54,7 @@ class CTerror : public CBaseMonster

LINK_ENTITY_TO_CLASS( monster_terror, CTerror )

const char *CTerror::pIdleSounds[] =
const char *CTerror::pAlertSounds[] =
{
"terror/allahuakbar.wav",
};
Expand Down Expand Up @@ -103,12 +103,12 @@ int CTerror::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
}


void CTerror::IdleSound( void )
void CTerror::AlertSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );

// Play a random idle sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0, ATTN_NORM, 0, pitch );
}


Expand Down Expand Up @@ -157,7 +157,7 @@ void CTerror::Precache()
{

PRECACHE_MODEL( "models/terror.mdl" );
PRECACHE_SOUND_ARRAY( pIdleSounds );
PRECACHE_SOUND_ARRAY( pAlertSounds );
}

//=========================================================
Expand Down

0 comments on commit e34b1f0

Please sign in to comment.