halflife icon indicating copy to clipboard operation
halflife copied to clipboard

Gauss charge sound is not always reset.

Open malortie opened this issue 2 years ago • 3 comments

The following code sends an event to stop the gauss charge sound on the client.

https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L392-L392

There are several places where the secondary attack is interrupted and does not send this event. The sound will keep playing indefinitely unless PrimaryAttack or SecondaryAttack is called.

The event should be sent at the following places:

  1. When a static discharge occurs:

    https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L280-L284

  2. When the weapon is charging and the player goes underwater:

    https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L177-L182

malortie avatar Dec 05 '21 18:12 malortie

Under what conditions does the sound keep playing? I tested this with fakelag 50 (~100 ping) and the sound is stopped in both cases.

SamVanheer avatar Jan 23 '22 15:01 SamVanheer

Looks like this doesn't happen when there's lag. It's a race condition of sorts, but it does happen.

SamVanheer avatar Feb 28 '22 20:02 SamVanheer

Note that when stopping the sound because the player is underwater the event flag FEV_NOTHOST should not be used because the client will predict the frame with m_fInAttack == 0 so it won't run the sound stop logic locally, the server has to order the client to stop it.

The zap sound played when going underwater with a charging Gauss won't play if there is no lag because the empty sound plays on the same channel, and the client will run that branch instead of the zap: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L177-L186

SamVanheer avatar Feb 28 '22 21:02 SamVanheer