diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1b987bcf1..6cf519147 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2146,12 +2146,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) if (demoplayback && !timingdemo) precache = false; - if (resetplayer && !FLS) - { - emeralds = 0; - memset(&luabanks, 0, sizeof(luabanks)); - } - if (modeattacking) { SetPlayerSkinByNum(0, cv_chooseskin.value-1); diff --git a/src/g_game.c b/src/g_game.c index b8c434998..f4e84512b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5048,6 +5048,12 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0; countdown = countdown2 = exitfadestarted = 0; + if (!FLS) + { + emeralds = 0; + memset(&luabanks, 0, sizeof(luabanks)); + } + for (i = 0; i < MAXPLAYERS; i++) { players[i].playerstate = PST_REBORN; @@ -5055,6 +5061,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean players[i].starpostx = players[i].starposty = players[i].starpostz = 0; players[i].recordscore = 0; + // default lives, continues and score if (netgame || multiplayer) { if (!FLS || (players[i].lives < 1)) @@ -5114,6 +5121,19 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean automapactive = false; imcontinuing = false; + // fetch saved data if available + if (savedata.lives > 0) + { + numgameovers = savedata.numgameovers; + players[consoleplayer].continues = savedata.continues; + players[consoleplayer].lives = savedata.lives; + players[consoleplayer].score = savedata.score; + if ((botingame = ((botskin = savedata.botskin) != 0))) + botcolor = skins[botskin-1].prefcolor; + emeralds = savedata.emeralds; + savedata.lives = 0; + } + if ((gametyperules & GTR_CUTSCENES) && !skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking && !(marathonmode & MA_NOCUTSCENES)) // Start a custom cutscene. F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer, FLS); else diff --git a/src/m_menu.c b/src/m_menu.c index 21ba98dd2..e10bb7547 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7100,9 +7100,6 @@ static void M_DestroyRobots(INT32 choice) static void M_LevelSelectWarp(INT32 choice) { - boolean fromloadgame = (currentMenu == &SP_LevelSelectDef); - boolean frompause = (currentMenu == &SP_PauseLevelSelectDef); - (void)choice; if (W_CheckNumForName(G_BuildMapName(cv_nextmap.value)) == LUMPERROR) @@ -7114,25 +7111,12 @@ static void M_LevelSelectWarp(INT32 choice) startmap = (INT16)(cv_nextmap.value); fromlevelselect = true; - if (fromloadgame) - G_LoadGame((UINT32)cursaveslot, startmap); + if (currentMenu == &SP_LevelSelectDef || currentMenu == &SP_PauseLevelSelectDef) + G_LoadGame((UINT32)cursaveslot, startmap); // reload from SP save data: this is needed to keep score/lives/continues from reverting to defaults else { cursaveslot = 0; - - if (frompause) - { - M_ClearMenus(true); - - G_DeferedInitNew(false, G_BuildMapName(startmap), cv_skin.value, false, fromlevelselect); // Not sure about using cv_skin here, but it seems fine in testing. - COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this - - if (levelselect.rows) - Z_Free(levelselect.rows); - levelselect.rows = NULL; - } - else - M_SetupChoosePlayer(0); + M_SetupChoosePlayer(0); } } diff --git a/src/p_setup.c b/src/p_setup.c index 175ab3328..aac02417d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7795,18 +7795,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) R_InitMobjInterpolators(); P_InitCachedActions(); - if (!fromnetsave && savedata.lives > 0) - { - numgameovers = savedata.numgameovers; - players[consoleplayer].continues = savedata.continues; - players[consoleplayer].lives = savedata.lives; - players[consoleplayer].score = savedata.score; - if ((botingame = ((botskin = savedata.botskin) != 0))) - botcolor = skins[botskin-1].prefcolor; - emeralds = savedata.emeralds; - savedata.lives = 0; - } - // internal game map maplumpname = G_BuildMapName(gamemap); lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);