]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix weapons panel debug code 313/head
authorterencehill <piuntn@gmail.com>
Wed, 20 Apr 2016 17:25:47 +0000 (19:25 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 20 Apr 2016 17:25:47 +0000 (19:25 +0200)
qcsrc/client/hud/panel/weapons.qc

index 8fa22dd5e8afbce4d43f6d29c7740b6915b1e553..cfacd59b60f831085e5216c8c86154f2c5d0cefe 100644 (file)
@@ -120,10 +120,20 @@ void HUD_Weapons()
                /// debug code
                if(cvar("wep_add"))
                {
+                       int j;
+                       int nHidden = 0;
+                       FOREACH(Weapons, it != WEP_Null, {
+                               if (it.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1;
+                       });
                        weapons_stat = '0 0 0';
-                       float countw = 1 + floor((floor(time * cvar("wep_add"))) % (Weapons_COUNT - 1));
-                       for(i = WEP_FIRST; i <= countw; ++i)
-                               weapons_stat |= WepSet_FromWeapon(Weapons_from(i));
+                       float countw = 1 + floor((floor(time * cvar("wep_add"))) % ((Weapons_COUNT - 1) - nHidden));
+                       for(i = 0, j = 0; i <= (Weapons_COUNT - 1) && j < countw; ++i)
+                       {
+                               if(weaponorder[i].spawnflags & WEP_FLAG_MUTATORBLOCKED)
+                                       continue;
+                               weapons_stat |= weaponorder[i].m_wepset;
+                               ++j;
+                       }
                }
                #endif
        }