From 509fda70d5be7946259a5f5befaffd6e4147083e Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:54:09 -0400 Subject: [PATCH] Revert P_InitThinkers: Centralise/tidy global mobj pointer handling This reverts commit 19da924b5e94ee2e60a59e7df8e2ddb912d8c885. --- src/p_saveg.c | 8 ++++++++ src/p_setup.c | 3 +++ src/p_tick.c | 20 ++++++-------------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index f0c8c91b5..3c8487984 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -4311,8 +4311,16 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save) } // we don't want the removed mobjs to come back + iquetail = iquehead = 0; P_InitThinkers(); + // Oh my god don't blast random memory with our reference counts. + boss3cap = waypointcap = kitemcap = NULL; + for (i = 0; i <= 15; i++) + { + skyboxcenterpnts[i] = skyboxviewpnts[i] = NULL; + } + // clear sector thinker pointers so they don't point to non-existant thinkers for all of eternity for (i = 0; i < numsectors; i++) { diff --git a/src/p_setup.c b/src/p_setup.c index 819d8434e..e2d0eeabb 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8427,6 +8427,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) memset(localaiming, 0, sizeof(localaiming)); K_InitDirector(); } + + // clear special respawning que + iquehead = iquetail = 0; // Remove the loading shit from the screen if (rendermode != render_none && !titlemapinaction && !reloadinggamestate) diff --git a/src/p_tick.c b/src/p_tick.c index 0616c9b94..fa0dab85e 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -204,24 +204,16 @@ void Command_CountMobjs_f(void) void P_InitThinkers(void) { UINT8 i; - - for (i = 0; i < NUM_THINKERLISTS; i++) - { - thlist[i].prev = thlist[i].next = &thlist[i]; - } - - iquehead = iquetail = 0; - + boss3cap = NULL; waypointcap = NULL; kitemcap = NULL; - - for (i = 0; i <= 15; i++) - { - skyboxcenterpnts[i] = skyboxviewpnts[i] = NULL; - } + P_InvalidateThinkersWithoutInit(); + for (i = 0; i < NUM_THINKERLISTS; i++) + thlist[i].prev = thlist[i].next = &thlist[i]; + + iquehead = iquetail = 0; } - // // P_InvalidateThinkersWithoutInit //