]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/weapons.qc
Merge branch 'sev/lumaIcons' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / weapons.qc
index 4506f69a0c591b603d41ca4fa5f6a497581c071f..8bf11cf1ac93d3994840bb64b96bac5ce993317d 100644 (file)
@@ -11,7 +11,7 @@
 entity weaponorder[Weapons_MAX];
 void weaponorder_swap(int i, int j, entity pass)
 {
-    TC(int, i); TC(int, j);
+       TC(int, i); TC(int, j);
        entity h = weaponorder[i];
        weaponorder[i] = weaponorder[j];
        weaponorder[j] = h;
@@ -20,7 +20,7 @@ void weaponorder_swap(int i, int j, entity pass)
 string weaponorder_cmp_str;
 int weaponorder_cmp(int i, int j, entity pass)
 {
-    TC(int, i); TC(int, j);
+       TC(int, i); TC(int, j);
        int ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].m_id), 0);
        int aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].m_id), 0);
        return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
@@ -108,7 +108,14 @@ void HUD_Weapons()
        }
 
        if(!autocvar_hud_panel_weapons_complainbubble || autocvar__hud_configure || time - complain_weapon_time >= when + fadetime)
-               complain_weapon = 0;
+               complain_weapon = NULL;
+
+       entity wepent = viewmodels[0]; // TODO: unhardcode
+
+       if (wepent.switchweapon == WEP_Null)
+               panel_switchweapon = NULL;
+       else if (!panel_switchweapon)
+               panel_switchweapon = wepent.switchweapon;
 
        if(autocvar__hud_configure)
        {
@@ -159,10 +166,18 @@ void HUD_Weapons()
 
                // do we own this weapon?
                weapon_count = 0;
-               for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
-                       if((weapons_stat & WepSet_FromWeapon(weaponorder[i])) || (weaponorder[i].m_id == complain_weapon))
-                               ++weapon_count;
-
+               if (autocvar_hud_panel_weapons_onlyowned >= 2) // only current
+               {
+                       for (i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
+                               if (weaponorder[i] == panel_switchweapon || weaponorder[i] == complain_weapon)
+                                       ++weapon_count;
+               }
+               else
+               {
+                       for (i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
+                               if ((weapons_stat & WepSet_FromWeapon(weaponorder[i])) || weaponorder[i] == complain_weapon)
+                                       ++weapon_count;
+               }
 
                // might as well commit suicide now, no reason to live ;)
                if (weapon_count == 0)
@@ -373,13 +388,6 @@ void HUD_Weapons()
                switch_speed = frametime * autocvar_hud_panel_weapons_selection_speed;
        vector radius_size = weapon_size * (autocvar_hud_panel_weapons_selection_radius + 1);
 
-       entity wepent = viewmodels[0]; // TODO: unhardcode
-
-       if(wepent.switchweapon == WEP_Null)
-               panel_switchweapon = NULL;
-       else if(!panel_switchweapon)
-               panel_switchweapon = wepent.switchweapon;
-
        // draw background behind currently selected weapon
        // do it earlier to make sure bg is drawn behind every weapon icons while it's moving
        if(panel_switchweapon)
@@ -395,10 +403,18 @@ void HUD_Weapons()
                if(!it || weapon_id < 0) { continue; }
 
                // 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 (autocvar_hud_panel_weapons_onlyowned)
                {
-                       if (!((weapons_stat & WepSet_FromWeapon(it)) || (it.m_id == complain_weapon)))
-                               continue;
+                       if (autocvar_hud_panel_weapons_onlyowned >= 2) // only current
+                       {
+                               if (!(it == panel_switchweapon || it == complain_weapon))
+                                       continue;
+                       }
+                       else
+                       {
+                               if (!((weapons_stat & WepSet_FromWeapon(it)) || (it == complain_weapon)))
+                                       continue;
+                       }
                }
                else
                {
@@ -518,7 +534,7 @@ void HUD_Weapons()
                }
 
                // draw the complain message
-               if(it.m_id == complain_weapon)
+               if(it == complain_weapon)
                {
                        if(fadetime)
                                a = ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1));