diff options
-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 */ |