MiniDoom

src/st_lib.ml

Implements reusable number, percent, multi-icon, and binary-icon widgets with classic-background restoration.

Package
(global)
Reachable
Yes

Imports

Declarations

_STL_AddPatchName

function _STL_AddPatchName(patch, name)

Appends one patch/name pair without relying on array concatenation.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `_STL_AddPatchName`.
namedynamic—Resource or object name to resolve.

View source

_STL_AsBool

inline function _STL_AsBool(v)

Converts supported scalar values to the widget visibility truth convention.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_STL_DrawPatchHD

function _STL_DrawPatchHD(x, y, scrn, patch)

Draws the classic patch and, on the foreground screen, overlays its registered high-resolution counterpart at offset-corrected coordinates.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
scrndynamic—Scrn value supplied to `_STL_DrawPatchHD`.
patchdynamic—Patch value supplied to `_STL_DrawPatchHD`.

View source

_STL_GetPatch

inline function _STL_GetPatch(patches, idx)

Safely resolves one patch from an array/list after integer normalization and bounds checks.

ParameterTypeDefaultDescription
patchesdynamic—Patches value supplied to `_STL_GetPatch`.
idxdynamic—Zero-based element or table index.

View source

_STL_GetRefValue

inline function _STL_GetRefValue(refv, fallback)

Dereferences the library's single-element reference convention and returns a fallback for empty or void values.

ParameterTypeDefaultDescription
refvdynamic—Refv value supplied to `_STL_GetRefValue`.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_STL_IDiv

inline function _STL_IDiv(a, b)

Divides widget layout integers with truncation toward zero and returns zero for a zero divisor.

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

View source

_STL_NameForPatch

function _STL_NameForPatch(patch)

Resolves a registered patch object back to the lump name required by the HD overlay path.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `_STL_NameForPatch`.

View source

_STL_PatchHeight

inline function _STL_PatchHeight(p)

Reads the signed little-endian height from a validated Doom patch header.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.

View source

_STL_PatchLeft

inline function _STL_PatchLeft(p)

Reads the patch left offset used to restore its exact background rectangle.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.

View source

_STL_PatchTop

inline function _STL_PatchTop(p)

Reads the patch top offset used to restore its exact background rectangle.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.

View source

_STL_PatchWidth

inline function _STL_PatchWidth(p)

Reads the signed little-endian width from a validated Doom patch header.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.

View source

_STL_RefBool

inline function _STL_RefBool(refv)

Dereferences a widget value and normalizes it to a visibility boolean.

ParameterTypeDefaultDescription
refvdynamic—Refv value supplied to `_STL_RefBool`.

View source

_STL_RefInt

inline function _STL_RefInt(refv, fallback)

Dereferences and truncates a widget value to an integer, retaining the supplied fallback on invalid input.

ParameterTypeDefaultDescription
refvdynamic—Refv value supplied to `_STL_RefInt`.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_STL_SetRefValue

inline function _STL_SetRefValue(refv, v)

Writes through the widget library's mutable single-element reference convention when storage is present.

ParameterTypeDefaultDescription
refvdynamic—Refv value supplied to `_STL_SetRefValue`.
vdynamic—Value consumed by the operation.

View source

_STL_ToInt

function _STL_ToInt(v, fallback)

Converts numeric/string widget values to integers by truncating toward zero, retaining the fallback on failure.

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

View source

st_binicon_t struct

st_multicon_t struct

st_number_t struct

st_percent_t struct

STlib_BG

const STlib_BG = 4

Defines stlib bg for the st lib subsystem.

View source

STlib_drawBinIcon

function STlib_drawBinIcon(b, refresh)

Draws or erases a boolean icon only when its value changes or a full refresh is requested.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
refreshdynamic—Refresh value supplied to `STlib_drawBinIcon`.

View source

STlib_drawMultIcon

function STlib_drawMultIcon(i, refresh)

Erases a changed prior icon from the status background and draws the newly selected patch when visible.

ParameterTypeDefaultDescription
idynamic—Zero-based iteration index.
refreshdynamic—Refresh value supplied to `STlib_drawMultIcon`.

View source

STlib_drawNum

function STlib_drawNum(n, refresh)

Restores the old digit area and draws a changed fixed-width signed value right-to-left, honoring Doom's 1994 sentinel.

ParameterTypeDefaultDescription
ndynamic—Number of values to process.
refreshdynamic—Refresh value supplied to `STlib_drawNum`.

View source

STlib_drawPercent

function STlib_drawPercent(p, refresh)

Draws the percent sign on refresh when visible, then updates the associated numeric widget.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.
refreshdynamic—Refresh value supplied to `STlib_drawPercent`.

View source

STlib_FG

const STlib_FG = 0

Defines stlib fg for the st lib subsystem.

View source

STlib_init

function STlib_init()

Caches and registers the optional minus-sign patch used by negative numeric widgets.

View source

STlib_initBinIcon

function STlib_initBinIcon(b, x, y, patch, val, on)

Binds a boolean icon widget to its patch, coordinates, referenced value, and visibility control.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
patchdynamic—Patch value supplied to `STlib_initBinIcon`.
valdynamic—Val value supplied to `STlib_initBinIcon`.
ondynamic—On value supplied to `STlib_initBinIcon`.

View source

STlib_initMultIcon

function STlib_initMultIcon(i, x, y, il, inum, on)

Binds an indexed icon widget to its patch array, referenced index/visibility, coordinates, and invalid initial cache.

ParameterTypeDefaultDescription
idynamic—Zero-based iteration index.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
ildynamic—Il value supplied to `STlib_initMultIcon`.
inumdynamic—Index identifying i.
ondynamic—On value supplied to `STlib_initMultIcon`.

View source

STlib_initNum

function STlib_initNum(n, x, y, pl, num, on, width)

Binds a numeric widget to coordinates, digit patches, referenced value/visibility, and fixed digit width.

ParameterTypeDefaultDescription
ndynamic—Number of values to process.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
pldynamic—Pl value supplied to `STlib_initNum`.
numdynamic—Index identifying the requested item.
ondynamic—On value supplied to `STlib_initNum`.
widthdynamic—Width of the target in pixels or map units.

View source

STlib_initPercent

function STlib_initPercent(p, x, y, pl, num, on, percentPatch)

Initializes a three-digit numeric widget and attaches its percent-sign patch.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
pldynamic—Pl value supplied to `STlib_initPercent`.
numdynamic—Index identifying the requested item.
ondynamic—On value supplied to `STlib_initPercent`.
percentPatchdynamic—Percent patch value supplied to `STlib_initPercent`.

View source

stlib_patch_name_data

stlib_patch_name_data

Stores the stlib patch name data collection used by the st lib subsystem.

View source

stlib_patch_name_names

stlib_patch_name_names

Stores the stlib patch name names collection used by the st lib subsystem.

View source

STlib_RegisterPatchName

function STlib_RegisterPatchName(patch, name)

Associates patch bytes with their lump name for optional HD overlays, replacing an existing mapping for the same object.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `STlib_RegisterPatchName`.
namedynamic—Resource or object name to resolve.

View source

STlib_updateBinIcon

function STlib_updateBinIcon(b, refresh)

Shows or erases a binary icon when its referenced boolean changes or the status bar refreshes.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
refreshdynamic—Refresh value supplied to `STlib_updateBinIcon`.

View source

STlib_updateMultIcon

function STlib_updateMultIcon(i, refresh)

Replaces a multi-icon widget when its referenced icon index changes or the status bar refreshes.

ParameterTypeDefaultDescription
idynamic—Zero-based iteration index.
refreshdynamic—Refresh value supplied to `STlib_updateMultIcon`.

View source

STlib_updateNum

function STlib_updateNum(n, refresh)

Redraws an enabled numeric widget when its value changed or a full refresh was requested.

ParameterTypeDefaultDescription
ndynamic—Number of values to process.
refreshdynamic—Refresh value supplied to `STlib_updateNum`.

View source

STlib_updatePercent

function STlib_updatePercent(p, refresh)

Updates a percentage widget, including its percent patch and visibility-controlled numeric value.

ParameterTypeDefaultDescription
pdynamic—Object or data record consumed by the operation.
refreshdynamic—Refresh value supplied to `STlib_updatePercent`.

View source

sttminus

sttminus

Holds the optional sttminus resource used by the st lib subsystem.

View source