]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Ultimate improvement of the onlyowned layout: change the automatic fix of the weapon...
authorterencehill <piuntn@gmail.com>
Sat, 7 Feb 2015 20:00:55 +0000 (21:00 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 7 Feb 2015 20:00:55 +0000 (21:00 +0100)
_hud_descriptions.cfg
hud_luma.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

index a47884ef05f586d66da20ad330a33b864eb3d017..06ffb8ccb9b7b88ab79b563d898027a6c1437b66 100644 (file)
@@ -62,6 +62,7 @@ seta hud_panel_weapons_label_scale "" "scale of the weapon text label"
 seta hud_panel_weapons_accuracy "" "show accuracy color as the weapon icon background; colors can be configured with accuracy_color* cvars"
 seta hud_panel_weapons_ammo "" "show ammo as a status bar"
 seta hud_panel_weapons_onlyowned "" "show only owned weapons"
+seta hud_panel_weapons_onlyowned_icon_maxscale "" "scale icons up by this factor when there's enough available space; 0 means use maximum available scale"
 
 seta hud_panel_ammo "" "enable/disable this panel"
 seta hud_panel_ammo_pos "" "position of this panel"
index 4f801509eb8681932a3ca0e9cdd98cd9fb9daf60..26f82aac45679141ca8fee44c14442676bbb408b 100644 (file)
@@ -60,6 +60,7 @@ seta hud_panel_weapons_timeout_fadefgmin "0.4"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_onlyowned_icon_maxscale "1.5"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.330000 0.865000"
index 34db2beb663e7cdf118e8cdb3814575a18529ef1..77c224e06b068283b2b08d85affb6abb060c9fba 100644 (file)
@@ -60,6 +60,7 @@ seta hud_panel_weapons_timeout_fadefgmin "0.4"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_onlyowned_icon_maxscale "1.5"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.330000 0.960000"
index 39a6fd2eddbcb8547c9be24ca5cc983ad6ac0c7c..93424cadc00e9d7a00f2cadb4dd223c0b4143a6b 100644 (file)
@@ -60,6 +60,7 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_onlyowned_icon_maxscale "1.5"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.650000 0.890000"
index 4b6b7e4a74288362ce8761363045f4d2e8767042..3947487afecdeb2059fb104eb0de109e18dca616 100644 (file)
@@ -60,6 +60,7 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_onlyowned_icon_maxscale "1.5"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.450000 0.630000"
index 20650899e77de25e7e1e33d485fbeb5beb2e243f..203e1bce56b0e3438004c4dddbd08c4bd2c288e3 100644 (file)
@@ -60,6 +60,7 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "1"
+seta hud_panel_weapons_onlyowned_icon_maxscale "1.5"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.190000 0.920000"
index 2d86881f5fa81c7827cf133718987757fd0da4df..3ecebc5bf8bbc17bcb43cba82492b12f8399619d 100644 (file)
@@ -60,6 +60,7 @@ seta hud_panel_weapons_timeout_fadefgmin "0"
 seta hud_panel_weapons_timeout_speed_in "0.25"
 seta hud_panel_weapons_timeout_speed_out "0.75"
 seta hud_panel_weapons_onlyowned "0"
+seta hud_panel_weapons_onlyowned_icon_maxscale "1.5"
 
 seta hud_panel_ammo 1
 seta hud_panel_ammo_pos "0.160000 0.910000"
index e35bf82dd2759122afc2cf11d46707ef5fc1177b..ac254df87da4aec303cfc4dbb91b275408f3a849 100644 (file)
@@ -352,6 +352,7 @@ float autocvar_hud_panel_weapons_complainbubble_time;
 int autocvar_hud_panel_weapons_label;
 float autocvar_hud_panel_weapons_label_scale = 0.5;
 bool autocvar_hud_panel_weapons_onlyowned;
+float autocvar_hud_panel_weapons_onlyowned_icon_maxscale = 1.5;
 float autocvar_hud_panel_weapons_timeout;
 int autocvar_hud_panel_weapons_timeout_effect;
 float autocvar_hud_panel_weapons_timeout_fadebgmin;
index 81812ca204eeb27d188499cf0dd3f1e41ee333da..b3cc1007aa81054c1571a6ce84201063f5057f6b 100644 (file)
@@ -539,21 +539,36 @@ void HUD_Weapons(void)
                weapon_size.y = padded_panel_size.y / rows;
 
                // reduce rows and columns as needed
-               // NOTE: although weapons should aways look the same even if onlyowned is enabled,
-               // we enlarge them a bit when possible to better match the desired aspect ratio
                if(padded_panel_size.x / padded_panel_size.y < aspect)
                {
                        columns = ceil(weapon_count / rows);
                        rows = ceil(weapon_count / columns);
-                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
-                       weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
                }
                else
                {
                        rows = ceil(weapon_count / columns);
                        columns = ceil(weapon_count / rows);
-                       weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
-                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+               }
+
+               // reduce cell size to match the desired aspect ratio
+               // NOTE: it doesn't reduce weapon icon size itself at all
+               // (assuming aspect ratio of the real weapon image == aspect)
+               if(weapon_size.x / weapon_size.y > aspect)
+                       weapon_size.x = aspect * weapon_size.y;
+               else
+                       weapon_size.y = weapon_size.x / aspect;
+
+               float maxscale = autocvar_hud_panel_weapons_onlyowned_icon_maxscale;
+               if(maxscale == 0)
+                       maxscale = 99;
+               if(maxscale > 1)
+               {
+                       weapon_size.x = min(padded_panel_size.x / columns, weapon_size.x * maxscale);
+                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.y * maxscale);
+                       if(weapon_size.x / weapon_size.y > aspect)
+                               weapon_size.x = aspect * weapon_size.y;
+                       else
+                               weapon_size.y = weapon_size.x / aspect;
                }
 
                // reduce size of the panel
index 898f3eb56f00f9cf6bb1195ba6d31e7a41035e74..fb3a42638f0b1d70118814ad0c22bcf1020809e8 100644 (file)
@@ -98,6 +98,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_timeout_speed_in");
                                        HUD_Write_PanelCvar_q("_timeout_speed_out");
                                        HUD_Write_PanelCvar_q("_onlyowned");
+                                       HUD_Write_PanelCvar_q("onlyowned_icon_maxscale");
                                        break;
                                case HUD_PANEL_AMMO:
                                        HUD_Write_PanelCvar_q("_onlycurrent");