MiniQuake

src/miniquake/world_bsp.ml

Package
miniquake.world_bsp
Reachable
Yes

Imports

Declarations

absoluteValue

function absoluteValue(value)

Return absolute value derived from the active module state.

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `absoluteValue`.

View source

addToFatPvs

function addToFatPvs(map, origin, nodeNumber, destination)

Add state for add to fat pvs.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `addToFatPvs`.
origindynamic—World-space origin of the operation.
nodeNumberdynamic—The node number input consumed by `addToFatPvs`.
destinationdynamic—Destination value or collection to update.

View source

anyLeafVisible

function anyLeafVisible(pvs, leaves)

Report whether any leaf visible holds for the active state.

ParameterTypeDefaultDescription
pvsdynamic—The pvs input consumed by `anyLeafVisible`.
leavesdynamic—The leaves input consumed by `anyLeafVisible`.

View source

appendTouchedLeaves

function appendTouchedLeaves(map, nodeNumber, mins, maxs, limit, result)

Add state for append touched leaves.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `appendTouchedLeaves`.
nodeNumberdynamic—The node number input consumed by `appendTouchedLeaves`.
minsdynamic—The mins input consumed by `appendTouchedLeaves`.
maxsdynamic—The maxs input consumed by `appendTouchedLeaves`.
limitdynamic—The limit input consumed by `appendTouchedLeaves`.
resultdynamic—Result value to report or translate into a status code.

View source

boxOnBspPlaneSide

function boxOnBspPlaneSide(mins, maxs, plane)

SV_FindTouchedLeafs stores every non-solid world leaf intersected by an entity's linked abs bounds (up to MAX_ENT_LEAFS). Large doors and moving walls often have their origin in a different PVS from the face seen by the player, so testing only Mod_PointInLeaf(origin) makes a physically present brush model disappear.

ParameterTypeDefaultDescription
minsdynamic—The mins input consumed by `boxOnBspPlaneSide`.
maxsdynamic—The maxs input consumed by `boxOnBspPlaneSide`.
planedynamic—The plane input consumed by `boxOnBspPlaneSide`.

View source

child

function child(node, side)

Implements the `child` operation for `miniquake.world_bsp` (child).

ParameterTypeDefaultDescription
nodedynamic—The node input consumed by `child`.
sidedynamic—The side input consumed by `child`.

View source

collisionHullCache

collisionHullCache

Tracks the module-level collision hull cache state owned by `miniquake.world_bsp`.

View source

collisionHullCacheMapKey

collisionHullCacheMapKey

Tracks the module-level collision hull cache map key state owned by `miniquake.world_bsp`.

View source

createHull

function createHull(map, hullIndex)

Create and initialize hull.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `createHull`.
hullIndexdynamic—Zero-based index of the requested entry.

View source

createModelHull

function createModelHull(map, modelIndex, hullIndex)

Create and initialize model hull.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `createModelHull`.
modelIndexdynamic—Zero-based index of the requested entry.
hullIndexdynamic—Zero-based index of the requested entry.

View source

decompressLeafPvs

function decompressLeafPvs(map, leafIndex)

Decompress one leaf visibility row without consulting the level cache.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `decompressLeafPvs`.
leafIndexdynamic—Zero-based index of the requested entry.

View source

drawingClipNodes

function drawingClipNodes(map)

Draws ing clip nodes for `miniquake.world_bsp`.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `drawingClipNodes`.

View source

emptyPlane

function emptyPlane()

Implements the `emptyPlane` operation for `miniquake.world_bsp` (empty plane).

View source

fatPvs

function fatPvs(map, origin)

SV_FatPVS merges the PVS on both sides of planes within eight units of the view point. This prevents entities on a doorway/portal boundary from blinking out as the camera crosses it.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `fatPvs`.
origindynamic—World-space origin of the operation.

View source

fatPvsScratch

fatPvsScratch

Tracks the module-level fat pvs scratch state owned by `miniquake.world_bsp`.

View source

fatPvsScratchMapKey

fatPvsScratchMapKey

Tracks the module-level fat pvs scratch map key state owned by `miniquake.world_bsp`.

View source

findPlayerStart

function findPlayerStart(map)

Return player start.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `findPlayerStart`.

View source

hullForBounds

function hullForBounds(map, mins, maxs)

Implements the `hullForBounds` operation for `miniquake.world_bsp` (hull for bounds).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `hullForBounds`.
minsdynamic—The mins input consumed by `hullForBounds`.
maxsdynamic—The maxs input consumed by `hullForBounds`.

View source

hullIndexForBounds

function hullIndexForBounds(mins, maxs)

----------------------------------------------------------------------------- Server brush-model collision. WinQuake selects the hull from the moving object's width, then uses the headnode of the addressed BSP submodel. This is what makes func_door, func_plat, func_train and other SOLID_BSP entities participate in the same exact collision path as the world. -----------------------------------------------------------------------------

ParameterTypeDefaultDescription
minsdynamic—The mins input consumed by `hullIndexForBounds`.
maxsdynamic—The maxs input consumed by `hullIndexForBounds`.

View source

leafForPoint

function leafForPoint(map, point)

Implements the `leafForPoint` operation for `miniquake.world_bsp` (leaf for point).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `leafForPoint`.
pointdynamic—The point input consumed by `leafForPoint`.

View source

leafPvs

function leafPvs(map, leafIndex)

Implements the `leafPvs` operation for `miniquake.world_bsp` (leaf pvs).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `leafPvs`.
leafIndexdynamic—Zero-based index of the requested entry.

View source

leafPvsCache

leafPvsCache

Tracks the module-level leaf pvs cache state owned by `miniquake.world_bsp`.

View source

leafPvsCacheMapKey

leafPvsCacheMapKey

The original engine keeps one decompression buffer, but MiniQuake's immutable protocol/render consumers otherwise allocate and expand the same leaf row on every server frame and whenever the camera enters a new leaf. Populate this map-local table while the loading plaque is visible.

View source

leafVisible

function leafVisible(pvs, leafIndex)

Return the pre-expanded world-face visibility mask for one view leaf. Report whether leaf visible holds for the active state.

ParameterTypeDefaultDescription
pvsdynamic—The pvs input consumed by `leafVisible`.
leafIndexdynamic—Zero-based index of the requested entry.

View source

Mod_LeafPVS

function Mod_LeafPVS(leafIndex, map)

Mirror Quake's Mod_LeafPVS routine and its observable state changes.

ParameterTypeDefaultDescription
leafIndexdynamic—Zero-based index of the requested entry.
mapdynamic—The map input consumed by `Mod_LeafPVS`.

View source

Mod_MakeHull0

function Mod_MakeHull0(map)

Mirror Quake's Mod_MakeHull0 routine and its observable state changes.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `Mod_MakeHull0`.

View source

Mod_PointInLeaf

function Mod_PointInLeaf(point, map)

Mirror Quake's Mod_PointInLeaf routine and its observable state changes.

ParameterTypeDefaultDescription
pointdynamic—The point input consumed by `Mod_PointInLeaf`.
mapdynamic—The map input consumed by `Mod_PointInLeaf`.

View source

modelHullCache

modelHullCache

Tracks the module-level model hull cache state owned by `miniquake.world_bsp`.

View source

modelHullCacheMapKey

modelHullCacheMapKey

Tracks the module-level model hull cache map key state owned by `miniquake.world_bsp`.

View source

orVisibility

function orVisibility(destination, source)

Implements the `orVisibility` operation for `miniquake.world_bsp` (or visibility).

ParameterTypeDefaultDescription
destinationdynamic—Destination value or collection to update.
sourcedynamic—Source value or collection to read.

View source

planeDistance

function planeDistance(plane, point)

Implements the `planeDistance` operation for `miniquake.world_bsp` (plane distance).

ParameterTypeDefaultDescription
planedynamic—The plane input consumed by `planeDistance`.
pointdynamic—The point input consumed by `planeDistance`.

View source

playerHull

function playerHull(map)

Original WinQuake naming aliases used by the host, QuakeC builtins and GL renderer. Keeping these at the world boundary avoids duplicating hull rules.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `playerHull`.

View source

pointContents

function pointContents(hull, point)

Implements the `pointContents` operation for `miniquake.world_bsp` (point contents).

ParameterTypeDefaultDescription
hulldynamic—The hull input consumed by `pointContents`.
pointdynamic—The point input consumed by `pointContents`.

View source

pointContentsFromNode

function pointContentsFromNode(hull, number, point)

Implements the `pointContentsFromNode` operation for `miniquake.world_bsp` (point contents from node).

ParameterTypeDefaultDescription
hulldynamic—The hull input consumed by `pointContentsFromNode`.
numberdynamic—The number input consumed by `pointContentsFromNode`.
pointdynamic—The point input consumed by `pointContentsFromNode`.

View source

pointContentsWorld

function pointContentsWorld(map, point)

Implements the `pointContentsWorld` operation for `miniquake.world_bsp` (point contents world).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `pointContentsWorld`.
pointdynamic—The point input consumed by `pointContentsWorld`.

View source

pointLeaf

function pointLeaf(map, point)

Implements the `pointLeaf` operation for `miniquake.world_bsp` (point leaf).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `pointLeaf`.
pointdynamic—The point input consumed by `pointLeaf`.

View source

precacheCollisionHulls

function precacheCollisionHulls(map)

Build the three immutable world hull descriptors while the loading plaque is active. Hull zero includes Mod_MakeHull0's expanded drawing nodes and was previously rebuilt for every point trace, producing hundreds of kilobytes of short-lived objects per gameplay frame.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `precacheCollisionHulls`.

View source

precacheLeafPvs

function precacheLeafPvs(map)

Pre-expand all visibility rows before gameplay starts.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `precacheLeafPvs`.

View source

RadiusFromBounds

function RadiusFromBounds(mins, maxs)

Implements the `RadiusFromBounds` operation for `miniquake.world_bsp` (radius from bounds).

ParameterTypeDefaultDescription
minsdynamic—The mins input consumed by `RadiusFromBounds`.
maxsdynamic—The maxs input consumed by `RadiusFromBounds`.

View source

recursiveHullCheck

function recursiveHullCheck(hull, number, p1Fraction, p2Fraction, p1, p2, trace)

Implements the `recursiveHullCheck` operation for `miniquake.world_bsp` (recursive hull check).

ParameterTypeDefaultDescription
hulldynamic—The hull input consumed by `recursiveHullCheck`.
numberdynamic—The number input consumed by `recursiveHullCheck`.
p1Fractiondynamic—The p1 fraction input consumed by `recursiveHullCheck`.
p2Fractiondynamic—The p2 fraction input consumed by `recursiveHullCheck`.
p1dynamic—The p1 input consumed by `recursiveHullCheck`.
p2dynamic—The p2 input consumed by `recursiveHullCheck`.
tracedynamic—The trace input consumed by `recursiveHullCheck`.

View source

touchedLeaves

function touchedLeaves(map, mins, maxs, limit)

Implements the `touchedLeaves` operation for `miniquake.world_bsp` (touched leaves).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `touchedLeaves`.
minsdynamic—The mins input consumed by `touchedLeaves`.
maxsdynamic—The maxs input consumed by `touchedLeaves`.
limitdynamic—The limit input consumed by `touchedLeaves`.

View source

trace

function trace(map, start, mins, maxs, finish)

Trace the requested value through the collision world.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `trace`.
startdynamic—The start input consumed by `trace`.
minsdynamic—The mins input consumed by `trace`.
maxsdynamic—The maxs input consumed by `trace`.
finishdynamic—The finish input consumed by `trace`.

View source

traceBrushModel

function traceBrushModel(map, modelIndex, entityOrigin, start, mins, maxs, finish)

Trace brush model through the collision world.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `traceBrushModel`.
modelIndexdynamic—Zero-based index of the requested entry.
entityOrigindynamic—The entity origin input consumed by `traceBrushModel`.
startdynamic—The start input consumed by `traceBrushModel`.
minsdynamic—The mins input consumed by `traceBrushModel`.
maxsdynamic—The maxs input consumed by `traceBrushModel`.
finishdynamic—The finish input consumed by `traceBrushModel`.

View source

traceInHull

function traceInHull(hull, start, finish)

Trace in hull through the collision world.

ParameterTypeDefaultDescription
hulldynamic—The hull input consumed by `traceInHull`.
startdynamic—The start input consumed by `traceInHull`.
finishdynamic—The finish input consumed by `traceInHull`.

View source

traceLine

function traceLine(map, start, finish)

Implements the `traceLine` operation for `miniquake.world_bsp` (trace line).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `traceLine`.
startdynamic—The start input consumed by `traceLine`.
finishdynamic—The finish input consumed by `traceLine`.

View source

tracePlayer

function tracePlayer(map, start, finish)

Trace player through the collision world.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `tracePlayer`.
startdynamic—The start input consumed by `tracePlayer`.
finishdynamic—The finish input consumed by `tracePlayer`.

View source

tracePoint

function tracePoint(map, start, finish)

Trace point through the collision world.

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `tracePoint`.
startdynamic—The start input consumed by `tracePoint`.
finishdynamic—The finish input consumed by `tracePoint`.

View source

truePointContents

function truePointContents(map, point)

Implements the `truePointContents` operation for `miniquake.world_bsp` (true point contents).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `truePointContents`.
pointdynamic—The point input consumed by `truePointContents`.

View source

worldPointContents

function worldPointContents(map, point)

Implements the `worldPointContents` operation for `miniquake.world_bsp` (world point contents).

ParameterTypeDefaultDescription
mapdynamic—The map input consumed by `worldPointContents`.
pointdynamic—The point input consumed by `worldPointContents`.

View source

zeroVector

function zeroVector()

Implements the `zeroVector` operation for `miniquake.world_bsp` (zero vector).

View source