MiniDoom

src/r_things.ml

Builds sprite definitions, projects world/player sprites, clips them against drawsegs, and renders masked content.

Package
(global)
Reachable
Yes

Imports

Declarations

_makeVisSprite

inline function _makeVisSprite()

Allocates a zeroed visible-sprite record with no linked-list neighbors or colormap.

View source

_RT_Abs

inline function _RT_Abs(v)

Coerces a numeric value and returns its non-negative integer magnitude.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_RT_AngNorm

inline function _RT_AngNorm(a)

Normalizes a numeric value to Doom's unsigned 32-bit binary-angle domain.

ParameterTypeDefaultDescription
adynamic—First input operand.

View source

_RT_BuildSpriteDef

function _RT_BuildSpriteDef(sprname)

Scans the sprite lump namespace for a four-letter prefix, installs primary/flip pairs, and validates every frame rotation.

ParameterTypeDefaultDescription
sprnamedynamic—Sprname value supplied to `_RT_BuildSpriteDef`.

View source

_RT_Clamp

inline function _RT_Clamp(v, lo, hi)

Constrains a sprite-rendering scalar to the supplied inclusive bounds.

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

View source

_rt_clipbot_work

_rt_clipbot_work

Stores the rt clipbot work collection used by the r things subsystem.

View source

_rt_cliptop_work

_rt_cliptop_work

Stores the rt cliptop work collection used by the r things subsystem.

View source

_rt_colormap_cache

_rt_colormap_cache

Stores the rt colormap cache collection used by the r things subsystem.

View source

_rt_colormap_cache_len

_rt_colormap_cache_len

Tracks the mutable rt colormap cache len value used by the r things subsystem.

View source

_RT_ColormapAt

inline function _RT_ColormapAt(idx)

Returns a clamped cached 256-entry COLORMAP slice and rebuilds the cache when its source length changes.

ParameterTypeDefaultDescription
idxdynamic—Zero-based element or table index.

View source

_rt_debug_disable_sprites

_rt_debug_disable_sprites

Tracks the mutable rt debug disable sprites value used by the r things subsystem.

View source

_RT_DrawMaskedPatchColumn

function _RT_DrawMaskedPatchColumn(patch, coloff)

Decodes and clips every post in one patch column, dispatches the active column drawer, and restores shared source state.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `_RT_DrawMaskedPatchColumn`.
coloffdynamic—Coloff value supplied to `_RT_DrawMaskedPatchColumn`.

View source

_rt_drawTranslation

_rt_drawTranslation

Holds the optional rt draw translation resource used by the r things subsystem.

View source

_RT_DrawUpscaledLinearSprite

function _RT_DrawUpscaledLinearSprite(vis, entry, origW, x1, x2)

Draws an upscaled transparent sprite image directly into the active framebuffer.

ParameterTypeDefaultDescription
visdynamic—Vis value supplied to `_RT_DrawUpscaledLinearSprite`.
entrydynamic—Entry value supplied to `_RT_DrawUpscaledLinearSprite`.
origWdynamic—Orig w value supplied to `_RT_DrawUpscaledLinearSprite`.
x1dynamic—Horizontal coordinate of the first endpoint.
x2dynamic—Horizontal coordinate of the second endpoint.

View source

_RT_EnumIndex

inline function _RT_EnumIndex(v, limit)

Resolves integer, numeric, or enum values to a bounded sprite-table index, returning -1 when invalid.

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

View source

_RT_GetClipValue

inline function _RT_GetClipValue(clipref, x, fallback)

Reads a column clip from a direct sequence or x-biased openings-arena reference.

ParameterTypeDefaultDescription
cliprefdynamic—Clipref value supplied to `_RT_GetClipValue`.
xdynamic—Horizontal map- or screen-space coordinate.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_RT_IDiv

inline function _RT_IDiv(a, b)

Returns a signed quotient truncated toward zero, or zero for invalid operands and a zero divisor in `_RT_IDiv`

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

View source

_RT_InstallSpriteLump

function _RT_InstallSpriteLump(frames, frame, rotation, lump, flipped, sprname, maxframe)

Installs one rot=0 or directional lump into a frame table while rejecting mixed, duplicate, or invalid rotations.

ParameterTypeDefaultDescription
framesdynamic—Frames value supplied to `_RT_InstallSpriteLump`.
framedynamic—Frame value supplied to `_RT_InstallSpriteLump`.
rotationdynamic—Rotation value supplied to `_RT_InstallSpriteLump`.
lumpdynamic—Lump value supplied to `_RT_InstallSpriteLump`.
flippeddynamic—Flipped value supplied to `_RT_InstallSpriteLump`.
sprnamedynamic—Sprname value supplied to `_RT_InstallSpriteLump`.
maxframedynamic—Maxframe value supplied to `_RT_InstallSpriteLump`.

View source

_RT_IsSeq

inline function _RT_IsSeq(v)

Recognizes the array and list containers used for sprite definitions, clips, and renderer tables.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_RT_LumpNameAt

inline function _RT_LumpNameAt(lumpnum)

Decodes a validated lump directory entry's zero-terminated eight-byte name.

ParameterTypeDefaultDescription
lumpnumdynamic—Index identifying lump.

View source

_RT_MakeEmptyFrame

inline function _RT_MakeEmptyFrame()

Creates an unresolved sprite frame with eight missing rotation lumps and unflipped defaults.

View source

_RT_Name4

inline function _RT_Name4(s)

Returns the uppercase four-byte sprite prefix from a name, or an empty string when too short.

ParameterTypeDefaultDescription
sdynamic—S value supplied to `_RT_Name4`.

View source

_rt_prof_enabled

_rt_prof_enabled

Tracks whether rt prof enabled is active in the r things subsystem.

View source

_RT_ProfDrawn

inline function _RT_ProfDrawn()

Tracks drawn sprites for renderer profiling.

View source

_rt_profDrawn

_rt_profDrawn

Tracks the mutable rt prof drawn value used by the r things subsystem.

View source

_RT_ProfProjected

inline function _RT_ProfProjected()

Tracks successful sprite projections for renderer profiling.

View source

_rt_profProjected

_rt_profProjected

Tracks the mutable rt prof projected value used by the r things subsystem.

View source

_RT_ProfReject

inline function _RT_ProfReject(kind)

Tracks sprite reject categories for renderer profiling.

ParameterTypeDefaultDescription
kinddynamic—Kind value supplied to `_RT_ProfReject`.

View source

_rt_profRejected

_rt_profRejected

Tracks the mutable rt prof rejected value used by the r things subsystem.

View source

_rt_profThings

_rt_profThings

Tracks the mutable rt prof things value used by the r things subsystem.

View source

_RT_ProfThingSeen

inline function _RT_ProfThingSeen()

Tracks visited things for renderer profiling when profiling is active.

View source

_RT_RebuildColormapCache

function _RT_RebuildColormapCache()

Builds reusable colormap slices to avoid per-sprite slice allocations.

View source

_rt_rejBadDef

_rt_rejBadDef

Tracks the mutable rt rej bad def value used by the r things subsystem.

View source

_rt_rejBadFrame

_rt_rejBadFrame

Tracks the mutable rt rej bad frame value used by the r things subsystem.

View source

_rt_rejBadLump

_rt_rejBadLump

Tracks the mutable rt rej bad lump value used by the r things subsystem.

View source

_rt_rejBadSprite

_rt_rejBadSprite

Tracks the mutable rt rej bad sprite value used by the r things subsystem.

View source

_rt_rejBehind

_rt_rejBehind

Tracks the mutable rt rej behind value used by the r things subsystem.

View source

_rt_rejNoFrame

_rt_rejNoFrame

Tracks the mutable rt rej no frame value used by the r things subsystem.

View source

_rt_rejNoSprites

_rt_rejNoSprites

Tracks the mutable rt rej no sprites value used by the r things subsystem.

View source

_rt_rejNoThing

_rt_rejNoThing

Tracks the mutable rt rej no thing value used by the r things subsystem.

View source

_rt_rejNoVis

_rt_rejNoVis

Tracks the mutable rt rej no vis value used by the r things subsystem.

View source

_rt_rejOffLeft

_rt_rejOffLeft

Tracks the mutable rt rej off left value used by the r things subsystem.

View source

_rt_rejOffRight

_rt_rejOffRight

Tracks the mutable rt rej off right value used by the r things subsystem.

View source

_rt_rejSide

_rt_rejSide

Tracks the mutable rt rej side value used by the r things subsystem.

View source

_RT_S32

inline function _RT_S32(v)

Reinterprets the low 32 bits of a coerced numeric value as a signed coordinate.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_RT_SelectSpriteLights

inline function _RT_SelectSpriteLights(lightnum)

Selects and clamps the scale-light row used to shade sprites in the current sector.

ParameterTypeDefaultDescription
lightnumdynamic—Index identifying light.

View source

_RT_ShadowColormap

inline function _RT_ShadowColormap()

Lazily caches the dark level-24 colormap used when fuzz rendering is unavailable.

View source

_rt_shadowMap

_rt_shadowMap

Holds the optional rt shadow map resource used by the r things subsystem.

View source

_rt_sorted

_rt_sorted

Stores the rt sorted collection used by the r things subsystem.

View source

_rt_sorted_count

_rt_sorted_count

Tracks the mutable rt sorted count value used by the r things subsystem.

View source

_RT_SourceScaleFromEntry

inline function _RT_SourceScaleFromEntry(entry, origW)

Resolves the high-resolution source scale for an upscaled sprite entry.

ParameterTypeDefaultDescription
entrydynamic—Entry value supplied to `_RT_SourceScaleFromEntry`.
origWdynamic—Orig w value supplied to `_RT_SourceScaleFromEntry`.

View source

_RT_SpriteIndex

inline function _RT_SpriteIndex(v)

Resolves a sprite identifier against the loaded definition count.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_RT_TargetBuffer

inline function _RT_TargetBuffer()

Returns the active sprite render target.

View source

_RT_ToInt

inline function _RT_ToInt(v, fallback)

Coerces numeric values to truncation-toward-zero integers and returns fallback on failure in `_RT_ToInt`

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_RT_UpperAscii

inline function _RT_UpperAscii(c)

Normalizes lowercase ASCII bytes before comparing case-insensitive WAD sprite names.

ParameterTypeDefaultDescription
cdynamic—C value supplied to `_RT_UpperAscii`.

View source

BASEYCENTER

const BASEYCENTER = 100

Defines baseycenter for the r things subsystem.

View source

MAXVISSPRITES

const MAXVISSPRITES = 128

Defines the maximum maxvissprites accepted by the r things subsystem.

View source

mceilingclip

mceilingclip

Holds the optional mceilingclip resource used by the r things subsystem.

View source

mfloorclip

mfloorclip

Holds the optional mfloorclip resource used by the r things subsystem.

View source

MINZ

const MINZ = 262144

Defines the minimum minz accepted by the r things subsystem.

View source

negonearray

negonearray

Stores the negonearray collection used by the r things subsystem.

View source

pspriteiscale

pspriteiscale

Tracks the mutable pspriteiscale value used by the r things subsystem.

View source

pspritescale

pspritescale

Tracks the mutable pspritescale value used by the r things subsystem.

View source

R_AddPSprites

function R_AddPSprites()

Draws the display player's first-person weapon/flash layers after validating player ownership.

View source

R_AddSprites

function R_AddSprites(sec)

Projects each non-viewplayer thing in a sector once per validcount using that sector's light row.

ParameterTypeDefaultDescription
secdynamic—Sec value supplied to `R_AddSprites`.

View source

R_ClearSprites

function R_ClearSprites()

Resets the visible-sprite pool, sorting/clipping workspaces, profiler counters, and sentinel list for a new frame.

View source

R_ClipVisSprite

function R_ClipVisSprite(vis, xl, xh)

Retains the classic clipping hook; drawseg silhouette clipping is integrated into R_DrawSprite.

ParameterTypeDefaultDescription
visdynamic—Vis value supplied to `R_ClipVisSprite`.
xldynamic—Xl value supplied to `R_ClipVisSprite`.
xhdynamic—Xh value supplied to `R_ClipVisSprite`.

View source

R_DrawMasked

function R_DrawMasked()

Draws sorted world sprites, remaining masked wall ranges, and first-person sprites in final masked-pass order.

View source

R_DrawMaskedColumn

function R_DrawMaskedColumn(column)

Retains the classic public hook; patch-column decoding is handled by _RT_DrawMaskedPatchColumn with explicit bytes and offsets.

ParameterTypeDefaultDescription
columndynamic—Column value supplied to `R_DrawMaskedColumn`.

View source

R_DrawPlayerSprites

function R_DrawPlayerSprites(player)

Selects the player's sector lighting, disables world clipping, and draws each active first-person sprite layer.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.

View source

R_DrawPSprite

function R_DrawPSprite(player, psp)

Projects one weapon/flash state in screen space, selects invisibility or lighting colormap, and draws its patch.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
pspdynamic—Psp value supplied to `R_DrawPSprite`.

View source

R_DrawSprite

function R_DrawSprite(spr)

Builds per-column top/bottom clips from overlapping drawseg silhouettes, draws nearer masked walls, then renders the sprite.

ParameterTypeDefaultDescription
sprdynamic—Spr value supplied to `R_DrawSprite`.

View source

R_DrawSprites

function R_DrawSprites()

Sorts and renders all projected world sprites unless the sprite debug-disable flag is set.

View source

R_DrawVisSprite

function R_DrawVisSprite(vis, x1, x2)

Selects fuzz/translation/base drawing, maps screen columns to patch columns, and renders a clipped visible sprite.

ParameterTypeDefaultDescription
visdynamic—Vis value supplied to `R_DrawVisSprite`.
x1dynamic—Horizontal coordinate of the first endpoint.
x2dynamic—Horizontal coordinate of the second endpoint.

View source

R_InitSpriteDefs

function R_InitSpriteDefs(namelist)

Compatibility entry point that rebuilds sprite definitions and clip arrays from a name list.

ParameterTypeDefaultDescription
namelistdynamic—Namelist value supplied to `R_InitSpriteDefs`.

View source

R_InitSprites

function R_InitSprites(namelist)

Sizes sprite clip sentinels and builds every named sprite definition from the WAD sprite-lump range.

ParameterTypeDefaultDescription
namelistdynamic—Namelist value supplied to `R_InitSprites`.

View source

R_InstallSpriteLump

function R_InstallSpriteLump(lump, frame, rotation, flipped)

Retains the classic public hook; sprite-lump installation is performed on explicit frame arrays by the internal builder.

ParameterTypeDefaultDescription
lumpdynamic—Lump value supplied to `R_InstallSpriteLump`.
framedynamic—Frame value supplied to `R_InstallSpriteLump`.
rotationdynamic—Rotation value supplied to `R_InstallSpriteLump`.
flippeddynamic—Flipped value supplied to `R_InstallSpriteLump`.

View source

R_NewVisSprite

function R_NewVisSprite()

Reserves the next preallocated visible-sprite record, returning void when MAXVISSPRITES is exhausted.

View source

R_ProjectSprite

function R_ProjectSprite(thing)

Transforms a world mobj into screen bounds, selects rotation/flip/light, and appends a visible sprite when in view.

ParameterTypeDefaultDescription
thingdynamic—World object affected by the operation.

View source

R_SortVisSprites

function R_SortVisSprites()

Copies active visible sprites into reusable storage and insertion-sorts them back-to-front by projection scale.

View source

R_ThingsProfileSetEnabled

function R_ThingsProfileSetEnabled(on)

Enables or disables sprite/render profiling counters in hot paths.

ParameterTypeDefaultDescription
ondynamic—On value supplied to `R_ThingsProfileSetEnabled`.

View source

RT_TRANSPARENT_INDEX

const RT_TRANSPARENT_INDEX = 255

Defines rt transparent index for the r things subsystem.

View source

screenheightarray

screenheightarray

Stores the screenheightarray collection used by the r things subsystem.

View source

spritelights

spritelights

Holds the optional spritelights resource used by the r things subsystem.

View source

sprtopscreen

sprtopscreen

Tracks the mutable sprtopscreen value used by the r things subsystem.

View source

spryscale

spryscale

Tracks the mutable spryscale value used by the r things subsystem.

View source

vissprite_p

vissprite_p

Tracks the mutable vissprite p value used by the r things subsystem.

View source

vissprites

vissprites

Stores the vissprites collection used by the r things subsystem.

View source

vsprsortedhead

vsprsortedhead

Holds the optional vsprsortedhead resource used by the r things subsystem.

View source