switch echo sound problem
There seems to be a problem with the sound effect of the switch which can be seen in doom2.wad map01.
Press the elevator switch, you can hear the switch sound which is a loud "click" and then another click about a second later as loud as the first one. We tested this in other ports like chocolate and prboom, and it seems to us the second sound(echo-like) is supposed to die off with distance, which is not the case with odamex, where the echo can be heard as loud as the first click regardless of the distance from the switch.
I was testing this with vain and we both came to the conclusion the sound is not correct. Here you can hear the switch sound effect in multiplayer chocolate doom from a player standing in the blue room(the player pressing the switch is muted): 0 , you can hear the first click, not the second one.
0.6-dev r1862 applies a fix for this bug.
Fix in 1862 causes weird issues in netplay (not single player curiously). This includes hearing your own weapons firing from a specific direction. I've found the issue is easiest to hear by running in a diagonal line while firing the SSG or BFG. Unsure of any other sound issues may have arisen.
finally being able to compile and test this, i'm afraid the switch sound is completely eliminated now since r1862, when you hit the lift switch in map01, you can hear only the lift coming down, not the switch itself, when you take the lift up and hit the other switch, it makes no sound at all - which of course is incorrect
Same problem is in map02. Both swtiches on the start does not make sound when you push them since r1862.
I tested this and I can hear the second click when I am really close to the switch, otherwise, it is silent. Also, Ralphis mentioned there might be other sound side-effects. I have observed that recently the BFG explosion sometimes is silent.
r2027 reverts the commit Nes put in to attempt to fix this as it seems to have caused more problems than helped.
Emulate vanilla doom's switch sound behavior, R1
The behavior of switches in Odamex stems from an attempt to fix a bug in vanilla Doom where the sound of a repeatable switch resetting is played at the map coordinates (0,0), and thus sounding much quieter than the initial switch trigger, which is heard at full volume anywhere on the map.
I have created a patch that emulates the vanilla Doom switch sound behavior if the cvar "co_vanillaswitches" is set (default).
Note: Calling S_Sound() using x & y values instead of pt (an array of fixed_t to denote a map location) results in the sound never being attenuated since S_AdjustSoundParams isn't called when pt is null. My code creates a static array of fixed_t for the switch sound location to get around this shortcoming. It may be worth fixing this issue if there are further sound-related bugs.
Emulate vanilla doom's switch sound behavior, R2
Updated patch to include different switch sound behavior when "co_vanillaswitches" is disabled. In that mode, switch sounds attenuate with distance like plats and doors. The initial switch sound and the reset sound for repeatable switches are centered in the sector containing the switch.
r2177 applies the patch for this, with a small change in terms of semantics. co_vanillaswitches is now co_zdoomswitches, defaulted to 0. I flipped the code executed in the conditionals in p_switch. Please test to verify.
Have tested and verified this fix with Dr. Sean. The enabled behavior of co_zdoomswitches needs to be fixed but that will be filed in an enhancement bug!