Skip to content

Commit

Permalink
Merge pull request #103 from malortie/sound-array-leech
Browse files Browse the repository at this point in the history
Use sound array macros (Leech)
  • Loading branch information
SamVanheer authored Dec 4, 2021
2 parents b692d13 + 50b2e4b commit 128df08
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions dlls/leech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,29 +278,25 @@ void CLeech::AttackSound()
{
if (gpGlobals->time > m_attackSoundTime)
{
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, pAttackSounds[RANDOM_LONG(0, ARRAYSIZE(pAttackSounds) - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM);
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pAttackSounds), 1.0, ATTN_NORM, 0, PITCH_NORM);
m_attackSoundTime = gpGlobals->time + 0.5;
}
}


void CLeech::AlertSound()
{
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, pAlertSounds[RANDOM_LONG(0, ARRAYSIZE(pAlertSounds) - 1)], 1.0, ATTN_NORM * 0.5, 0, PITCH_NORM);
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pAlertSounds), 1.0, ATTN_NORM * 0.5, 0, PITCH_NORM);
}


void CLeech::Precache()
{
int i;

//PRECACHE_MODEL("models/icky.mdl");
PRECACHE_MODEL("models/leech.mdl");

for (i = 0; i < ARRAYSIZE(pAttackSounds); i++)
PRECACHE_SOUND((char*)pAttackSounds[i]);
for (i = 0; i < ARRAYSIZE(pAlertSounds); i++)
PRECACHE_SOUND((char*)pAlertSounds[i]);
PRECACHE_SOUND_ARRAY(pAttackSounds);
PRECACHE_SOUND_ARRAY(pAlertSounds);
}


Expand Down

0 comments on commit 128df08

Please sign in to comment.