MiniQuake

src/miniquake/view.ml

Package
miniquake.view
Reachable
Yes

Imports

Declarations

absolute

function absolute(value)

Implements the `absolute` operation for `miniquake.view` (absolute).

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `absolute`.

View source

addDamage

function addDamage(state, count, fromDirection, viewAngles, kickRoll, kickPitch, kickTime)

Compatibility entry points retained for the existing focused tests.

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `addDamage`.
countdynamic—Number of entries or units to process.
fromDirectiondynamic—The from direction input consumed by `addDamage`.
viewAnglesdynamic—The view angles input consumed by `addDamage`.
kickRolldynamic—The kick roll input consumed by `addDamage`.
kickPitchdynamic—The kick pitch input consumed by `addDamage`.
kickTimedynamic—Time value used by the operation.

View source

angledelta

function angledelta(angle)

Implements the `angledelta` operation for `miniquake.view` (angledelta).

ParameterTypeDefaultDescription
angledynamic—The angle input consumed by `angledelta`.

View source

BuildGammaTable

function BuildGammaTable(state, gamma)

Create and initialize gamma table.

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `BuildGammaTable`.
gammadynamic—The gamma input consumed by `BuildGammaTable`.

View source

calcBob

function calcBob(time, velocity, bobAmount, bobCycle, bobUp)

Implements the `calcBob` operation for `miniquake.view` (calc bob).

ParameterTypeDefaultDescription
timedynamic—Simulation or presentation time for the operation.
velocitydynamic—Velocity applied by the operation.
bobAmountdynamic—The bob amount input consumed by `calcBob`.
bobCycledynamic—The bob cycle input consumed by `calcBob`.
bobUpdynamic—The bob up input consumed by `calcBob`.

View source

CalcGunAngle

function CalcGunAngle(state, clientTime, frameTime, idleScale, yawCycle, rollCycle, pitchCycle, yawLevel, rollLevel, pitchLevel)

Implements the `CalcGunAngle` operation for `miniquake.view` (calc gun angle).

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `CalcGunAngle`.
clientTimedynamic—Time value used by the operation.
frameTimedynamic—Time value used by the operation.
idleScaledynamic—The idle scale input consumed by `CalcGunAngle`.
yawCycledynamic—The yaw cycle input consumed by `CalcGunAngle`.
rollCycledynamic—The roll cycle input consumed by `CalcGunAngle`.
pitchCycledynamic—The pitch cycle input consumed by `CalcGunAngle`.
yawLeveldynamic—The yaw level input consumed by `CalcGunAngle`.
rollLeveldynamic—The roll level input consumed by `CalcGunAngle`.
pitchLeveldynamic—The pitch level input consumed by `CalcGunAngle`.

View source

calcRoll

function calcRoll(angles, velocity, rollAngle, rollSpeed)

Implements the `calcRoll` operation for `miniquake.view` (calc roll).

ParameterTypeDefaultDescription
anglesdynamic—Orientation angles used by the operation.
velocitydynamic—Velocity applied by the operation.
rollAngledynamic—The roll angle input consumed by `calcRoll`.
rollSpeeddynamic—The roll speed input consumed by `calcRoll`.

View source

calculate

function calculate(state, player, cameraAngles, clientTime, frameTime, bobAmount, bobCycle, bobUp, rollAngle, rollSpeed, kickTime)

Compute the requested value.

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `calculate`.
playerdynamic—The player input consumed by `calculate`.
cameraAnglesdynamic—The camera angles input consumed by `calculate`.
clientTimedynamic—Time value used by the operation.
frameTimedynamic—Time value used by the operation.
bobAmountdynamic—The bob amount input consumed by `calculate`.
bobCycledynamic—The bob cycle input consumed by `calculate`.
bobUpdynamic—The bob up input consumed by `calculate`.
rollAngledynamic—The roll angle input consumed by `calculate`.
rollSpeeddynamic—The roll speed input consumed by `calculate`.
kickTimedynamic—Time value used by the operation.

View source

create

function create()

Implements the `create` operation for `miniquake.view` (create).

View source

CSHIFT_BONUS

const CSHIFT_BONUS = 2

Defines the cshift bonus value used by `miniquake.view`.

View source

CSHIFT_CONTENTS

const CSHIFT_CONTENTS = 0

Defines the cshift contents value used by `miniquake.view`.

View source

CSHIFT_DAMAGE

const CSHIFT_DAMAGE = 1

Defines the cshift damage value used by `miniquake.view`.

View source

CSHIFT_POWERUP

const CSHIFT_POWERUP = 3

Defines the cshift powerup value used by `miniquake.view`.

View source

decayDamage

function decayDamage(state, frameTime, kickTime)

Implements the `decayDamage` operation for `miniquake.view` (decay damage).

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `decayDamage`.
frameTimedynamic—Time value used by the operation.
kickTimedynamic—Time value used by the operation.

View source

emptyGamma

function emptyGamma()

Implements the `emptyGamma` operation for `miniquake.view` (empty gamma).

View source

emptyRamps

function emptyRamps()

Implements the `emptyRamps` operation for `miniquake.view` (empty ramps).

View source

NUM_CSHIFTS

const NUM_CSHIFTS = 4

Defines the num cshifts value used by `miniquake.view`.

View source

PI

const PI = 3.14159265358979

Defines the pi value used by `miniquake.view`.

View source

reset

function reset(state, playerOrigin)

Implements the `reset` operation for `miniquake.view` (reset).

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `reset`.
playerOrigindynamic—The player origin input consumed by `reset`.

View source

smoothStairStep

function smoothStairStep(state, player, frameTime)

Implements the `smoothStairStep` operation for `miniquake.view` (smooth stair step).

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `smoothStairStep`.
playerdynamic—The player input consumed by `smoothStairStep`.
frameTimedynamic—Time value used by the operation.

View source

V_AddIdle

function V_AddIdle(state, clientTime, idleScale, yawCycle, rollCycle, pitchCycle, yawLevel, rollLevel, pitchLevel)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_AddIdle`.
clientTimedynamic—Time value used by the operation.
idleScaledynamic—The idle scale input consumed by `V_AddIdle`.
yawCycledynamic—The yaw cycle input consumed by `V_AddIdle`.
rollCycledynamic—The roll cycle input consumed by `V_AddIdle`.
pitchCycledynamic—The pitch cycle input consumed by `V_AddIdle`.
yawLeveldynamic—The yaw level input consumed by `V_AddIdle`.
rollLeveldynamic—The roll level input consumed by `V_AddIdle`.
pitchLeveldynamic—The pitch level input consumed by `V_AddIdle`.

View source

V_BonusFlash_f

function V_BonusFlash_f(state)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_BonusFlash_f`.

View source

V_BoundOffsets

function V_BoundOffsets(state, entityOrigin)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_BoundOffsets`.
entityOrigindynamic—The entity origin input consumed by `V_BoundOffsets`.

View source

V_CalcBlend

function V_CalcBlend(state, cshiftPercent)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CalcBlend`.
cshiftPercentdynamic—The cshift percent input consumed by `V_CalcBlend`.

View source

V_CalcBob

function V_CalcBob(time, velocity, bobAmount, bobCycle, bobUp)

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

ParameterTypeDefaultDescription
timedynamic—Simulation or presentation time for the operation.
velocitydynamic—Velocity applied by the operation.
bobAmountdynamic—The bob amount input consumed by `V_CalcBob`.
bobCycledynamic—The bob cycle input consumed by `V_CalcBob`.
bobUpdynamic—The bob up input consumed by `V_CalcBob`.

View source

V_CalcIntermissionRefdef

function V_CalcIntermissionRefdef(state, player, clientTime, yawCycle, rollCycle, pitchCycle, yawLevel, rollLevel, pitchLevel)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CalcIntermissionRefdef`.
playerdynamic—The player input consumed by `V_CalcIntermissionRefdef`.
clientTimedynamic—Time value used by the operation.
yawCycledynamic—The yaw cycle input consumed by `V_CalcIntermissionRefdef`.
rollCycledynamic—The roll cycle input consumed by `V_CalcIntermissionRefdef`.
pitchCycledynamic—The pitch cycle input consumed by `V_CalcIntermissionRefdef`.
yawLeveldynamic—The yaw level input consumed by `V_CalcIntermissionRefdef`.
rollLeveldynamic—The roll level input consumed by `V_CalcIntermissionRefdef`.
pitchLeveldynamic—The pitch level input consumed by `V_CalcIntermissionRefdef`.

View source

V_CalcPowerupCshift

function V_CalcPowerupCshift(state, items)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CalcPowerupCshift`.
itemsdynamic—The items input consumed by `V_CalcPowerupCshift`.

View source

V_CalcRefdef

function V_CalcRefdef(state, player, viewAngles, idealPitch, forwardMove, forwardSpeed, clientTime, frameTime, stepFrameTime, demoPlayback, registry)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CalcRefdef`.
playerdynamic—The player input consumed by `V_CalcRefdef`.
viewAnglesdynamic—The view angles input consumed by `V_CalcRefdef`.
idealPitchdynamic—The ideal pitch input consumed by `V_CalcRefdef`.
forwardMovedynamic—The forward move input consumed by `V_CalcRefdef`.
forwardSpeeddynamic—The forward speed input consumed by `V_CalcRefdef`.
clientTimedynamic—Time value used by the operation.
frameTimedynamic—Time value used by the operation.
stepFrameTimedynamic—Time value used by the operation.
demoPlaybackdynamic—The demo playback input consumed by `V_CalcRefdef`.
registrydynamic—The registry input consumed by `V_CalcRefdef`.

View source

V_CalcRoll

function V_CalcRoll(angles, velocity, rollAngle, rollSpeed)

V_CalcRoll is also consumed by sv_user.c in the original engine.

ParameterTypeDefaultDescription
anglesdynamic—Orientation angles used by the operation.
velocitydynamic—Velocity applied by the operation.
rollAngledynamic—The roll angle input consumed by `V_CalcRoll`.
rollSpeeddynamic—The roll speed input consumed by `V_CalcRoll`.

View source

V_CalcViewRoll

function V_CalcViewRoll(state, entityAngles, velocity, health, frameTime, rollAngle, rollSpeed, kickTime)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CalcViewRoll`.
entityAnglesdynamic—The entity angles input consumed by `V_CalcViewRoll`.
velocitydynamic—Velocity applied by the operation.
healthdynamic—The health input consumed by `V_CalcViewRoll`.
frameTimedynamic—Time value used by the operation.
rollAngledynamic—The roll angle input consumed by `V_CalcViewRoll`.
rollSpeeddynamic—The roll speed input consumed by `V_CalcViewRoll`.
kickTimedynamic—Time value used by the operation.

View source

V_CheckGamma

function V_CheckGamma(state, gamma)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CheckGamma`.
gammadynamic—The gamma input consumed by `V_CheckGamma`.

View source

V_ClearClientState

function V_ClearClientState(state)

The cl-owned fields used by view.c are cleared by CL_ClearState's memset. Renderer statics (oldz, old gun angles, damage kick globals, gamma state and the user-configurable cshift_empty) intentionally survive map changes.

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_ClearClientState`.

View source

V_CommandTrace

function V_CommandTrace(state)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_CommandTrace`.

View source

V_cshift_f

function V_cshift_f(state, arguments)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_cshift_f`.
argumentsdynamic—Command-line arguments to inspect or execute.

View source

V_DriftPitch

function V_DriftPitch(state, viewAngles, idealPitch, forwardMove, forwardSpeed, frameTime, clientTime, centerMove, centerSpeed, noclipAngleHack, onGround, demoPlayback)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_DriftPitch`.
viewAnglesdynamic—The view angles input consumed by `V_DriftPitch`.
idealPitchdynamic—The ideal pitch input consumed by `V_DriftPitch`.
forwardMovedynamic—The forward move input consumed by `V_DriftPitch`.
forwardSpeeddynamic—The forward speed input consumed by `V_DriftPitch`.
frameTimedynamic—Time value used by the operation.
clientTimedynamic—Time value used by the operation.
centerMovedynamic—The center move input consumed by `V_DriftPitch`.
centerSpeeddynamic—The center speed input consumed by `V_DriftPitch`.
noclipAngleHackdynamic—The noclip angle hack input consumed by `V_DriftPitch`.
onGrounddynamic—The on ground input consumed by `V_DriftPitch`.
demoPlaybackdynamic—The demo playback input consumed by `V_DriftPitch`.

View source

V_Init

function V_Init(state)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_Init`.

View source

V_ParseDamage

function V_ParseDamage(state, armor, blood, source, entityOrigin, entityAngles, kickRoll, kickPitch, kickTime)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_ParseDamage`.
armordynamic—The armor input consumed by `V_ParseDamage`.
blooddynamic—The blood input consumed by `V_ParseDamage`.
sourcedynamic—Source value or collection to read.
entityOrigindynamic—The entity origin input consumed by `V_ParseDamage`.
entityAnglesdynamic—The entity angles input consumed by `V_ParseDamage`.
kickRolldynamic—The kick roll input consumed by `V_ParseDamage`.
kickPitchdynamic—The kick pitch input consumed by `V_ParseDamage`.
kickTimedynamic—Time value used by the operation.

View source

V_RenderView

function V_RenderView(state, player, client, registry, frameTime, paused, demoPlayback, intermission, forcedConsole)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_RenderView`.
playerdynamic—The player input consumed by `V_RenderView`.
clientdynamic—Client state participating in the operation.
registrydynamic—The registry input consumed by `V_RenderView`.
frameTimedynamic—Time value used by the operation.
pauseddynamic—The paused input consumed by `V_RenderView`.
demoPlaybackdynamic—The demo playback input consumed by `V_RenderView`.
intermissiondynamic—The intermission input consumed by `V_RenderView`.
forcedConsoledynamic—The forced console input consumed by `V_RenderView`.

View source

V_SetContentsColor

function V_SetContentsColor(state, contents)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_SetContentsColor`.
contentsdynamic—The contents input consumed by `V_SetContentsColor`.

View source

V_StartPitchDrift

function V_StartPitchDrift(state, clientTime, centerSpeed)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_StartPitchDrift`.
clientTimedynamic—Time value used by the operation.
centerSpeeddynamic—The center speed input consumed by `V_StartPitchDrift`.

View source

V_StopPitchDrift

function V_StopPitchDrift(state, clientTime)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_StopPitchDrift`.
clientTimedynamic—Time value used by the operation.

View source

V_UpdatePalette

function V_UpdatePalette(state, items, frameTime, cshiftPercent, gamma)

This is the GLQUAKE V_UpdatePalette path. It also constructs the original three gamma ramps so a diagnostic build can compare the software-palette result without asking the platform bridge to own game policy.

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.view` state used by `V_UpdatePalette`.
itemsdynamic—The items input consumed by `V_UpdatePalette`.
frameTimedynamic—Time value used by the operation.
cshiftPercentdynamic—The cshift percent input consumed by `V_UpdatePalette`.
gammadynamic—The gamma input consumed by `V_UpdatePalette`.

View source

viewTraceEmpty

viewTraceEmpty

V_RenderView's compatibility trace contains only fixed stage names. Share the immutable variants instead of rebuilding nested arrays every frame.

View source

viewTraceIntermission

viewTraceIntermission

Tracks the module-level view trace intermission state owned by `miniquake.view`.

View source

viewTraceIntermissionStereo

viewTraceIntermissionStereo

Tracks the module-level view trace intermission stereo state owned by `miniquake.view`.

View source

viewTracePaused

viewTracePaused

Tracks the module-level view trace paused state owned by `miniquake.view`.

View source

viewTracePausedStereo

viewTracePausedStereo

Tracks the module-level view trace paused stereo state owned by `miniquake.view`.

View source

viewTraceRefdef

viewTraceRefdef

Tracks the module-level view trace refdef state owned by `miniquake.view`.

View source

viewTraceRefdefStereo

viewTraceRefdefStereo

Tracks the module-level view trace refdef stereo state owned by `miniquake.view`.

View source