Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HL/OF/BS] Gluon gun beam keeps showing with mouse2 held down #2612

Open
CS-PRO1 opened this issue Jul 21, 2019 · 3 comments
Open

[HL/OF/BS] Gluon gun beam keeps showing with mouse2 held down #2612

CS-PRO1 opened this issue Jul 21, 2019 · 3 comments

Comments

@CS-PRO1
Copy link

CS-PRO1 commented Jul 21, 2019

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:
cllw1
(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 with cl_lw 1)

However if cl_lw is set to 0 the beam will be stuck to the point it was fired into:
cllw0

Gluon gun fixes are intended for a future release so I'll put other known bugs together here for easy locating: #1077 #2510

@CS-PRO1 CS-PRO1 changed the title [HL] Gluon gun beam keeps showing with secondary mouse click [HL/OF/BS] Gluon gun beam keeps showing with mouse2 held down Jul 21, 2019
@CS-PRO1
Copy link
Author

CS-PRO1 commented Jul 21, 2019

Update: I tested this on WON v.1.1.0.9 and the same bug appears there..

@SamVanheer
Copy link

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.

@SamVanheer
Copy link

I've implemented this fix:
twhl-community/halflife-updated@5dff980

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants