mark dead entities before pruning

This commit is contained in:
jacob 2026-03-19 15:54:05 -05:00
parent 7ba8c7f3bf
commit b63b6197a6
3 changed files with 35 additions and 26 deletions

View File

@ -506,14 +506,11 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
if (M.cmdline.asan)
{
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-fsanitize=address"));
// PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-fsanitize-address-use-after-return"));
// PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-fsanitize-address-use-after-return")); // NOTE: Requires ASAN_OPTIONS=detect_stack_use_after_return=1
}
else
else if (!M.cmdline.release)
{
if (!M.cmdline.release)
{
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-RTCsu"));
}
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-RTCsu"));
}
// TODO: Export debug info separately for release builds

View File

@ -2172,6 +2172,20 @@ void P_StepFrame(P_Frame *frame)
//- Prune ents
{
// Mark dead entities
for (P_Ent *ent = P_FirstEnt(frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
{
if (ent->exists <= 0)
{
P_Ent *weapon = P_EntFromKey(frame, ent->weapon);
if (!P_IsEntNil(weapon))
{
weapon->exists = 0;
}
}
}
// Gather ents to prune
i64 ents_to_prune_count = 0;
P_EntKey *ents_to_prune = PushStructsNoZero(scratch.arena, P_EntKey, frame->ents_count);
for (P_Ent *ent = P_FirstEnt(frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
@ -2179,13 +2193,10 @@ void P_StepFrame(P_Frame *frame)
if (ent->exists <= 0)
{
ents_to_prune[ents_to_prune_count++] = ent->key;
if (!P_IsEntKeyNil(ent->weapon))
{
ents_to_prune[ents_to_prune_count++] = ent->weapon;
}
}
}
// Prune
for (i64 prune_idx = 0; prune_idx < ents_to_prune_count; ++prune_idx)
{
// FIXME: Ensure sure prunes are received by clients
@ -2209,9 +2220,6 @@ void P_StepFrame(P_Frame *frame)
P_Ent *local_player = P_EntFromKey(frame, P_tl.local_player);
P_Ent *local_guy = P_EntFromKey(frame, local_player->guy);
//////////////////////////////
//- Mark simulated ents

View File

@ -45,23 +45,27 @@ V_Cmd *V_PushVisCmd(String name)
String V_StringFromHotkey(Arena *arena, V_Hotkey hotkey)
{
String result = Zi;
TempArena scratch = BeginScratch(arena);
StringList parts = Zi;
if (hotkey.ctrl)
{
PushStringToList(scratch.arena, &parts, Lit("Ctrl"));
StringList parts = Zi;
if (hotkey.ctrl)
{
PushStringToList(scratch.arena, &parts, Lit("Ctrl"));
}
if (hotkey.alt)
{
PushStringToList(scratch.arena, &parts, Lit("Alt"));
}
if (hotkey.shift)
{
PushStringToList(scratch.arena, &parts, Lit("Shift"));
}
PushStringToList(scratch.arena, &parts, StringFromButton(hotkey.button));
result = StringFromList(arena, parts, Lit(" + "));
}
if (hotkey.alt)
{
PushStringToList(scratch.arena, &parts, Lit("Alt"));
}
if (hotkey.shift)
{
PushStringToList(scratch.arena, &parts, Lit("Shift"));
}
PushStringToList(scratch.arena, &parts, StringFromButton(hotkey.button));
EndScratch(scratch);
return StringFromList(arena, parts, Lit(" + "));
return result;
}
void V_PushParticles(V_Emitter src)