]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
New cvar hud_panel_itemstime_size_dinamic, if enabled reduces panel size by removing...
authorterencehill <piuntn@gmail.com>
Sat, 9 Jun 2012 17:09:07 +0000 (19:09 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 9 Jun 2012 23:47:22 +0000 (01:47 +0200)
_hud_descriptions.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc
qcsrc/menu/xonotic/dialog_hudpanel_itemstime.c

index 499f2d508f105eb03aec871c0b078d68ab296b0e..c1d4422d4610afd568c3220d891c5ddaba7789b3 100644 (file)
@@ -306,4 +306,5 @@ seta hud_panel_itemstime_progressbar_reduced "" "progressbar is displayed only i
 seta hud_panel_itemstime_showspawned "0" "show icons of already spawned items"
 seta hud_panel_itemstime_text "" "show text"
 seta hud_panel_itemstime_ratio "" "ratio between space reserved for text and icon width of each item entry (min value is 2)"
+seta hud_panel_itemstime_size_dinamic "" "reduce panel size by removing spacing beetwen items"
 
index 92d245accc26a7654d6f75597398bd78e0b1d47a..ebf06360251cf34416092eea238ba38bc2a19ed6 100644 (file)
@@ -304,5 +304,6 @@ seta hud_panel_itemstime_progressbar_reduced "0"
 seta hud_panel_itemstime_showspawned "0"
 seta hud_panel_itemstime_text "1"
 seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_size_dinamic "1"
 
 menu_sync
index 16a1a39243a0fbaa38568f69deee638658181f7b..c9d8efa9c00a60e0be13c55cce2747416ea1753f 100644 (file)
@@ -304,5 +304,6 @@ seta hud_panel_itemstime_progressbar_reduced "0"
 seta hud_panel_itemstime_showspawned "0"
 seta hud_panel_itemstime_text "1"
 seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_size_dinamic "1"
 
 menu_sync
index 9c2d6e382d313dbac0b20b1428673a46f8133b48..e785511160184f0dcb9d31d16fbf0ed2016844b5 100644 (file)
@@ -304,5 +304,6 @@ seta hud_panel_itemstime_progressbar_reduced "0"
 seta hud_panel_itemstime_showspawned "0"
 seta hud_panel_itemstime_text "1"
 seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_size_dinamic "1"
 
 menu_sync
index feb939361dc0c8164f3aebb1ea394b888ac90417..c766eeeca13db8a1d68254f203a003d53d10719b 100644 (file)
@@ -304,5 +304,6 @@ seta hud_panel_itemstime_progressbar_reduced "1"
 seta hud_panel_itemstime_showspawned "0"
 seta hud_panel_itemstime_text "1"
 seta hud_panel_itemstime_ratio "3.5"
+seta hud_panel_itemstime_size_dinamic "1"
 
 menu_sync
index 4a96925963f4c4ec5e4e849f895752b66790fdfc..98e6f0b8631a8979cad4c02736aaad976d842b0d 100644 (file)
@@ -304,5 +304,6 @@ seta hud_panel_itemstime_progressbar_reduced "0"
 seta hud_panel_itemstime_showspawned "0"
 seta hud_panel_itemstime_text "1"
 seta hud_panel_itemstime_ratio "2"
+seta hud_panel_itemstime_size_dinamic "1"
 
 menu_sync
index e5ea0bb0098fd1236a58b6c9ca4c105db88e52bb..d7055f25f7ba1978945f8d4943365b8d2f8c8be6 100644 (file)
@@ -246,6 +246,7 @@ float autocvar_hud_panel_healtharmor_text;
 float autocvar_hud_panel_infomessages;
 float autocvar_hud_panel_infomessages_flip;
 float autocvar_hud_panel_itemstime;
+float autocvar_hud_panel_itemstime_size_dinamic;
 float autocvar_hud_panel_itemstime_ratio;
 float autocvar_hud_panel_itemstime_iconalign;
 float autocvar_hud_panel_itemstime_progressbar;
index 377480443c70b1a0901dd729ca20356b5b163989..3067539503c856322167c198d2bf9acb4ab796d5 100644 (file)
@@ -5052,7 +5052,6 @@ void HUD_ItemsTime(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -5071,21 +5070,50 @@ void HUD_ItemsTime(void)
 
        local noref vector offset; // fteqcc sucks
        float newSize;
-       if(itemstime_size_x/itemstime_size_y > ar)
+       if(autocvar_hud_panel_itemstime_size_dinamic)
        {
-               newSize = ar * itemstime_size_y;
-               offset_x = itemstime_size_x - newSize;
-               pos_x += offset_x/2;
-               itemstime_size_x = newSize;
+               if(autocvar__hud_configure)
+               if(menu_enabled != 2)
+                       HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
+
+               // reduce panel to avoid spacing items
+               if(itemstime_size_x / itemstime_size_y < ar)
+               {
+                       newSize = rows * itemstime_size_x / ar;
+                       pos_y += (mySize_y - newSize) / 2;
+                       mySize_y = newSize;
+                       itemstime_size_y = mySize_y / rows;
+               }
+               else
+               {
+                       newSize = columns * itemstime_size_y * ar;
+                       pos_x += (mySize_x - newSize) / 2;
+                       mySize_x = newSize;
+                       itemstime_size_x = mySize_x / columns;
+               }
+               panel_pos = pos - '1 1 0' * panel_bg_padding;
+               panel_size = mySize + '2 2 0' * panel_bg_padding;
        }
        else
        {
-               newSize = 1/ar * itemstime_size_x;
-               offset_y = itemstime_size_y - newSize;
-               pos_y += offset_y/2;
-               itemstime_size_y = newSize;
+               if(itemstime_size_x/itemstime_size_y > ar)
+               {
+                       newSize = ar * itemstime_size_y;
+                       offset_x = itemstime_size_x - newSize;
+                       pos_x += offset_x/2;
+                       itemstime_size_x = newSize;
+               }
+               else
+               {
+                       newSize = 1/ar * itemstime_size_x;
+                       offset_y = itemstime_size_y - newSize;
+                       pos_y += offset_y/2;
+                       itemstime_size_y = newSize;
+               }
        }
 
+       HUD_Panel_DrawBg(1);
+
        for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) {
                if (ItemsTime_time[i] == -1)
                        continue;
index 5406cc9c08c674e3885c421019bd03770c8bce40..dae28835583df17e8666d07c3d7d53c77045698b 100644 (file)
@@ -189,6 +189,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_showspawned");
                                        HUD_Write_PanelCvar_q("_text");
                                        HUD_Write_PanelCvar_q("_ratio");
+                                       HUD_Write_PanelCvar_q("_size_dinamic");
                                        break;
                        }
                        HUD_Write("\n");
index 53134f2e90d6afce4b06f71280b42f8bca3768b3..349be0a8a281c9080531e073426e4ef883d13be7 100644 (file)
@@ -38,5 +38,7 @@ void XonoticHUDItemsTimeDialog_fill(entity me)
                me.TD(me, 1, 2.6, e = makeXonoticSlider(2, 8, 0.5, "hud_panel_itemstime_ratio"));
        me.TR(me);
                me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_itemstime_showspawned", _("Show spawned items")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_itemstime_size_dinamic", _("Dinamic size")));
 }
 #endif