In case a requested quick load upon death cannot be completed, perform a pistol start instead of doing nothing

git-svn-id: https://svn.eduke32.com/eduke32@6761 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-03-11 03:47:11 +00:00
parent 491783d81e
commit 1460dec6d8
5 changed files with 27 additions and 11 deletions

View file

@ -4952,7 +4952,8 @@ FAKE_F3:
KB_FlushKeyboardQueue();
KB_ClearKeysDown();
S_PauseSounds(1);
G_LoadPlayerMaybeMulti(*g_quickload);
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
g_quickload->reset();
}
}

View file

@ -1095,8 +1095,11 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags, int32_t cons
KB_ClearKeysDown();
FX_StopAllSounds();
S_ClearSoundLocks();
G_LoadPlayerMaybeMulti(*g_quickload);
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
{
g_quickload->reset();
goto QuickLoadFailure;
}
}
else if (!(resetFlags & 1))
{
@ -1106,7 +1109,11 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags, int32_t cons
Menu_Change(MENU_RESETPLAYER);
}
}
else g_player[playerNum].ps->gm = MODE_RESTART;
else
{
QuickLoadFailure:
g_player[playerNum].ps->gm = MODE_RESTART;
}
#if !defined LUNATIC
vmFlags |= VM_NOEXECUTE;
#endif

View file

@ -3469,17 +3469,22 @@ static void Menu_Verify(int32_t input)
break;
case MENU_RESETPLAYER:
if (input)
switch (input)
{
default:
KB_FlushKeyboardQueue();
KB_ClearKeysDown();
FX_StopAllSounds();
S_ClearSoundLocks();
G_LoadPlayerMaybeMulti(*g_quickload);
}
else
{
if (G_LoadPlayerMaybeMulti(*g_quickload) == 0)
break;
// error state, consider as a no instead of yes
g_quickload->reset();
fallthrough__;
case 0:
if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
{
if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
@ -3487,6 +3492,7 @@ static void Menu_Verify(int32_t input)
}
Menu_Change(MENU_CLOSE);
break;
}
break;

View file

@ -615,7 +615,7 @@ saveproblem:
return -1;
}
void G_LoadPlayerMaybeMulti(savebrief_t & sv)
int32_t G_LoadPlayerMaybeMulti(savebrief_t & sv)
{
if (g_netServer || ud.multimode > 1)
{
@ -623,12 +623,14 @@ void G_LoadPlayerMaybeMulti(savebrief_t & sv)
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
// g_player[myconnectindex].ps->gm = MODE_GAME;
return 127;
}
else
{
int32_t c = G_LoadPlayer(sv);
if (c == 0)
g_player[myconnectindex].ps->gm = MODE_GAME;
return c;
}
}

View file

@ -123,7 +123,7 @@ int32_t G_LoadPlayer(savebrief_t & sv);
int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh);
void ReadSaveGameHeaders(void);
void G_SavePlayerMaybeMulti(savebrief_t & sv, bool isAutoSave = false);
void G_LoadPlayerMaybeMulti(savebrief_t & sv);
int32_t G_LoadPlayerMaybeMulti(savebrief_t & sv);
#ifdef YAX_ENABLE
extern void sv_postyaxload(void);