frame allocs (25.2): physics, npc, vehicles and wildlife's bounded growth declared - id tables to their most, a walker slot, a guest's copies, a player's own vehicle, a table at a load
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
082fd26bf1
commit
34664e867f
7 changed files with 8 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
const PH_INDEX: int = 8388607 # a body id's low 23 bits are its index (Jolt's BodyID)
|
||||
|
||||
# every body owns nothing: at a world's opening, the table made once at its size and kept after
|
||||
@alloc_ok("the body table made at its size when a world opens, kept after")
|
||||
function ph_own_reset(physics_st: mut PhysicsState, max_bodies: int) -> void {
|
||||
if len(physics_st.ph_own) < max_bodies {
|
||||
List.clear(physics_st.ph_own)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ function ph_keep(physics_st: mut PhysicsState, s: pointer) -> int {
|
|||
physics_st.ph_shapes[id] = s
|
||||
return id
|
||||
}
|
||||
@alloc_ok("the id table grows to the most shapes held at once; a freed id is handed out again")
|
||||
push(physics_st.ph_shapes, s)
|
||||
return len(physics_st.ph_shapes) - 1
|
||||
}
|
||||
|
|
@ -26,6 +27,7 @@ export function phys_shape_free(physics_st: mut PhysicsState, id: int) -> void {
|
|||
if s == null { return }
|
||||
jph_shape_free(s)
|
||||
physics_st.ph_shapes[id] = null
|
||||
@alloc_ok("the spare ids, no more than the most shapes ever held")
|
||||
push(physics_st.ph_spare, id)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export function phys_walker_add(physics_st: mut PhysicsState, r: float, h: float
|
|||
return i
|
||||
}
|
||||
}
|
||||
@alloc_ok("a slot for the most walkers at once; a removed one's slot is reused")
|
||||
push(physics_st.ph_walkers, k)
|
||||
return len(physics_st.ph_walkers) - 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue