]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve check for vertical sorting
authorterencehill <piuntn@gmail.com>
Sat, 21 Feb 2015 14:56:15 +0000 (15:56 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 21 Feb 2015 14:56:15 +0000 (15:56 +0100)
qcsrc/client/hud.qc

index 54c23eff45046f1229a44292099a4eaafe0c09a8..a596208a44015340e04607b56d238eac71ef7f4b 100644 (file)
@@ -591,7 +591,6 @@ void HUD_Weapons(void)
                rows = table_size.y;
                weapon_size.x = padded_panel_size.x / columns;
                weapon_size.y = padded_panel_size.y / rows;
-               vertical_order = (columns >= rows);
 
                // 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
@@ -603,6 +602,7 @@ void HUD_Weapons(void)
                        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);
+                       vertical_order = false;
                }
                else
                {
@@ -611,6 +611,7 @@ void HUD_Weapons(void)
                        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);
+                       vertical_order = true;
                }
 
                // reduce size of the panel
@@ -753,7 +754,7 @@ void HUD_Weapons(void)
                rows = table_size.y;
                weapon_size.x = panel_size.x / columns;
                weapon_size.y = panel_size.y / rows;
-               vertical_order = (columns >= rows);
+               vertical_order = (panel_size.x / panel_size.y >= aspect);
        }
 
        // calculate position/size for visual bar displaying ammount of ammo status