ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.72k stars 624 forks source link

357/Python repeatedly starts reload animation if holding down primary attack with prediction enabled #3028

Open SamVanheer opened 3 years ago

SamVanheer commented 3 years ago

If weapon prediction is enabled and if you fire the 357 until it's empty and continue to hold down the primary attack key, the reload animation is started every frame until you let go of the attack key.

This happens because of this code: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/python.cpp#L170-L176

If m_fFireOnEmpty is false it immediately tries to reload. This code executes every frame on the client which causes the glitchy animation.

It should instead do what the Glock does: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/wpn_shared/hl_wpn_glock.cpp#L110-L114

The call to Reload needs to be removed. The weapon will reload automatically as soon as the player lets go of the attack key.

This bug was originally reported as part of #617 but was overlooked.

pierow commented 3 years ago

This is happening because of issue https://github.com/ValveSoftware/halflife/issues/3071. m_fFireOnEmpty would be true if iMaxClip() could return the correct value in client side weapons code. https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/hl/hl_weapons.cpp#L352-L360