Merge branch 'gamestatereloaded' into 'master'

Gamestate reloaded

See merge request KartKrew/Kart!551
This commit is contained in:
toaster 2022-03-12 19:08:04 +00:00
commit 87fe8f2c9c
4 changed files with 33 additions and 28 deletions

View file

@ -1291,6 +1291,8 @@ static void CL_LoadReceivedSavegame(boolean reloading)
// load a base level // load a base level
if (P_LoadNetGame(reloading)) if (P_LoadNetGame(reloading))
{
if (!reloading)
{ {
CON_LogMessage(va(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap))); CON_LogMessage(va(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)));
@ -1307,6 +1309,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
CON_LogMessage("\"\n"); CON_LogMessage("\"\n");
} }
}
else else
{ {
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));

View file

@ -589,7 +589,7 @@ static void loading_status(void)
sprintf(s, "%d%%", (++ls_percent)<<1); sprintf(s, "%d%%", (++ls_percent)<<1);
x = BASEVIDWIDTH/2; x = BASEVIDWIDTH/2;
y = BASEVIDHEIGHT/2; y = BASEVIDHEIGHT/2;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Black background to match fade in effect V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); // Black background to match fade in effect
//V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright. //V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright.
M_DrawTextBox(x-58, y-8, 13, 1); M_DrawTextBox(x-58, y-8, 13, 1);
V_DrawString(x-50, y, V_YELLOWMAP, "Loading..."); V_DrawString(x-50, y, V_YELLOWMAP, "Loading...");

View file

@ -4496,6 +4496,7 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading)
// tell the sound code to reset the music since we're skipping what // tell the sound code to reset the music since we're skipping what
// normally sets this flag // normally sets this flag
if (!reloading)
mapmusflags |= MUSIC_RELOADRESET; mapmusflags |= MUSIC_RELOADRESET;
G_SetGamestate(READINT16(save_p)); G_SetGamestate(READINT16(save_p));

View file

@ -3943,9 +3943,12 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// will be set by player think. // will be set by player think.
players[consoleplayer].viewz = 1; players[consoleplayer].viewz = 1;
// Cancel all d_main.c fadeouts (keep fade in though).
if (reloadinggamestate)
wipegamestate = gamestate; // Don't fade if reloading the gamestate
// Encore mode fade to pink to white // Encore mode fade to pink to white
// This is handled BEFORE sounds are stopped. // This is handled BEFORE sounds are stopped.
if (encoremode && !prevencoremode && !demo.rewinding) else if (encoremode && !prevencoremode && !demo.rewinding)
{ {
if (rendermode != render_none) if (rendermode != render_none)
{ {
@ -4007,10 +4010,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
} }
// Cancel all d_main.c fadeouts (keep fade in though).
if (reloadinggamestate)
wipegamestate = gamestate; // Don't fade if reloading the gamestate
// Special stage & record attack retry fade to white // Special stage & record attack retry fade to white
// This is handled BEFORE sounds are stopped. // This is handled BEFORE sounds are stopped.
if (G_GetModeAttackRetryFlag()) if (G_GetModeAttackRetryFlag())
@ -4030,14 +4029,15 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
*/ */
// Let's fade to white here
// But only if we didn't do the encore startup wipe
if (!demo.rewinding)
{
// Make sure all sounds are stopped before Z_FreeTags. // Make sure all sounds are stopped before Z_FreeTags.
S_StopSounds(); S_StopSounds();
S_ClearSfx(); S_ClearSfx();
// Let's fade to white here
// But only if we didn't do the encore startup wipe
if (!demo.rewinding && !reloadinggamestate)
{
// Fade out music here. Deduct 2 tics so the fade volume actually reaches 0. // Fade out music here. Deduct 2 tics so the fade volume actually reaches 0.
// But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug. // But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug.
if (!(reloadinggamestate || titlemapinaction)) if (!(reloadinggamestate || titlemapinaction))
@ -4204,9 +4204,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
{ {
P_InitCamera(); P_InitCamera();
memset(localaiming, 0, sizeof(localaiming)); memset(localaiming, 0, sizeof(localaiming));
}
K_InitDirector(); K_InitDirector();
}
wantedcalcdelay = wantedfrequency*2; wantedcalcdelay = wantedfrequency*2;
indirectitemcooldown = 0; indirectitemcooldown = 0;
@ -4226,7 +4225,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_MapEnd(); P_MapEnd();
// Remove the loading shit from the screen // Remove the loading shit from the screen
if (rendermode != render_none && !(titlemapinaction || reloadinggamestate)) if (rendermode != render_none && !titlemapinaction && !reloadinggamestate)
F_WipeColorFill(levelfadecol); F_WipeColorFill(levelfadecol);
if (precache || dedicated) if (precache || dedicated)
@ -4237,7 +4236,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
if (!(netgame || multiplayer || demo.playback) && !majormods) if (!(netgame || multiplayer || demo.playback) && !majormods)
mapvisited[gamemap-1] |= MV_VISITED; mapvisited[gamemap-1] |= MV_VISITED;
else if (netgame || multiplayer) else if (!demo.playback)
mapvisited[gamemap-1] |= MV_MP; // you want to record that you've been there this session, but not permanently mapvisited[gamemap-1] |= MV_MP; // you want to record that you've been there this session, but not permanently
G_AddMapToBuffer(gamemap-1); G_AddMapToBuffer(gamemap-1);
@ -4260,7 +4259,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
lastmaploaded = gamemap; // HAS to be set after saving!! lastmaploaded = gamemap; // HAS to be set after saving!!
} }
if (grandprixinfo.gp == true) if (reloadinggamestate)
;
else if (grandprixinfo.gp == true)
{ {
if (grandprixinfo.initalize == true) if (grandprixinfo.initalize == true)
{ {