]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Added confirm question to "Reset to Defaults" option.
authortomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 18 Sep 2004 17:30:55 +0000 (17:30 +0000)
committertomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 18 Sep 2004 17:30:55 +0000 (17:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4522 d7cf8633-e32d-0410-b094-e92efae38249

menu.c
menu.h

diff --git a/menu.c b/menu.c
index f86ac6950a374920f2ef347e9f70886e20a2f057..474f7edf5aa81a0745a8149d0955d433d9195865 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -43,6 +43,7 @@ void M_Menu_Main_f (void);
        void M_Menu_Options_Graphics_f (void);
        void M_Menu_Options_ColorControl_f (void);
                void M_Menu_Keys_f (void);
        void M_Menu_Options_Graphics_f (void);
        void M_Menu_Options_ColorControl_f (void);
                void M_Menu_Keys_f (void);
+               void M_Menu_Reset_f (void);
                void M_Menu_Video_f (void);
        void M_Menu_Help_f (void);
        void M_Menu_Quit_f (void);
                void M_Menu_Video_f (void);
        void M_Menu_Help_f (void);
        void M_Menu_Quit_f (void);
@@ -61,6 +62,7 @@ void M_Main_Draw (void);
        void M_Options_Graphics_Draw (void);
        void M_Options_ColorControl_Draw (void);
                void M_Keys_Draw (void);
        void M_Options_Graphics_Draw (void);
        void M_Options_ColorControl_Draw (void);
                void M_Keys_Draw (void);
+               void M_Reset_Draw (void);
                void M_Video_Draw (void);
        void M_Help_Draw (void);
        void M_Quit_Draw (void);
                void M_Video_Draw (void);
        void M_Help_Draw (void);
        void M_Quit_Draw (void);
@@ -79,6 +81,7 @@ void M_Main_Key (int key, char ascii);
        void M_Options_Graphics_Key (int key, char ascii);
        void M_Options_ColorControl_Key (int key, char ascii);
                void M_Keys_Key (int key, char ascii);
        void M_Options_Graphics_Key (int key, char ascii);
        void M_Options_ColorControl_Key (int key, char ascii);
                void M_Keys_Key (int key, char ascii);
+               void M_Reset_Key (int key, char ascii);
                void M_Video_Key (int key, char ascii);
        void M_Help_Key (int key, char ascii);
        void M_Quit_Key (int key, char ascii);
                void M_Video_Key (int key, char ascii);
        void M_Help_Key (int key, char ascii);
        void M_Quit_Key (int key, char ascii);
@@ -1422,7 +1425,7 @@ void M_Options_Key (int k, char ascii)
                        Con_ToggleConsole_f ();
                        break;
                case 2:
                        Con_ToggleConsole_f ();
                        break;
                case 2:
-                       Cbuf_AddText ("exec default.cfg\n");
+                       M_Menu_Reset_f ();
                        break;
                case 3:
                        M_Menu_Video_f ();
                        break;
                case 3:
                        M_Menu_Video_f ();
@@ -2365,6 +2368,44 @@ void M_Keys_Key (int k, char ascii)
        }
 }
 
        }
 }
 
+void M_Menu_Reset_f (void)
+{
+       key_dest = key_menu;
+       m_state = m_reset;
+       m_entersound = true;
+}
+
+
+void M_Reset_Key (int key, char ascii)
+{
+       switch (key)
+       {
+       case K_ESCAPE:
+       case 'n':
+       case 'N':
+               m_state = m_options;
+               m_entersound = true;
+               break;
+
+       case 'Y':
+       case 'y':
+               Cbuf_AddText ("exec default.cfg\n");
+               break;
+
+       default:
+               break;
+       }
+}
+
+void M_Reset_Draw (void)
+{
+       int lines = 2, linelength = 20;
+       M_Background(linelength * 8 + 16, lines * 8 + 16);
+       M_DrawTextBox(0, 0, linelength, lines);
+       M_Print(8 + 4 * (linelength - 19),  8, "Really wanna reset?");
+       M_Print(8 + 4 * (linelength - 11), 16, "Press y / n");
+}
+
 //=============================================================================
 /* VIDEO MENU */
 
 //=============================================================================
 /* VIDEO MENU */
 
@@ -3790,6 +3831,7 @@ void M_Init (void)
        Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
        Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
        Cmd_AddCommand ("menu_video", M_Menu_Video_f);
        Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
        Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
        Cmd_AddCommand ("menu_video", M_Menu_Video_f);
+       Cmd_AddCommand ("menu_reset", M_Menu_Reset_f);
        Cmd_AddCommand ("help", M_Menu_Help_f);
        Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
 
        Cmd_AddCommand ("help", M_Menu_Help_f);
        Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
 
@@ -3913,6 +3955,10 @@ void M_Draw (void)
                M_Keys_Draw ();
                break;
 
                M_Keys_Draw ();
                break;
 
+       case m_reset:
+               M_Reset_Draw ();
+               break;
+
        case m_video:
                M_Video_Draw ();
                break;
        case m_video:
                M_Video_Draw ();
                break;
@@ -4003,6 +4049,11 @@ void M_Keydown (int key, char ascii)
                M_Keys_Key (key, ascii);
                return;
 
                M_Keys_Key (key, ascii);
                return;
 
+       case m_reset:
+               M_Reset_Key (key, ascii);
+               return;
+
+
        case m_video:
                M_Video_Key (key, ascii);
                return;
        case m_video:
                M_Video_Key (key, ascii);
                return;
diff --git a/menu.h b/menu.h
index 883bfb508d40acf7c7e5d2447621ebecbbd96da6..1dd8e17e7200d0e18cab813fbde91396995cc626 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -44,7 +44,8 @@ enum m_state_e {
        m_slist,
        m_options_effects,
        m_options_graphics,
        m_slist,
        m_options_effects,
        m_options_graphics,
-       m_options_colorcontrol
+       m_options_colorcontrol,
+       m_reset
 };
 
 extern enum m_state_e m_state;
 };
 
 extern enum m_state_e m_state;