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,15 +506,12 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
if (M.cmdline.asan) if (M.cmdline.asan)
{ {
PushStringToList(perm, &cp.compiler_only_flags_msvc, Lit("-fsanitize=address")); 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 // TODO: Export debug info separately for release builds
PushStringToList(perm, &cp.flags_msvc, Lit("-DEBUG:FULL")); PushStringToList(perm, &cp.flags_msvc, Lit("-DEBUG:FULL"));

View File

@ -2172,6 +2172,20 @@ void P_StepFrame(P_Frame *frame)
//- Prune ents //- 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; i64 ents_to_prune_count = 0;
P_EntKey *ents_to_prune = PushStructsNoZero(scratch.arena, P_EntKey, frame->ents_count); 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)) 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) if (ent->exists <= 0)
{ {
ents_to_prune[ents_to_prune_count++] = ent->key; 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) for (i64 prune_idx = 0; prune_idx < ents_to_prune_count; ++prune_idx)
{ {
// FIXME: Ensure sure prunes are received by clients // 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_player = P_EntFromKey(frame, P_tl.local_player);
P_Ent *local_guy = P_EntFromKey(frame, local_player->guy); P_Ent *local_guy = P_EntFromKey(frame, local_player->guy);
////////////////////////////// //////////////////////////////
//- Mark simulated ents //- Mark simulated ents

View File

@ -45,7 +45,9 @@ V_Cmd *V_PushVisCmd(String name)
String V_StringFromHotkey(Arena *arena, V_Hotkey hotkey) String V_StringFromHotkey(Arena *arena, V_Hotkey hotkey)
{ {
String result = Zi;
TempArena scratch = BeginScratch(arena); TempArena scratch = BeginScratch(arena);
{
StringList parts = Zi; StringList parts = Zi;
if (hotkey.ctrl) if (hotkey.ctrl)
{ {
@ -60,8 +62,10 @@ String V_StringFromHotkey(Arena *arena, V_Hotkey hotkey)
PushStringToList(scratch.arena, &parts, Lit("Shift")); PushStringToList(scratch.arena, &parts, Lit("Shift"));
} }
PushStringToList(scratch.arena, &parts, StringFromButton(hotkey.button)); PushStringToList(scratch.arena, &parts, StringFromButton(hotkey.button));
result = StringFromList(arena, parts, Lit(" + "));
}
EndScratch(scratch); EndScratch(scratch);
return StringFromList(arena, parts, Lit(" + ")); return result;
} }
void V_PushParticles(V_Emitter src) void V_PushParticles(V_Emitter src)