MiniDoom

src/p_mobj.ml

Defines actor state, spawn/removal ownership, missile and player creation, movement, and item respawn.

Package
(global)
Reachable
Yes

Imports

Declarations

_InitItemRespawnQueue

inline function _InitItemRespawnQueue()

Allocates the bounded dropped-item mapthing/timestamp ring on first respawn-queue use.

View source

_Mobj_Default

function _Mobj_Default()

Constructs an unlinked inert actor whose fields satisfy mobj_t's runtime invariants.

View source

_PM_AllocNetUid

inline function _PM_AllocNetUid()

Allocates a positive per-mobj uid used by multiplayer replication.

View source

_PM_EnsurePlayerSlots

function _PM_EnsurePlayerSlots()

Extends player and in-game arrays to MAXPLAYERS before mapthing-driven spawn access.

View source

_PM_IDiv

inline function _PM_IDiv(a, b)

Truncates actor movement quotients toward zero, returning zero for invalid operands.

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

View source

_PM_MobjTypeIndex

function _PM_MobjTypeIndex(v)

Converts a checked mobj type enum/value to an in-range mobjinfo table index.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_pm_next_netuid

_pm_next_netuid

Tracks the mutable pm next netuid value used by the p mobj subsystem.

View source

_pm_next_thinker_id

_pm_next_thinker_id

Tracks the mutable pm next thinker id value used by the p mobj subsystem.

View source

_PM_RegisterThinker

inline function _PM_RegisterThinker(node, owner)

Records the stable thinker-node-to-mobj association used when callbacks receive only a node.

ParameterTypeDefaultDescription
nodedynamic—Node value supplied to `_PM_RegisterThinker`.
ownerdynamic—Owner value supplied to `_PM_RegisterThinker`.

View source

_PM_ResolveThinkerId

inline function _PM_ResolveThinkerId(node)

Returns stable thinker registration id used for multiplayer actor mapping.

ParameterTypeDefaultDescription
nodedynamic—Node value supplied to `_PM_ResolveThinkerId`.

View source

_PM_ResolveThinkerOwner

inline function _PM_ResolveThinkerOwner(node)

Resolves either a direct mobj or its registered thinker node to the current actor owner.

ParameterTypeDefaultDescription
nodedynamic—Node value supplied to `_PM_ResolveThinkerOwner`.

View source

_PM_StateSpriteIndex

inline function _PM_StateSpriteIndex(spr)

Converts a state sprite enum/value to a valid sprite table index or the null sprite.

ParameterTypeDefaultDescription
sprdynamic—Spr value supplied to `_PM_StateSpriteIndex`.

View source

_pm_thinker_ids

_pm_thinker_ids

Stores the pm thinker ids collection used by the p mobj subsystem.

View source

_pm_thinker_nodes

_pm_thinker_nodes

Stores the pm thinker nodes collection used by the p mobj subsystem.

View source

_pm_thinker_owners

_pm_thinker_owners

Stores the pm thinker owners collection used by the p mobj subsystem.

View source

_PM_ToInt

inline function _PM_ToInt(v, fallback)

Normalizes enum/numeric actor fields to truncating integers with a supplied fallback.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
fallbackdynamic—Value returned when the requested conversion or lookup is unavailable.

View source

_PM_UnregisterThinker

inline function _PM_UnregisterThinker(node)

Removes a thinker-node ownership entry when its mobj leaves the world.

ParameterTypeDefaultDescription
nodedynamic—Node value supplied to `_PM_UnregisterThinker`.

View source

FRICTION

const FRICTION = 59392

Defines friction for the p mobj subsystem.

View source

iquehead

iquehead

Tracks the mutable iquehead value used by the p mobj subsystem.

View source

iquetail

iquetail

Tracks the mutable iquetail value used by the p mobj subsystem.

View source

ITEMQUESIZE

const ITEMQUESIZE = 128

Defines itemquesize for the p mobj subsystem.

View source

itemrespawnque

itemrespawnque

Stores the itemrespawnque collection used by the p mobj subsystem.

View source

itemrespawntime

itemrespawntime

Stores the itemrespawntime collection used by the p mobj subsystem.

View source

mobj_t struct

mobjflag_t enum

P_CheckMissileSpawn

function P_CheckMissileSpawn(th)

Advances a new missile half a tic and explodes it immediately if its initial position is blocked.

ParameterTypeDefaultDescription
thdynamic—Th value supplied to `P_CheckMissileSpawn`.

View source

P_ExplodeMissile

function P_ExplodeMissile(mo)

Stops missile momentum, enters its death state, removes missile solidity, and plays its death cue.

ParameterTypeDefaultDescription
modynamic—Map object affected by the operation.

View source

P_MobjThinker

function P_MobjThinker(mo)

Advances one actor's movement/state timer and triggers nightmare respawn when eligible.

ParameterTypeDefaultDescription
modynamic—Map object affected by the operation.

View source

P_NightmareRespawn

function P_NightmareRespawn(mobj)

Recreates a killed monster at its original spawn point with teleport fog and reaction delay.

ParameterTypeDefaultDescription
mobjdynamic—Map object affected by the operation.

View source

P_RemoveMobj

function P_RemoveMobj(th)

Queues eligible specials for respawn, unlinks the actor, and unregisters its thinker safely.

ParameterTypeDefaultDescription
thdynamic—Th value supplied to `P_RemoveMobj`.

View source

P_RespawnSpecials

function P_RespawnSpecials()

Respawns one queued pickup after its delay when the destination is unoccupied.

View source

P_SetMobjState

function P_SetMobjState(mobj, state)

Enters a state, runs its action, and follows zero-tic transitions until a timed or null state.

ParameterTypeDefaultDescription
mobjdynamic—Map object affected by the operation.
statedynamic—Subsystem state read or updated by the operation.

View source

P_SpawnBlood

function P_SpawnBlood(x, y, z, damage)

Spawns a randomized blood spray and selects its damage-scaled animation state.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
zdynamic—Vertical world-space coordinate.
damagedynamic—Damage value supplied to `P_SpawnBlood`.

View source

P_SpawnMapThing

function P_SpawnMapThing(mthing)

Filters a mapthing by player/skill/type rules, then spawns its actor and map-derived flags.

ParameterTypeDefaultDescription
mthingdynamic—Mthing value supplied to `P_SpawnMapThing`.

View source

P_SpawnMissile

function P_SpawnMissile(source, dest, type)

Aims a projectile from source to destination, sets owner/momentum, and validates its first step.

ParameterTypeDefaultDescription
sourcedynamic—Source value or buffer.
destdynamic—Dest value supplied to `P_SpawnMissile`.
typedynamic—Type value supplied to `P_SpawnMissile`.

View source

P_SpawnMobj

function P_SpawnMobj(x, y, z, type)

Instantiates an actor from mobjinfo, links it spatially, and registers its thinker ownership.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
zdynamic—Vertical world-space coordinate.
typedynamic—Type value supplied to `P_SpawnMobj`.

View source

P_SpawnPlayer

function P_SpawnPlayer(mthing)

Converts a player start mapthing into a live pawn and attaches view, health, and reborn state.

ParameterTypeDefaultDescription
mthingdynamic—Mthing value supplied to `P_SpawnPlayer`.

View source

P_SpawnPlayerMissile

function P_SpawnPlayerMissile(source, type)

Auto-aims a player projectile across fallback angles before spawning and validating it.

ParameterTypeDefaultDescription
sourcedynamic—Source value or buffer.
typedynamic—Type value supplied to `P_SpawnPlayerMissile`.

View source

P_SpawnPuff

function P_SpawnPuff(x, y, z)

Spawns a randomized-height bullet puff and selects its melee-safe animation variant.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
zdynamic—Vertical world-space coordinate.

View source

P_XYMovement

function P_XYMovement(mo)

Applies bounded XY momentum through collision/slide logic, then friction for grounded actors.

ParameterTypeDefaultDescription
modynamic—Map object affected by the operation.

View source

P_ZMovement

function P_ZMovement(mo)

Integrates vertical momentum, gravity, floor/ceiling impacts, bouncing skulls, and missile explosions.

ParameterTypeDefaultDescription
modynamic—Map object affected by the operation.

View source

STOPSPEED

const STOPSPEED = 4096

Defines stopspeed for the p mobj subsystem.

View source