Open malortie opened 2 years ago
Under what conditions does the sound keep playing? I tested this with fakelag 50 (~100 ping) and the sound is stopped in both cases.
Looks like this doesn't happen when there's lag. It's a race condition of sorts, but it does happen.
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
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:
When a static discharge occurs:
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L280-L284
When the weapon is charging and the player goes underwater:
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L177-L182