Unlink non-mobj and non-precip thinkers when loading and freeing

Move globalweather to before P_SpawnSpecials so that specials can properly change weather and have it communicated in savegames
This commit is contained in:
Ashnal 2022-09-29 19:22:53 -04:00
parent c24a0d0a47
commit f8d71450e5
3 changed files with 8 additions and 3 deletions

View file

@ -10331,7 +10331,6 @@ void P_RemoveSavegameMobj(mobj_t *mobj)
thinker_t *thinker = (thinker_t *)mobj; thinker_t *thinker = (thinker_t *)mobj;
thinker_t *next = thinker->next; thinker_t *next = thinker->next;
(next->prev = thinker->prev)->next = next; (next->prev = thinker->prev)->next = next;
R_DestroyLevelInterpolators(thinker);
Z_Free(thinker); Z_Free(thinker);
} }
} }

View file

@ -2677,7 +2677,11 @@ static void P_NetUnArchiveThinkers(void)
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker || currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker) if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker || currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
else else
{
(next->prev = currentthinker->prev)->next = next;
R_DestroyLevelInterpolators(currentthinker);
Z_Free(currentthinker); Z_Free(currentthinker);
}
} }
// we don't want the removed mobjs to come back // we don't want the removed mobjs to come back
@ -3090,6 +3094,7 @@ static inline void P_NetArchiveSpecials(void)
// Sky number // Sky number
WRITEINT32(save_p, globallevelskynum); WRITEINT32(save_p, globallevelskynum);
CONS_Printf("globalweather write %d", globalweather);
// Current global weather type // Current global weather type
WRITEUINT8(save_p, globalweather); WRITEUINT8(save_p, globalweather);
@ -3126,6 +3131,7 @@ static void P_NetUnArchiveSpecials(void)
P_SetupLevelSky(j, true); P_SetupLevelSky(j, true);
globalweather = READUINT8(save_p); globalweather = READUINT8(save_p);
CONS_Printf("globalweather read %d", globalweather);
if (globalweather) if (globalweather)
{ {

View file

@ -3124,14 +3124,14 @@ boolean P_SetupLevel(boolean skipprecip)
if (!playerstarts[numcoopstarts]) if (!playerstarts[numcoopstarts])
break; break;
globalweather = mapheaderinfo[gamemap-1]->weather;
// set up world state // set up world state
P_SpawnSpecials(fromnetsave); P_SpawnSpecials(fromnetsave);
if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame) if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)
P_SpawnPrecipitation(); P_SpawnPrecipitation();
globalweather = mapheaderinfo[gamemap-1]->weather;
#ifdef HWRENDER // not win32 only 19990829 by Kin #ifdef HWRENDER // not win32 only 19990829 by Kin
if (rendermode != render_soft && rendermode != render_none) if (rendermode != render_soft && rendermode != render_none)
{ {