mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-22 01:47:45 +01:00
Use sound array macros. (#215)
* Use random sound array. * Use random sound array. * Use random sound array. * Use random sound array. * Use random sound array.
This commit is contained in:
parent
ac2a757b90
commit
0a0952e186
@ -335,7 +335,7 @@ void CAGrunt::DeathSound( void )
|
||||
{
|
||||
StopTalking();
|
||||
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pDieSounds[RANDOM_LONG( 0, ARRAYSIZE( pDieSounds ) - 1 )], 1.0f, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pDieSounds ), 1.0f, ATTN_NORM );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -345,7 +345,7 @@ void CAGrunt::AlertSound( void )
|
||||
{
|
||||
StopTalking();
|
||||
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0f, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0f, ATTN_NORM );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -355,7 +355,7 @@ void CAGrunt::AttackSound( void )
|
||||
{
|
||||
StopTalking();
|
||||
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0f, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0f, ATTN_NORM );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -372,7 +372,7 @@ void CAGrunt::PainSound( void )
|
||||
|
||||
StopTalking();
|
||||
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0f, ATTN_NORM );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0f, ATTN_NORM );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -528,7 +528,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 250.0f;
|
||||
}
|
||||
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
|
||||
Vector vecArmPos, vecArmAng;
|
||||
GetAttachment( 0, vecArmPos, vecArmAng );
|
||||
@ -537,7 +537,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
else
|
||||
{
|
||||
// Play a random attack miss sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -557,7 +557,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -250.0f;
|
||||
}
|
||||
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
|
||||
Vector vecArmPos, vecArmAng;
|
||||
GetAttachment( 0, vecArmPos, vecArmAng );
|
||||
@ -566,7 +566,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
else
|
||||
{
|
||||
// Play a random attack miss sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -608,30 +608,15 @@ void CAGrunt::Spawn()
|
||||
//=========================================================
|
||||
void CAGrunt::Precache()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/agrunt.mdl" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND( pIdleSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pDieSounds ); i++ )
|
||||
PRECACHE_SOUND( pDieSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
|
||||
PRECACHE_SOUND_ARRAY( pIdleSounds );
|
||||
PRECACHE_SOUND_ARRAY( pDieSounds );
|
||||
PRECACHE_SOUND_ARRAY( pPainSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAlertSounds );
|
||||
|
||||
PRECACHE_SOUND( "hassault/hw_shoot1.wav" );
|
||||
|
||||
|
@ -471,7 +471,7 @@ void CGargantua::StompAttack( void )
|
||||
UTIL_TraceLine( vecStart, vecEnd, ignore_monsters, edict(), &trace );
|
||||
CStomp::StompCreate( vecStart, trace.vecEndPos, 0 );
|
||||
UTIL_ScreenShake( pev->origin, 12.0, 100.0, 2.0, 1000 );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pStompSounds[RANDOM_LONG( 0, ARRAYSIZE( pStompSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pStompSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
|
||||
|
||||
UTIL_TraceLine( pev->origin, pev->origin - Vector(0,0,20), ignore_monsters, edict(), &trace );
|
||||
if( trace.flFraction < 1.0f )
|
||||
@ -759,8 +759,6 @@ void CGargantua::Spawn()
|
||||
//=========================================================
|
||||
void CGargantua::Precache()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/garg.mdl" );
|
||||
PRECACHE_MODEL( GARG_EYE_SPRITE_NAME );
|
||||
PRECACHE_MODEL( GARG_BEAM_SPRITE_NAME );
|
||||
@ -769,38 +767,17 @@ void CGargantua::Precache()
|
||||
gGargGibModel = PRECACHE_MODEL( GARG_GIB_MODEL );
|
||||
PRECACHE_SOUND( GARG_STOMP_BUZZ_SOUND );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pBeamAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( pBeamAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pRicSounds ); i++ )
|
||||
PRECACHE_SOUND( pRicSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pFootSounds ); i++ )
|
||||
PRECACHE_SOUND( pFootSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND( pIdleSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pStompSounds ); i++ )
|
||||
PRECACHE_SOUND( pStompSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pBreatheSounds ); i++ )
|
||||
PRECACHE_SOUND( pBreatheSounds[i] );
|
||||
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
|
||||
PRECACHE_SOUND_ARRAY( pBeamAttackSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
|
||||
PRECACHE_SOUND_ARRAY( pRicSounds );
|
||||
PRECACHE_SOUND_ARRAY( pFootSounds );
|
||||
PRECACHE_SOUND_ARRAY( pIdleSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAlertSounds );
|
||||
PRECACHE_SOUND_ARRAY( pPainSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackSounds );
|
||||
PRECACHE_SOUND_ARRAY( pStompSounds );
|
||||
PRECACHE_SOUND_ARRAY( pBreatheSounds );
|
||||
}
|
||||
|
||||
void CGargantua::UpdateOnRemove()
|
||||
@ -831,7 +808,7 @@ void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
|
||||
{
|
||||
if( m_painSoundTime < gpGlobals->time )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM );
|
||||
m_painSoundTime = gpGlobals->time + RANDOM_FLOAT( 2.5, 4 );
|
||||
}
|
||||
}
|
||||
@ -976,10 +953,10 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
//UTIL_MakeVectors( pev->angles ); // called by CheckTraceHullAttack
|
||||
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
|
||||
}
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
|
||||
}
|
||||
else // Play a random attack miss sound
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
|
||||
|
||||
Vector forward;
|
||||
UTIL_MakeVectorsPrivate( pev->angles, forward, NULL, NULL );
|
||||
@ -988,14 +965,14 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
case GARG_AE_RIGHT_FOOT:
|
||||
case GARG_AE_LEFT_FOOT:
|
||||
UTIL_ScreenShake( pev->origin, 4.0, 3.0, 1.0, 750 );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_BODY, pFootSounds[RANDOM_LONG( 0, ARRAYSIZE( pFootSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_BODY, RANDOM_SOUND_ARRAY( pFootSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
|
||||
break;
|
||||
case GARG_AE_STOMP:
|
||||
StompAttack();
|
||||
m_seeTime = gpGlobals->time + 12.0f;
|
||||
break;
|
||||
case GARG_AE_BREATHE:
|
||||
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pBreatheSounds[RANDOM_LONG( 0, ARRAYSIZE( pBreatheSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
|
||||
EMIT_SOUND_DYN( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pBreatheSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
|
||||
break;
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
@ -1071,7 +1048,7 @@ void CGargantua::StartTask( Task_t *pTask )
|
||||
break;
|
||||
case TASK_SOUND_ATTACK:
|
||||
if( RANDOM_LONG( 0, 100 ) < 30 )
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM );
|
||||
TaskComplete();
|
||||
break;
|
||||
case TASK_DIE:
|
||||
|
@ -235,7 +235,7 @@ void CISlave::PainSound( void )
|
||||
{
|
||||
if( RANDOM_LONG( 0, 2 ) == 0 )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ void CISlave::PainSound( void )
|
||||
//=========================================================
|
||||
void CISlave::DeathSound( void )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pDeathSounds[RANDOM_LONG( 0, ARRAYSIZE( pDeathSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pDeathSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -315,12 +315,12 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
}
|
||||
// Play a random attack hit sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Play a random attack miss sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -334,11 +334,11 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->punchangle.z = -18;
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
}
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
}
|
||||
else
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -531,8 +531,6 @@ void CISlave::Spawn()
|
||||
//=========================================================
|
||||
void CISlave::Precache()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/islave.mdl" );
|
||||
PRECACHE_MODEL( "sprites/lgtning.spr" );
|
||||
PRECACHE_SOUND( "debris/zap1.wav" );
|
||||
@ -543,17 +541,10 @@ void CISlave::Precache()
|
||||
PRECACHE_SOUND( "headcrab/hc_headbite.wav" );
|
||||
PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ )
|
||||
PRECACHE_SOUND( pDeathSounds[i] );
|
||||
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
|
||||
PRECACHE_SOUND_ARRAY( pPainSounds );
|
||||
PRECACHE_SOUND_ARRAY( pDeathSounds );
|
||||
|
||||
UTIL_PrecacheOther( "test_effect" );
|
||||
}
|
||||
|
@ -259,27 +259,23 @@ void CLeech::AttackSound( void )
|
||||
{
|
||||
if( gpGlobals->time > m_attackSoundTime )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0f, ATTN_NORM, 0, PITCH_NORM );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0f, ATTN_NORM, 0, PITCH_NORM );
|
||||
m_attackSoundTime = gpGlobals->time + 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
void CLeech::AlertSound( void )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0f, ATTN_NORM * 0.5f, 0, PITCH_NORM );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0f, ATTN_NORM * 0.5f, 0, PITCH_NORM );
|
||||
}
|
||||
|
||||
void CLeech::Precache( void )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
//PRECACHE_MODEL( "models/icky.mdl" );
|
||||
PRECACHE_MODEL( "models/leech.mdl" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
PRECACHE_SOUND_ARRAY( pAttackSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAlertSounds );
|
||||
}
|
||||
|
||||
int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
|
@ -154,14 +154,14 @@ void CZombie::PainSound( void )
|
||||
int pitch = 95 + RANDOM_LONG( 0, 9 );
|
||||
|
||||
if( RANDOM_LONG( 0, 5 ) < 2 )
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
void CZombie::AlertSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG( 0, 9 );
|
||||
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
void CZombie::IdleSound( void )
|
||||
@ -169,7 +169,7 @@ void CZombie::IdleSound( 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( pIdleSounds ), 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
void CZombie::AttackSound( void )
|
||||
@ -177,7 +177,7 @@ void CZombie::AttackSound( void )
|
||||
int pitch = 95 + RANDOM_LONG( 0, 9 );
|
||||
|
||||
// Play a random attack sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
@ -202,10 +202,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
|
||||
}
|
||||
// Play a random attack hit sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5 , 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5 , 5 ) );
|
||||
}
|
||||
else // Play a random attack miss sound
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
|
||||
if( RANDOM_LONG( 0, 1 ) )
|
||||
AttackSound();
|
||||
@ -224,10 +224,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100;
|
||||
}
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
}
|
||||
else
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
|
||||
if( RANDOM_LONG( 0, 1 ) )
|
||||
AttackSound();
|
||||
@ -244,10 +244,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100;
|
||||
}
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
}
|
||||
else
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
|
||||
if( RANDOM_LONG( 0, 1 ) )
|
||||
AttackSound();
|
||||
@ -286,27 +286,14 @@ void CZombie::Spawn()
|
||||
//=========================================================
|
||||
void CZombie::Precache()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
PRECACHE_MODEL( "models/zombie.mdl" );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackHitSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackMissSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND( pAttackSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND( pIdleSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND( pAlertSounds[i] );
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAttackSounds );
|
||||
PRECACHE_SOUND_ARRAY( pIdleSounds );
|
||||
PRECACHE_SOUND_ARRAY( pAlertSounds );
|
||||
PRECACHE_SOUND_ARRAY( pPainSounds );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
Loading…
Reference in New Issue
Block a user