mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 22:01:01 +00:00
Merge branch 'resetplayer-rodeo' into 'next'
Fix #1064 Closes #1064 See merge request STJr/SRB2!2081
This commit is contained in:
commit
e442dc262e
4 changed files with 23 additions and 37 deletions
|
@ -2146,12 +2146,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||||
if (demoplayback && !timingdemo)
|
if (demoplayback && !timingdemo)
|
||||||
precache = false;
|
precache = false;
|
||||||
|
|
||||||
if (resetplayer && !FLS)
|
|
||||||
{
|
|
||||||
emeralds = 0;
|
|
||||||
memset(&luabanks, 0, sizeof(luabanks));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modeattacking)
|
if (modeattacking)
|
||||||
{
|
{
|
||||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||||
|
|
20
src/g_game.c
20
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;
|
numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
||||||
countdown = countdown2 = exitfadestarted = 0;
|
countdown = countdown2 = exitfadestarted = 0;
|
||||||
|
|
||||||
|
if (!FLS)
|
||||||
|
{
|
||||||
|
emeralds = 0;
|
||||||
|
memset(&luabanks, 0, sizeof(luabanks));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
players[i].playerstate = PST_REBORN;
|
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].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))
|
||||||
|
@ -5114,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
|
||||||
|
|
20
src/m_menu.c
20
src/m_menu.c
|
@ -7100,9 +7100,6 @@ static void M_DestroyRobots(INT32 choice)
|
||||||
|
|
||||||
static void M_LevelSelectWarp(INT32 choice)
|
static void M_LevelSelectWarp(INT32 choice)
|
||||||
{
|
{
|
||||||
boolean fromloadgame = (currentMenu == &SP_LevelSelectDef);
|
|
||||||
boolean frompause = (currentMenu == &SP_PauseLevelSelectDef);
|
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
||||||
if (W_CheckNumForName(G_BuildMapName(cv_nextmap.value)) == LUMPERROR)
|
if (W_CheckNumForName(G_BuildMapName(cv_nextmap.value)) == LUMPERROR)
|
||||||
|
@ -7114,24 +7111,11 @@ static void M_LevelSelectWarp(INT32 choice)
|
||||||
startmap = (INT16)(cv_nextmap.value);
|
startmap = (INT16)(cv_nextmap.value);
|
||||||
fromlevelselect = true;
|
fromlevelselect = true;
|
||||||
|
|
||||||
if (fromloadgame)
|
if (currentMenu == &SP_LevelSelectDef || currentMenu == &SP_PauseLevelSelectDef)
|
||||||
G_LoadGame((UINT32)cursaveslot, startmap);
|
G_LoadGame((UINT32)cursaveslot, startmap); // reload from SP save data: this is needed to keep score/lives/continues from reverting to defaults
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cursaveslot = 0;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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