Open CS-PRO1 opened 5 years ago
Update: I tested this on WON v.1.1.0.9 and the same bug appears there..
This happens in the latest beta as well.
It happens because the Egon destroys the beam effect in WeaponIdle
, which is only called if no attack buttons are held down.
The easiest solution is to override ShouldWeaponIdle
to return true for the Egon, and then checking if the primary attack button is being held down before running the logic in WeaponIdle
. This way the effect is destroyed if the primary attack button isn't being held down.
This does not fix the second part of the problem, which is that holding both attack buttons down will show the beam without actually doing damage or using ammo. This happens because secondary attack takes priority over primary attack.
An easy fix is to add an additional check in WeaponIdle
to destroy the effect if the secondary attack button is being held down.
That amounts to this:
void CEgon::WeaponIdle( void )
{
if( !( m_pPlayer->m_afButtonPressed & IN_ATTACK2 ) && ( m_pPlayer->pev->button & IN_ATTACK ) )
{
return;
}
//Existing logic...
}
Note that i am checking m_afButtonPressed
here since the weapons code clears IN_ATTACK2
after handling a secondary attack.
This fixes both the non-damaging beam effect and the misaligned beam effect.
I've implemented this fix: https://github.com/Solokiller/halflife-updated/commit/5dff9808d7a605663cc7e8ab5ff70b76a6da3eb3
Note that i also changed the m_flTimeWeaponIdle
to use UTIL_WeaponTimeBase
. The Egon gun incorrectly checked this variable against gpGlobals->time
, which is incorrect.
I'm testing this on an old build [6153] so I'm not sure if it's still not fixed.. Easy to Reproduce, just fire the gluon with mouse1 and press mouse2 then stop holding mouse1 and keep holding mouse2. You'll see the beam still active but sound will stop playing shortly after (in some cases the sound keeps playing). Of course it doesn't cause any damage. This happens in both SP and MP, but with different behavior related to the value of
cl_lw
. If it was set to 1 the beam will move with mouse's movement normally: _(Let me also note that the beam doesn't come out of the correct spot, it's shifted a bit to the right but that's a different issue and happens with actual +attack. This only happens withcl_lw 1
)_However if
cl_lw
is set to 0 the beam will be stuck to the point it was fired into:Gluon gun fixes are intended for a future release so I'll put other known bugs together here for easy locating: https://github.com/ValveSoftware/halflife/issues/1077 https://github.com/ValveSoftware/halflife/issues/2510