mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 05:41:42 +00:00
relocate savedata code from P_LoadLevel to G_InitNew as well
(this doesn't fix !1064 yet, this just makes the code a bit tidier)
This commit is contained in:
parent
d20ca3d919
commit
77d70aaa1b
2 changed files with 14 additions and 12 deletions
14
src/g_game.c
14
src/g_game.c
|
@ -5061,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].starpostx = players[i].starposty = players[i].starpostz = 0;
|
||||||
players[i].recordscore = 0;
|
players[i].recordscore = 0;
|
||||||
|
|
||||||
|
// default lives, continues and score
|
||||||
if (netgame || multiplayer)
|
if (netgame || multiplayer)
|
||||||
{
|
{
|
||||||
if (!FLS || (players[i].lives < 1))
|
if (!FLS || (players[i].lives < 1))
|
||||||
|
@ -5120,6 +5121,19 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
automapactive = false;
|
automapactive = false;
|
||||||
imcontinuing = 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.
|
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);
|
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer, FLS);
|
||||||
else
|
else
|
||||||
|
|
|
@ -7795,18 +7795,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
R_InitMobjInterpolators();
|
R_InitMobjInterpolators();
|
||||||
P_InitCachedActions();
|
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
|
// internal game map
|
||||||
maplumpname = G_BuildMapName(gamemap);
|
maplumpname = G_BuildMapName(gamemap);
|
||||||
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
|
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
|
||||||
|
|
Loading…
Reference in a new issue