SWITCHES

From ZDoom Wiki
Jump to: navigation, search
DoomWiki.org
For more information on this article, visit the SWITCHES page on the Doom Wiki.
Error.gif
Warning: This page describes a feature created for Boom that is maintained in ZDoom for backwards-compatibility purposes only. It is not recommended that new projects make use of this feature. Everything that can be done with the SWITCHES lump can be done better and more easily by using ANIMDEFS.


The SWITCHES lump was originally Boom's method of defining additional switches. Although some modern editors such as SLADE 3 allow to create and edit this lump directly in binary form, the original method devised by TeamTNT involved creating a text file and converting it with a small utility called swantbls (switch and animation tables).

Contrarily to ANIMDEFS, SWITCHES lumps are not cumulative. Only the last one loaded will be used.

Format

SWITCHES is a series of 20 byte entries:

Length Description
9 bytes Null-terminated name of the "off" texture.
9 bytes Null-terminated name of the "on" texture.
2 bytes 16 bit int specifying which IWADs this switch works with:
  • 0: terminate SWITCHES list.
  • 1: Shareware.
  • 2: Shareware, Doom.
  • 3: Shareware, Doom, Doom II.

The last entry, with a 0 in its final two bytes, is not used.

If a switch is defined while its textures are not present, the vanilla engine will complain, which is why this tiered approach was adopted by id Software originally, and also why Doom II contains some identical switch definitions that are never used in its maps; they correspond to switches from Doom that were dummied out to prevent errors.

Swantbls syntax

The swantbls tool converts a plain text file into an ANIMATED and SWITCHES lump. The format of the plain text file prior to conversion is as follows (quoth defswani.dat):

# This file is input for SWANTBLS.EXE, it specifies the switchnames
# and animated textures and flats usable with BOOM. The output of
# SWANTBLS is two lumps, SWITCHES.LMP and ANIMATED.LMP that should
# be inserted in the PWAD as lumps.
#
#switches usable with each IWAD, 1=SW, 2=registered DOOM, 3=DOOM2
[SWITCHES]
#epi    texture1        texture2
1       SW1BRCOM        SW2BRCOM
...
#animated flats, spd is number of frames between changes
[FLATS]
#spd    last        first
8       NUKAGE3     NUKAGE1
...
#animated textures, spd is number of frames between changes
[TEXTURES]
#spd    last        first
8       BLODGR4     BLODGR1
...

External links