MiniDoom

src/p_switch.ml

Resolves switch texture pairs, manages timed buttons, and dispatches player-use line specials.

Package
(global)
Reachable
Yes

Imports

Declarations

_alphSwitchList

_alphSwitchList

Stores the alph switch list collection used by the p switch subsystem.

View source

_InitButtonList

function _InitButtonList()

Lazily creates the fixed set of reusable timed-button records with inactive timers.

View source

_PSW_DiagUseEnabled

function _PSW_DiagUseEnabled()

Caches whether switch-use diagnostic logging was enabled on the command line.

View source

_PSW_DiagUseLog

inline function _PSW_DiagUseLog(msg)

Emits a switch-use diagnostic only when the cached diagnostic option is active.

ParameterTypeDefaultDescription
msgdynamic—Msg value supplied to `_PSW_DiagUseLog`.

View source

_PSW_Idiv

inline function _PSW_Idiv(a, b)

Returns a signed quotient truncated toward zero, using zero when the divisor is zero.

ParameterTypeDefaultDescription
adynamic—First input operand.
bdynamic—Second input operand.

View source

_PSW_IsSeq

inline function _PSW_IsSeq(v)

Tests whether an arbitrary value is an indexable array or byte sequence.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_PSW_Side0

inline function _PSW_Side0(line)

Resolves a line's front sidedef while rejecting absent or out-of-range side indices.

ParameterTypeDefaultDescription
linedynamic—Map line or text line affected by the operation.

View source

_PSW_StartSound

inline function _PSW_StartSound(origin, sound)

Emits a switch sound from a valid positional origin when audio support is available.

ParameterTypeDefaultDescription
origindynamic—Origin value supplied to `_PSW_StartSound`.
sounddynamic—Sound value supplied to `_PSW_StartSound`.

View source

_pswDiagUse

_pswDiagUse

Tracks whether psw diag use is active in the p switch subsystem.

View source

_pswDiagUseCount

_pswDiagUseCount

Tracks the mutable psw diag use count value used by the p switch subsystem.

View source

_pswDiagUseInit

_pswDiagUseInit

Tracks whether psw diag use init is active in the p switch subsystem.

View source

buttonlist

buttonlist

Stores the buttonlist collection used by the p switch subsystem.

View source

numswitches

numswitches

Tracks the mutable numswitches value used by the p switch subsystem.

View source

P_ChangeSwitchTexture

function P_ChangeSwitchTexture(line, useAgain)

Finds the activated sidedef texture's paired switch image, plays its sound, and optionally schedules restoration.

ParameterTypeDefaultDescription
linedynamic—Map line or text line affected by the operation.
useAgaindynamic—Use again value supplied to `P_ChangeSwitchTexture`.

View source

P_InitSwitchList

function P_InitSwitchList()

Resolves texture pairs allowed by the current game edition and terminates the list with a sentinel.

View source

P_StartButton

function P_StartButton(line, w, texture, time)

Reserves a timer for a reusable switch texture, avoiding duplicate records for the same linedef.

ParameterTypeDefaultDescription
linedynamic—Map line or text line affected by the operation.
wdynamic—W value supplied to `P_StartButton`.
texturedynamic—Texture value supplied to `P_StartButton`.
timedynamic—Time value used by the operation.

View source

P_UpdateButtons

function P_UpdateButtons()

Counts down reusable switches, restores their original sidedef texture at expiry, and frees their timer records.

View source

P_UseSpecialLine

function P_UseSpecialLine(thing, line, side)

Enforces side and monster-use restrictions, dispatches a linedef's manual special, and changes its switch texture on success.

ParameterTypeDefaultDescription
thingdynamic—World object affected by the operation.
linedynamic—Map line or text line affected by the operation.
sidedynamic—Map side affected by the operation.

View source

switchlist

switchlist

Stores the switchlist collection used by the p switch subsystem.

View source