Browse Source

Fix gonome double sounds, fix gut attachment

opforfixed
Roman Chistokhodov 5 years ago
parent
commit
ec5b716407
  1. 34
      dlls/gearbox/gonome.cpp

34
dlls/gearbox/gonome.cpp

@ -148,6 +148,7 @@ public:
Schedule_t *GetSchedule(); Schedule_t *GetSchedule();
Schedule_t *GetScheduleOfType( int Type ); Schedule_t *GetScheduleOfType( int Type );
void RunTask(Task_t* pTask);
int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
void Killed(entvars_t *pevAttacker, int iGib); void Killed(entvars_t *pevAttacker, int iGib);
@ -177,6 +178,8 @@ protected:
BOOL m_fPlayerLocked; BOOL m_fPlayerLocked;
EHANDLE m_lockedPlayer; EHANDLE m_lockedPlayer;
#endif #endif
bool m_meleeAttack2;
bool m_playedAttackSound;
}; };
LINK_ENTITY_TO_CLASS(monster_gonome, CGonome) LINK_ENTITY_TO_CLASS(monster_gonome, CGonome)
@ -316,10 +319,12 @@ void CGonome::SetActivity( Activity NewActivity )
// special melee animations // special melee animations
if ((pev->origin - m_hEnemy->pev->origin).Length2D() >= 48 ) if ((pev->origin - m_hEnemy->pev->origin).Length2D() >= 48 )
{ {
m_meleeAttack2 = false;
iSequence = LookupSequence("attack1"); iSequence = LookupSequence("attack1");
} }
else else
{ {
m_meleeAttack2 = true;
iSequence = LookupSequence("attack2"); iSequence = LookupSequence("attack2");
} }
} }
@ -472,6 +477,7 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent)
switch (pEvent->event) switch (pEvent->event)
{ {
case GONOME_SCRIPT_EVENT_SOUND: case GONOME_SCRIPT_EVENT_SOUND:
if (m_Activity != ACT_MELEE_ATTACK1)
EMIT_SOUND(ENT(pev), CHAN_BODY, pEvent->options, 1, ATTN_NORM); EMIT_SOUND(ENT(pev), CHAN_BODY, pEvent->options, 1, ATTN_NORM);
break; break;
case GONOME_AE_SPIT: case GONOME_AE_SPIT:
@ -481,6 +487,7 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent)
if (GetGonomeGuts(vecArmPos)) if (GetGonomeGuts(vecArmPos))
{ {
m_pGonomeGuts->pev->skin = entindex();
m_pGonomeGuts->pev->body = 1; m_pGonomeGuts->pev->body = 1;
m_pGonomeGuts->pev->aiment = ENT(pev); m_pGonomeGuts->pev->aiment = ENT(pev);
m_pGonomeGuts->pev->movetype = MOVETYPE_FOLLOW; m_pGonomeGuts->pev->movetype = MOVETYPE_FOLLOW;
@ -851,6 +858,33 @@ Schedule_t* CGonome::GetScheduleOfType(int Type)
return CBaseMonster::GetScheduleOfType(Type); return CBaseMonster::GetScheduleOfType(Type);
} }
void CGonome::RunTask(Task_t *pTask)
{
// HACK to stop Gonome from playing attack sound twice
if (pTask->iTask == TASK_MELEE_ATTACK1)
{
if (!m_playedAttackSound)
{
const char* sample = NULL;
if (m_meleeAttack2)
{
sample = "gonome/gonome_melee2.wav";
}
else
{
sample = "gonome/gonome_melee1.wav";
}
EMIT_SOUND(ENT(pev), CHAN_BODY, sample, 1, ATTN_NORM);
m_playedAttackSound = true;
}
}
else
{
m_playedAttackSound = false;
}
CBaseMonster::RunTask(pTask);
}
//========================================================= //=========================================================
// Start task - selects the correct activity and performs // Start task - selects the correct activity and performs
// any necessary calculations to start the next task on the // any necessary calculations to start the next task on the

Loading…
Cancel
Save