]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/ammo.qc
Add a networked entity to hold weapon state
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / ammo.qc
index 5c45ff0f331a1544be55bf6b4f3a262d7f704022..94545ac4bff69ea3511cb20866973709d190895a 100644 (file)
@@ -98,11 +98,13 @@ void HUD_Ammo()
        if(hud != HUD_NORMAL) return;
        if(!autocvar__hud_configure)
        {
-               if(!autocvar_hud_panel_ammo) return;
-               if(spectatee_status == -1) return;
+               if((!autocvar_hud_panel_ammo) || (spectatee_status == -1))
+                       return;
+               if(STAT(HEALTH) < 1 && autocvar_hud_panel_ammo_hide_ondeath)
+                       return;
        }
 
-       HUD_Panel_UpdateCvars();
+       HUD_Panel_LoadCvars();
 
        draw_beginBoldFont();
 
@@ -114,7 +116,7 @@ void HUD_Ammo()
                HUD_Scale_Enable();
        else
                HUD_Scale_Disable();
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -167,7 +169,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;