diff options
author | Simon Howard | 2014-03-27 22:44:19 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-27 22:44:19 -0400 |
commit | 840e87ce39fe2319cbcfc4ff97c2781ce36e5549 (patch) | |
tree | e93189d537f2c8fe440c85c6c39f1e2a4df9a2b7 | |
parent | cea768a93430b1823cc3d2e683282833b70b75f1 (diff) | |
download | chocolate-doom-840e87ce39fe2319cbcfc4ff97c2781ce36e5549.tar.gz chocolate-doom-840e87ce39fe2319cbcfc4ff97c2781ce36e5549.tar.bz2 chocolate-doom-840e87ce39fe2319cbcfc4ff97c2781ce36e5549.zip |
hexen: Allow abort on startup by pressing escape.
Vanilla Hexen allows the game startup to be aborted by pressing the
escape key. This can also be used to abort netgame startup. Add back
this functionality by polling the SDL event loop; this feature only
works if the graphical startup is enabled, but that's good enough.
-rw-r--r-- | src/hexen/d_net.c | 4 | ||||
-rw-r--r-- | src/hexen/st_start.c | 8 | ||||
-rw-r--r-- | src/i_videohr.c | 23 | ||||
-rw-r--r-- | src/i_videohr.h | 1 |
4 files changed, 31 insertions, 5 deletions
diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index f3b7766e..5c64f7ed 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -33,6 +33,7 @@ #include "i_system.h" #include "i_timer.h" #include "i_video.h" +#include "i_videohr.h" #include "h2def.h" #include "p_local.h" #include "s_sound.h" @@ -239,7 +240,8 @@ static boolean StartupProgress(int now_ready, int total) ready = now_ready; - return true; + // Allow the user to hit escape during netgame startup to abort. + return !I_CheckAbortHR(); } // diff --git a/src/hexen/st_start.c b/src/hexen/st_start.c index 58df878e..b8cf389a 100644 --- a/src/hexen/st_start.c +++ b/src/hexen/st_start.c @@ -204,11 +204,11 @@ void ST_UpdateNetNotches(int notchPosition) void ST_Progress(void) { - // haleyjd FIXME: any way to get input here? SDL event loop? -#ifdef __WATCOMC__ // Check for ESC press -- during startup all events eaten here - I_StartupReadKeys(); -#endif + if (I_CheckAbortHR()) + { + I_Quit(); + } if (using_graphical_startup) { diff --git a/src/i_videohr.c b/src/i_videohr.c index 94fc5309..5a491def 100644 --- a/src/i_videohr.c +++ b/src/i_videohr.c @@ -220,3 +220,26 @@ void I_BlackPaletteHR(void) I_SetPaletteHR(blackpal); } +// Check if the user has hit the escape key to abort startup. +boolean I_CheckAbortHR(void) +{ + SDL_Event ev; + boolean result = false; + + // Not initialized? + if (hr_surface == NULL) + { + return false; + } + + while (SDL_PollEvent(&ev)) + { + if (ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_ESCAPE) + { + result = true; + } + } + + return result; +} + diff --git a/src/i_videohr.h b/src/i_videohr.h index 5de5158f..12b2abf4 100644 --- a/src/i_videohr.h +++ b/src/i_videohr.h @@ -37,6 +37,7 @@ void I_InitPaletteHR(void); void I_SetPaletteHR(const byte *palette); void I_FadeToPaletteHR(const byte *palette); void I_BlackPaletteHR(void); +boolean I_CheckAbortHR(void); #endif /* #ifndef I_VIDEOHR_H */ |