]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix weapons panel showing lots of portos when onlyowned mode is off
authorterencehill <piuntn@gmail.com>
Tue, 19 Apr 2016 16:50:56 +0000 (18:50 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 19 Apr 2016 16:50:56 +0000 (18:50 +0200)
qcsrc/client/hud/panel/weapons.qc

index c465caf4fddc3911ca2e997adaead177a2f6fa40..ed896e52ac730c2853e56e5888e50cbca7f3a44c 100644 (file)
@@ -297,7 +297,13 @@ void HUD_Weapons()
 
        if(!rows) // if rows is > 0 onlyowned code has already updated these vars
        {
-               vector table_size = HUD_GetTableSize_BestItemAR((Weapons_COUNT - 1), panel_size, aspect);
+               int nHidden = 0;
+               WepSet weapons_stat = WepSet_GetFromStat();
+               FOREACH(Weapons, it != WEP_Null, {
+                       if (weapons_stat & it.m_wepset) continue;
+                       if (it.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1;
+               });
+               vector table_size = HUD_GetTableSize_BestItemAR((Weapons_COUNT - 1) - nHidden, panel_size, aspect);
                columns = table_size.x;
                rows = table_size.y;
                weapon_size.x = panel_size.x / columns;
@@ -347,8 +353,15 @@ void HUD_Weapons()
 
                // skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon
                if(autocvar_hud_panel_weapons_onlyowned)
-               if (!((weapons_stat & WepSet_FromWeapon(it)) || (it.m_id == complain_weapon)))
-                       continue;
+               {
+                       if (!((weapons_stat & WepSet_FromWeapon(it)) || (it.m_id == complain_weapon)))
+                               continue;
+               }
+               else
+               {
+                       if (it.spawnflags & WEP_FLAG_MUTATORBLOCKED && !(weapons_stat & WepSet_FromWeapon(it)))
+                               continue;
+               }
 
                // figure out the drawing position of weapon
                weapon_pos = (panel_pos + eX * column * weapon_size.x + eY * row * weapon_size.y);