From 01b4cbbeeadfa5882feb6e31ad4b65f09e83d051 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 13 Nov 2024 12:48:44 +0700 Subject: [PATCH] fast exit with Alt-F4 or pressing the close button (#2017) * disable ENDOOM --- src/d_event.h | 6 +----- src/d_main.c | 4 +++- src/d_main.h | 1 + src/i_video.c | 7 ++----- src/mn_menu.c | 16 ---------------- 5 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/d_event.h b/src/d_event.h index eac541da..d1c425f4 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -40,11 +40,7 @@ typedef enum evtype_e ev_joyb_up, ev_joystick, ev_joystick_state, - ev_gyro, - - // Quit event. Triggered when the user clicks the "close" button - // to terminate the application. - ev_quit, + ev_gyro } evtype_t; typedef union evdata_u diff --git a/src/d_main.c b/src/d_main.c index ea084293..70d008d4 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1701,9 +1701,11 @@ static void D_ShowEndDoom(void) I_Endoom(endoom); } +boolean disable_endoom = false; + static boolean AllowEndDoom(void) { - return (exit_sequence == EXIT_SEQUENCE_FULL + return !disable_endoom && (exit_sequence == EXIT_SEQUENCE_FULL || (exit_sequence == EXIT_SEQUENCE_PWAD_ENDOOM && !W_IsIWADLump(W_CheckNumForName("ENDOOM")))); } diff --git a/src/d_main.h b/src/d_main.h index 7427e52b..dda49af9 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -43,6 +43,7 @@ extern boolean clfastparm; // checkparm of -fast void D_SetMaxHealth(void); void D_SetBloodColor(void); +extern boolean disable_endoom; boolean D_AllowQuitSound(void); // Called by IO functions when input is detected. diff --git a/src/i_video.c b/src/i_video.c index f0be6556..1b4b7f9f 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -509,11 +509,8 @@ static void ProcessEvent(SDL_Event *ev) break; case SDL_QUIT: - { - static event_t event; - event.type = ev_quit; - D_PostEvent(&event); - } + disable_endoom = true; + I_SafeExit(0); break; case SDL_WINDOWEVENT: diff --git a/src/mn_menu.c b/src/mn_menu.c index 27087c3e..f23aa6c0 100644 --- a/src/mn_menu.c +++ b/src/mn_menu.c @@ -2892,22 +2892,6 @@ boolean M_Responder(event_t *ev) switch (ev->type) { - // "close" button pressed on window? - case ev_quit: - // First click on close button = bring up quit confirm message. - // Second click on close button = confirm quit - if (menuactive && messageToPrint - && messageRoutine == M_QuitResponse) - { - M_QuitResponse('y'); - } - else - { - M_StartSound(sfx_swtchn); - M_QuitDOOM(0); - } - return true; - case ev_joystick_state: if (menu_input == pad_mode && repeat != MENU_NULL && joywait < I_GetTime())