# _R_Abs
inline function _R_Abs(x)Converts an arbitrary numeric value to an integer and returns its non-negative magnitude.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
src/r_main.mlBuilds view/projection tables, derives interpolated camera state, and orchestrates software or OpenGL player-view rendering.
d_net.ml → src/d_net.mld_player.ml → src/d_player.mldoomdef.ml → src/doomdef.mldoomstat.ml → src/doomstat.mlm_argv.ml → src/m_argv.mlm_bbox.ml → src/m_bbox.mlr_data.ml → src/r_data.mlr_gl.ml → src/r_gl.mlr_hires.ml → src/r_hires.mlr_local.ml → src/r_local.mlr_renderer.ml → src/r_renderer.mlr_sky.ml → src/r_sky.mlstd/math.ml → ../MiniLangCompilerOptimization/MiniLangCompilerPy/std/math.ml external dependencystd/time.ml → ../MiniLangCompilerOptimization/MiniLangCompilerPy/std/time.ml external dependencyinline function _R_Abs(x)Converts an arbitrary numeric value to an integer and returns its non-negative magnitude.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
inline function _R_AngNorm(a)Normalizes an angle or numeric input to Doom's unsigned 32-bit binary-angle domain.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
inline function _R_AngSub(a, b)Subtracts two binary angles with unsigned 32-bit wraparound.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
inline function _R_ColorMapAt(level)Returns one clamped 256-entry lighting colormap, or a black fallback when COLORMAP data is missing.
| Parameter | Type | Default | Description |
|---|---|---|---|
level | dynamic | — | Level value supplied to `_R_ColorMapAt`. |
inline function _R_FineSineAt(angle)Samples the wrapped fine-sine table for a binary angle, returning zero if tables are unavailable.
| Parameter | Type | Default | Description |
|---|---|---|---|
angle | dynamic | — | Doom binary-angle measurement. |
inline function _R_HasSignBit(v)Tests the high bit of a normalized binary angle or wrapped 32-bit delta.
| Parameter | Type | Default | Description |
|---|---|---|---|
v | dynamic | — | Value consumed by the operation. |
inline function _R_IDiv(a, b)Coerces numeric operands and returns their signed quotient truncated toward zero, using zero for a zero divisor.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
function _R_InitTextureMapping()Builds inverse screen-column/binary-angle tables from the current projection and establishes the horizontal clip angle.
_r_interp_cur_angleTracks the mutable r interp cur angle value used by the r main subsystem.
_r_interp_cur_xTracks the mutable r interp cur x value used by the r main subsystem.
_r_interp_cur_yTracks the mutable r interp cur y value used by the r main subsystem.
_r_interp_cur_zTracks the mutable r interp cur z value used by the r main subsystem.
_r_interp_last_ticTracks the mutable r interp last tic value used by the r main subsystem.
_r_interp_playerHolds the optional r interp player resource used by the r main subsystem.
_r_interp_prev_angleTracks the mutable r interp prev angle value used by the r main subsystem.
_r_interp_prev_xTracks the mutable r interp prev x value used by the r main subsystem.
_r_interp_prev_yTracks the mutable r interp prev y value used by the r main subsystem.
_r_interp_prev_zTracks the mutable r interp prev z value used by the r main subsystem.
inline function _R_IsSeq(v)Recognizes the array and list containers accepted by renderer lookup tables.
| Parameter | Type | Default | Description |
|---|---|---|---|
v | dynamic | — | Value consumed by the operation. |
inline function _R_LerpAngle(a, b, frac)Interpolates along the shortest wrapped path between two 32-bit binary angles.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
frac | dynamic | — | Frac value supplied to `_R_LerpAngle`. |
inline function _R_LerpS32(a, b, frac)Linearly interpolates signed 32-bit coordinates and preserves signed wrap semantics at the result.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
frac | dynamic | — | Frac value supplied to `_R_LerpS32`. |
_r_prof_bsp_msTracks the mutable r prof bsp ms value used by the r main subsystem.
_r_prof_clear_msTracks the mutable r prof clear ms value used by the r main subsystem.
_r_prof_enabledTracks whether r prof enabled is active in the r main subsystem.
_r_prof_framesTracks the mutable r prof frames value used by the r main subsystem.
_r_prof_masked_msTracks the mutable r prof masked ms value used by the r main subsystem.
_r_prof_planes_msTracks the mutable r prof planes ms value used by the r main subsystem.
_r_prof_t0Tracks the mutable r prof t0 value used by the r main subsystem.
function _R_ProfileFlushMaybe()Once per second, prints accumulated pipeline counters and resets renderer, BSP, and draw profiling windows.
function _R_RebuildScaleLight()Recomputes scale-indexed wall colormaps for the active view width and detail shift.
function _R_RenderOpenGLPlayerView(player)Attempts to draw the current player view with the active OpenGL renderer.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
function _R_S32(v)Coerces a numeric value and reinterprets its low 32 bits as a signed integer.
| Parameter | Type | Default | Description |
|---|---|---|---|
v | dynamic | — | Value consumed by the operation. |
function _R_SetupFrame(player)Derives the camera from player state, interpolates uncapped frames, selects fixed lighting, and advances frame validity counters.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
inline function _R_TanToAngle(num, den)Converts a non-negative slope ratio into a clamped lookup-table binary angle.
| Parameter | Type | Default | Description |
|---|---|---|---|
num | dynamic | — | Index identifying the requested item. |
den | dynamic | — | Den value supplied to `_R_TanToAngle`. |
inline function _R_TimeMs()Returns the platform tick counter as an integer millisecond timestamp for render profiling.
inline function _R_ToFrac(v)Converts the render interpolation control to a scalar clamped to [0,1], defaulting invalid inputs to one.
| Parameter | Type | Default | Description |
|---|---|---|---|
v | dynamic | — | Value consumed by the operation. |
inline function _R_ToIntOr(v, fallback)Coerces numbers and numeric values to a truncation-toward-zero integer, returning 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. |
basecolfuncHolds the optional basecolfunc resource used by the r main subsystem.
centerxTracks the mutable centerx value used by the r main subsystem.
centerxfracTracks the mutable centerxfrac value used by the r main subsystem.
centeryTracks the mutable centery value used by the r main subsystem.
centeryfracTracks the mutable centeryfrac value used by the r main subsystem.
colfuncHolds the optional colfunc resource used by the r main subsystem.
detailshiftTracks the mutable detailshift value used by the r main subsystem.
extralightTracks the mutable extralight value used by the r main subsystem.
const FIELDOFVIEW = 2048Defines fieldofview for the r main subsystem.
fixedcolormapHolds the optional fixedcolormap resource used by the r main subsystem.
framecountTracks the mutable framecount value used by the r main subsystem.
fuzzcolfuncHolds the optional fuzzcolfunc resource used by the r main subsystem.
const LIGHTLEVELS = 16Defines lightlevels for the r main subsystem.
const LIGHTSCALESHIFT = 12Defines lightscaleshift for the r main subsystem.
const LIGHTSEGSHIFT = 4Defines lightsegshift for the r main subsystem.
const LIGHTZSHIFT = 20Defines lightzshift for the r main subsystem.
linecountTracks the mutable linecount value used by the r main subsystem.
loopcountTracks the mutable loopcount value used by the r main subsystem.
const MAXLIGHTSCALE = 48Defines the maximum maxlightscale accepted by the r main subsystem.
const MAXLIGHTZ = 128Defines the maximum maxlightz accepted by the r main subsystem.
const NUMCOLORMAPS = 32Defines the numcolormaps count used by the r main subsystem.
projectionTracks the mutable projection value used by the r main subsystem.
function R_AddPointToBox(x, y, box)Expands a four-entry BOXLEFT/RIGHT/BOTTOM/TOP bounds array to include a point.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
box | dynamic | — | Bounding-box array to read or update. |
function R_ExecuteSetViewSize()Applies the deferred block/detail request only when a view-size rebuild is pending.
function R_Init()Initializes render data, geometry/light tables, view sizing, translations, and optional profiling hooks.
function R_InitLightTables()Builds distance-indexed, scale-indexed, and fixed-colormap lighting lookup matrices.
function R_InitPointToAngle()Ensures the trigonometric tables required by point-to-angle calculations are populated.
function R_InitTables()Initializes the shared fine-angle, tangent, sine, and slope lookup tables.
function R_InitTextureMapping()Rebuilds the public view-column-to-angle and angle-to-column mapping tables.
function R_PointInSubsector(x, y)Walks the BSP from its root to locate the leaf subsector containing a world coordinate.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
inline function R_PointOnSegSide(x, y, seg)Classifies a fixed-point position against an oriented seg for clipping and sprite-side decisions.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
seg | dynamic | — | Seg value supplied to `R_PointOnSegSide`. |
inline function R_PointOnSide(x, y, node)Classifies a fixed-point position against a BSP partition, using axis fast paths and overflow-safe sign tests.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
node | dynamic | — | Node value supplied to `R_PointOnSide`. |
function R_PointToAngle(x, y)Computes the wrapped binary angle from the current view origin to a world point via octant slope lookup.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
inline function R_PointToAngle2(x1, y1, x2, y2)Computes the binary angle between arbitrary endpoints while restoring the renderer's global view origin afterward.
| Parameter | Type | Default | Description |
|---|---|---|---|
x1 | dynamic | — | Horizontal coordinate of the first endpoint. |
y1 | dynamic | — | Vertical coordinate of the first endpoint. |
x2 | dynamic | — | Horizontal coordinate of the second endpoint. |
y2 | dynamic | — | Vertical coordinate of the second endpoint. |
inline function R_PointToDist(x, y)Computes fixed-point planar distance from the view origin using slope and sine lookup tables.
| Parameter | Type | Default | Description |
|---|---|---|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
function R_RenderClassicPlayerView(player)Draws the current player view with the classic CPU renderer only.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
function R_RenderPlayerView(player)Dispatches the player view to exactly one active renderer.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
function R_ResetViewInterpolation()Discards the previous camera sample so a spawn or level transition cannot interpolate from stale world coordinates.
function R_ScaleFromGlobalAngle(visangle)Derives the perspective scale for a wall column and clamps it to Doom's supported fixed-point range.
| Parameter | Type | Default | Description |
|---|---|---|---|
visangle | dynamic | — | Visangle value supplied to `R_ScaleFromGlobalAngle`. |
function R_SetupFrame(player)Public entry point that derives view position, angle, lighting, and interpolation state for one player frame.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
function R_SetViewSize(blocks, detail)Clamps and applies a view-block request, rebuilding projection, draw callbacks, buffers, sprite scale, and light tables.
| Parameter | Type | Default | Description |
|---|---|---|---|
blocks | dynamic | — | Blocks value supplied to `R_SetViewSize`. |
detail | dynamic | — | Detail value supplied to `R_SetViewSize`. |
scalelightHolds the optional scalelight resource used by the r main subsystem.
scalelightfixedHolds the optional scalelightfixed resource used by the r main subsystem.
setblocksTracks the mutable setblocks value used by the r main subsystem.
setdetailTracks the mutable setdetail value used by the r main subsystem.
setsizeneededTracks whether setsizeneeded is active in the r main subsystem.
spanfuncHolds the optional spanfunc resource used by the r main subsystem.
sscountTracks the mutable sscount value used by the r main subsystem.
transcolfuncHolds the optional transcolfunc resource used by the r main subsystem.
validcountTracks the mutable validcount value used by the r main subsystem.
viewangleoffsetTracks the mutable viewangleoffset value used by the r main subsystem.
viewcosTracks the mutable viewcos value used by the r main subsystem.
viewheightTracks the mutable viewheight value used by the r main subsystem.
viewsinTracks the mutable viewsin value used by the r main subsystem.
viewwidthTracks the mutable viewwidth value used by the r main subsystem.
viewwindowxTracks the mutable viewwindowx value used by the r main subsystem.
viewwindowyTracks the mutable viewwindowy value used by the r main subsystem.
zlightHolds the optional zlight resource used by the r main subsystem.