From f97fe4bd65bab49d55cdcdcbe47a8f72fa57e37e Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 24 Jun 2024 21:28:07 +0200 Subject: [PATCH] Test: Restore save_p after P_LoadLevel P_LoadLevel calls some functions that save gamedata and unset save_p. this is kinda hacky but i perhaps will port the redone save buffer sometime --- src/p_saveg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 1d2d8908a..3c1b1c2f2 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3362,6 +3362,7 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(boolean reloading) { UINT32 pig; INT32 i; + UINT8 *old_save_p; if (READUINT32(save_p) != ARCHIVEBLOCK_MISC) I_Error("Bad $$$.sav at archive block Misc"); @@ -3399,12 +3400,17 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(boolean reloading) encoremode = (boolean)READUINT8(save_p); + // FIXME: save_p should not be global!!! + old_save_p = save_p; + if (!P_SetupLevel(true, reloading)) { CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); return false; } + save_p = old_save_p; + // get the time leveltime = READUINT32(save_p); totalrings = READUINT32(save_p);