]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/ammo.qc
client: remove _all
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / ammo.qc
index e299d1416ea1485da0cd4dee153aa1afc835dd4f..9e8320452a5e7dcf8db20213e12091dbd9ee1216 100644 (file)
@@ -1,6 +1,11 @@
 #include "ammo.qh"
 
+#include <client/autocvars.qh>
+#include <client/defs.qh>
+#include <client/miscfunctions.qh>
+#include <client/view.qh>
 #include <common/t_items.qh>
+#include <common/wepent.qh>
 
 // Ammo (#1)
 
@@ -150,7 +155,7 @@ void HUD_Ammo()
 
        rows = HUD_GetRowCount(total_ammo_count, mySize, 3);
        columns = ceil((total_ammo_count)/rows);
-       ammo_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
+       ammo_size = vec2(mySize.x / columns, mySize.y / rows);
 
        vector offset = '0 0 0';
        float newSize;
@@ -169,7 +174,9 @@ void HUD_Ammo()
                ammo_size.y = newSize;
        }
 
-       Weapon wep = switchweapon;
+       entity wepent = viewmodels[0]; // TODO: unhardcode
+
+       Weapon wep = wepent.switchweapon;
        int i;
        bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO);
        row = column = 0;
@@ -205,7 +212,7 @@ void HUD_Ammo()
                {
                        ammotype = GetAmmoFieldFromNum(i);
                        DrawAmmoItem(
-                               pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y),
+                               pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)),
                                ammo_size,
                                ammotype,
                                (wep.ammo_field == ammotype),
@@ -227,7 +234,7 @@ void HUD_Ammo()
 
                float f = bound(0, nade_statuschange_elapsedtime*2, 1);
 
-               DrawAmmoNades(pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f);
+               DrawAmmoNades(pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f);
        }
 
        draw_endBoldFont();