- moved the main event processing functions into the global main loop.

Now, with all the Build timer stuff removed these calls were all identical between games.
This commit is contained in:
Christoph Oelckers 2020-08-26 16:47:30 +02:00
parent a9f556c1bd
commit b76168f673
9 changed files with 37 additions and 56 deletions

View file

@ -890,19 +890,15 @@ static void commonTicker()
void GameInterface::RunGameFrame()
{
if (gamestate == GS_STARTUP) gameInit();
commonTicker();
netGetPackets();
handleevents();
updatePauseStatus();
D_ProcessEvents();
ctrlGetInput();
switch (gamestate)
{
default:
case GS_STARTUP:
gameInit();
if (userConfig.CommandMap.IsNotEmpty())
{
}

View file

@ -905,6 +905,31 @@ void TickSubsystems()
if (cnt == 5) nexttick = nowtick + tickInterval;
}
static void updatePauseStatus()
{
if (M_Active() || System_WantGuiCapture())
{
paused = 1;
}
else if (!M_Active() || !System_WantGuiCapture())
{
if (!pausedWithKey)
{
paused = 0;
}
if (sendPause)
{
sendPause = false;
paused = pausedWithKey ? 0 : 2;
pausedWithKey = !!paused;
}
}
paused ? S_PauseSound(!pausedWithKey, !paused) : S_ResumeSound(paused);
}
void app_loop()
{
gamestate = GS_STARTUP;
@ -918,6 +943,10 @@ void app_loop()
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
I_SetFrameTime();
handleevents();
updatePauseStatus();
D_ProcessEvents();
gi->RunGameFrame();
// Draw overlay elements to the 2D drawer
@ -1182,30 +1211,6 @@ bool CheckCheatmode(bool printmsg)
return gi->CheatAllowed(printmsg);
}
void updatePauseStatus()
{
if (M_Active() || System_WantGuiCapture())
{
paused = 1;
}
else if (!M_Active() || !System_WantGuiCapture())
{
if (!pausedWithKey)
{
paused = 0;
}
if (sendPause)
{
sendPause = false;
paused = pausedWithKey ? 0 : 2;
pausedWithKey = !!paused;
}
}
paused ? S_PauseSound(!pausedWithKey, !paused) : S_ResumeSound(paused);
}
bool OkForLocalization(FTextureID texnum, const char* substitute)
{
return false;

View file

@ -205,8 +205,6 @@ enum
PAUSESFX_CONSOLE = 2
};
void updatePauseStatus();
void updatePauseStatus(bool state, bool multiplayer);
extern int paused;
extern int chatmodeon;

View file

@ -201,12 +201,6 @@ void ShutDown(void)
//UnInitFX();
}
void HandleAsync()
{
handleevents();
}
static bool HollyCheat(cheatseq_t* c)
{
// Do the closest thing to this cheat that's available.

View file

@ -76,10 +76,6 @@ enum GameFunction_t
#define kTimerTicks 120
#ifdef __WATCOMC__
void handleevents();
#endif
enum basepal_t {
BASEPAL = 0,
ANIMPAL,
@ -127,7 +123,6 @@ void StatusMessage(int messageTime, const char *fmt, ...);
int DoSpiritHead();
void HandleAsync();
void CheckKeys();
void CheckKeys2();
void GameTicker();

View file

@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "c_console.h"
#include "cheathandler.h"
#include "statistics.h"
#include "g_input.h"
#include "core/menu/menu.h"
BEGIN_PS_NS
@ -83,7 +84,11 @@ static int FinishLevel(TArray<JobDesc> &jobs)
// There's really no choice but to enter an active wait loop here to make the sound play out.
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
int nTicks = gameclock + 12;
while (nTicks > gameclock) { HandleAsync(); }
while (nTicks > gameclock)
{
I_GetEvent();
soundEngine->UpdateSounds(I_GetTime());
}
}
}
else nPlayerLives[0] = 0;
@ -263,9 +268,6 @@ void GameInterface::RunGameFrame()
again:
try
{
HandleAsync();
updatePauseStatus();
D_ProcessEvents();
CheckProgression();
switch (gamestate)
{

View file

@ -159,9 +159,7 @@ void PlayerInterruptKeys()
if (paused)
return;
D_ProcessEvents();
localInput = {};
localInput = {};
PlayerInput input {};
if (PlayerList[nLocalPlayer].nHealth == 0)

View file

@ -399,9 +399,6 @@ void startmainmenu()
void GameInterface::RunGameFrame()
{
handleevents();
updatePauseStatus();
D_ProcessEvents();
switch (gamestate)
{
default:

View file

@ -812,10 +812,6 @@ void GameInterface::RunGameFrame()
{
// if the menu initiazed a new game or loaded a savegame, switch to play mode.
if (SavegameLoaded || NextLevel) gamestate = GS_LEVEL;
handleevents();
updatePauseStatus();
D_ProcessEvents();
DoUpdateSounds();
switch (gamestate)
{