Files
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.
| Parameter | Type | Default | Description |
|---|
patch | dynamic | — | Patch value supplied to `_STL_AddPatchName`. |
name | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
scrn | dynamic | — | Scrn value supplied to `_STL_DrawPatchHD`. |
patch | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
patches | dynamic | — | Patches value supplied to `_STL_GetPatch`. |
idx | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
refv | dynamic | — | Refv value supplied to `_STL_GetRefValue`. |
fallback | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
a | dynamic | — | First input operand. |
b | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
patch | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
refv | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
refv | dynamic | — | Refv value supplied to `_STL_RefInt`. |
fallback | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
refv | dynamic | — | Refv value supplied to `_STL_SetRefValue`. |
v | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
fallback | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
i | dynamic | — | Zero-based iteration index. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
n | dynamic | — | Number of values to process. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | Object or data record consumed by the operation. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
patch | dynamic | — | Patch value supplied to `STlib_initBinIcon`. |
val | dynamic | — | Val value supplied to `STlib_initBinIcon`. |
on | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
i | dynamic | — | Zero-based iteration index. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
il | dynamic | — | Il value supplied to `STlib_initMultIcon`. |
inum | dynamic | — | Index identifying i. |
on | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
n | dynamic | — | Number of values to process. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
pl | dynamic | — | Pl value supplied to `STlib_initNum`. |
num | dynamic | — | Index identifying the requested item. |
on | dynamic | — | On value supplied to `STlib_initNum`. |
width | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | Object or data record consumed by the operation. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
pl | dynamic | — | Pl value supplied to `STlib_initPercent`. |
num | dynamic | — | Index identifying the requested item. |
on | dynamic | — | On value supplied to `STlib_initPercent`. |
percentPatch | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
patch | dynamic | — | Patch value supplied to `STlib_RegisterPatchName`. |
name | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
i | dynamic | — | Zero-based iteration index. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
n | dynamic | — | Number of values to process. |
refresh | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
p | dynamic | — | Object or data record consumed by the operation. |
refresh | dynamic | — | Refresh value supplied to `STlib_updatePercent`. |
View source
# sttminus
sttminus
Holds the optional sttminus resource used by the st lib subsystem.
View source