X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fammo.qc;h=0cc1f23956aa417f554c186183ff2f0438d6f53d;hb=926af42299cb036e51ec47149a342fe5173e4979;hp=ce700586caad1efe174acea70a0a85f06b2a0ced;hpb=70bba988cd32922d29e40235db6ad1d8149bdc67;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index ce700586c..0cc1f2395 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -1,15 +1,27 @@ #include "ammo.qh" -#include -#include -#include +#include +#include #include -#include -#include #include +#include +#include // Ammo (#1) +void HUD_Ammo_Export(int fh) +{ + // allow saving cvars that aesthetically change the panel into hud skin files + HUD_Write_Cvar("hud_panel_ammo_onlycurrent"); + HUD_Write_Cvar("hud_panel_ammo_noncurrent_alpha"); + HUD_Write_Cvar("hud_panel_ammo_noncurrent_scale"); + HUD_Write_Cvar("hud_panel_ammo_iconalign"); + HUD_Write_Cvar("hud_panel_ammo_progressbar"); + HUD_Write_Cvar("hud_panel_ammo_progressbar_name"); + HUD_Write_Cvar("hud_panel_ammo_progressbar_xoffset"); + HUD_Write_Cvar("hud_panel_ammo_text"); +} + void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color) { HUD_Panel_DrawProgressBar( @@ -20,10 +32,10 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } -void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, bool isInfinite) +void DrawAmmoItem(vector myPos, vector mySize, Resource ammoType, bool isCurrent, bool isInfinite) { TC(bool, isCurrent); TC(bool, isInfinite); - if(ammoType == RESOURCE_NONE) + if(ammoType == RES_NONE) return; // Initialize variables @@ -31,7 +43,7 @@ void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, boo int ammo; if(autocvar__hud_configure) { - isCurrent = (ammoType == RESOURCE_ROCKETS); // Rockets always current + isCurrent = (ammoType == RES_ROCKETS); // Rockets always current ammo = 60; } else @@ -104,7 +116,7 @@ void HUD_Ammo() { if((!autocvar_hud_panel_ammo) || (spectatee_status == -1)) return; - if(STAT(HEALTH) < 1 && autocvar_hud_panel_ammo_hide_ondeath) + if(STAT(HEALTH) <= 0 && autocvar_hud_panel_ammo_hide_ondeath) return; } @@ -177,13 +189,13 @@ void HUD_Ammo() Weapon wep = wepent.switchweapon; int i; - bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO); + bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO); row = column = 0; if(autocvar_hud_panel_ammo_onlycurrent) { if(autocvar__hud_configure) { - DrawAmmoItem(pos, ammo_size, RESOURCE_ROCKETS, true, false); + DrawAmmoItem(pos, ammo_size, RES_ROCKETS, true, false); } else { @@ -205,11 +217,12 @@ void HUD_Ammo() } else { - int ammotype; row = column = 0; - for(i = 0; i < AMMO_COUNT; ++i) + // disabling new-style loop for now to restore original order of ammo types + //FOREACH(Resources, it.instanceOfAmmoResource && !it.m_hidden, + for(int j = 0; j < AMMO_COUNT; ++j) { - ammotype = GetAmmoTypeFromNum(i); + Resource ammotype = GetAmmoTypeFromNum(j); DrawAmmoItem( pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)), ammo_size,