]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/menu.qc
restart menu when having turned "" to "en" to make menu.dat.en.po apply
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / menu.qc
index f5c0f6da5d2b36fdce817b36a8e4d483272a8a7f..c46069a3c436297cdaeb1ff8f23ba5d9a28df171 100644 (file)
@@ -29,7 +29,15 @@ void m_sync()
 void m_init()
 {
        cvar_set("_menu_alpha", "0");
-       prvm_language = strzone(cvar_string("prvm_language"));
+       prvm_language = cvar_string("prvm_language");
+       if(prvm_language == "")
+       {
+               prvm_language = "en";
+               cvar_set("prvm_language", prvm_language);
+               localcmd("\nmenu_restart; togglemenu\n");
+       }
+       prvm_language = strzone(prvm_language);
+       cvar_set("_menu_prvm_language", prvm_language);
 
        check_unacceptable_compiler_bugs();
 
@@ -50,6 +58,17 @@ void m_init()
                        dprint(s, ": ", getgamedirinfo(i, GETGAMEDIRINFO_DESCRIPTION));
                }
        }
+
+       // needs to be done so early because of the constants they create
+       RegisterWeapons();
+       RegisterGametypes();
+
+       float ddsload = cvar("r_texture_dds_load");
+       float texcomp = cvar("gl_texturecompression");
+       updateCompression();
+       if(ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression"))
+               localcmd("\nr_restart\n");
+       initConwidths();
 }
 
 float MENU_ASPECT = 1.25; // 1280x1024
@@ -116,9 +135,6 @@ void m_init_delayed()
        if(!preMenuInit())
                return;
        menuInitialized = 1;
-       GameCommand_Init();
-
-       RegisterWeapons();
 
        fh = -1;
        if(cvar_string("menu_skin") != "")
@@ -615,6 +631,8 @@ void m_draw()
        float t;
        float realFrametime;
 
+       execute_next_frame();
+
        menuMouseMode = cvar("menu_mouse_absolute");
 
        if (anim)
@@ -819,15 +837,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;
 
@@ -911,7 +937,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)