MiniDoom

src/d_main.ml

Bootstraps WADs and engine subsystems, then drives title sequencing, frame dispatch, and profiling.

Package
(global)
Reachable
Yes

Imports

Declarations

_D_AddDemoLmpFromArgs

inline function _D_AddDemoLmpFromArgs(flag)

Adds demo lump from args entries to the Doom core.

ParameterTypeDefaultDescription
flagdynamic—Flag value supplied to `_D_AddDemoLmpFromArgs`.

View source

_D_ArgValue

function _D_ArgValue(flag)

Returns the string immediately following a command-line flag without consuming later options.

ParameterTypeDefaultDescription
flagdynamic—Flag value supplied to `_D_ArgValue`.

View source

_D_AttachExistingAutoHDWAD

function _D_AttachExistingAutoHDWAD()

Adds an existing automatic HDWAD to the WAD list before the WAD system starts.

View source

_D_AutoHDWADShouldRun

function _D_AutoHDWADShouldRun()

Checks whether OpenGL should automatically use a generated HDWAD.

View source

_D_DigitAt

function _D_DigitAt(s, idx)

Decodes one ASCII decimal digit at a checked string offset.

ParameterTypeDefaultDescription
sdynamic—S value supplied to `_D_DigitAt`.
idxdynamic—Zero-based element or table index.

View source

_D_DrawMPDebugOverlay

function _D_DrawMPDebugOverlay()

Renders multiplayer debug telemetry text overlay when MP runtime is active.

View source

_D_FileReadable

inline function _D_FileReadable(path)

Accepts only non-empty paths that currently resolve to regular files.

ParameterTypeDefaultDescription
pathdynamic—Filesystem path to process.

View source

_D_GenerateHDWADCacheAfterInit

function _D_GenerateHDWADCacheAfterInit()

Initializes generate HDWADCache After Init state for the Doom core system.

View source

_D_GeomNameForMapName

function _D_GeomNameForMapName(mapName)

Converts a map marker into its deterministic cached-geometry lump name.

ParameterTypeDefaultDescription
mapNamedynamic—Map name value supplied to `_D_GeomNameForMapName`.

View source

_d_hdwad_progress_done

_d_hdwad_progress_done

Tracks the mutable d hdwad progress done value used by the d main subsystem.

View source

_d_hdwad_progress_last_draw_ms

_d_hdwad_progress_last_draw_ms

Tracks the mutable d hdwad progress last draw ms value used by the d main subsystem.

View source

_d_hdwad_progress_phase_base

_d_hdwad_progress_phase_base

Tracks the mutable d hdwad progress phase base value used by the d main subsystem.

View source

_d_hdwad_progress_phase_done

_d_hdwad_progress_phase_done

Tracks the mutable d hdwad progress phase done value used by the d main subsystem.

View source

_d_hdwad_progress_phase_expected

_d_hdwad_progress_phase_expected

Tracks the mutable d hdwad progress phase expected value used by the d main subsystem.

View source

_d_hdwad_progress_phase_span

_d_hdwad_progress_phase_span

Tracks the mutable d hdwad progress phase span value used by the d main subsystem.

View source

_d_hdwad_progress_start_ms

_d_hdwad_progress_start_ms

Tracks the mutable d hdwad progress start ms value used by the d main subsystem.

View source

_d_hdwad_progress_total

_d_hdwad_progress_total

Tracks the mutable d hdwad progress total value used by the d main subsystem.

View source

_d_hdwad_status_text

_d_hdwad_status_text

Stores the mutable d hdwad status text text used by the d main subsystem.

View source

_D_HDWADDrawLoadingScreen

function _D_HDWADDrawLoadingScreen(text)

Presents TITLEPIC with centered Doom-font HDWAD progress text.

ParameterTypeDefaultDescription
textdynamic—Text to process.

View source

_D_HDWADDrawText

function _D_HDWADDrawText(text, y)

Draws centered loading text with Doom STCFN font patches.

ParameterTypeDefaultDescription
textdynamic—Text to process.
ydynamic—Vertical map- or screen-space coordinate.

View source

_D_HDWADDurationText

function _D_HDWADDurationText(ms)

Formats a millisecond duration for the HDWAD loading progress line.

ParameterTypeDefaultDescription
msdynamic—Ms value supplied to `_D_HDWADDurationText`.

View source

_D_HDWADFinishProgressPhase

function _D_HDWADFinishProgressPhase()

Completes the current weighted HDWAD generation phase.

View source

_D_HDWADFontLump

function _D_HDWADFontLump(code)

Builds the STCFN lump name used for HDWAD loading text.

ParameterTypeDefaultDescription
codedynamic—Code value supplied to `_D_HDWADFontLump`.

View source

_D_HDWADLooksComplete

function _D_HDWADLooksComplete(path)

Validates that an HDWAD contains metadata and generated geometry required for reuse.

ParameterTypeDefaultDescription
pathdynamic—Filesystem path to process.

View source

_D_HDWADPatchWidth

inline function _D_HDWADPatchWidth(patch)

Reads a Doom patch width without depending on renderer init.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `_D_HDWADPatchWidth`.

View source

_D_HDWADPathForWad

function _D_HDWADPathForWad(wad)

Derives the automatic HD rendering-cache sidecar path for a gameplay WAD.

ParameterTypeDefaultDescription
waddynamic—Wad value supplied to `_D_HDWADPathForWad`.

View source

_D_HDWADProgressLine

function _D_HDWADProgressLine()

Builds the second HDWAD loading line with percent and remaining time.

View source

_D_HDWADProgressReset

function _D_HDWADProgressReset()

Clears HDWAD loading progress state.

View source

_D_HDWADScaleFromArgs

function _D_HDWADScaleFromArgs()

Parses and clamps the requested offline HDWAD upscale factor.

View source

_D_HDWADSetProgressPhase

function _D_HDWADSetProgressPhase(text, basePct, spanPct, expectedUnits)

Starts a weighted HDWAD generation phase.

ParameterTypeDefaultDescription
textdynamic—Text to process.
basePctdynamic—Base pct value supplied to `_D_HDWADSetProgressPhase`.
spanPctdynamic—Span pct value supplied to `_D_HDWADSetProgressPhase`.
expectedUnitsdynamic—Expected units value supplied to `_D_HDWADSetProgressPhase`.

View source

_D_HDWADStatus

function _D_HDWADStatus(text)

Shows the current HDWAD generation phase in the application title.

ParameterTypeDefaultDescription
textdynamic—Text to process.

View source

_D_HDWADTextByte

inline function _D_HDWADTextByte(c)

Normalizes one byte for the HDWAD loading font.

ParameterTypeDefaultDescription
cdynamic—C value supplied to `_D_HDWADTextByte`.

View source

_D_HDWADTextWidth

function _D_HDWADTextWidth(text)

Measures loading text using Doom STCFN font patches.

ParameterTypeDefaultDescription
textdynamic—Text to process.

View source

_D_IDiv

inline function _D_IDiv(a, b)

Returns a quotient truncated toward zero, mapping non-integers and division by zero to zero.

ParameterTypeDefaultDescription
adynamic—First input operand.
bdynamic—Second input operand.

View source

_D_InitEventQueue

function _D_InitEventQueue()

Clears the fixed-size input event ring and resets both producer and consumer cursors.

View source

_D_IsMapMarkerName

function _D_IsMapMarkerName(name)

Recognizes canonical MAPxx and ExMy lump markers with decimal digit validation.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.

View source

_D_IsResponseTokenByte

inline function _D_IsResponseTokenByte(c)

Accepts the non-whitespace printable byte range used while tokenizing response files.

ParameterTypeDefaultDescription
cdynamic—C value supplied to `_D_IsResponseTokenByte`.

View source

_D_IsWadPath

function _D_IsWadPath(path)

Recognizes case-insensitive .wad filenames before deriving an adjacent HDWAD cache path.

ParameterTypeDefaultDescription
pathdynamic—Filesystem path to process.

View source

_D_MapNameFor

function _D_MapNameFor(episode, map)

Formats an episode/map pair using the active IWAD naming convention.

ParameterTypeDefaultDescription
episodedynamic—Episode value supplied to `_D_MapNameFor`.
mapdynamic—Map value supplied to `_D_MapNameFor`.

View source

_D_MapPairsFromLumps

function _D_MapPairsFromLumps(lumps)

Discovers playable episode/map pairs from loaded WAD marker lumps.

ParameterTypeDefaultDescription
lumpsdynamic—Lumps value supplied to `_D_MapPairsFromLumps`.

View source

_D_NameInList

function _D_NameInList(names, name)

Tests ASCII map/lump membership without allocating a secondary lookup table.

ParameterTypeDefaultDescription
namesdynamic—Names value supplied to `_D_NameInList`.
namedynamic—Resource or object name to resolve.

View source

_D_ParseResponseArgs

function _D_ParseResponseArgs(data)

Parses parse Response Args input into Doom core runtime data.

ParameterTypeDefaultDescription
datadynamic—Binary or structured data to process.

View source

_D_ParseWadFilesFromArgs

function _D_ParseWadFilesFromArgs()

Parses parse Wad Files From Args input into Doom core runtime data.

View source

_d_prof_am_ms

_d_prof_am_ms

Tracks the mutable d prof am ms value used by the d main subsystem.

View source

_d_prof_frame_hist

_d_prof_frame_hist

Stores the d prof frame hist collection used by the d main subsystem.

View source

_d_prof_frame_max_us

_d_prof_frame_max_us

Tracks the mutable d prof frame max us value used by the d main subsystem.

View source

_d_prof_frame_samples

_d_prof_frame_samples

Tracks the mutable d prof frame samples value used by the d main subsystem.

View source

_d_prof_frames

_d_prof_frames

Tracks the mutable d prof frames value used by the d main subsystem.

View source

_d_prof_gl_boundary_ms

_d_prof_gl_boundary_ms

Tracks the mutable d prof gl boundary ms value used by the d main subsystem.

View source

_d_prof_gl_cache_ms

_d_prof_gl_cache_ms

Tracks the mutable d prof gl cache ms value used by the d main subsystem.

View source

_d_prof_gl_depth_ms

_d_prof_gl_depth_ms

Tracks the mutable d prof gl depth ms value used by the d main subsystem.

View source

_d_prof_gl_dyn_ms

_d_prof_gl_dyn_ms

Tracks the mutable d prof gl dyn ms value used by the d main subsystem.

View source

_d_prof_gl_flat_batches

_d_prof_gl_flat_batches

Tracks the mutable d prof gl flat batches value used by the d main subsystem.

View source

_d_prof_gl_flat_drawn

_d_prof_gl_flat_drawn

Tracks the mutable d prof gl flat drawn value used by the d main subsystem.

View source

_d_prof_gl_flat_vertices

_d_prof_gl_flat_vertices

Tracks the mutable d prof gl flat vertices value used by the d main subsystem.

View source

_d_prof_gl_flats_ms

_d_prof_gl_flats_ms

Tracks the mutable d prof gl flats ms value used by the d main subsystem.

View source

_d_prof_gl_light_ms

_d_prof_gl_light_ms

Tracks the mutable d prof gl light ms value used by the d main subsystem.

View source

_d_prof_gl_masked_ms

_d_prof_gl_masked_ms

Tracks the mutable d prof gl masked ms value used by the d main subsystem.

View source

_d_prof_gl_sky_ms

_d_prof_gl_sky_ms

Tracks the mutable d prof gl sky ms value used by the d main subsystem.

View source

_d_prof_gl_sprites_ms

_d_prof_gl_sprites_ms

Tracks the mutable d prof gl sprites ms value used by the d main subsystem.

View source

_d_prof_gl_wall_batches

_d_prof_gl_wall_batches

Tracks the mutable d prof gl wall batches value used by the d main subsystem.

View source

_d_prof_gl_wall_drawn

_d_prof_gl_wall_drawn

Tracks the mutable d prof gl wall drawn value used by the d main subsystem.

View source

_d_prof_gl_wall_vertices

_d_prof_gl_wall_vertices

Tracks the mutable d prof gl wall vertices value used by the d main subsystem.

View source

_d_prof_gl_walls_ms

_d_prof_gl_walls_ms

Tracks the mutable d prof gl walls ms value used by the d main subsystem.

View source

_d_prof_gl_weapon_ms

_d_prof_gl_weapon_ms

Tracks the mutable d prof gl weapon ms value used by the d main subsystem.

View source

_d_prof_hu_ms

_d_prof_hu_ms

Tracks the mutable d prof hu ms value used by the d main subsystem.

View source

_d_prof_last_frame_us

_d_prof_last_frame_us

Tracks the mutable d prof last frame us value used by the d main subsystem.

View source

_d_prof_mobj_thinkers

_d_prof_mobj_thinkers

Tracks the mutable d prof mobj thinkers value used by the d main subsystem.

View source

_d_prof_other_ms

_d_prof_other_ms

Tracks the mutable d prof other ms value used by the d main subsystem.

View source

_d_prof_player_ms

_d_prof_player_ms

Tracks the mutable d prof player ms value used by the d main subsystem.

View source

_d_prof_r_ms

_d_prof_r_ms

Tracks the mutable d prof r ms value used by the d main subsystem.

View source

_d_prof_special_ms

_d_prof_special_ms

Tracks the mutable d prof special ms value used by the d main subsystem.

View source

_d_prof_st_ms

_d_prof_st_ms

Tracks the mutable d prof st ms value used by the d main subsystem.

View source

_d_prof_t0

_d_prof_t0

Tracks the mutable d prof t0 value used by the d main subsystem.

View source

_d_prof_thinker_ms

_d_prof_thinker_ms

Tracks the mutable d prof thinker ms value used by the d main subsystem.

View source

_d_prof_thinkers

_d_prof_thinkers

Tracks the mutable d prof thinkers value used by the d main subsystem.

View source

_d_prof_tick_ms

_d_prof_tick_ms

Tracks the mutable d prof tick ms value used by the d main subsystem.

View source

_d_prof_tics

_d_prof_tics

Tracks the mutable d prof tics value used by the d main subsystem.

View source

_d_prof_vid_ms

_d_prof_vid_ms

Tracks the mutable d prof vid ms value used by the d main subsystem.

View source

_d_profile_render

_d_profile_render

Tracks whether d profile render is active in the d main subsystem.

View source

_D_ProfileAdd

function _D_ProfileAdd(slot, delta)

Adds one measured duration to its renderer/gameplay profiling bucket when profiling is enabled.

ParameterTypeDefaultDescription
slotdynamic—Slot value supplied to `_D_ProfileAdd`.
deltadynamic—Delta value supplied to `_D_ProfileAdd`.

View source

_D_ProfileFlushMaybe

function _D_ProfileFlushMaybe()

Flushes one-second profiling aggregates and resets their counters after the interval elapsed.

View source

_D_ProfileFrameSample

function _D_ProfileFrameSample(deltaUs)

Adds one complete frame duration to a compact millisecond histogram.

ParameterTypeDefaultDescription
deltaUsdynamic—Delta us value supplied to `_D_ProfileFrameSample`.

View source

_D_ProfileGameTick

function _D_ProfileGameTick()

Counts one executed game tic for runtime profiling.

View source

_D_ProfileGLAdd

function _D_ProfileGLAdd(slot, delta)

Accumulates fine-grained OpenGL renderer timings for the profile log.

ParameterTypeDefaultDescription
slotdynamic—Slot value supplied to `_D_ProfileGLAdd`.
deltadynamic—Delta value supplied to `_D_ProfileGLAdd`.

View source

_D_ProfileGLBatches

function _D_ProfileGLBatches(kind, total, drawn, vertices)

Accumulates OpenGL batch visibility counts for renderer profiling.

ParameterTypeDefaultDescription
kinddynamic—Kind value supplied to `_D_ProfileGLBatches`.
totaldynamic—Total value supplied to `_D_ProfileGLBatches`.
drawndynamic—Drawn value supplied to `_D_ProfileGLBatches`.
verticesdynamic—Vertices value supplied to `_D_ProfileGLBatches`.

View source

_D_ProfileLog

function _D_ProfileLog(line)

Writes profiler output to stdout and to a log file for windows-subsystem builds.

ParameterTypeDefaultDescription
linedynamic—Map line or text line affected by the operation.

View source

_D_ProfileMs

inline function _D_ProfileMs(us)

Converts accumulated microseconds to whole milliseconds for compact profile output.

ParameterTypeDefaultDescription
usdynamic—Us value supplied to `_D_ProfileMs`.

View source

_D_ProfilePercentileMs

function _D_ProfilePercentileMs(percent)

Reads a percentile from the current frame histogram.

ParameterTypeDefaultDescription
percentdynamic—Percent value supplied to `_D_ProfilePercentileMs`.

View source

_D_ProfileThinker

function _D_ProfileThinker(isMobj)

Counts thinker execution and separates mobj thinkers for gameplay profiling.

ParameterTypeDefaultDescription
isMobjdynamic—Whether is mobj holds.

View source

_D_ProfileTimeUs

inline function _D_ProfileTimeUs()

Reads a high-resolution monotonic timestamp without changing game timing.

View source

_D_ReadHDWADImageNames

function _D_ReadHDWADImageNames(path)

Reads HDWAD image names from the high-resolution image directory.

ParameterTypeDefaultDescription
pathdynamic—Filesystem path to process.

View source

_D_ReadHDWADLumpNames

function _D_ReadHDWADLumpNames(path)

Validates an HDWAD v6 directory and extracts its eight-byte lump-name table.

ParameterTypeDefaultDescription
pathdynamic—Filesystem path to process.

View source

_D_StatusBarVisible

inline function _D_StatusBarVisible()

Determines classic status-bar visibility without comparing a scaled HD view height to logical screen dimensions.

View source

_D_StrContains

function _D_StrContains(haystack, needle)

Performs a bytewise substring search used while classifying command-line paths.

ParameterTypeDefaultDescription
haystackdynamic—Haystack value supplied to `_D_StrContains`.
needledynamic—Needle value supplied to `_D_StrContains`.

View source

_D_TimeMs

inline function _D_TimeMs()

Returns the monotonic runtime clock used by loading and profiling telemetry.

View source

_D_ToLowerAscii

function _D_ToLowerAscii(s)

Converts lower ASCII values for the Doom core.

ParameterTypeDefaultDescription
sdynamic—S value supplied to `_D_ToLowerAscii`.

View source

advancedemo

advancedemo

Tracks whether advancedemo is active in the d main subsystem.

View source

D_AddFile

function D_AddFile(file)

Adds file entries to the Doom core.

ParameterTypeDefaultDescription
filedynamic—File value supplied to `D_AddFile`.

View source

D_AdvanceDemo

function D_AdvanceDemo()

Defers a title/demo sequence advance until the main loop reaches a safe game-action boundary.

View source

D_Display

function D_Display()

Composes one frame, including wipes, view/HUD layers, palette updates, and profiling.

View source

D_DoAdvanceDemo

function D_DoAdvanceDemo()

Rotates through title pages and built-in demos, selecting mission-specific page durations and music.

View source

D_DoomLoop

function D_DoomLoop()

Runs the permanent event/tic/render loop with capped or interpolated presentation scheduling.

View source

D_DoomMain

function D_DoomMain()

Runs the main Doom core entry point.

View source

d_force_wipe

d_force_wipe

Tracks whether d force wipe is active in the d main subsystem.

View source

D_ForceWipe

function D_ForceWipe()

Forces the next display pass to run a full screen-wipe transition.

View source

D_HDWADProgressStep

function D_HDWADProgressStep(units)

Advances the visible HDWAD generation progress from builder callbacks.

ParameterTypeDefaultDescription
unitsdynamic—Units value supplied to `D_HDWADProgressStep`.

View source

D_PageDrawer

function D_PageDrawer()

Draws the current title/demo page or clears the framebuffer when its lump is unavailable.

View source

D_PageTicker

function D_PageTicker()

Counts down the current title/help page and queues the next demo-sequence entry on expiry.

View source

D_PostEvent

function D_PostEvent(ev)

Enqueues one input event in the bounded power-of-two responder ring.

ParameterTypeDefaultDescription
evdynamic—Input event to process.

View source

D_ProcessEvents

function D_ProcessEvents()

Dispatches queued input through menu then gameplay responders in deterministic order.

View source

D_PROFILE_LOG_PATH

const D_PROFILE_LOG_PATH = "minidoom_profile.log"

Defines the d profile log path text used by the d main subsystem.

View source

D_StartTitle

function D_StartTitle()

Resets game actions to the title demo screen and restarts the attract-mode sequence.

View source

demosequence

demosequence

Tracks the mutable demosequence value used by the d main subsystem.

View source

eventhead

eventhead

Tracks the mutable eventhead value used by the d main subsystem.

View source

events

events

Holds the optional events resource used by the d main subsystem.

View source

eventtail

eventtail

Tracks the mutable eventtail value used by the d main subsystem.

View source

FindResponseFile

function FindResponseFile()

Computes response file values for the Doom core.

View source

IdentifyVersion

function IdentifyVersion()

Selects the IWAD, game mode, language, and mission family before resource initialization.

View source

MAXWADFILES

const MAXWADFILES = 20

Defines the maximum maxwadfiles accepted by the d main subsystem.

View source

pagename

pagename

Stores the mutable pagename text used by the d main subsystem.

View source

pagetic

pagetic

Tracks the mutable pagetic value used by the d main subsystem.

View source

wadfiles

wadfiles

Stores the wadfiles collection used by the d main subsystem.

View source