From 47c5ad63c15209759ad4922fd31d2b51d0e510e4 Mon Sep 17 00:00:00 2001
From: TimePath <andrew.hardaker1995@gmail.com>
Date: Mon, 5 Oct 2015 19:10:52 +1100
Subject: [PATCH] Weapons: Don't take mutator blocked weapons into account when
 sizing the weapons panel, unless they are held

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

diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index 1b762f82d0..a47ccd7a0f 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -472,7 +472,15 @@ void HUD_Weapons(void)
 		vector padded_panel_size = panel_size - '2 2 0' * panel_bg_padding;
 
 		// get the all-weapons layout
-		vector table_size = HUD_GetTableSize_BestItemAR((WEP_COUNT - 1), padded_panel_size, aspect);
+		int nHidden = 0;
+		WepSet weapons_stat = WepSet_GetFromStat();
+		for (int i = WEP_FIRST; i <= WEP_LAST; ++i) {
+			WepSet weapons_wep = WepSet_FromWeapon(i);
+			if (weapons_stat & weapons_wep) continue;
+			Weapon w = get_weaponinfo(i);
+			if (w.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1;
+		}
+		vector table_size = HUD_GetTableSize_BestItemAR((WEP_COUNT - 1) - nHidden, padded_panel_size, aspect);
 		columns = table_size.x;
 		rows = table_size.y;
 		weapon_size.x = padded_panel_size.x / columns;
-- 
2.39.5