]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Weapons panel in onlyowned mode: enlarge weapon_size to match desired aspect ratio...
authorterencehill <piuntn@gmail.com>
Tue, 7 Jan 2014 23:33:01 +0000 (00:33 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 7 Jan 2014 23:33:01 +0000 (00:33 +0100)
qcsrc/client/hud.qc

index 252142506f88731b28e21e679c0bd5d84b7d52b2..9399af83b1b57f1b81d8a641a3f6617f2deae11c 100644 (file)
@@ -568,7 +568,7 @@ void HUD_Weapons(void)
                weapon_size_y = old_panel_size_y / rows;
 
                // change table values to include only the owned weapons
-               // weapon_size won't be changed
+               float columns_save = columns;
                if(weapon_count <= rows)
                {
                        rows = weapon_count;
@@ -577,6 +577,10 @@ void HUD_Weapons(void)
                else
                        columns = ceil(weapon_count / rows);
 
+               // enlarge weapon_size to match desired aspect ratio in order to capitalize on panel space
+               if(columns < columns_save)
+                       weapon_size_x = min(old_panel_size_x / columns, aspect * weapon_size_y);
+
                // reduce size of the panel
                panel_size_x = columns * weapon_size_x;
                panel_size_y = rows * weapon_size_y;