X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fammo.qc;h=95ceced82c74d7ca6a39adc2084de9e950c85a2c;hp=94545ac4bff69ea3511cb20866973709d190895a;hb=93afc08b09294e6dea4d0c98ce5226fdee9d1c92;hpb=50d8efb863874f811bdcc118d7e873836902e453 diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index 94545ac4b..95ceced82 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -1,6 +1,12 @@ #include "ammo.qh" +#include +#include +#include +#include #include +#include +#include // Ammo (#1) @@ -14,12 +20,10 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } -void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time); // TODO: mutator - -void DrawAmmoItem(vector myPos, vector mySize, .int ammoType, bool isCurrent, bool isInfinite) +void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, bool isInfinite) { - TC(bool, isCurrent); TC(bool, isInfinite); - if(ammoType == ammo_none) + TC(bool, isCurrent); TC(bool, isInfinite); + if(ammoType == RES_NONE) return; // Initialize variables @@ -27,7 +31,7 @@ void DrawAmmoItem(vector myPos, vector mySize, .int ammoType, bool isCurrent, bo int ammo; if(autocvar__hud_configure) { - isCurrent = (ammoType == ammo_rockets); // Rockets always current + isCurrent = (ammoType == RES_ROCKETS); // Rockets always current ammo = 60; } else @@ -150,7 +154,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; @@ -173,20 +177,20 @@ 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, ammo_rockets, true, false); + DrawAmmoItem(pos, ammo_size, RES_ROCKETS, true, false); } else { DrawAmmoItem( pos, ammo_size, - wep.ammo_field, + wep.ammo_type, true, infinite_ammo ); @@ -201,16 +205,16 @@ void HUD_Ammo() } else { - .int ammotype; + int ammotype; row = column = 0; for(i = 0; i < AMMO_COUNT; ++i) { - ammotype = GetAmmoFieldFromNum(i); + ammotype = GetAmmoTypeFromNum(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), + (wep.ammo_type == ammotype), infinite_ammo ); @@ -229,7 +233,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();