Files
src/miniquake2/client/state.ml
Provides miniquake2 client state facilities for this project.
- Package
miniquake2.client.state- Reachable
- Yes
Imports
Declarations
# acceptPrediction
function acceptPrediction(client, fixedOrigin, angles)
Accept prediction.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
fixedOrigin | dynamic | — | fixedOrigin value consumed by this operation. |
angles | dynamic | — | angles value consumed by this operation. |
View source
# acceptSnapshot
function acceptSnapshot(client, frame)
Accept snapshot.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
View source
# animatedFrame
inline function animatedFrame(state, effects, renderTime)
Return the animated frame value.
| Parameter | Type | Default | Description |
|---|
state | dynamic | — | Mutable state inspected or updated by the operation. |
effects | dynamic | — | effects value consumed by this operation. |
renderTime | dynamic | — | renderTime value consumed by this operation. |
View source
# appendColorShell
function appendColorShell(output, outputIndex, state, oldState, fraction, renderTime, assetResolvers, lerpReset)
Append color shell.
| Parameter | Type | Default | Description |
|---|
output | dynamic | — | Output collection or buffer populated by the operation. |
outputIndex | dynamic | — | Zero-based index of output. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
oldState | dynamic | — | oldState value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
renderTime | dynamic | — | renderTime value consumed by this operation. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
lerpReset | dynamic | — | lerpReset value consumed by this operation. |
View source
# appendModelEntity
function appendModelEntity(output, outputIndex, state, oldState, modelIndex, part, fraction, renderTime, assetResolvers, randomResolver, lerpReset)
Append model entity.
| Parameter | Type | Default | Description |
|---|
output | dynamic | — | Output collection or buffer populated by the operation. |
outputIndex | dynamic | — | Zero-based index of output. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
oldState | dynamic | — | oldState value consumed by this operation. |
modelIndex | dynamic | — | Zero-based index of model. |
part | dynamic | — | part value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
renderTime | dynamic | — | renderTime value consumed by this operation. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
randomResolver | dynamic | — | randomResolver value consumed by this operation. |
lerpReset | dynamic | — | lerpReset value consumed by this operation. |
View source
# appendPowerScreen
function appendPowerScreen(output, outputIndex, state, oldState, fraction, renderTime, assetResolvers, lerpReset)
Append power screen.
| Parameter | Type | Default | Description |
|---|
output | dynamic | — | Output collection or buffer populated by the operation. |
outputIndex | dynamic | — | Zero-based index of output. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
oldState | dynamic | — | oldState value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
renderTime | dynamic | — | renderTime value consumed by this operation. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
lerpReset | dynamic | — | lerpReset value consumed by this operation. |
View source
# appendViewWeapon
function appendViewWeapon(output, outputIndex, client, fraction, assetResolvers, viewOrigin, viewAngles)
Append view weapon.
| Parameter | Type | Default | Description |
|---|
output | dynamic | — | Output collection or buffer populated by the operation. |
outputIndex | dynamic | — | Zero-based index of output. |
client | dynamic | — | client value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
viewOrigin | dynamic | — | viewOrigin value consumed by this operation. |
viewAngles | dynamic | — | viewAngles value consumed by this operation. |
View source
# buildEntities
function buildEntities(client, fraction, assetResolvers, localEntityNumber, randomResolver, viewOrigin, viewAngles)
Build entities.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
localEntityNumber | dynamic | — | localEntityNumber value consumed by this operation. |
randomResolver | dynamic | — | randomResolver value consumed by this operation. |
viewOrigin | dynamic | — | viewOrigin value consumed by this operation. |
viewAngles | dynamic | — | viewAngles value consumed by this operation. |
View source
# buildPredictedRefDef
function buildPredictedRefDef(client, fraction, width, height, assetResolvers, localEntityNumber, randomResolver)
Build predicted ref def.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
width | dynamic | — | Width in the coordinate or storage units used by the caller. |
height | dynamic | — | Height in the coordinate or storage units used by the caller. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
localEntityNumber | dynamic | — | localEntityNumber value consumed by this operation. |
randomResolver | dynamic | — | randomResolver value consumed by this operation. |
View source
# buildPredictedRefDefWithOffset
function buildPredictedRefDefWithOffset(client, fraction, width, height, assetResolvers, localEntityNumber, randomResolver, predictionOffset)
Build a predicted refdef while matching a locally ridden pusher's visual interpolation. The offset is deliberately explicit so ordinary movement prediction, demos and renderer captures cannot accidentally inherit it.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
width | dynamic | — | Width in the coordinate or storage units used by the caller. |
height | dynamic | — | Height in the coordinate or storage units used by the caller. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
localEntityNumber | dynamic | — | localEntityNumber value consumed by this operation. |
randomResolver | dynamic | — | randomResolver value consumed by this operation. |
predictionOffset | dynamic | — | predictionOffset value consumed by this operation. |
View source
# buildRefDef
function buildRefDef(client, fraction, width, height, assetResolvers, localEntityNumber, randomResolver)
Demos and deterministic renderer captures intentionally retain pure server interpolation. The live product uses the explicit predicted entry point.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
width | dynamic | — | Width in the coordinate or storage units used by the caller. |
height | dynamic | — | Height in the coordinate or storage units used by the caller. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
localEntityNumber | dynamic | — | localEntityNumber value consumed by this operation. |
randomResolver | dynamic | — | randomResolver value consumed by this operation. |
View source
# buildRefDefInternal
function buildRefDefInternal(client, fraction, width, height, assetResolvers, localEntityNumber, randomResolver, usePrediction, predictionOffset)
Build ref def internal.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
width | dynamic | — | Width in the coordinate or storage units used by the caller. |
height | dynamic | — | Height in the coordinate or storage units used by the caller. |
assetResolvers | dynamic | — | assetResolvers value consumed by this operation. |
localEntityNumber | dynamic | — | localEntityNumber value consumed by this operation. |
randomResolver | dynamic | — | randomResolver value consumed by this operation. |
usePrediction | dynamic | — | usePrediction value consumed by this operation. |
predictionOffset | dynamic | — | predictionOffset value consumed by this operation. |
View source
# clampFraction
inline function clampFraction(value)
Clamp fraction.
| Parameter | Type | Default | Description |
|---|
value | dynamic | — | Value consumed or transformed by the operation. |
View source
# clearPrediction
function clearPrediction(client)
Clear prediction.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
View source
miniquake2.client.state.ClientRuntime struct
# create
function create()
Creates create for the miniquake2 client state module.
View source
# currentEntity
inline function currentEntity(client, number)
Return the current entity value.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
number | dynamic | — | number value consumed by this operation. |
View source
# disguiseFamily
inline function disguiseFamily(skin)
Return the disguise family value.
| Parameter | Type | Default | Description |
|---|
skin | dynamic | — | skin value consumed by this operation. |
View source
# effectiveEffects
inline function effectiveEffects(state)
Return the effective effects value.
| Parameter | Type | Default | Description |
|---|
state | dynamic | — | Mutable state inspected or updated by the operation. |
View source
# effectiveRenderFx
inline function effectiveRenderFx(state)
Render effective fx.
| Parameter | Type | Default | Description |
|---|
state | dynamic | — | Mutable state inspected or updated by the operation. |
View source
# entityRenderAngles
inline function entityRenderAngles(oldState, state, fraction, reset)
Render entity angles.
| Parameter | Type | Default | Description |
|---|
oldState | dynamic | — | oldState value consumed by this operation. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
reset | dynamic | — | reset value consumed by this operation. |
View source
# entityRenderOrigin
inline function entityRenderOrigin(oldState, state, fraction, reset)
Render entity origin.
| Parameter | Type | Default | Description |
|---|
oldState | dynamic | — | oldState value consumed by this operation. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
reset | dynamic | — | reset value consumed by this operation. |
View source
# entityRequiresLerpReset
inline function entityRequiresLerpReset(oldState, state)
CL_DeltaEntity deliberately breaks interpolation when an entity changes model, moves more than 512 units between server frames, or reports either teleport event. Particle trails already observe this rule; the render handoff must use the same predecessor or models visibly sweep through the world after teleports and model replacements.
| Parameter | Type | Default | Description |
|---|
oldState | dynamic | — | oldState value consumed by this operation. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
View source
# findEntity
function findEntity(entities, number)
Find entity.
| Parameter | Type | Default | Description |
|---|
entities | dynamic | — | entities value consumed by this operation. |
number | dynamic | — | number value consumed by this operation. |
View source
# interpolatedAngles
function interpolatedAngles(oldState, currentState, fraction)
Return the interpolated angles.
| Parameter | Type | Default | Description |
|---|
oldState | dynamic | — | oldState value consumed by this operation. |
currentState | dynamic | — | currentState value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
View source
# interpolatedOrigin
function interpolatedOrigin(oldState, currentState, fraction)
Return the interpolated origin.
| Parameter | Type | Default | Description |
|---|
oldState | dynamic | — | oldState value consumed by this operation. |
currentState | dynamic | — | currentState value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
View source
# interpolationPlayer
function interpolationPlayer(client)
Return the interpolation player value.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
View source
# lastKnownEntity
inline function lastKnownEntity(client, number)
Return the last entity state published during this map epoch. Effects such as muzzle flashes may arrive in a packet whose snapshot omits an otherwise unchanged source entity, matching cl_entities[number].current in stock.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
number | dynamic | — | number value consumed by this operation. |
View source
# lerp
inline function lerp(first, second, fraction)
Return the lerp value.
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | first value consumed by this operation. |
second | dynamic | — | second value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
View source
# lerpAngle
inline function lerpAngle(first, second, fraction)
Quake II angles wrap at 360 degrees. A scalar interpolation would spin the long way around when a snapshot crosses north (for example 359 -> 1).
| Parameter | Type | Default | Description |
|---|
first | dynamic | — | first value consumed by this operation. |
second | dynamic | — | second value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
View source
# notePredictionStep
function notePredictionStep(client, previousFixedOrigin, currentFixedOrigin, flags, frameMsec)
CL_PredictMovement recognizes one ordinary stair riser in fixed-point Pmove coordinates (8..20 world units) and records a half-frame-adjusted start time. CL_CalcViewValues then removes that vertical discontinuity over the next 100 ms instead of snapping the camera upward.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
previousFixedOrigin | dynamic | — | previousFixedOrigin value consumed by this operation. |
currentFixedOrigin | dynamic | — | currentFixedOrigin value consumed by this operation. |
flags | dynamic | — | Bit flags controlling the operation. |
frameMsec | dynamic | — | frameMsec value consumed by this operation. |
View source
# renderAngles
function renderAngles(oldState, state, effects, fraction, renderTime, lerpReset)
Render angles.
| Parameter | Type | Default | Description |
|---|
oldState | dynamic | — | oldState value consumed by this operation. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
effects | dynamic | — | effects value consumed by this operation. |
fraction | dynamic | — | fraction value consumed by this operation. |
renderTime | dynamic | — | renderTime value consumed by this operation. |
lerpReset | dynamic | — | lerpReset value consumed by this operation. |
View source
# runLightStyles
function runLightStyles(client, renderTime)
Run light styles.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
renderTime | dynamic | — | renderTime value consumed by this operation. |
View source
# setConnectionState
function setConnectionState(client, state)
Set connection state.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
state | dynamic | — | Mutable state inspected or updated by the operation. |
View source
# setLightStyle
function setLightStyle(client, index, pattern)
CL_SetLightstyle decodes CS_LIGHTS strings lazily at their 10 Hz playback rate. Keeping the compact source string avoids a second 256 x MAX_QPATH float table and is cheaper than rebuilding every style on every render.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
index | dynamic | — | Zero-based index of the affected item. |
pattern | dynamic | — | pattern value consumed by this operation. |
View source
# setPredictionRealTime
function setPredictionRealTime(client, now)
Set prediction real time.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
now | dynamic | — | now value consumed by this operation. |
View source
# setPredictionStepSuppressed
function setPredictionStepSuppressed(client, value)
Tell the stair smoother whether local prediction is currently carried by a moving brush. A lift's regular vertical displacement falls inside the ordinary 8..20-unit stair range, but smoothing it as a stair every server frame makes the camera repeatedly ease downward and visibly hop upward. The application derives this flag from Player.groundEntity before it replays prediction; the underlying movement state remains authoritative.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
value | dynamic | — | Value consumed or transformed by the operation. |
View source
# stateModelCount
inline function stateModelCount(state)
Return the state model count.
| Parameter | Type | Default | Description |
|---|
state | dynamic | — | Mutable state inspected or updated by the operation. |
View source
# updatePredictionError
function updatePredictionError(client, predictedFixedOrigin)
Update prediction error.
| Parameter | Type | Default | Description |
|---|
client | dynamic | — | client value consumed by this operation. |
predictedFixedOrigin | dynamic | — | predictedFixedOrigin value consumed by this operation. |
View source