2  Core Definitions & Types: Overview

This tour shows the fundamental types and definitions used throughout the Doom engine: integer limits, type aliases, game modes, key codes, events, commands, and player state.

Next we’ll look at the core header files that define DOOM’s basic types, game parameters, and player state.


2.0.1 πŸ“‚ File: linuxdoom-1.10/doomtype.h

The doomtype.h header defines platform-independent basic types and limits used throughout the engine.


2.0.2 πŸ“‚ File: linuxdoom-1.10/doomdef.h

The file doomdef.h defines global parameters and constants used throughout the DOOM engine.


2.0.3 πŸ“‚ File: linuxdoom-1.10/doomdef.c

The file doomdef.c includes doomdef.h but contains no actual code.


2.0.4 πŸ“‚ File: linuxdoom-1.10/d_event.h

The file d_event.h declares input event types, event queues, and high-level game actions.


2.0.5 πŸ“‚ File: linuxdoom-1.10/d_ticcmd.h

The file d_ticcmd.h defines the per-tick input command structure used for local updates and network transmission.


2.0.6 πŸ“‚ File: linuxdoom-1.10/d_player.h

The file d_player.h encapsulates player-specific state, cheats, inventory, and intermission stats.


2.0.7 πŸ“„ File: doomtype.h (lines 31–37)

Defines a boolean alias and a byte alias for unsigned char.


2.0.8 πŸ“„ File: d_player.h (lines 109–110)

In the player_t struct, boolean cards[NUMCARDS] tracks key cards and boolean backpack flags if the backpack has been picked up.


2.0.9 πŸ“„ File: d_ticcmd.h (lines 42–43)

The ticcmd_t struct uses byte chatchar for ASCII typed chat and byte buttons for input flags.


2.0.10 πŸ“„ File: doomtype.h (lines 44–49)

Defines the maximum values for signed integer types: char, short, int, long.


2.0.11 πŸ“„ File: doomtype.h (lines 50–55)

Defines minimum values for signed integer types.


2.0.12 πŸ“„ File: doomdef.h (lines 33–47)

VERSION defines the engine version. GameMode_t identifies the DOOM release.


2.0.13 πŸ“„ File: doomdef.h (lines 51–70)

GameMission_t identifies the DOOM variant; Language_t selects display language.


2.0.14 πŸ“„ File: doomdef.h (lines 73–84)

RANGECHECK enables debug checks. SNDSERV toggles sound server use.


2.0.15 πŸ“„ File: doomdef.h (lines 98–105)

BASE_WIDTH, SCREEN_MUL, and INV_ASPECT_RATIO control screen scaling and shape.


2.0.16 πŸ“„ File: doomdef.h (lines 110–113)

SCREENWIDTH and SCREENHEIGHT set the in-game resolution (320Γ—200).


2.0.17 πŸ“„ File: doomdef.h (lines 119–122)

MAXPLAYERS caps multiplayer to 4. TICRATE sets 35 ticks per second.


2.0.18 πŸ“„ File: doomdef.h (lines 127–133)

gamestate_t enumerates game states: play, intermission, finale, or demo.


2.0.19 πŸ“„ File: doomdef.h (lines 139–154)

Monster flags (MTF_*) and skill_t define AI behavior and difficulty.


2.0.20 πŸ“„ File: doomdef.h (lines 162–173)

card_t enumerates access cards and skull keys.


2.0.21 πŸ“„ File: doomdef.h (lines 180–240)

Enums for weapons (weapontype_t), ammo (ammotype_t), power-ups (powertype_t), and their durations (powerduration_t).


2.0.22 πŸ“„ File: doomdef.h (lines 250–281)

Key codes mapping keyboard input to game actions.


Next we’ll look at input event handling in d_event.h, which defines how DOOM processes keyboard and mouse input into game actions.


2.0.23 πŸ“„ File: doomdef.c (lines 29–33)

Includes doomdef.h with no added logic, under a C++ pragma.


2.0.24 πŸ“„ File: d_event.h (lines 35–50)

evtype_t lists raw input types; event_t encapsulates the event data.


2.0.25 πŸ“„ File: d_event.h (lines 53–100)

gameaction_t defines transitions; buttoncode_t uses bit flags for inputs.


2.0.26 πŸ“„ File: d_event.h (lines 108–115)

Global input queue: events[MAXEVENTS], eventhead, eventtail, and gameaction.


2.0.27 πŸ“„ File: d_ticcmd.h (lines 36–43)

ticcmd_t input struct includes forwardmove, sidemove, angleturn, and buttons.


The following steps illustrate how ticcmd_t is constructed, transmitted, and applied in Doom’s loop.


2.0.28 πŸ“„ File: g_game.c (lines 249–253)

G_BuildTiccmd creates game commands and sets consistency checks for sync.


2.0.29 πŸ“„ File: g_game.c (lines 662–667)

In G_Ticker, per-player cmd fields are filled from netcmds or demos.


2.0.30 πŸ“„ File: p_user.c (lines 152–155)

In P_MovePlayer, cmd->angleturn rotates the player’s angle.


2.0.31 πŸ“„ File: d_player.h (lines 53–62)

playerstate_t enumerates player states: alive, dead, or respawning.


2.0.32 πŸ“„ File: d_player.h (lines 68–77)

cheat_t flags enable modes like no-clip or god mode.


Next we’ll look at the player data structures, which store both runtime state and level statistics.


2.0.33 πŸ“„ File: d_player.h (lines 83–166)

player_t holds all player state, resources, view, inventory, and progress.


2.0.34 πŸ“„ File: d_player.h (lines 173–211)

Intermission data structs: - wbplayerstruct_t: tracks player stats - wbstartstruct_t: holds level-wide data


And there you have it β€” the core types and definitions that power Doom’s engine.