From 44bd1785b53fb9fa50d19d72b7cfe28025954454 Mon Sep 17 00:00:00 2001
From: terencehill <piuntn@gmail.com>
Date: Wed, 8 Jan 2014 00:33:01 +0100
Subject: [PATCH] Weapons panel in onlyowned mode: enlarge weapon_size to match
 desired aspect ratio (hud_panel_weapons_aspect) in order to capitalize on
 panel space

---
 qcsrc/client/hud.qc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 252142506..9399af83b 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -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;
-- 
2.39.5