# _PI_AmmoIndex
inline function _PI_AmmoIndex(a)Converts an ammo enum/value into a checked inventory index.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
src/p_inter.mlApplies pickups, armor and damage, resolves deaths, and maintains player frag attribution.
am_map.ml → src/am_map.mld_player.ml → src/d_player.mldoomdef.ml → src/doomdef.mldoomstat.ml → src/doomstat.mldstrings.ml → src/dstrings.mli_system.ml → src/i_system.mlinfo.ml → src/info.mlm_argv.ml → src/m_argv.mlm_random.ml → src/m_random.mlp_local.ml → src/p_local.mlp_mobj.ml → src/p_mobj.mlp_pspr.ml → src/p_pspr.mlr_main.ml → src/r_main.mls_sound.ml → src/s_sound.mlsounds.ml → src/sounds.mltables.ml → src/tables.mlinline function _PI_AmmoIndex(a)Converts an ammo enum/value into a checked inventory index.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
function _PI_CardIndex(card)Converts a key/card enum/value into a checked cards-array index.
| Parameter | Type | Default | Description |
|---|---|---|---|
card | dynamic | — | Card value supplied to `_PI_CardIndex`. |
inline function _PI_CommitTouchedPlayer(toucher, player, pidx)Writes pickup-mutated player state back to global slot and touching mobj.
| Parameter | Type | Default | Description |
|---|---|---|---|
toucher | dynamic | — | Toucher value supplied to `_PI_CommitTouchedPlayer`. |
player | dynamic | — | Player state affected by the operation. |
pidx | dynamic | — | Pidx value supplied to `_PI_CommitTouchedPlayer`. |
function _PI_DiagHitEnabled()Enables bounded hit diagnostics only for explicit developer runs.
inline function _PI_DiagHitLog(msg)Emits rate-limited damage diagnostics without flooding normal gameplay output.
| Parameter | Type | Default | Description |
|---|---|---|---|
msg | dynamic | — | Msg value supplied to `_PI_DiagHitLog`. |
inline function _PI_HasCard(player, card)Tests whether a player already owns a checked key/card inventory entry.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
card | dynamic | — | Card value supplied to `_PI_HasCard`. |
inline function _PI_HasWeapon(player, weapon)Tests a checked weapon ownership bit on a possibly incomplete player record.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
weapon | dynamic | — | Weapon value supplied to `_PI_HasWeapon`. |
inline function _PI_IDiv(a, b)Truncates damage and ammo scaling quotients toward zero, returning zero for invalid divisors.
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
inline function _PI_IsNoTargetPlayerMobj(mo)Reports whether a damage source is a player whose persistent notarget cheat forbids monster retaliation.
| Parameter | Type | Default | Description |
|---|---|---|---|
mo | dynamic | — | Map object affected by the operation. |
function _PI_PlayerIndex(player)Resolves a player struct to its authoritative slot for frag/pickup commits.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
function _PI_PlayerIndexForThing(player, thing)Resolves player slot by player struct first, then by owning mobj.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
thing | dynamic | — | World object affected by the operation. |
function _PI_PowerIndex(pw)Converts a power enum/value into a checked powers-array index.
| Parameter | Type | Default | Description |
|---|---|---|---|
pw | dynamic | — | Pw value supplied to `_PI_PowerIndex`. |
function _PI_WeaponIndex(w)Converts a weapon enum/value into a checked ownership-table index.
| Parameter | Type | Default | Description |
|---|---|---|---|
w | dynamic | — | W value supplied to `_PI_WeaponIndex`. |
inline function _PI_WeaponInfo(weapon)Resolves immutable weapon metadata after validating the weapon index.
| Parameter | Type | Default | Description |
|---|---|---|---|
weapon | dynamic | — | Weapon value supplied to `_PI_WeaponInfo`. |
_piDiagHitTracks whether pi diag hit is active in the p inter subsystem.
_piDiagHitCountTracks the mutable pi diag hit count value used by the p inter subsystem.
_piDiagHitInitTracks whether pi diag hit init is active in the p inter subsystem.
const BONUSADD = 6Defines bonusadd for the p inter subsystem.
clipammoStores the clipammo collection used by the p inter subsystem.
maxammoStores the maxammo collection used by the p inter subsystem.
function P_DamageMobj(target, inflictor, source, damage)Applies armor, thrust, pain, death, and attacker attribution for one damage event.
| Parameter | Type | Default | Description |
|---|---|---|---|
target | dynamic | — | Target value supplied to `P_DamageMobj`. |
inflictor | dynamic | — | Inflictor value supplied to `P_DamageMobj`. |
source | dynamic | — | Source value or buffer. |
damage | dynamic | — | Damage value supplied to `P_DamageMobj`. |
function P_GiveAmmo(player, ammo, num)Adds clip-scaled ammunition, clamps capacity, and selects a newly usable weapon.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
ammo | dynamic | — | Ammo value supplied to `P_GiveAmmo`. |
num | dynamic | — | Index identifying the requested item. |
function P_GiveArmor(player, armortype)Replaces armor only when the requested class provides more effective points.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
armortype | dynamic | — | Armortype value supplied to `P_GiveArmor`. |
function P_GiveBody(player, num)Heals a player and mirrors the clamped health into the owned mobj.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
num | dynamic | — | Index identifying the requested item. |
function P_GiveCard(player, card)Grants a key/card once and triggers the pickup flash.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
card | dynamic | — | Card value supplied to `P_GiveCard`. |
function P_GivePower(player, power)Grants or refreshes a player powerup while respecting permanent berserk strength.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
power | dynamic | — | Power value supplied to `P_GivePower`. |
function P_GiveWeapon(player, weapon, dropped)Applies Doom coop/deathmatch weapon-stay and ammo pickup rules.
| Parameter | Type | Default | Description |
|---|---|---|---|
player | dynamic | — | Player state affected by the operation. |
weapon | dynamic | — | Weapon value supplied to `P_GiveWeapon`. |
dropped | dynamic | — | Dropped value supplied to `P_GiveWeapon`. |
function P_KillMobj(source, target)Finalizes an actor death, including Doom frag semantics, corpse state, drops, and player rebirth state.
| Parameter | Type | Default | Description |
|---|---|---|---|
source | dynamic | — | Source value or buffer. |
target | dynamic | — | Target value supplied to `P_KillMobj`. |
function P_TouchSpecialThing(special, toucher)Resolves one pickup collision, mutates authoritative inventory, and removes consumable actors.
| Parameter | Type | Default | Description |
|---|---|---|---|
special | dynamic | — | Special value supplied to `P_TouchSpecialThing`. |
toucher | dynamic | — | Toucher value supplied to `P_TouchSpecialThing`. |