MiniDoom

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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
lodynamic—Inclusive lower bound.
hidynamic—Inclusive upper bound.

View source

_s16le

inline function _s16le(b, off)

Decodes a two-byte little-endian patch field with signed 16-bit interpretation.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
offdynamic—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.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
offdynamic—Zero-based byte or element offset.

View source

_u32le

inline function _u32le(b, off)

Decodes an unsigned 32-bit little-endian patch-column offset.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
offdynamic—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.

ParameterTypeDefaultDescription
logicalYdynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—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.

ParameterTypeDefaultDescription
srcxdynamic—Srcx value supplied to `V_CopyRect`.
srcydynamic—Srcy value supplied to `V_CopyRect`.
srcscrndynamic—Srcscrn value supplied to `V_CopyRect`.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
destxdynamic—Destx value supplied to `V_CopyRect`.
destydynamic—Desty value supplied to `V_CopyRect`.
destscrndynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
scrndynamic—Scrn value supplied to `V_DrawBlock`.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
srcdynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
colordynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
namedynamic—Resource or object name to resolve.
flippeddynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
namedynamic—Resource or object name to resolve.
flippeddynamic—Flipped value supplied to `V_DrawNamedUpscaledPatchOverlayLogicalScale`.
logicalScaledynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
scrndynamic—Scrn value supplied to `V_DrawPatch`.
patchdynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
scrndynamic—Scrn value supplied to `V_DrawPatchDirect`.
patchdynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
scrndynamic—Scrn value supplied to `V_DrawPatchFlipped`.
patchdynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
colordynamic—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.

ParameterTypeDefaultDescription
namedynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
patchdynamic—Patch value supplied to `V_DrawUpscaledPatchOverlay`.
flippeddynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
scrndynamic—Scrn value supplied to `V_GetBlock`.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
destBufdynamic—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.

ParameterTypeDefaultDescription
idxdynamic—Zero-based element or table index.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—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.

ParameterTypeDefaultDescription
idxdynamic—Zero-based element or table index.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—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.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—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.

ParameterTypeDefaultDescription
enableddynamic—Whether the requested feature should be enabled.

View source