- removed quitevent.

This was some meticulously preserved relic of bad old DOS times used to block OS facilities to close an app.
Since this has been worked around at a lower level already the variable was essentially without function but some quite bad code depended on it.
This commit is contained in:
Christoph Oelckers 2019-12-01 09:02:17 +01:00
parent d8c74a8b00
commit 8a98f9b3ca
12 changed files with 17 additions and 73 deletions

View file

@ -1291,11 +1291,7 @@ RESTART:
ready2send = 1; ready2send = 1;
while (!gQuitGame) while (!gQuitGame)
{ {
if (handleevents() && quitevent) handleevents();
{
inputState.SetKeyStatus(sc_Escape, 1);
quitevent = 0;
}
netUpdate(); netUpdate();
MUSIC_Update(); MUSIC_Update();
inputState.SetBindsEnabled(gInputMode == kInputGame); inputState.SetBindsEnabled(gInputMode == kInputGame);

View file

@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "i_specialpaths.h" #include "i_specialpaths.h"
#include "view.h" #include "view.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "menu/menu.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -293,14 +294,7 @@ void CDemo::ProcessKeys(void)
{ {
switch (nKey) switch (nKey)
{ {
case 1: case sc_F12:
if (!CGameMenuMgr::m_bActive)
{
gGameMenuMgr.Push(&menuMain, -1);
at2 = 1;
}
break;
case 0x58:
gViewIndex = connectpoint2[gViewIndex]; gViewIndex = connectpoint2[gViewIndex];
if (gViewIndex == -1) if (gViewIndex == -1)
gViewIndex = connecthead; gViewIndex = connecthead;
@ -321,21 +315,12 @@ void CDemo::Playback(void)
inputState.SetBindsEnabled(false); inputState.SetBindsEnabled(false);
ready2send = 0; ready2send = 0;
int v4 = 0; int v4 = 0;
if (!CGameMenuMgr::m_bActive)
{
gGameMenuMgr.Push(&menuMain, -1);
at2 = 1;
}
gNetFifoClock = totalclock; gNetFifoClock = totalclock;
gViewMode = 3; gViewMode = 3;
_DEMOPLAYBACK: _DEMOPLAYBACK:
while (at1 && !gQuitGame) while (at1 && !gQuitGame)
{ {
if (handleevents() && quitevent) handleevents();
{
inputState.SetKeyStatus(sc_Escape, 1);
quitevent = 0;
}
MUSIC_Update(); MUSIC_Update();
while (totalclock >= gNetFifoClock && !gQuitGame) while (totalclock >= gNetFifoClock && !gQuitGame)
{ {
@ -407,8 +392,6 @@ _DEMOPLAYBACK:
if (G_FPSLimit()) if (G_FPSLimit())
{ {
viewDrawScreen(); viewDrawScreen();
if (gInputMode == kInputMenu && CGameMenuMgr::m_bActive)
gGameMenuMgr.Draw();
videoNextPage(); videoNextPage();
} }
if (TestBitString(gotpic, 2342)) if (TestBitString(gotpic, 2342))

View file

@ -542,7 +542,7 @@ void netGetPackets(void)
gStartNewGame = 1; gStartNewGame = 1;
break; break;
case 255: case 255:
inputState.SetKeyStatus(sc_Escape, 1); inputState.SetKeyStatus(sc_Escape);
break; break;
} }
} }
@ -1007,11 +1007,13 @@ void netInitialize(bool bConsole)
while (numplayers < gNetPlayers) while (numplayers < gNetPlayers)
{ {
handleevents(); handleevents();
#if 0
if (quitevent) if (quitevent)
{ {
netServerDisconnect(); netServerDisconnect();
QuitGame(); QuitGame();
} }
#endif
if (!bConsole && inputState.GetKeyStatus(sc_Escape)) if (!bConsole && inputState.GetKeyStatus(sc_Escape))
{ {
netServerDisconnect(); netServerDisconnect();
@ -1168,11 +1170,13 @@ void netInitialize(bool bConsole)
while (bWaitServer) while (bWaitServer)
{ {
handleevents(); handleevents();
#if 0
if (quitevent) if (quitevent)
{ {
netClientDisconnect(); netClientDisconnect();
QuitGame(); QuitGame();
} }
#endif
if (!bConsole && inputState.GetKeyStatus(sc_Escape)) if (!bConsole && inputState.GetKeyStatus(sc_Escape))
{ {
netClientDisconnect(); netClientDisconnect();

View file

@ -22,7 +22,7 @@
extern int32_t g_maskDrawMode; extern int32_t g_maskDrawMode;
#endif #endif
extern char quitevent, appactive; extern char appactive;
extern char modechange; extern char modechange;
extern char nogl; extern char nogl;

View file

@ -306,7 +306,6 @@ static int32_t defsparser(scriptfile *script)
} }
#endif #endif
handleevents(); handleevents();
if (quitevent) return 0;
tokn = getatoken(script,basetokens,ARRAY_SIZE(basetokens)); tokn = getatoken(script,basetokens,ARRAY_SIZE(basetokens));
cmdtokptr = script->ltextptr; cmdtokptr = script->ltextptr;
switch (tokn) switch (tokn)

View file

@ -100,7 +100,7 @@ unsigned char syncstate;
int32_t inputchecked = 0; int32_t inputchecked = 0;
bool screenshot_requested; bool screenshot_requested;
char quitevent=0, appactive=1, novideo=0; char appactive=1, novideo=0;
// video // video
static SDL_Surface *sdl_surface/*=NULL*/; static SDL_Surface *sdl_surface/*=NULL*/;

View file

@ -5720,12 +5720,6 @@ static void G_Startup(void)
for (i=0; i<MAXPLAYERS; i++) for (i=0; i<MAXPLAYERS; i++)
g_player[i].pingcnt = 0; g_player[i].pingcnt = 0;
if (quitevent)
{
G_Shutdown();
return;
}
Net_GetPackets(); Net_GetPackets();
if (numplayers > 1) if (numplayers > 1)
@ -6031,8 +6025,6 @@ int GameInterface::app_main()
system_getcvars(); system_getcvars();
if (quitevent) return 4;
if (g_networkMode != NET_DEDICATED_SERVER && validmodecnt > 0) if (g_networkMode != NET_DEDICATED_SERVER && validmodecnt > 0)
{ {
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1) < 0) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1) < 0)
@ -6195,11 +6187,7 @@ MAIN_LOOP_RESTART:
do //main loop do //main loop
{ {
if (gameHandleEvents() && quitevent) gameHandleEvents();
{
inputState.SetKeyStatus(sc_Escape, 1);
quitevent = 0;
}
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
inputState.SetBindsEnabled(!!(myplayer.gm & (MODE_GAME|MODE_DEMO))); inputState.SetBindsEnabled(!!(myplayer.gm & (MODE_GAME|MODE_DEMO)));

View file

@ -432,7 +432,6 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case WM_CLOSE: case WM_CLOSE:
if (mode == TAB_CONFIG) done = 0; if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE; return TRUE;
case WM_DESTROY: case WM_DESTROY:
@ -456,7 +455,6 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
{ {
case WIN_STARTWIN_CANCEL: case WIN_STARTWIN_CANCEL:
if (mode == TAB_CONFIG) done = 0; if (mode == TAB_CONFIG) done = 0;
else quitevent++;
return TRUE; return TRUE;
case WIN_STARTWIN_START: case WIN_STARTWIN_START:
done = 1; done = 1;

View file

@ -7157,12 +7157,6 @@ static void G_Startup(void)
for (i=0; i<MAXPLAYERS; i++) for (i=0; i<MAXPLAYERS; i++)
g_player[i].playerreadyflag = 0; g_player[i].playerreadyflag = 0;
if (quitevent)
{
G_Shutdown();
return;
}
Net_GetPackets(); Net_GetPackets();
if (numplayers > 1) if (numplayers > 1)
@ -7416,8 +7410,6 @@ int GameInterface::app_main()
i = 1-i; i = 1-i;
} }
if (quitevent) return 4;
Anim_Init(); Anim_Init();
const char *defsfile = G_DefFile(); const char *defsfile = G_DefFile();
@ -7628,11 +7620,7 @@ MAIN_LOOP_RESTART:
do //main loop do //main loop
{ {
if (handleevents() && quitevent) handleevents();
{
inputState.SetKeyStatus(sc_Escape, 1);
quitevent = 0;
}
Net_GetPackets(); Net_GetPackets();

View file

@ -320,12 +320,12 @@ playanm(short anim_num)
switch (ANIMnum) switch (ANIMnum)
{ {
case ANIM_INTRO: case ANIM_INTRO:
if (I_GeneralTrigger() || quitevent) if (I_GeneralTrigger())
I_GeneralTriggerClear(); I_GeneralTriggerClear();
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
break; break;
case ANIM_SERP: case ANIM_SERP:
if (I_EscapeTrigger() || quitevent) if (I_EscapeTrigger())
I_EscapeTriggerClear(); I_EscapeTriggerClear();
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
break; break;

View file

@ -842,11 +842,6 @@ void InitGame()
while (initmultiplayerscycle()) while (initmultiplayerscycle())
{ {
handleevents(); handleevents();
if (quitevent)
{
QuitFlag = TRUE;
return;
}
} }
} }
#else #else
@ -1650,7 +1645,6 @@ void LogoLevel(void)
while (TRUE) while (TRUE)
{ {
handleevents(); handleevents();
if (quitevent) { QuitFlag = TRUE; break; }
// taken from top of faketimerhandler // taken from top of faketimerhandler
// limits checks to max of 40 times a second // limits checks to max of 40 times a second
@ -1778,7 +1772,7 @@ void SybexScreen(void)
videoNextPage(); videoNextPage();
ResetKeys(); ResetKeys();
while (!KeyPressed() && !quitevent) handleevents(); while (!KeyPressed()) handleevents();
} }
// CTW REMOVED END // CTW REMOVED END
@ -1961,8 +1955,6 @@ void MenuLevel(void)
handleevents(); handleevents();
OSD_DispatchQueued(); OSD_DispatchQueued();
if (quitevent) QuitFlag = TRUE;
// taken from top of faketimerhandler // taken from top of faketimerhandler
// limits checks to max of 40 times a second // limits checks to max of 40 times a second
if (totalclock >= ototalclock + synctics) if (totalclock >= ototalclock + synctics)
@ -2645,8 +2637,6 @@ void Control()
handleevents(); handleevents();
OSD_DispatchQueued(); OSD_DispatchQueued();
if (quitevent) QuitFlag = TRUE;
NewLevel(); NewLevel();
} }
@ -2903,8 +2893,6 @@ void RunLevel(void)
D_ProcessEvents(); D_ProcessEvents();
faketimerhandler(); faketimerhandler();
if (quitevent) QuitFlag = TRUE;
MoveLoop(); MoveLoop();

View file

@ -631,7 +631,7 @@ waitforeverybody(void)
handleevents(); handleevents();
getpackets(); getpackets();
if (quitevent || (wfe_ExitCallback && wfe_ExitCallback())) if (wfe_ExitCallback && wfe_ExitCallback()))
{ {
// allow exit // allow exit
//if (inputState.GetKeyStatus(KEYSC_ESC)) //if (inputState.GetKeyStatus(KEYSC_ESC))