Files
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.
| Parameter | Type | Default | Description |
|---|
n | dynamic | — | Number of values to process. |
fill | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
lo | dynamic | — | Inclusive lower bound. |
hi | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
patchBytes | dynamic | — | Patch bytes value supplied to `_rd_drawColumnInCacheAt`. |
colOff | dynamic | — | Col off value supplied to `_rd_drawColumnInCacheAt`. |
cache | dynamic | — | Cache value supplied to `_rd_drawColumnInCacheAt`. |
cacheOff | dynamic | — | Cache off value supplied to `_rd_drawColumnInCacheAt`. |
originy | dynamic | — | Vertical coordinate or vector component represented by originy. |
cacheheight | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
patchBytes | dynamic | — | Patch bytes value supplied to `_rd_drawPatchColumnToCanvas`. |
colOff | dynamic | — | Col off value supplied to `_rd_drawPatchColumnToCanvas`. |
canvas | dynamic | — | Canvas value supplied to `_rd_drawPatchColumnToCanvas`. |
texW | dynamic | — | Tex w value supplied to `_rd_drawPatchColumnToCanvas`. |
texH | dynamic | — | Tex h value supplied to `_rd_drawPatchColumnToCanvas`. |
dstX | dynamic | — | Horizontal coordinate or vector component represented by dst x. |
originY | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
tex | dynamic | — | Texture identifier or texture data to process. |
width | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
limit | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
texnum | dynamic | — | Index identifying tex. |
View source
# _rd_getUpscaledTextureColumn
function _rd_getUpscaledTextureColumn(tex, col)
Returns a column from an upscaled composited wall texture, if available.
| Parameter | Type | Default | Description |
|---|
tex | dynamic | — | Texture identifier or texture data to process. |
col | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
View source
# _rd_idiv
inline function _rd_idiv(a, b)
Performs integer division with truncation toward zero.
| Parameter | Type | Default | Description |
|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
View source
# _rd_isSeq
inline function _rd_isSeq(v)
Recognizes both array and list containers accepted by renderer resource tables.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
iter | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
arr | dynamic | — | Arr value supplied to `_rd_markPresent`. |
idx | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
lumpname | dynamic | — | Lumpname value supplied to `_rd_parseTextureLump`. |
patchlookup | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
col | dynamic | — | Col value supplied to `_rd_wrapColumn`. |
mask | dynamic | — | Mask value supplied to `_rd_wrapColumn`. |
width | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
patch | dynamic | — | Patch value supplied to `R_DrawColumnInCache`. |
cache | dynamic | — | Cache value supplied to `R_DrawColumnInCache`. |
originy | dynamic | — | Vertical coordinate or vector component represented by originy. |
cacheheight | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
texnum | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
texnum | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
tex | dynamic | — | Texture identifier or texture data to process. |
col | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
flatnum | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
tex | dynamic | — | Texture identifier or texture data to process. |
col | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | 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