]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/menu.qc
Merge branch 'master' into Mario/fullbright_skins
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / menu.qc
index bde7fbe281ce1423e7dc4448ec7ca0e8ebc2dafd..96d98b9c502149cfe54d18461cbc08ec9ff0c1e6 100644 (file)
@@ -588,9 +588,11 @@ void m_tooltip(vector pos)
 
                                        int i = 0;
                                        float w = 0;
-                                       for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; ++i)
+                                       for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining && i <= 16; ++i)
                                        {
                                                string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
+                                               if (i == 16)
+                                                       s = "...";
                                                float f = draw_TextWidth(s, false, fontsize);
                                                if (f > w) w = f;
                                        }
@@ -660,18 +662,36 @@ void m_tooltip(vector pos)
                        p = menuTooltipOrigin;
                        p.x += SKINMARGIN_TOOLTIP_x / conwidth;
                        p.y += SKINMARGIN_TOOLTIP_y / conheight;
-                       for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; p.y += fontsize.y)
+                       int i = 0;
+                       for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining && i <= 16; ++i, p.y += fontsize.y)
                        {
                                string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
+                               if (i == 16)
+                                       s = "...";
                                draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false);
                        }
                }
        }
 }
 
+float autocvar_menu_force_on_disconnection;
 void m_draw(float width, float height)
 {
-       if (clientstate() == CS_DISCONNECTED) m_toggle(true);
+       if (autocvar_menu_force_on_disconnection > 0)
+       {
+               static float connected_time;
+               if (clientstate() == CS_DISCONNECTED)
+               {
+                       if (connected_time && time - connected_time > autocvar_menu_force_on_disconnection)
+                       {
+                               m_toggle(true);
+                               connected_time = 0;
+                       }
+               }
+               else
+                       connected_time = time;
+       }
+
        m_gamestatus();
 
        execute_next_frame();