]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - menu.c
illuminated surfaces are now sorted by texture, giving a good fps
[xonotic/darkplaces.git] / menu.c
diff --git a/menu.c b/menu.c
index 5958dcbf88da0eac127dcb129373a6a836bc2cc2..0a403c0627a535ba70ed45d98b6c1e4ada1f1498 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -33,7 +33,7 @@ static cvar_t forceqmenu = { 0, "forceqmenu", "0", "enables the quake menu inste
 static int NehGameType;
 
 enum m_state_e m_state;
-char m_return_reason[32];
+char m_return_reason[128];
 
 void M_Menu_Main_f (void);
        void M_Menu_SinglePlayer_f (void);
@@ -867,10 +867,16 @@ void M_Menu_Save_f (void)
 {
        if (!sv.active)
                return;
+#if 1
+       // LordHavoc: allow saving multiplayer games
+       if (cl.islocalgame && cl.intermission)
+               return;
+#else
        if (cl.intermission)
                return;
        if (!cl.islocalgame)
                return;
+#endif
        m_entersound = true;
        m_state = m_save;
        key_dest = key_menu;
@@ -2519,31 +2525,6 @@ void M_Menu_Keys_f (void)
 
 #define NUMKEYS 5
 
-void M_FindKeysForCommand (const char *command, int *keys)
-{
-       int             count;
-       int             j;
-       char    *b;
-
-       for (j = 0;j < NUMKEYS;j++)
-               keys[j] = -1;
-
-       count = 0;
-
-       for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
-       {
-               b = keybindings[0][j];
-               if (!b)
-                       continue;
-               if (!strcmp (b, command) )
-               {
-                       keys[count++] = j;
-                       if (count == NUMKEYS)
-                               break;
-               }
-       }
-}
-
 static void M_UnbindCommand (char *command)
 {
        int             j;
@@ -2593,7 +2574,7 @@ static void M_Keys_Draw (void)
                else
                        M_Print(16, y, bindnames[i][1]);
 
-               M_FindKeysForCommand (bindnames[i][0], keys);
+               Key_FindKeysForCommand (bindnames[i][0], keys, NUMKEYS, 0);
 
                // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
                if (keys[0] == -1)
@@ -2674,7 +2655,7 @@ static void M_Keys_Key (int k, int ascii)
                break;
 
        case K_ENTER:           // go into bind mode
-               M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
+               Key_FindKeysForCommand (bindnames[keys_cursor][0], keys, NUMKEYS, 0);
                S_LocalSound ("sound/misc/menu2.wav");
                if (keys[NUMKEYS - 1] != -1)
                        M_UnbindCommand (bindnames[keys_cursor][0]);
@@ -5035,6 +5016,10 @@ void M_KeyEvent (int key, int ascii, qboolean downevent)
 
 }
 
+void M_NewMap(void)
+{
+}
+
 void M_Shutdown(void)
 {
        // reset key_dest
@@ -5155,6 +5140,15 @@ void MP_ToggleMenu(int mode)
        PRVM_End;
 }
 
+void MP_NewMap(void)
+{
+       PRVM_Begin;
+       PRVM_SetProg(PRVM_MENUPROG);
+       if (prog->funcoffsets.m_newmap)
+               PRVM_ExecuteProgram(prog->funcoffsets.m_newmap,"m_newmap() required");
+       PRVM_End;
+}
+
 void MP_Shutdown (void)
 {
        PRVM_Begin;
@@ -5217,6 +5211,7 @@ void (*MR_KeyEvent) (int key, int ascii, qboolean downevent);
 void (*MR_Draw) (void);
 void (*MR_ToggleMenu) (int mode);
 void (*MR_Shutdown) (void);
+void (*MR_NewMap) (void);
 
 void MR_SetRouting(qboolean forceold)
 {
@@ -5230,6 +5225,7 @@ void MR_SetRouting(qboolean forceold)
                MR_Draw = M_Draw;
                MR_ToggleMenu = M_ToggleMenu;
                MR_Shutdown = M_Shutdown;
+               MR_NewMap = M_NewMap;
 
                // init
                if(!m_init)
@@ -5247,6 +5243,7 @@ void MR_SetRouting(qboolean forceold)
                MR_Draw = MP_Draw;
                MR_ToggleMenu = MP_ToggleMenu;
                MR_Shutdown = MP_Shutdown;
+               MR_NewMap = MP_NewMap;
 
                if(!mp_init)
                {