42 Specials, Switches & Teleporters
This tour examines how Doom
handles level specials, switches, and teleporters for triggering effects and moving entities.
42.0.1 Special Effects Initialization
p_spec.h
- P_SpawnSpecials
: Initializes level specials like lighting, doors, and platforms when a map loads.
p_spec.c
- P_SpawnSpecials()
: Processes sectors and lines at load time, creating thinkers for special behaviors. - Type 48 lines scroll textures: handled for animation updates.
42.0.2 Switch Logic
p_switch.c
- P_InitSwitchList
: Fills switchlist[]
with on/off texture pairs.
- Switch toggling uses XOR (i^1) to find texture pair and plays a sound.
- Switch activations schedule effects and update textures.
- P_UpdateSpecials
: Restores original wall texture after button timer expires.
42.0.3 Teleportation
p_telept.c
- Teleporters are triggered from the back side only. - EV_Teleport
: Finds teleport landing spots (MT_TELEPORTMAN
) via sector tag. - P_TeleportMove
: Moves the object, adjusts height and view position.
This completes the tour of specials, switches, and teleporters in Doom
’s core logic.