]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/menu_fixes' into 'master'
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 9 May 2016 21:03:59 +0000 (21:03 +0000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 9 May 2016 21:03:59 +0000 (21:03 +0000)
Misc minor fixes to the menu

See merge request !316

defaultXonotic.cfg
qcsrc/menu/menu.qc
qcsrc/menu/xonotic/checkbox.qc
qcsrc/menu/xonotic/checkbox.qh
qcsrc/menu/xonotic/cvarlist.qc
qcsrc/menu/xonotic/dialog_settings_audio.qc
qcsrc/menu/xonotic/dialog_settings_game.qc
qcsrc/menu/xonotic/dialog_settings_game_messages.qc
qcsrc/menu/xonotic/dialog_settings_game_model.qh
qcsrc/menu/xonotic/tab.qh

index 2056f15115d79f83f170c5128fc9a38ea0b4d040..6554bb1a76bccd80cb217e09d2f64ed73101ee9f 100644 (file)
@@ -809,6 +809,7 @@ seta menu_tooltips 1 "menu tooltips: 0 disabled, 1 enabled, 2 also shows cvar or
 set menu_picmip_bypass 0 "bypass texture quality enforcement based on system resources, not recommended and may cause crashes!"
 set menu_showboxes 0 "show item bounding boxes (debug)"
 set menu_cvarlist_onlymodified 0 "show only modified cvars in the cvar list"
+set menu_force_on_disconnection 1 "force to show the menu this number of seconds after you get disconnected (0 to disable)"
 
 r_textbrightness 0.2
 r_textcontrast 0.8
index 913cdbe34b43f6bb068c7e8748e301da57386397..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();
@@ -790,15 +810,11 @@ void m_draw(float width, float height)
 
        draw_alpha *= menuAlpha;
 
-       if (!Menu_Active)
-       {
-               // do not update mouse position
-               // it prevents mouse jumping to '0 0 0' when menu is fading out
-       }
-       else if (menuMouseMode)
+       if (menuMouseMode)
        {
-               vector newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
-               if (newMouse != '0 0 0' && newMouse != menuMousePos)
+               vector rawMousePos = getmousepos();
+               vector newMouse = globalToBox(rawMousePos, draw_shift, draw_scale);
+               if (rawMousePos != '0 0 0' && newMouse != menuMousePos)
                {
                        menuMousePos = newMouse;
                        if (mouseButtonsPressed) main.mouseDrag(main, menuMousePos);
index 6015e48bad45369c9b350e4eefe38d29202f2e8a..b863518981b7b9fb5023e881fc695754e7d7cfcb 100644 (file)
@@ -58,6 +58,8 @@ void XonoticCheckBox_setChecked(entity me, float val)
        {
                me.checked = val;
                me.saveCvars(me);
+               if(me.linkedCheckBox)
+                       me.linkedCheckBox.loadCvars(me.linkedCheckBox);
        }
 }
 void XonoticCheckBox_loadCvars(entity me)
index a188f4c0aeb0c61f304d44ba213d5f2ced89a8c7..90a1bf5d4b67e4906223b4c8bf5392e5e82e0dab 100644 (file)
@@ -21,6 +21,7 @@ CLASS(XonoticCheckBox, CheckBox)
 
        ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
        ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+       ATTRIB(XonoticCheckBox, linkedCheckBox, entity, NULL)
 ENDCLASS(XonoticCheckBox)
 entity makeXonoticCheckBox_T(float, string, string, string);
 entity makeXonoticCheckBox(float, string, string);
index f23af46d9ea017839dc159122168db91a9146fef..12bb2810ba87282e54d9df9c43b7df5e1dba38c1 100644 (file)
@@ -1,6 +1,7 @@
 #include "cvarlist.qh"
 
 #include "inputbox.qh"
+#include "../item/checkbox.qh"
 #include "../item/container.qh"
 #include "../item/checkbox.qh"
 
index 4a25682e0b01c95e8e71ed39a06d46e7b81b2ed6..7af8c550032b3dec7e6368f19b6ada4cfe8099d7 100644 (file)
@@ -17,7 +17,7 @@ entity makeXonoticAudioSettingsTab()
 
 void XonoticAudioSettingsTab_fill(entity me)
 {
-       entity e, s;
+       entity e, e2, s;
        entity audioApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0',
                "snd_restart;"
                "snd_attenuation_method_${menu_snd_attenuation_method};"
@@ -146,13 +146,11 @@ void XonoticAudioSettingsTab_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 3, makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
        me.TR(me);
-               me.hiddenMenuSoundsSlider = makeXonoticSlider_T(1, 1, 1, "menu_sounds",
-                       _("Play sounds when clicking or hovering over menu items"));
-               me.TD(me, 1, 1.2, e = makeXonoticSliderCheckBox(0, 1, me.hiddenMenuSoundsSlider, _("Menu sounds")));
-                       e.tooltip = me.hiddenMenuSoundsSlider.tooltip;
-               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(2, 0, me.hiddenMenuSoundsSlider, _("Focus sounds")));
-                       e.tooltip = me.hiddenMenuSoundsSlider.tooltip;
-               setDependent(e, "menu_sounds", 1, 2);
+               me.TD(me, 1, 1.2, e = makeXonoticCheckBox_T(0, "menu_sounds", _("Menu sounds"),
+                       _("Play sounds when clicking menu items")));
+               me.TD(me, 1, 1.2, e.linkedCheckBox = e2 = makeXonoticCheckBoxEx_T(2, 1, "menu_sounds", _("Focus sounds"),
+                       _("Play sounds when hovering over menu items too")));
+               setDependent(e2, "menu_sounds", 1, 2);
        me.TR(me);
        me.TR(me);
                me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));
index 32d29d7dc7ce79a6b35d97e261ae208b53ead1aa..d2ce368d1d0b225452230bfef96ff4770f540890 100644 (file)
@@ -13,7 +13,7 @@ METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string th
 {
     Lazy l = Settings_from(i);
     entity it = l.m_get();
-    if (returns) returns(it.tooltip);
+    if (returns) returns(it.titleTooltip);
     return it;
 }
 METHOD(SettingSource, reload, int(entity this, string filter)) { return Settings_COUNT; }
index 58d0de9b6329d50eb96c1f43857e53974e02d9bf..0ea55f637e86e783f5853f4124b3888f616d12a9 100644 (file)
@@ -53,7 +53,7 @@ void XonoticGameMessageSettingsTab_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.4);
                me.TD(me, 1, 2.6, e = makeXonoticCheckBox_T(0, "notification_show_sprees_info_newline", _("Print on a seperate line"), "-"));
-                       setDependent(e, "notification_show_sprees", 1, 1);
+                       setDependentAND(e, "notification_show_sprees", 1, 1, "notification_show_sprees_info", 1, 3);
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(2, 1, "notification_CHOICE_FRAG", _("Add extra frag information to centerprint when available"), "-"));
                        makeMulti(e, "notification_CHOICE_FRAGGED notification_CHOICE_TYPEFRAG notification_CHOICE_TYPEFRAGGED");
@@ -65,17 +65,17 @@ void XonoticGameMessageSettingsTab_fill(entity me)
                me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Gamemode Settings")));
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(2, 1, "notification_CHOICE_CTF_CAPTURE_TIME_RED", _("Display capture times in Capture The Flag"), "-"));
-                       makeMulti(e, "notification_CHOICE_CTF_CAPTURE_TIME_BLUE notification_CHOICE_CTF_CAPTURE_BROKEN_RED notification_CHOICE_CTF_CAPTURE_BROKEN_BLUE notification_CHOICE_CTF_CAPTURE_UNBROKEN_RED notification_CHOICE_CTF_CAPTURE_UNBROKEN_BLUE ");
+                       makeMulti(e, "notification_CHOICE_CTF_CAPTURE_TIME_BLUE notification_CHOICE_CTF_CAPTURE_TIME_YELLOW notification_CHOICE_CTF_CAPTURE_TIME_PINK notification_CHOICE_CTF_CAPTURE_BROKEN_RED notification_CHOICE_CTF_CAPTURE_BROKEN_BLUE notification_CHOICE_CTF_CAPTURE_BROKEN_YELLOW notification_CHOICE_CTF_CAPTURE_BROKEN_PINK notification_CHOICE_CTF_CAPTURE_UNBROKEN_RED notification_CHOICE_CTF_CAPTURE_UNBROKEN_BLUE notification_CHOICE_CTF_CAPTURE_UNBROKEN_YELLOW notification_CHOICE_CTF_CAPTURE_UNBROKEN_PINK");
                        e.sendCvars = true;
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(2, 1, "notification_CHOICE_CTF_PICKUP_ENEMY", _("Display name of flag stealer in Capture The Flag"), "-"));
-                       makeMulti(e, "notification_CHOICE_CTF_PICKUP_TEAM");
+                       makeMulti(e, "notification_CHOICE_CTF_PICKUP_ENEMY_TEAM notification_CHOICE_CTF_PICKUP_ENEMY_NEUTRAL");
                        e.sendCvars = true;
 
        me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(4, 1, "con_notify", _("Display console messages in the top left corner"), "-"));
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(4, 0, "con_notify", _("Display console messages in the top left corner"), "-"));
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(2, 1, "notification_allow_chatboxprint", _("Display all info messages in the chatbox"), "-"));
        me.TR(me);
index 8ca179d36ad89990b9edd1b2db1e8d78f36a8f64..8dd6eaecb321cbb50f490e9de0c7b25d6c4f0ada 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticGameModelSettingsTab, XonoticTab)
        METHOD(XonoticGameModelSettingsTab, fill, void(entity));
        METHOD(XonoticGameModelSettingsTab, showNotify, void(entity));
        ATTRIB(XonoticGameModelSettingsTab, title, string, _("Models"))
-       ATTRIB(XonoticGameModelSettingsTab, tooltip, string, _("Customize how players and items are displayed in game"))
+       ATTRIB(XonoticGameModelSettingsTab, titleTooltip, string, _("Customize how players and items are displayed in game"))
        ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
        ATTRIB(XonoticGameModelSettingsTab, rows, float, 15.5)
        ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
index 26fe898bbb2d6d05502d4dcd088aee7deea7f8db..b296d2491846c5f27ca20b45847397d631699b6f 100644 (file)
@@ -19,4 +19,9 @@ CLASS(XonoticTab, Tab)
        ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
 
        ATTRIB(XonoticTab, backgroundImage, string, string_null)
+
+       // using "titleTooltip" instead of "tooltip" so that
+       // the tooltip search function doesn't find it
+       // .tooltip should be set only in the item displaying the tab title
+       ATTRIB(XonoticTab, titleTooltip, string, string_null)
 ENDCLASS(XonoticTab)