MiniDoom

src/r_data.ml

Parses texture definitions and exposes cached flat, wall-column, sprite, colormap, and level-precache data to renderers.

Package
(global)
Reachable
Yes

Imports

Declarations

_allocIntArray

inline function _allocIntArray(n, fill)

Allocates a filled array after normalizing invalid or negative requested lengths to zero.

ParameterTypeDefaultDescription
ndynamic—Number of values to process.
filldynamic—Fill value supplied to `_allocIntArray`.

View source

_nameTo8

inline function _nameTo8(name)

Truncates a resource name to Doom's eight-character lookup limit while leaving shorter names unchanged.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.

View source

_r_allSpritesPrecached

_r_allSpritesPrecached

Tracks whether r all sprites precached is active in the r data subsystem.

View source

_rd_clamp

inline function _rd_clamp(v, lo, hi)

Restricts a texture dimension, index, or allocation size to caller-supplied inclusive bounds.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
lodynamic—Inclusive lower bound.
hidynamic—Inclusive upper bound.

View source

_rd_drawColumnInCacheAt

function _rd_drawColumnInCacheAt(patchBytes, colOff, cache, cacheOff, originy, cacheheight)

Decodes a patch column from an explicit lump offset into a selected vertical region of a shared composite buffer.

ParameterTypeDefaultDescription
patchBytesdynamic—Patch bytes value supplied to `_rd_drawColumnInCacheAt`.
colOffdynamic—Col off value supplied to `_rd_drawColumnInCacheAt`.
cachedynamic—Cache value supplied to `_rd_drawColumnInCacheAt`.
cacheOffdynamic—Cache off value supplied to `_rd_drawColumnInCacheAt`.
originydynamic—Vertical coordinate or vector component represented by originy.
cacheheightdynamic—Height of cache in pixels or map units.

View source

_rd_drawPatchColumnToCanvas

function _rd_drawPatchColumnToCanvas(patchBytes, colOff, canvas, texW, texH, dstX, originY)

Decodes a patch column's transparent posts into one clipped x position of a row-major composite canvas.

ParameterTypeDefaultDescription
patchBytesdynamic—Patch bytes value supplied to `_rd_drawPatchColumnToCanvas`.
colOffdynamic—Col off value supplied to `_rd_drawPatchColumnToCanvas`.
canvasdynamic—Canvas value supplied to `_rd_drawPatchColumnToCanvas`.
texWdynamic—Tex w value supplied to `_rd_drawPatchColumnToCanvas`.
texHdynamic—Tex h value supplied to `_rd_drawPatchColumnToCanvas`.
dstXdynamic—Horizontal coordinate or vector component represented by dst x.
originYdynamic—Vertical coordinate or vector component represented by origin y.

View source

_rd_ensureColumnCache

inline function _rd_ensureColumnCache(tex, width)

Returns a texture's correctly sized lazy column-cache array, replacing malformed storage when necessary.

ParameterTypeDefaultDescription
texdynamic—Texture identifier or texture data to process.
widthdynamic—Width of the target in pixels or map units.

View source

_rd_enumIndex

inline function _rd_enumIndex(v, limit)

Converts integer-like or enum metadata to a validated zero-based index below a caller limit.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
limitdynamic—Limit value supplied to `_rd_enumIndex`.

View source

_rd_generateTextureComposite

function _rd_generateTextureComposite(texnum)

Overlays every placed patch into a row-major wall canvas and caches independent vertical columns for fallback sampling.

ParameterTypeDefaultDescription
texnumdynamic—Index identifying tex.

View source

_rd_getUpscaledTextureColumn

function _rd_getUpscaledTextureColumn(tex, col)

Returns a column from an upscaled composited wall texture, if available.

ParameterTypeDefaultDescription
texdynamic—Texture identifier or texture data to process.
coldynamic—Col value supplied to `_rd_getUpscaledTextureColumn`.

View source

_rd_i16

inline function _rd_i16(b, off)

Delegates signed 16-bit little-endian decoding for texture directory fields.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
offdynamic—Zero-based byte or element offset.

View source

_rd_i32

inline function _rd_i32(b, off)

Delegates signed 32-bit little-endian decoding for texture counts and offsets.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
offdynamic—Zero-based byte or element offset.

View source

_rd_idiv

inline function _rd_idiv(a, b)

Performs integer division with truncation toward zero.

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

View source

_rd_isSeq

inline function _rd_isSeq(v)

Recognizes both array and list containers accepted by renderer resource tables.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_rd_loadPulse

inline function _rd_loadPulse(iter)

Pumps window/audio updates periodically while expensive renderer precache loops run.

ParameterTypeDefaultDescription
iterdynamic—Iter value supplied to `_rd_loadPulse`.

View source

_rd_markPresent

inline function _rd_markPresent(arr, idx)

Sets one validated resource-usage bitmap entry without risking malformed map indices.

ParameterTypeDefaultDescription
arrdynamic—Arr value supplied to `_rd_markPresent`.
idxdynamic—Zero-based element or table index.

View source

_rd_parseTextureLump

function _rd_parseTextureLump(lumpname, patchlookup)

Decodes one optional TEXTURE directory into normalized definitions and resolves each PNAMES patch reference to a lump.

ParameterTypeDefaultDescription
lumpnamedynamic—Lumpname value supplied to `_rd_parseTextureLump`.
patchlookupdynamic—Patchlookup value supplied to `_rd_parseTextureLump`.

View source

_rd_upperName8

function _rd_upperName8(v)

Normalizes string or byte resource names to uppercase, zero-terminated, at-most-eight-character text.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_rd_wrapColumn

inline function _rd_wrapColumn(col, mask, width)

Wraps a requested wall column through its width mask and corrects non-power-of-two or negative results.

ParameterTypeDefaultDescription
coldynamic—Col value supplied to `_rd_wrapColumn`.
maskdynamic—Mask value supplied to `_rd_wrapColumn`.
widthdynamic—Width of the target in pixels or map units.

View source

colormaps

colormaps

Holds the optional colormaps resource used by the r data subsystem.

View source

firstflat

firstflat

Tracks the mutable firstflat value used by the r data subsystem.

View source

firstpatch

firstpatch

Tracks the mutable firstpatch value used by the r data subsystem.

View source

firstspritelump

firstspritelump

Tracks the mutable firstspritelump value used by the r data subsystem.

View source

flatmemory

flatmemory

Tracks the mutable flatmemory value used by the r data subsystem.

View source

flattranslation

flattranslation

Holds the optional flattranslation resource used by the r data subsystem.

View source

lastflat

lastflat

Tracks the mutable lastflat value used by the r data subsystem.

View source

lastpatch

lastpatch

Tracks the mutable lastpatch value used by the r data subsystem.

View source

lastspritelump

lastspritelump

Tracks the mutable lastspritelump value used by the r data subsystem.

View source

numflats

numflats

Tracks the mutable numflats value used by the r data subsystem.

View source

numpatches

numpatches

Tracks the mutable numpatches value used by the r data subsystem.

View source

numspritelumps

numspritelumps

Tracks the mutable numspritelumps value used by the r data subsystem.

View source

numtextures

numtextures

Tracks the mutable numtextures value used by the r data subsystem.

View source

R_CheckTextureNumForName

function R_CheckTextureNumForName(name)

Resolves a normalized wall-texture name without failure, treating Doom's '-' no-texture marker as index zero.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.

View source

R_DrawColumnInCache

function R_DrawColumnInCache(patch, cache, originy, cacheheight)

Decodes a patch-column post stream into a clipped vertical cache at the requested texture y origin.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `R_DrawColumnInCache`.
cachedynamic—Cache value supplied to `R_DrawColumnInCache`.
originydynamic—Vertical coordinate or vector component represented by originy.
cacheheightdynamic—Height of cache in pixels or map units.

View source

R_FlatNumForName

function R_FlatNumForName(name)

Resolves an eight-character flat name to its range-relative index and treats missing required flats as fatal.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.

View source

R_GenerateComposite

function R_GenerateComposite(texnum)

Materializes only columns requiring multiple patch overlays into the packed composite layout computed by the lookup pass.

ParameterTypeDefaultDescription
texnumdynamic—Index identifying tex.

View source

R_GenerateLookup

function R_GenerateLookup(texnum)

Classifies each texture column as direct single-patch data or composite storage and assigns its lump and byte offset.

ParameterTypeDefaultDescription
texnumdynamic—Index identifying tex.

View source

R_GetColumn

function R_GetColumn(tex, col)

Returns a wrapped wall column from HD data, the lazy cache, a direct patch post, or a generated composite in that order.

ParameterTypeDefaultDescription
texdynamic—Texture identifier or texture data to process.
coldynamic—Col value supplied to `R_GetColumn`.

View source

R_GetFlat

function R_GetFlat(flatnum)

Applies flat animation translation, validates the resulting range, and returns the cached lump bytes.

ParameterTypeDefaultDescription
flatnumdynamic—Index identifying flat.

View source

R_GetMaskedColumnRaw

function R_GetMaskedColumnRaw(tex, col)

Returns the source patch bytes and post-stream offset for a wrapped direct masked column, rejecting composite columns.

ParameterTypeDefaultDescription
texdynamic—Texture identifier or texture data to process.
coldynamic—Col value supplied to `R_GetMaskedColumnRaw`.

View source

R_InitColormaps

function R_InitColormaps()

Pins the COLORMAP lump as the renderer's static light-remapping table.

View source

R_InitData

function R_InitData()

Initializes wall textures, flats, sprite metrics, colormaps, and sky identifiers in dependency-safe order.

View source

R_InitFlats

function R_InitFlats()

Resolves the F_START/F_END flat range and seeds an identity animation-translation table.

View source

R_InitSpriteLumps

function R_InitSpriteLumps()

Resolves the sprite lump range and precomputes fixed-point width, left offset, and top offset for every patch.

View source

R_InitTextures

function R_InitTextures()

Resolves PNAMES and texture directories, allocates animation/column caches, and classifies every wall-texture column.

View source

R_PrecacheLevel

function R_PrecacheLevel()

Marks flats, textures, patches, and sprite frames referenced by the current level, caches them, and totals their memory use.

View source

R_TextureNumForName

function R_TextureNumForName(name)

Resolves a required wall texture and falls back to index zero while optionally logging missing names in developer mode.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.

View source

rd_column_source_scale

rd_column_source_scale

Tracks the mutable rd column source scale value used by the r data subsystem.

View source

rd_texpatch_t struct

rd_texture_t struct

rd_upscaledtexturecolumncache

rd_upscaledtexturecolumncache

Holds the optional rd upscaledtexturecolumncache resource used by the r data subsystem.

View source

spritememory

spritememory

Tracks the mutable spritememory value used by the r data subsystem.

View source

spriteoffset

spriteoffset

Holds the optional spriteoffset resource used by the r data subsystem.

View source

spritetopoffset

spritetopoffset

Holds the optional spritetopoffset resource used by the r data subsystem.

View source

spritewidth

spritewidth

Holds the optional spritewidth resource used by the r data subsystem.

View source

texturecolumncache

texturecolumncache

Holds the optional texturecolumncache resource used by the r data subsystem.

View source

texturecolumnlump

texturecolumnlump

Holds the optional texturecolumnlump resource used by the r data subsystem.

View source

texturecolumnofs

texturecolumnofs

Holds the optional texturecolumnofs resource used by the r data subsystem.

View source

texturecomposite

texturecomposite

Holds the optional texturecomposite resource used by the r data subsystem.

View source

texturecompositesize

texturecompositesize

Holds the optional texturecompositesize resource used by the r data subsystem.

View source

textureheight

textureheight

Holds the optional textureheight resource used by the r data subsystem.

View source

texturememory

texturememory

Tracks the mutable texturememory value used by the r data subsystem.

View source

textures

textures

Holds the optional textures resource used by the r data subsystem.

View source

texturetranslation

texturetranslation

Holds the optional texturetranslation resource used by the r data subsystem.

View source

texturewidthmask

texturewidthmask

Holds the optional texturewidthmask resource used by the r data subsystem.

View source