MiniDoom

src/p_inter.ml

Applies pickups, armor and damage, resolves deaths, and maintains player frag attribution.

Package
(global)
Reachable
Yes

Imports

Declarations

_PI_AmmoIndex

inline function _PI_AmmoIndex(a)

Converts an ammo enum/value into a checked inventory index.

ParameterTypeDefaultDescription
adynamic—First input operand.

View source

_PI_CardIndex

function _PI_CardIndex(card)

Converts a key/card enum/value into a checked cards-array index.

ParameterTypeDefaultDescription
carddynamic—Card value supplied to `_PI_CardIndex`.

View source

_PI_CommitTouchedPlayer

inline function _PI_CommitTouchedPlayer(toucher, player, pidx)

Writes pickup-mutated player state back to global slot and touching mobj.

ParameterTypeDefaultDescription
toucherdynamic—Toucher value supplied to `_PI_CommitTouchedPlayer`.
playerdynamic—Player state affected by the operation.
pidxdynamic—Pidx value supplied to `_PI_CommitTouchedPlayer`.

View source

_PI_DiagHitEnabled

function _PI_DiagHitEnabled()

Enables bounded hit diagnostics only for explicit developer runs.

View source

_PI_DiagHitLog

inline function _PI_DiagHitLog(msg)

Emits rate-limited damage diagnostics without flooding normal gameplay output.

ParameterTypeDefaultDescription
msgdynamic—Msg value supplied to `_PI_DiagHitLog`.

View source

_PI_HasCard

inline function _PI_HasCard(player, card)

Tests whether a player already owns a checked key/card inventory entry.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
carddynamic—Card value supplied to `_PI_HasCard`.

View source

_PI_HasWeapon

inline function _PI_HasWeapon(player, weapon)

Tests a checked weapon ownership bit on a possibly incomplete player record.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
weapondynamic—Weapon value supplied to `_PI_HasWeapon`.

View source

_PI_IDiv

inline function _PI_IDiv(a, b)

Truncates damage and ammo scaling quotients toward zero, returning zero for invalid divisors.

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

View source

_PI_IsNoTargetPlayerMobj

inline function _PI_IsNoTargetPlayerMobj(mo)

Reports whether a damage source is a player whose persistent notarget cheat forbids monster retaliation.

ParameterTypeDefaultDescription
modynamic—Map object affected by the operation.

View source

_PI_PlayerIndex

function _PI_PlayerIndex(player)

Resolves a player struct to its authoritative slot for frag/pickup commits.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.

View source

_PI_PlayerIndexForThing

function _PI_PlayerIndexForThing(player, thing)

Resolves player slot by player struct first, then by owning mobj.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
thingdynamic—World object affected by the operation.

View source

_PI_PowerIndex

function _PI_PowerIndex(pw)

Converts a power enum/value into a checked powers-array index.

ParameterTypeDefaultDescription
pwdynamic—Pw value supplied to `_PI_PowerIndex`.

View source

_PI_WeaponIndex

function _PI_WeaponIndex(w)

Converts a weapon enum/value into a checked ownership-table index.

ParameterTypeDefaultDescription
wdynamic—W value supplied to `_PI_WeaponIndex`.

View source

_PI_WeaponInfo

inline function _PI_WeaponInfo(weapon)

Resolves immutable weapon metadata after validating the weapon index.

ParameterTypeDefaultDescription
weapondynamic—Weapon value supplied to `_PI_WeaponInfo`.

View source

_piDiagHit

_piDiagHit

Tracks whether pi diag hit is active in the p inter subsystem.

View source

_piDiagHitCount

_piDiagHitCount

Tracks the mutable pi diag hit count value used by the p inter subsystem.

View source

_piDiagHitInit

_piDiagHitInit

Tracks whether pi diag hit init is active in the p inter subsystem.

View source

BONUSADD

const BONUSADD = 6

Defines bonusadd for the p inter subsystem.

View source

clipammo

clipammo

Stores the clipammo collection used by the p inter subsystem.

View source

maxammo

maxammo

Stores the maxammo collection used by the p inter subsystem.

View source

P_DamageMobj

function P_DamageMobj(target, inflictor, source, damage)

Applies armor, thrust, pain, death, and attacker attribution for one damage event.

ParameterTypeDefaultDescription
targetdynamic—Target value supplied to `P_DamageMobj`.
inflictordynamic—Inflictor value supplied to `P_DamageMobj`.
sourcedynamic—Source value or buffer.
damagedynamic—Damage value supplied to `P_DamageMobj`.

View source

P_GiveAmmo

function P_GiveAmmo(player, ammo, num)

Adds clip-scaled ammunition, clamps capacity, and selects a newly usable weapon.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
ammodynamic—Ammo value supplied to `P_GiveAmmo`.
numdynamic—Index identifying the requested item.

View source

P_GiveArmor

function P_GiveArmor(player, armortype)

Replaces armor only when the requested class provides more effective points.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
armortypedynamic—Armortype value supplied to `P_GiveArmor`.

View source

P_GiveBody

function P_GiveBody(player, num)

Heals a player and mirrors the clamped health into the owned mobj.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
numdynamic—Index identifying the requested item.

View source

P_GiveCard

function P_GiveCard(player, card)

Grants a key/card once and triggers the pickup flash.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
carddynamic—Card value supplied to `P_GiveCard`.

View source

P_GivePower

function P_GivePower(player, power)

Grants or refreshes a player powerup while respecting permanent berserk strength.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
powerdynamic—Power value supplied to `P_GivePower`.

View source

P_GiveWeapon

function P_GiveWeapon(player, weapon, dropped)

Applies Doom coop/deathmatch weapon-stay and ammo pickup rules.

ParameterTypeDefaultDescription
playerdynamic—Player state affected by the operation.
weapondynamic—Weapon value supplied to `P_GiveWeapon`.
droppeddynamic—Dropped value supplied to `P_GiveWeapon`.

View source

P_KillMobj

function P_KillMobj(source, target)

Finalizes an actor death, including Doom frag semantics, corpse state, drops, and player rebirth state.

ParameterTypeDefaultDescription
sourcedynamic—Source value or buffer.
targetdynamic—Target value supplied to `P_KillMobj`.

View source

P_TouchSpecialThing

function P_TouchSpecialThing(special, toucher)

Resolves one pickup collision, mutates authoritative inventory, and removes consumable actors.

ParameterTypeDefaultDescription
specialdynamic—Special value supplied to `P_TouchSpecialThing`.
toucherdynamic—Toucher value supplied to `P_TouchSpecialThing`.

View source