]> 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 5af7cce487ea7965bdd33a1540704ebe7388f598..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)
@@ -344,7 +360,6 @@ void HUD_Weapons()
                // retrieve information about the current weapon to be drawn
                entity it = weaponorder[i];
                weapon_id = it.impulse;
-               isCurrent = (it == switchweapon);
 
                // skip if this weapon doesn't exist
                if(!it || weapon_id < 0) { continue; }
@@ -367,6 +382,7 @@ void HUD_Weapons()
                noncurrent_pos.y = weapon_pos.y + (weapon_size.y - noncurrent_size.y) / 2;
 
                // draw background behind currently selected weapon
+               isCurrent = (it == switchweapon);
                if(isCurrent)
                        drawpic_aspect_skin(weapon_pos, "weapon_current_bg", weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);