50 Sprite & State Definitions
This tour examines how DOOM uses sprite types and animation states through the info.h
, p_mobj.h
, and p_pspr.c
headers and source files.
50.1 spritenum_t and statenum_t Enums
These enums define core identifiers for graphics and animation logic:
// spritenum_t assigns numeric values to sprite identifiers.
-1.10/info.h:30–37 linuxdoom
// spritenum_t ends at NUMSPRITES.
-1.10/info.h:168–172 linuxdoom
// statenum_t defines animation states.
-1.10/info.h:174–182 linuxdoom
// NUMSTATES tracks how many animation states exist.
-1.10/info.h:1142–1145 linuxdoom
50.2 state_t Struct
state_t
uses spritenum_t
and statenum_t
for visual and behavioral sequencing:
// state_t's sprite field defines the graphic for the state.
-1.10/info.h:1149–1152 linuxdoom
// nextstate field enables chaining animation frames.
-1.10/info.h:1154 linuxdoom
50.3 Integration in Game Logic
// mobj_t uses spritenum_t for renderable sprites.
-1.10/p_mobj.h:222–224 linuxdoom
// P_SetMobjState applies new statenum_t values to animate mobjs.
-1.10/p_mobj.c:54–57 linuxdoom
// P_SetPsprite uses statenum_t values like S_PISTOL for weapon animation.
-1.10/p_pspr.c:59–62 linuxdoom
50.4 Summary
spritenum_t
defines renderable graphics.statenum_t
defines logical animation states.state_t
connects graphics to behavior, linking each frame to a sprite and next state.