X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fammo.qc;h=94545ac4bff69ea3511cb20866973709d190895a;hp=ac8fee0f10333484529051e823aa88af64e3ecbe;hb=87bec07409c336c956a798556064c6819ad40a4d;hpb=935976d2b23b527a6dda9f8309972f0334bfc829 diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index ac8fee0f1..94545ac4b 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -1,3 +1,7 @@ +#include "ammo.qh" + +#include + // Ammo (#1) void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color) @@ -10,44 +14,11 @@ 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) -{ - float bonusNades = getstatf(STAT_NADE_BONUS); - float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE); - float bonusType = getstati(STAT_NADE_BONUS_TYPE); - Nade def = Nades_from(bonusType); - vector nadeColor = def.m_color; - string nadeIcon = def.m_icon; - - vector iconPos, textPos; - - if(autocvar_hud_panel_ammo_iconalign) - { - iconPos = myPos + eX * 2 * mySize.y; - textPos = myPos; - } - else - { - iconPos = myPos; - textPos = myPos + eX * mySize.y; - } - - if(bonusNades > 0 || bonusProgress > 0) - { - DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor); - - if(autocvar_hud_panel_ammo_text) - drawstring_aspect(textPos, ftos(bonusNades), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - - if(draw_expanding) - drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, expand_time); - - drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', 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) { + TC(bool, isCurrent); TC(bool, isInfinite); if(ammoType == ammo_none) return; @@ -127,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(); @@ -139,7 +112,11 @@ void HUD_Ammo() pos = panel_pos; mySize = panel_size; - HUD_Panel_DrawBg(1); + if (autocvar_hud_panel_ammo_dynamichud) + HUD_Scale_Enable(); + else + HUD_Scale_Disable(); + HUD_Panel_DrawBg(); if(panel_bg_padding) { pos += '1 1 0' * panel_bg_padding; @@ -147,7 +124,7 @@ void HUD_Ammo() } int rows = 0, columns, row, column; - float nade_cnt = getstatf(STAT_NADE_BONUS), nade_score = getstatf(STAT_NADE_BONUS_SCORE); + float nade_cnt = STAT(NADE_BONUS), nade_score = STAT(NADE_BONUS_SCORE); bool draw_nades = (nade_cnt > 0 || nade_score > 0); float nade_statuschange_elapsedtime; int total_ammo_count; @@ -175,7 +152,7 @@ void HUD_Ammo() columns = ceil((total_ammo_count)/rows); ammo_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows); - vector offset = '0 0 0'; // fteqcc sucks + vector offset = '0 0 0'; float newSize; if(ammo_size.x/ammo_size.y > 3) { @@ -192,8 +169,11 @@ void HUD_Ammo() ammo_size.y = newSize; } + entity wepent = viewmodels[0]; // TODO: unhardcode + + Weapon wep = wepent.switchweapon; int i; - bool infinite_ammo = (getstati(STAT_ITEMS, 0, 24) & IT_UNLIMITED_WEAPON_AMMO); + bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO); row = column = 0; if(autocvar_hud_panel_ammo_onlycurrent) { @@ -206,7 +186,7 @@ void HUD_Ammo() DrawAmmoItem( pos, ammo_size, - (get_weaponinfo(switchweapon)).ammo_field, + wep.ammo_field, true, infinite_ammo ); @@ -230,7 +210,7 @@ void HUD_Ammo() pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y), ammo_size, ammotype, - ((get_weaponinfo(switchweapon)).ammo_field == ammotype), + (wep.ammo_field == ammotype), infinite_ammo );