#44 button/switch sound origins and exit switch sounds

closed-accepted
None
5
2006-10-07
2006-08-02
RjY
No

Here are some fixes for bugs that apparently go back to
the original source release and beyond[*]

1. Wrong sound origin for switch/button presses

P_ChangeSwitchTexture (p_switch.c) blithely uses
buttonlist->soundorg as a sound origin without
initialising it. buttonlist is usually all zeroed out,
so you get NULL as a sound origin, full volume
throughout the level, etc.

switchsound.patch changes this to use the sound origin
of the sector the switch faces, to match similar usage
in P_StartButton (p_switch.c). One problem with this
approach is that the sound from pressing switches
facing large sectors will appear to come from a long
way off. See later for a suggested solution to this.

2. Wrong sound origin for button "popouts"

When a button pops out again, P_UpdateSpecials
(p_spec.c) plays a sound. Unfortunately, the code
erroneously takes the address of the sound origin
pointer! Using &buttonlist[i].soundorg usually results
in the sound origin being played at map coordinates
(0,0), which is why you often don't hear it at all, or
in an odd position.

For example, run E4M8, go down the stairs, face the
skull switch (linedef #96) and press it. When it pops
out again, the sound can be heard coming from the top
of the stairs to your right. Other good examples
include the two doors to the gore room in E2M5 (sectors
#47 and #52), the lift switches that get you out of the
initial building in MAP15 (linedefs #1586 and #1588)
and the switch you face at the start of MAP26 (linedef #38)

buttonsound.patch fixes this.

3. Arguably wrong sound for exit switches

The intention of the code at the start of
P_ChangeSwitchTexture is clear - to change the sound of
exit switches from swtchn to swtchx. However this never
happens, as before that the line special is cleared so
the test is never true (exit switches are never repeatable)

exitsound.patch enables the use of the different sound
for exit switches by reordering the tests.

You can argue this isn't a bug, as no version of Doom I
know about actually fixes it, and using the regular
sound for exit switches has been the case since day
one. So I leave the decision up to you.

Other patches and notes:

switch-button-exit.patch merges the three patches above
(switchsound.patch and exitsound.patch clash as they
both affect the start of P_ChangeSwitchTexture)

sw-bt-ex-linesound.patch is my preferred solution.
Starting from switch-button-exit.patch, it then adds
sound origins at the midpoints of lines, and uses them
instead of the sound origin of the facing sector for a
switch. This fixes the aforementioned problem of
switches in large sectors having far-off sounds. It
also tidies up P_ChangeSwitchTexture considerably,
removing a lot of duplicated code.

[*] I must stress that none of these patches change any
behaviour in compatibility modes. Changes are only
enabled when both comp_sound is off, and when
compatibility_level is at least prboom_6_compatibility
(the current level)

Discussion

  • RjY
    RjY
    2006-08-02

    fix sound origin for switch/button presses

     
    Attachments
  • RjY
    RjY
    2006-08-02

    fix sound origin for button popouts

     
    Attachments
  • RjY
    RjY
    2006-08-02

    exit switches use "correct" sound

     
    Attachments
  • RjY
    RjY
    2006-08-02

    {switch,button,exit}sound.patch merged

     
  • RjY
    RjY
    2006-08-02

    switch-button-exit + sound origins for linedefs

     
  • Logged In: YES
    user_id=18721

    Accepted except the exit switch sound change.

     
    • assigned_to: nobody --> proff_fs
    • status: open --> closed-accepted