]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/menu.qc
Merge remote-tracking branch 'origin/divVerent/allow-override-item-model'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / menu.qc
index c8c3b62f4f61225c1493722248c19016eeaa15d5..536295fc2f479f66dbdd08641c10a4a49330bac6 100644 (file)
@@ -18,6 +18,14 @@ float menuMouseMode;
 
 void SUB_Null() { }
 
+void m_sync()
+{
+       updateCompression();
+       updateConwidths();
+
+       loadAllCvars(main);
+}
+
 void m_init()
 {
        cvar_set("_menu_alpha", "0");
@@ -42,6 +50,10 @@ void m_init()
                        dprint(s, ": ", getgamedirinfo(i, GETGAMEDIRINFO_DESCRIPTION));
                }
        }
+
+       // needs to be done so early because of the constants they create
+       RegisterWeapons();
+       RegisterGametypes();
 }
 
 float MENU_ASPECT = 1.25; // 1280x1024
@@ -108,9 +120,6 @@ void m_init_delayed()
        if(!preMenuInit())
                return;
        menuInitialized = 1;
-       GameCommand_Init();
-
-       RegisterWeapons();
 
        fh = -1;
        if(cvar_string("menu_skin") != "")
@@ -169,6 +178,8 @@ void m_init_delayed()
        menuShiftState = 0;
        menuMousePos = '0.5 0.5 0';
 
+       m_sync();
+
        if(Menu_Active)
                m_display(); // delayed menu display
 }
@@ -809,15 +820,23 @@ void m_hide()
        main.hideNotify(main);
 }
 
-void m_toggle()
+void m_toggle(float mode)
 {
        if(Menu_Active)
+       {
+               if (mode == 1)
+                       return;
                m_hide();
+       }
        else
+       {
+               if (mode == 0)
+                       return;
                m_display();
+       }
 }
 
-void m_shutdown()
+void Shutdown()
 {
        entity e;
 
@@ -901,7 +920,7 @@ void m_goto(string itemname)
        }
        else
        {
-               for(e = NULL; (e = findstring(e, name, itemname)); )
+               for(e = NULL; (e = find(e, name, itemname)); )
                        if(e.classname != "vtbl")
                                break;
                if(e)