shithub: choc

Download patch

ref: 15f1bce94eec21fe9e11ee7e6745d01ccd4cfa70
parent: 112bc3fcab6654c20bc980a04d377b5b03044067
author: Simon Howard <[email protected]>
date: Thu Oct 20 19:19:32 EDT 2011

Confirm quit game when the window close button is clicked a second time.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2449

--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1310,7 +1310,6 @@
 }
 
 
-
 void M_StopMessage(void)
 {
     menuactive = messageLastMenuActive;
@@ -1447,8 +1446,19 @@
     // "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;
     }
 
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -1066,8 +1066,19 @@
     // "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;
     }
 
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -1162,8 +1162,20 @@
     // "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;
     }
 
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -1686,8 +1686,19 @@
     // "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;
     }