Set GS_LEVEL after level load, set GS_WAITINGFORPLAYERS during level transition if GS_LEVEL is current GS

This commit is contained in:
JugadorXEI 2021-05-28 16:32:21 +02:00
parent dfc942a628
commit 733cf20a10
2 changed files with 15 additions and 9 deletions

View file

@ -1597,9 +1597,9 @@ void D_SRB2Main(void)
{ {
pagename = "TITLESKY"; pagename = "TITLESKY";
levelstarttic = gametic; levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false)) if (!P_SetupLevel(false))
I_Quit(); // fail so reset game stuff I_Quit(); // fail so reset game stuff
G_SetGamestate(GS_LEVEL);
} }
#ifdef HAVE_DISCORDRPC #ifdef HAVE_DISCORDRPC

View file

@ -1733,14 +1733,12 @@ void G_DoLoadLevel(boolean resetplayer)
Y_EndIntermission(); Y_EndIntermission();
if (gamestate == GS_VOTING) if (gamestate == GS_VOTING)
Y_EndVote(); Y_EndVote();
// Don't allow people to download a partial/corrupted
G_SetGamestate(GS_LEVEL); // save while the server's loading the map/during the wipe.
// (this addresses "map" command usage, which means
for (i = 0; i < MAXPLAYERS; i++) // transitions/different gamestates would be skipped.)
{ if (gamestate == GS_LEVEL)
if (resetplayer || (playeringame[i] && players[i].playerstate == PST_DEAD)) gamestate = GS_WAITINGPLAYERS;
players[i].playerstate = PST_REBORN;
}
// Setup the level. // Setup the level.
if (!P_SetupLevel(false)) if (!P_SetupLevel(false))
@ -1750,6 +1748,14 @@ void G_DoLoadLevel(boolean resetplayer)
return; return;
} }
G_SetGamestate(GS_LEVEL);
for (i = 0; i < MAXPLAYERS; i++)
{
if (resetplayer || (playeringame[i] && players[i].playerstate == PST_DEAD))
players[i].playerstate = PST_REBORN;
}
if (!resetplayer) if (!resetplayer)
P_FindEmerald(); P_FindEmerald();