]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/menu.qc
Merge translatable strings for !1017 (Mario/monsters) early
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / menu.qc
index f374b0a10b2ec780c1252e1afc5ef348c0fe0b35..9331364108cd5a2cfd17429178a5035c69e7793b 100644 (file)
@@ -221,6 +221,8 @@ void m_init_delayed()
        }
 
        if (Menu_Active) m_display();  // delayed menu display
+
+       cvar_set("_menu_initialized", "2");
 }
 
 void m_keyup(float key, float ascii)
@@ -672,14 +674,15 @@ void m_tooltip(vector pos)
        }
 }
 
+const int MIN_DISCONNECTION_TIME = 1;
 float autocvar_menu_force_on_disconnection;
 bool autocvar_g_campaign;
 void m_draw(float width, float height)
 {
-       if (autocvar_menu_force_on_disconnection > 0)
+       static float connected_time;
+       if (clientstate() == CS_DISCONNECTED)
        {
-               static float connected_time;
-               if (clientstate() == CS_DISCONNECTED)
+               if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
                {
                        if (autocvar_g_campaign)
                        {
@@ -689,15 +692,14 @@ void m_draw(float width, float height)
                                cvar_set("g_campaign", "0");
                                m_sync();
                        }
-                       if (connected_time && time - connected_time > autocvar_menu_force_on_disconnection)
-                       {
+                       if (autocvar_menu_force_on_disconnection > 0)
                                m_toggle(true);
-                               connected_time = 0;
-                       }
+                       localcmd("\nmenu_cmd directmenu Welcome RESET\n");
+                       connected_time = 0;
                }
-               else
-                       connected_time = time;
        }
+       else
+               connected_time = time;
 
        m_gamestatus();
 
@@ -969,12 +971,16 @@ void m_goto(string itemname)
                if (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
                {
                        m_hide();
+                       return;
                }
-               else
-               {
-                       m_activate_window(main.mainNexposee);
-                       m_display();
-               }
+               itemname = "nexposee";
+       }
+
+       if (itemname == "nexposee")
+       {
+               // unlike 'togglemenu 1', this closes modal and root dialogs if opened
+               m_activate_window(main.mainNexposee);
+               m_display();
        }
        else
        {