Wrong sound for exit switches

From DoomWiki.org

Revision as of 21:19, 27 January 2019 by Quasar (talk | contribs) (Minor fmt, +wl)


The Doom source code seems to reveal that at some point in development exit switches were meant to have the alternative switch sound DSSWTCHX rather than the normal DSSWTCHN. However, due to a logic error, the code to change the sound effect is never executed.

Technical

The intention of this code, from P_ChangeSwitchTexture (in file p_switch.c) is clear

    // EXIT SWITCH?
    if (line->special == 11)
        sound = sfx_swtchx;

Unfortunately, a few lines up in the same function, the following is written:

    if (!useAgain)
        line->special = 0;

Thus line->special is zeroed out before it can be tested against the special number for an exit switch (exit switches are not considered repeatable).

Note also that secret exit switches (special number 51) are not handled at all.