Files
src/v_video.ml
Provides video buffer and palette helper routines used by renderer and UI.
- Package
(global)- Reachable
- Yes
Imports
Declarations
# _clampInt
inline function _clampInt(x, lo, hi)
Restricts a pixel coordinate or extent to caller-supplied inclusive bounds.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
lo | dynamic | — | Inclusive lower bound. |
hi | dynamic | — | Inclusive upper bound. |
View source
# _s16le
inline function _s16le(b, off)
Decodes a two-byte little-endian patch field with signed 16-bit interpretation.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
View source
# _u16le
inline function _u16le(b, off)
Decodes an unsigned 16-bit little-endian field from Doom patch bytes.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
View source
# _u32le
inline function _u32le(b, off)
Decodes an unsigned 32-bit little-endian patch-column offset.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
View source
# dirtybox
dirtybox
Stores the dirtybox collection used by the v video subsystem.
View source
# gammatable
gammatable
Stores the gammatable collection used by the v video subsystem.
View source
# screens
screens
Stores the screens collection used by the v video subsystem.
View source
# usegamma
usegamma
Tracks the mutable usegamma value used by the v video subsystem.
View source
# V_ClearHighresOverlay
function V_ClearHighresOverlay()
Clears high-resolution prepared patch overlay pixels from the previous frame.
View source
# V_ClearHighresOverlayKeepLogicalY
function V_ClearHighresOverlayKeepLogicalY(logicalY)
Clears high-resolution overlay pixels above a logical Y coordinate while preserving the lower persistent area.
| Parameter | Type | Default | Description |
|---|
logicalY | dynamic | — | Vertical coordinate or vector component represented by logical y. |
View source
# V_ClearHighresOverlayRect
function V_ClearHighresOverlayRect(x, y, width, height)
Clears one logical rectangle from the high-resolution overlay mask.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
View source
# V_ClearOverlayMask
function V_ClearOverlayMask()
Clears the per-frame mask of logical pixels drawn by late UI patches.
View source
# V_CopyRect
function V_CopyRect(srcx, srcy, srcscrn, width, height, destx, desty, destscrn)
Copies an indexed rectangle between logical screens and invalidates overlapping HD overlay content on the visible screen.
| Parameter | Type | Default | Description |
|---|
srcx | dynamic | — | Srcx value supplied to `V_CopyRect`. |
srcy | dynamic | — | Srcy value supplied to `V_CopyRect`. |
srcscrn | dynamic | — | Srcscrn value supplied to `V_CopyRect`. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
destx | dynamic | — | Destx value supplied to `V_CopyRect`. |
desty | dynamic | — | Desty value supplied to `V_CopyRect`. |
destscrn | dynamic | — | Destscrn value supplied to `V_CopyRect`. |
View source
# V_DrawBlock
function V_DrawBlock(x, y, scrn, width, height, src)
Copies a tightly packed indexed block into a logical screen and marks visible pixels for dirty and late-overlay composition.
| 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 `V_DrawBlock`. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
src | dynamic | — | Src value supplied to `V_DrawBlock`. |
View source
# V_DrawDitheredOverlayRect
function V_DrawDitheredOverlayRect(x, y, width, height, color)
Draws a clipped checkerboard shade whose unmarked pixels preserve the world as palette-safe transparency.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
color | dynamic | — | Doom palette index used for drawing. |
View source
# V_DrawNamedUpscaledPatchOverlay
function V_DrawNamedUpscaledPatchOverlay(x, y, name, flipped)
Draws a prepared upscaled patch image into the high-resolution overlay.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
name | dynamic | — | Resource or object name to resolve. |
flipped | dynamic | — | Flipped value supplied to `V_DrawNamedUpscaledPatchOverlay`. |
View source
# V_DrawNamedUpscaledPatchOverlayLogicalScale
function V_DrawNamedUpscaledPatchOverlayLogicalScale(x, y, name, flipped, logicalScale)
Draws a prepared HDWAD patch at a Doom-layout scale without running any scaler.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
name | dynamic | — | Resource or object name to resolve. |
flipped | dynamic | — | Flipped value supplied to `V_DrawNamedUpscaledPatchOverlayLogicalScale`. |
logicalScale | dynamic | — | Logical scale value supplied to `V_DrawNamedUpscaledPatchOverlayLogicalScale`. |
View source
# V_DrawPatch
function V_DrawPatch(x, y, scrn, patch)
Decodes clipped Doom patch-column posts into an indexed screen while tracking visible dirty and HD-overlay regions.
| 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 `V_DrawPatch`. |
patch | dynamic | — | Patch value supplied to `V_DrawPatch`. |
View source
# V_DrawPatchDirect
function V_DrawPatchDirect(x, y, scrn, patch)
Preserves the legacy direct-patch entry point by forwarding to the normal clipped patch renderer.
| 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 `V_DrawPatchDirect`. |
patch | dynamic | — | Patch value supplied to `V_DrawPatchDirect`. |
View source
# V_DrawPatchFlipped
function V_DrawPatchFlipped(x, y, scrn, patch)
Decodes a Doom patch with reversed source-column order while retaining normal placement, clipping, and overlay tracking.
| 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 `V_DrawPatchFlipped`. |
patch | dynamic | — | Patch value supplied to `V_DrawPatchFlipped`. |
View source
# V_DrawSolidOverlayRect
function V_DrawSolidOverlayRect(x, y, width, height, color)
Fills and marks a clipped opaque late-overlay rectangle, primarily for UI borders and separators.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
color | dynamic | — | Doom palette index used for drawing. |
View source
# V_DrawUpscaledFlatOverlay
function V_DrawUpscaledFlatOverlay(name)
Draws a prepared upscaled flat image into the high-resolution overlay.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
View source
# V_DrawUpscaledPatchOverlay
function V_DrawUpscaledPatchOverlay(x, y, patch, flipped)
Resolves a cached patch's lump name and delegates its optional HD replacement into the late UI overlay.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
patch | dynamic | — | Patch value supplied to `V_DrawUpscaledPatchOverlay`. |
flipped | dynamic | — | Flipped value supplied to `V_DrawUpscaledPatchOverlay`. |
View source
# V_EndOverlayMask
function V_EndOverlayMask()
Stops recording late UI overlay pixels while keeping the recorded mask for presentation.
View source
# V_EnsureHighresOverlay
function V_EnsureHighresOverlay()
Lazily allocates high-resolution patch overlay buffers.
View source
# V_GetBlock
function V_GetBlock(x, y, scrn, width, height, destBuf)
Copies a logical-screen rectangle into a tightly packed caller-provided byte buffer.
| 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 `V_GetBlock`. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
destBuf | dynamic | — | Dest buf value supplied to `V_GetBlock`. |
View source
# v_highres_patch_overlay_enabled
v_highres_patch_overlay_enabled
Tracks whether v highres patch overlay enabled is active in the v video subsystem.
View source
# V_HighresOverlayCanReuse
function V_HighresOverlayCanReuse()
Reports whether the previous high-resolution page overlay is still intact.
View source
# v_hioverlay
v_hioverlay
Holds the optional v hioverlay resource used by the v video subsystem.
View source
# v_hioverlay_cached_flipped
v_hioverlay_cached_flipped
Tracks whether v hioverlay cached flipped is active in the v video subsystem.
View source
# v_hioverlay_cached_name
v_hioverlay_cached_name
Stores the mutable v hioverlay cached name text used by the v video subsystem.
View source
# v_hioverlay_cached_scale
v_hioverlay_cached_scale
Tracks the mutable v hioverlay cached scale value used by the v video subsystem.
View source
# v_hioverlay_cached_valid
v_hioverlay_cached_valid
Tracks whether v hioverlay cached valid is active in the v video subsystem.
View source
# v_hioverlay_cached_x
v_hioverlay_cached_x
Tracks the mutable v hioverlay cached x value used by the v video subsystem.
View source
# v_hioverlay_cached_y
v_hioverlay_cached_y
Tracks the mutable v hioverlay cached y value used by the v video subsystem.
View source
# v_hioverlay_maxx
v_hioverlay_maxx
Tracks the mutable v hioverlay maxx value used by the v video subsystem.
View source
# v_hioverlay_maxy
v_hioverlay_maxy
Tracks the mutable v hioverlay maxy value used by the v video subsystem.
View source
# v_hioverlay_minx
v_hioverlay_minx
Tracks the mutable v hioverlay minx value used by the v video subsystem.
View source
# v_hioverlay_miny
v_hioverlay_miny
Tracks the mutable v hioverlay miny value used by the v video subsystem.
View source
# v_hioverlay_scale
v_hioverlay_scale
Tracks the mutable v hioverlay scale value used by the v video subsystem.
View source
# v_hioverlaymask
v_hioverlaymask
Holds the optional v hioverlaymask resource used by the v video subsystem.
View source
# V_Init
function V_Init()
Allocates five logical indexed screens and resets dirty-rectangle plus late-overlay tracking for a fresh video session.
View source
# V_MarkHighresOverlayPixel
inline function V_MarkHighresOverlayPixel(idx, x, y)
Marks one prepared high-resolution overlay pixel as valid.
| Parameter | Type | Default | Description |
|---|
idx | dynamic | — | Zero-based element or table index. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
View source
# V_MarkOverlayPixel
inline function V_MarkOverlayPixel(idx, x, y)
Marks one logical pixel as part of the late UI overlay.
| Parameter | Type | Default | Description |
|---|
idx | dynamic | — | Zero-based element or table index. |
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
View source
# V_MarkRect
function V_MarkRect(x, y, width, height)
Expands the global dirty bounds to cover both corners of a modified logical-screen rectangle.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
View source
# v_overlay_active
v_overlay_active
Tracks whether v overlay active is active in the v video subsystem.
View source
# v_overlay_maxx
v_overlay_maxx
Tracks the mutable v overlay maxx value used by the v video subsystem.
View source
# v_overlay_maxy
v_overlay_maxy
Tracks the mutable v overlay maxy value used by the v video subsystem.
View source
# v_overlay_minx
v_overlay_minx
Tracks the mutable v overlay minx value used by the v video subsystem.
View source
# v_overlay_miny
v_overlay_miny
Tracks the mutable v overlay miny value used by the v video subsystem.
View source
# v_overlaymask
v_overlaymask
Holds the optional v overlaymask resource used by the v video subsystem.
View source
# V_SetHighresPatchOverlayEnabled
function V_SetHighresPatchOverlayEnabled(enabled)
Lets dense logical UI batches skip redundant per-glyph HD preparation while preserving normal HUD assets by default.
| Parameter | Type | Default | Description |
|---|
enabled | dynamic | — | Whether the requested feature should be enabled. |
View source