Skip to content

Commit

Permalink
Fix the events sometimes playing second time after the attack animati…
Browse files Browse the repository at this point in the history
…on. Controlled by anim_attack_reset_fix cvar
  • Loading branch information
FreeSlave committed Dec 16, 2024
1 parent 110f93d commit dd0cd12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ cvar_t satchelfix = { "satchelfix", "1", FCVAR_SERVER };
cvar_t explosionfix = { "explosionfix", "1", FCVAR_SERVER };
cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "1", FCVAR_SERVER };
cvar_t animeventfix = {"animeventfix", "0", FCVAR_SERVER };
cvar_t anim_attack_reset_fix = {"anim_attack_reset_fix", "1", FCVAR_SERVER };
cvar_t corpsephysics = { "corpsephysics", "0", FCVAR_SERVER };
cvar_t pushablemode = { "pushablemode", "0", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
Expand Down Expand Up @@ -1578,6 +1579,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &explosionfix );
CVAR_REGISTER( &monsteryawspeedfix );
CVAR_REGISTER( &animeventfix );
CVAR_REGISTER( &anim_attack_reset_fix );
CVAR_REGISTER( &corpsephysics );
CVAR_REGISTER( &pushablemode );
CVAR_REGISTER( &forcerespawn );
Expand Down
7 changes: 0 additions & 7 deletions dlls/gonome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
#define GONOME_AE_BITE3 ( 21 )
#define GONOME_AE_BITE4 ( 22 )

#define GONOME_SCRIPT_EVENT_SOUND ( 1011 )

//=========================================================
// Gonome's guts projectile
//=========================================================
Expand Down Expand Up @@ -470,11 +468,6 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent)
{
switch (pEvent->event)
{
case GONOME_SCRIPT_EVENT_SOUND:
// HACK: prevent playing the sound twice
if (m_Activity != ACT_MELEE_ATTACK1)
EmitSound( CHAN_BODY, pEvent->options, 1, ATTN_NORM);
break;
case GONOME_AE_SPIT:
{
Vector vecArmPos, vecArmAng;
Expand Down
6 changes: 6 additions & 0 deletions dlls/schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ void CBaseMonster::MaintainSchedule( void )
}
}

extern cvar_t anim_attack_reset_fix;

//=========================================================
// RunTask
//=========================================================
Expand Down Expand Up @@ -566,6 +568,8 @@ void CBaseMonster::RunTask( Task_t *pTask )
if( m_fSequenceFinished )
{
m_Activity = ACT_RESET;
if (anim_attack_reset_fix.value)
m_IdealActivity = ACT_RESET;
TaskComplete();
}
break;
Expand All @@ -584,6 +588,8 @@ void CBaseMonster::RunTask( Task_t *pTask )
if( m_fSequenceFinished )
{
m_Activity = ACT_RESET;
if (anim_attack_reset_fix.value)
m_IdealActivity = ACT_RESET;
TaskComplete();
}
break;
Expand Down

0 comments on commit dd0cd12

Please sign in to comment.