- removed the old main loop.

This commit is contained in:
Christoph Oelckers 2020-09-02 23:03:48 +02:00
parent b49e050baf
commit b3d89a6a0b
5 changed files with 1 additions and 113 deletions

View file

@ -136,7 +136,6 @@ void I_SetWindowTitle(const char* caption);
void S_ParseSndInfo(); void S_ParseSndInfo();
void I_DetectOS(void); void I_DetectOS(void);
void LoadScripts(); void LoadScripts();
void app_loop();
void MainLoop(); void MainLoop();
@ -865,7 +864,7 @@ int RunGame()
D_CheckNetGame(); D_CheckNetGame();
MainLoop(); MainLoop();
return 0; // this is never reached. app_loop only exits via exception. return 0; // this is never reached. MainLoop only exits via exception.
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -922,49 +921,6 @@ void updatePauseStatus()
paused ? S_PauseSound(!pausedWithKey, !paused) : S_ResumeSound(paused); paused ? S_PauseSound(!pausedWithKey, !paused) : S_ResumeSound(paused);
} }
void app_loop()
{
gamestate = GS_STARTUP;
while (true)
{
try
{
I_SetFrameTime();
TickSubsystems();
handleevents();
updatePauseStatus();
D_ProcessEvents();
gi->RunGameFrame();
// Draw overlay elements to the 2D drawer
FStat::PrintStat(twod);
CT_Drawer();
C_DrawConsole();
M_Drawer();
// Handle the final 2D overlays.
if (gamestate == GS_LEVEL) DrawFullscreenBlends();
DrawRateStuff();
soundEngine->UpdateSounds(I_GetTime());
Mus_UpdateMusic(); // must be at the end.
videoShowFrame(0);
videoSetBrightness(0); // immediately reset this so that the value doesn't stick around in the backend.
}
catch (CRecoverableError& err)
{
gi->ErrorCleanup();
C_FullConsole();
Printf(TEXTCOLOR_RED "%s\n", err.what());
}
}
}
//========================================================================== //==========================================================================
// //
// //

View file

@ -102,9 +102,6 @@ struct GameInterface
virtual void Ticker() {} virtual void Ticker() {}
virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; } virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; }
virtual void RunGameFrame() {} // this must go away once things are done.
virtual FString statFPS() virtual FString statFPS()
{ {
FString output; FString output;

View file

@ -570,34 +570,6 @@ void GameInterface::Ticker()
CheckProgression(); // todo: Get rid of this. CheckProgression(); // todo: Get rid of this.
} }
void GameTicker()
{
int const currentTic = I_GetTime();
if (paused)
{
buttonMap.ResetButtonStates();
}
else
{
gameupdatetime.Reset();
gameupdatetime.Clock();
while (!EndLevel && currentTic - lastTic >= 1)
{
lastTic = currentTic;
gi->Ticker();
}
gameupdatetime.Unclock();
if (nPlayerLives[nLocalPlayer] <= 0) {
startmainmenu();
}
}
}
void ExitGame() void ExitGame()
{ {
ShutDown(); ShutDown();

View file

@ -234,7 +234,6 @@ struct GameInterface : ::GameInterface
{ {
const char* Name() override { return "Exhumed"; } const char* Name() override { return "Exhumed"; }
void app_init() override; void app_init() override;
void RunGameFrame() override;
bool GenerateSavePic() override; bool GenerateSavePic() override;
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override; void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
void MenuOpened() override; void MenuOpened() override;

View file

@ -250,14 +250,6 @@ void CheckProgression()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GameLoop()
{
GameTicker();
PlayerInterruptKeys(true);
gi->UpdateSounds();
}
void GameInterface::Startup() void GameInterface::Startup()
{ {
resettiming(); resettiming();
@ -280,34 +272,6 @@ void GameInterface::Startup()
} }
void GameInterface::RunGameFrame()
{
again:
CheckProgression();
switch (gamestate)
{
default:
case GS_STARTUP:
break;
case GS_MENUSCREEN:
case GS_FULLCONSOLE:
gi->DrawBackground();
break;
case GS_LEVEL:
GameLoop();
gi->Render();
break;
case GS_INTERMISSION:
case GS_INTRO:
RunScreenJobFrame(); // This handles continuation through its completion callback.
break;
}
}
void GameInterface::ErrorCleanup() void GameInterface::ErrorCleanup()
{ {
// Clear all progression sensitive variables here. // Clear all progression sensitive variables here.