Browse Source

Fix shockroach sounds

opforfixed
Roman Chistokhodov 5 years ago
parent
commit
8d19eeec10
  1. 12
      dlls/gearbox/shockroach.cpp
  2. 3
      dlls/gearbox/shockroach.h
  3. 11
      dlls/headcrab.cpp
  4. 3
      dlls/headcrab.h

12
dlls/gearbox/shockroach.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
#include "headcrab.h"
#include "shockroach.h"
LINK_ENTITY_TO_CLASS(monster_shockroach, CShockRoach);
LINK_ENTITY_TO_CLASS(monster_shockroach, CShockRoach)
TYPEDESCRIPTION CShockRoach::m_SaveData[] =
{
@ -35,7 +35,7 @@ TYPEDESCRIPTION CShockRoach::m_SaveData[] = @@ -35,7 +35,7 @@ TYPEDESCRIPTION CShockRoach::m_SaveData[] =
DEFINE_FIELD(CShockRoach, m_fRoachSolid, FIELD_BOOLEAN),
};
IMPLEMENT_SAVERESTORE(CShockRoach, CHeadCrab);
IMPLEMENT_SAVERESTORE(CShockRoach, CHeadCrab)
const char *CShockRoach::pIdleSounds[] =
{
@ -64,7 +64,7 @@ const char *CShockRoach::pDeathSounds[] = @@ -64,7 +64,7 @@ const char *CShockRoach::pDeathSounds[] =
const char *CShockRoach::pBiteSounds[] =
{
"shockroach/schock_bite.wav",
"shockroach/shock_bite.wav",
};
@ -207,7 +207,6 @@ void CShockRoach::StartTask(Task_t *pTask) @@ -207,7 +207,6 @@ void CShockRoach::StartTask(Task_t *pTask)
{
case TASK_RANGE_ATTACK1:
{
EMIT_SOUND_DYN(edict(), CHAN_WEAPON, pAttackSounds[0], GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch());
m_IdealActivity = ACT_RANGE_ATTACK1;
SetTouch(&CShockRoach::LeapTouch);
break;
@ -222,3 +221,8 @@ int CShockRoach::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl @@ -222,3 +221,8 @@ int CShockRoach::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// Skip headcrab's TakeDamage to avoid unwanted immunity to acid.
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CShockRoach::AttackSound()
{
EMIT_SOUND_DYN(edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY(pAttackSounds), GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch());
}

3
dlls/gearbox/shockroach.h

@ -47,6 +47,9 @@ public: @@ -47,6 +47,9 @@ public:
float m_flBirthTime;
BOOL m_fRoachSolid;
protected:
void AttackSound();
};

11
dlls/headcrab.cpp

@ -224,9 +224,7 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -224,9 +224,7 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent )
vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 350;
}
int iSound = RANDOM_LONG(0,2);
if( iSound != 0 )
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pAttackSounds[iSound], GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch() );
AttackSound();
pev->velocity = vecJumpDir;
m_flNextAttack = gpGlobals->time + 2;
@ -445,6 +443,13 @@ Schedule_t *CHeadCrab::GetScheduleOfType( int Type ) @@ -445,6 +443,13 @@ Schedule_t *CHeadCrab::GetScheduleOfType( int Type )
return CBaseMonster::GetScheduleOfType( Type );
}
void CHeadCrab::AttackSound()
{
int iSound = RANDOM_LONG(0,2);
if( iSound != 0 )
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pAttackSounds[iSound], GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch() );
}
class CBabyCrab : public CHeadCrab
{
public:

3
dlls/headcrab.h

@ -56,6 +56,9 @@ public: @@ -56,6 +56,9 @@ public:
static const char *pAttackSounds[];
static const char *pDeathSounds[];
static const char *pBiteSounds[];
protected:
virtual void AttackSound();
};
#endif

Loading…
Cancel
Save