From 15f1bce94eec21fe9e11ee7e6745d01ccd4cfa70 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 20 Oct 2011 23:19:32 +0000 Subject: Confirm quit game when the window close button is clicked a second time. Subversion-branch: /branches/v2-branch Subversion-revision: 2449 --- src/doom/m_menu.c | 16 +++++++++++++--- src/heretic/mn_menu.c | 15 +++++++++++++-- src/hexen/mn_menu.c | 16 ++++++++++++++-- src/strife/m_menu.c | 15 +++++++++++++-- 4 files changed, 53 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index bae11cc8..a21060b1 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -1310,7 +1310,6 @@ M_StartMessage } - void M_StopMessage(void) { menuactive = messageLastMenuActive; @@ -1447,8 +1446,19 @@ boolean M_Responder (event_t* ev) // "close" button pressed on window? if (ev->type == ev_quit) { - S_StartSound(NULL,sfx_swtchn); - M_QuitDOOM(0); + // 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(key_menu_confirm); + } + else + { + S_StartSound(NULL,sfx_swtchn); + M_QuitDOOM(0); + } + return true; } diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 4db108cf..bba0da5c 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -1066,8 +1066,19 @@ boolean MN_Responder(event_t * event) // "close" button pressed on window? if (event->type == ev_quit) { - SCQuitGame(0); - S_StartSound(NULL, sfx_chat); + // First click on close = bring up quit confirm message. + // Second click = confirm quit. + + if (!MenuActive && askforquit && typeofask == 1) + { + G_CheckDemoStatus(); + I_Quit(); + } + else + { + SCQuitGame(0); + S_StartSound(NULL, sfx_chat); + } return true; } diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c index 0bd942a4..94f6b1a3 100644 --- a/src/hexen/mn_menu.c +++ b/src/hexen/mn_menu.c @@ -1162,8 +1162,20 @@ boolean MN_Responder(event_t * event) // "close" button pressed on window? if (event->type == ev_quit) { - SCQuitGame(0); - S_StartSound(NULL, SFX_CHAT); + // First click on close = bring up quit confirm message. + // Second click = confirm quit. + + if (!MenuActive && askforquit && typeofask == 1) + { + G_CheckDemoStatus(); + I_Quit(); + } + else + { + SCQuitGame(0); + S_StartSound(NULL, SFX_CHAT); + } + return true; } diff --git a/src/strife/m_menu.c b/src/strife/m_menu.c index 1593bdf2..2fa63abc 100644 --- a/src/strife/m_menu.c +++ b/src/strife/m_menu.c @@ -1686,8 +1686,19 @@ boolean M_Responder (event_t* ev) // "close" button pressed on window? if (ev->type == ev_quit) { - S_StartSound(NULL, sfx_swtchn); - M_QuitStrife(0); + // 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(key_menu_confirm); + } + else + { + S_StartSound(NULL, sfx_swtchn); + M_QuitStrife(0); + } + return true; } -- cgit v1.2.3