diff --git a/dlls/zombie.cpp b/dlls/zombie.cpp index ff75f1c4e..10788ba42 100644 --- a/dlls/zombie.cpp +++ b/dlls/zombie.cpp @@ -157,14 +157,14 @@ void CZombie::PainSound() 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() { 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() @@ -172,7 +172,7 @@ void CZombie::IdleSound() int pitch = 100 + RANDOM_LONG(-5, 5); // 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() @@ -180,7 +180,7 @@ void CZombie::AttackSound() int pitch = 100 + RANDOM_LONG(-5, 5); // 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); } @@ -206,10 +206,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(); @@ -229,10 +229,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(); @@ -250,10 +250,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(); @@ -293,27 +293,14 @@ void CZombie::Spawn() //========================================================= void CZombie::Precache() { - int i; - PRECACHE_MODEL("models/zombie.mdl"); - for (i = 0; i < ARRAYSIZE(pAttackHitSounds); i++) - PRECACHE_SOUND((char*)pAttackHitSounds[i]); - - for (i = 0; i < ARRAYSIZE(pAttackMissSounds); i++) - PRECACHE_SOUND((char*)pAttackMissSounds[i]); - - for (i = 0; i < ARRAYSIZE(pAttackSounds); i++) - PRECACHE_SOUND((char*)pAttackSounds[i]); - - for (i = 0; i < ARRAYSIZE(pIdleSounds); i++) - PRECACHE_SOUND((char*)pIdleSounds[i]); - - for (i = 0; i < ARRAYSIZE(pAlertSounds); i++) - PRECACHE_SOUND((char*)pAlertSounds[i]); - - for (i = 0; i < ARRAYSIZE(pPainSounds); i++) - PRECACHE_SOUND((char*)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); } //=========================================================