# _PS_EnsureRuntimeArrays
function _PS_EnsureRuntimeArrays()Ensures player and spawn tables have canonical capacities and rewinds deathmatch-start insertion for the new level.
src/p_setup.mlDecodes map lumps into runtime geometry, links sector topology, spawns things/specials, and prepares a playable level.
d_player.ml → src/d_player.mldoomdata.ml → src/doomdata.mldoomdef.ml → src/doomdef.mldoomstat.ml → src/doomstat.mlg_game.ml → src/g_game.mli_system.ml → src/i_system.mlinfo.ml → src/info.mlm_bbox.ml → src/m_bbox.mlm_fixed.ml → src/m_fixed.mlm_swap.ml → src/m_swap.mlp_local.ml → src/p_local.mlp_mobj.ml → src/p_mobj.mlp_spec.ml → src/p_spec.mlp_switch.ml → src/p_switch.mlp_tick.ml → src/p_tick.mlr_data.ml → src/r_data.mlr_defs.ml → src/r_defs.mlr_state.ml → src/r_state.mlr_things.ml → src/r_things.mls_sound.ml → src/s_sound.mlw_wad.ml → src/w_wad.mlz_zone.ml → src/z_zone.mlfunction _PS_EnsureRuntimeArrays()Ensures player and spawn tables have canonical capacities and rewinds deathmatch-start insertion for the new level.
inline function _PS_I16LE(b, off)Decodes a two-byte map-lump field with signed 16-bit interpretation.
| Parameter | Type | Default | Description |
|---|---|---|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
inline function _PS_MapName(episode, map)Maps episode/map numbers to canonical ExMy or MAPnn lump names, with edition-appropriate first-map fallback.
| Parameter | Type | Default | Description |
|---|---|---|---|
episode | dynamic | — | Episode value supplied to `_PS_MapName`. |
map | dynamic | — | Map value supplied to `_PS_MapName`. |
inline function _PS_Name8(data, off)Extracts an eight-byte texture or flat name field from a map record without decoding it prematurely.
| Parameter | Type | Default | Description |
|---|---|---|---|
data | dynamic | — | Binary or structured data to process. |
off | dynamic | — | Zero-based byte or element offset. |
inline function _PS_ReadLumpBytes(lump)Allocates an exact-size buffer and copies a map lump into it, returning an empty buffer for zero-length lumps.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `_PS_ReadLumpBytes`. |
inline function _PS_U16LE(b, off)Decodes an unsigned 16-bit little-endian field from a map lump.
| Parameter | Type | Default | Description |
|---|---|---|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
inline function _PS_VertexOrZero(idx)Resolves a map vertex index and substitutes an origin vertex for malformed references.
| Parameter | Type | Default | Description |
|---|---|---|---|
idx | dynamic | — | Zero-based element or table index. |
inline function _PSET_IDiv(a, b)Returns a signed quotient truncated toward zero, or zero for invalid operands and a zero divisor in `_PSET_IDiv`
| Parameter | Type | Default | Description |
|---|---|---|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
inline function _PSET_IsSeq(v)Recognizes both array and list containers accepted by map geometry and runtime tables.
| Parameter | Type | Default | Description |
|---|---|---|---|
v | dynamic | — | Value consumed by the operation. |
inline function _PSET_LoadPulse(text)Keeps the window responsive and updates loading UI during expensive level setup phases.
| Parameter | Type | Default | Description |
|---|---|---|---|
text | dynamic | — | Text to process. |
function P_GroupLines()Assigns subsector sectors and builds each sector's line list, fixed bounds, blockmap bounds, and centered sound origin.
function P_Init()Prepares switch pairs, animated flats/textures, and sprite definitions shared by all subsequently loaded levels.
function P_LoadBlockMap(lump)Decodes BLOCKMAP words, promotes its origin, normalizes cell offsets, and allocates empty per-cell thing chains.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadBlockMap`. |
function P_LoadLineDefs(lump)Decodes LINEDEFS, resolves vertices and sectors, and precomputes direction, slope class, and bounding boxes.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadLineDefs`. |
function P_LoadNodes(lump)Decodes BSP partition origins, directions, child bounds, and node-or-subsector child identifiers.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadNodes`. |
function P_LoadSectors(lump)Decodes SECTORS records, resolves flat names, and initializes mutable sound, thing, line, and special ownership fields.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadSectors`. |
function P_LoadSegs(lump)Decodes SEGS geometry and resolves its linedef, sidedef, front sector, and optional opposite sector links.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadSegs`. |
function P_LoadSideDefs(lump)Decodes SIDEDEFS offsets and texture names, then resolves each record's owning sector reference.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadSideDefs`. |
function P_LoadSubsectors(lump)Decodes SSECTORS seg ranges while leaving sector ownership for the later line-grouping pass.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadSubsectors`. |
function P_LoadThings(lump)Decodes THINGS records and spawns edition-compatible map objects, stopping at unsupported commercial actors in noncommercial games.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadThings`. |
function P_LoadVertexes(lump)Decodes four-byte VERTEXES records and promotes map-unit coordinates to fixed-point runtime vertices.
| Parameter | Type | Default | Description |
|---|---|---|---|
lump | dynamic | — | Lump value supplied to `P_LoadVertexes`. |
function P_SetupLevel(episode, map, playermask, skill)Tears down prior level state, loads map lumps in dependency order, links geometry, spawns actors/specials, precaches assets, and enters GS_LEVEL.
| Parameter | Type | Default | Description |
|---|---|---|---|
episode | dynamic | — | Episode value supplied to `P_SetupLevel`. |
map | dynamic | — | Map value supplied to `P_SetupLevel`. |
playermask | dynamic | — | Playermask value supplied to `P_SetupLevel`. |
skill | dynamic | — | Skill value supplied to `P_SetupLevel`. |