]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Upscale icons with the previous code (AR "fix") rather then with hud_panel_weapons_on...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 1088011808d0c6479f632725848403b82ed3d2bd..c799ad550d2f8acce515a2b1b54f8b791eb3efbb 100644 (file)
@@ -566,25 +566,17 @@ void HUD_Weapons(void)
                        rows = ceil(weapon_count / columns);
                }
 
-               // 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;
+               // 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.y > padded_panel_size.x)
+               {
+                       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
-                       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;
+                       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 size of the panel