48  Status Bar

This walkthrough examines how Doom’s status bar is built using four widget types declared in st_lib.h and implemented in st_stuff.c.

48.1 Widget Types (st_lib.h)

  • st_number_t: Displays right-justified numbers using digit patches.
  • st_percent_t: Displays numbers with a percent sign.
  • st_multicon_t: Displays one of multiple icons at a center-aligned position.
  • st_binicon_t: Binary (on/off) icon display.

48.1.1 Code Highlights

// st_number_t: status bar number widget
4470

// st_percent_t: shows a percentage
7684

// st_multicon_t: multi-state icon widget
89111

// st_binicon_t: binary icon widget
118138

48.2 Widget Initialization (st_stuff.c)

Widgets are initialized using corresponding STlib_init* functions:

  • STlib_initNum: Initializes ammo counter (w_ready)
    • 1287–1294
  • STlib_initPercent: Sets up health display
    • 1299–1306
  • STlib_initBinIcon: Configures icon for arms background
    • 1309–1314
  • HUD logic overview:
    • 1336–1341

48.3 Summary

The status bar displays game info using combinations of numbers, percentages, and icons. Each widget has matching initialization and update functions:

  • STlib_initNum / updateNum
  • STlib_initPercent / updatePercent
  • STlib_initMultIcon / updateMultIcon
  • STlib_initBinIcon / updateBinIcon