Revert "- Tidy up autosaving for all the games."

This reverts commit 10445635cf.

Contrary to what the reverted commit states, it is absolutely essential to have this delay. Duke and Blood initialize a lot of things in their first tick that are necessary before the world is stable to save.
This commit is contained in:
Christoph Oelckers 2023-05-14 09:39:13 +02:00
parent 5d4e6696ca
commit 6e060c2e83
6 changed files with 14 additions and 3 deletions

View file

@ -146,9 +146,11 @@ void G_BuildTiccmd(ticcmd_t* cmd)
//
//
//==========================================================================
bool newGameStarted;
void NewGame(MapRecord* map, int skill, bool ns = false)
{
newGameStarted = true;
ShowIntermission(nullptr, map, nullptr, [=](bool) {
gi->NewGame(map, skill, ns);
gameaction = ga_level;
@ -203,7 +205,6 @@ static void GameTicker()
gameaction = ga_level;
gi->NextLevel(g_nextmap, g_nextskill);
ResetStatusBar();
M_Autosave();
break;
case ga_newgame:
@ -258,6 +259,11 @@ static void GameTicker()
G_DoLoadGame();
break;
case ga_autosave:
if (gamestate == GS_LEVEL && !newGameStarted) M_Autosave();
newGameStarted = false;
break;
case ga_level:
Net_ClearFifo();
inputState.ClearAllInput();

View file

@ -469,6 +469,7 @@ void GameInterface::Ticker()
gFrameCount++;
PlayClock += kTicsPerFrame;
if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
for (int i = 0; i < 8; i++)
{

View file

@ -105,6 +105,7 @@ void GameInterface::Ticker()
r_NoInterpolate = false;
PlayClock+= 4; // This must be at the end of this block so that the first tic receives a value of 0!
if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
}
else r_NoInterpolate = true;

View file

@ -334,6 +334,7 @@ void GameInterface::Ticker()
GameMove();
PlayClock += 4;
if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
r_NoInterpolate = false;
}
else
@ -514,7 +515,7 @@ void EraseScreen(int nVal)
bool GameInterface::CanSave()
{
return !bRecord && !bPlayback && !bInDemo && nTotalPlayers == 1 && nFreeze == 0;
return gamestate == GS_LEVEL && !bRecord && !bPlayback && !bInDemo && nTotalPlayers == 1 && nFreeze == 0;
}
::GameStats GameInterface::getStats()

View file

@ -86,7 +86,7 @@ void GameInterface::MenuSound(EMenuSounds snd)
bool GameInterface::CanSave()
{
return (!CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !(Player[myconnectindex].Flags & PF_DEAD));
return (gamestate == GS_LEVEL && !CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !(Player[myconnectindex].Flags & PF_DEAD));
}
//---------------------------------------------------------------------------

View file

@ -6892,6 +6892,8 @@ void domovethings(void)
return;
}
if (PlayClock == synctics) gameaction = ga_autosave; // let the game run for 1 frame before saving.
thinktime.Reset();
thinktime.Clock();