]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/weapons.qc
Merge branch 'master' into terencehill/dynamic_hud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / weapons.qc
index 52fcc549aac908f7ee336b2bfaad6229a7d316a4..7aac7a39e3d418929620db41e6beab51681b3840 100644 (file)
@@ -106,22 +106,34 @@ void HUD_Weapons()
        {
                if(!weapons_stat)
                {
-                       weapons_stat |= WepSet_FromWeapon(Weapons_from(WEP_BLASTER.m_id));
-                       weapons_stat |= WepSet_FromWeapon(Weapons_from(WEP_SHOTGUN.m_id));
-                       weapons_stat |= WepSet_FromWeapon(Weapons_from(WEP_MORTAR.m_id));
-                       weapons_stat |= WepSet_FromWeapon(Weapons_from(WEP_CRYLINK.m_id));
-                       weapons_stat |= WepSet_FromWeapon(Weapons_from(WEP_VORTEX.m_id));
-                       weapons_stat |= WepSet_FromWeapon(Weapons_from(WEP_DEVASTATOR.m_id));
+                       int j = 0;
+                       FOREACH(Weapons, it != WEP_Null && it.impulse >= 0 && (it.impulse % 3 != 0) && j < 6, {
+                               if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
+                               {
+                                       weapons_stat |= it.m_wepset;
+                                       ++j;
+                               }
+                       });
                }
 
                #if 0
                /// 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
        }
@@ -290,6 +302,10 @@ void HUD_Weapons()
        }
 
        // draw the background, then change the virtual size of it to better fit other items inside
+       if (autocvar_hud_panel_weapons_dynamichud)
+               HUD_Scale_Enable();
+       else
+               HUD_Scale_Disable();
        HUD_Panel_DrawBg(1);
 
        if(center.x == -1)