fast exit with Alt-F4 or pressing the close button (#2017)

* disable ENDOOM
This commit is contained in:
Roman Fomin 2024-11-13 12:48:44 +07:00 committed by GitHub
parent 58dcc9da3c
commit 01b4cbbeea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 27 deletions

View File

@ -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

View File

@ -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"))));
}

View File

@ -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.

View File

@ -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:

View File

@ -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())