seta hud_panel_weapons_orderbyimpulse "1" "List weapons in their impulse order instead of priority"
seta hud_panel_ammo_maxammo "40" "when you have this much ammo, the ammo status bar is full"
+seta hud_panel_ammo_maxfuel "100" "when you have this much fuel, the fuel status bar is full"
seta hud_panel_ammo_hide_ondeath 0 "hide this panel when dead"
seta hud_panel_powerups_hide_ondeath 0 "hide this panel when dead"
ammo = 60;
}
else
- ammo = getstati(GetAmmoStat(ammoType));
+ ammo = GetAmmoStat(ammoType);
if(!isCurrent)
{
else
alpha = panel_fg_alpha * bound(0, autocvar_hud_panel_ammo_noncurrent_alpha, 1);
- string text = isInfinite ? "\xE2\x88\x9E" : ftos(ammo); // Use infinity symbol (U+221E)
+ // Use infinity symbol (U+221E)
+ string text = isInfinite ? "\xE2\x88\x9E" : ftos((ammoType == RES_FUEL) ? ceil(ammo) : ammo);
// Draw item
if(isCurrent)
drawpic_aspect_skin(myPos, "ammo_current_bg", mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- if(ammo > 0 && autocvar_hud_panel_ammo_progressbar)
- HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL);
+ if(ammo > 0 && (autocvar_hud_panel_ammo_progressbar || ammoType == RES_FUEL))
+ {
+ vector ammo_bar_color = textColor;
+ float ammo_bar_max = autocvar_hud_panel_ammo_maxammo;
+ if (ammoType == RES_FUEL)
+ {
+ ammo_bar_color = autocvar_hud_progressbar_fuel_color;
+ ammo_bar_max = autocvar_hud_panel_ammo_maxfuel;
+ }
+ vector ofs = eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x;
+ HUD_Panel_DrawProgressBar(myPos + ofs, mySize - ofs, autocvar_hud_panel_ammo_progressbar_name,
+ ammo / ammo_bar_max, 0, 0, ammo_bar_color,
+ autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL);
+ }
if(autocvar_hud_panel_ammo_text)
drawstring_aspect(textPos, text, eX * (2/3) * mySize.x + eY * mySize.y, textColor, alpha, DRAWFLAG_NORMAL);
else
total_ammo_count = AMMO_COUNT;
+ bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO);
+ bool have_hook = (WepSet_GetFromStat() & WEPSET(HOOK)) != '0 0 0';
+ bool have_jetpack = boolean(STAT(ITEMS) & IT_JETPACK);
+
+ // always show fuel if we have jetpack or off-hand hook
+ bool show_fuel = (STAT(FUEL) || infinite_ammo || have_jetpack || have_hook);
+ if (show_fuel)
+ ++total_ammo_count;
+
if(draw_nades)
{
++total_ammo_count;
Weapon wep = wepent.switchweapon;
int i;
- bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO);
row = column = 0;
if(autocvar_hud_panel_ammo_onlycurrent)
{
row = column = 0;
IL_EACH(default_order_resources, it.instanceOfAmmoResource && !it.m_hidden,
{
+ bool isCurrent = (wep.ammo_type == it);
+ if (it == RES_FUEL)
+ {
+ if (!show_fuel)
+ continue;
+ if (!isCurrent)
+ isCurrent = have_jetpack; // jetpack can be used anytime
+ }
+
DrawAmmoItem(
pos + vec2(column * (ammo_size.x + offset.x), row * (ammo_size.y + offset.y)),
ammo_size,
it,
- (wep.ammo_type == it),
+ isCurrent,
infinite_ammo
);
bool autocvar_hud_panel_ammo;
bool autocvar_hud_panel_ammo_dynamichud = true;
+vector autocvar_hud_progressbar_fuel_color;
bool autocvar_hud_panel_ammo_hide_ondeath = false;
bool autocvar_hud_panel_ammo_iconalign;
int autocvar_hud_panel_ammo_maxammo;
+int autocvar_hud_panel_ammo_maxfuel = 100;
bool autocvar_hud_panel_ammo_onlycurrent;
float autocvar_hud_panel_ammo_noncurrent_alpha = 0.7;
float autocvar_hud_panel_ammo_noncurrent_scale = 1;
void HUD_HealthArmor()
{
- int armor, health, fuel, air_time;
+ int armor, health, air_time;
if(!autocvar__hud_configure)
{
if((!autocvar_hud_panel_healtharmor) || (spectatee_status == -1))
prev_health = 0;
prev_armor = 0;
}
- fuel = STAT(FUEL);
air_time = bound(0, STAT(AIR_FINISHED) - time, 10);
}
else
{
health = 150;
armor = 75;
- fuel = 20;
air_time = 6;
}
air_alpha = bound(0, start_alpha + (1 - start_alpha) * (1 - f), 1);
}
- float fuel_alpha;
- if (!fuel)
- fuel_alpha = 0;
- else
- {
- float start_alpha = autocvar_hud_panel_healtharmor_fuelbar_startalpha;
- float f = (100 - fuel) / 50;
- fuel_alpha = bound(0, start_alpha + (1 - start_alpha) * f, 1);
- }
-
int baralign = autocvar_hud_panel_healtharmor_baralign;
int iconalign = autocvar_hud_panel_healtharmor_iconalign;
if(autocvar_hud_panel_healtharmor_text)
DrawNumIcon(pos, mySize, hp, biggercount, false, false, iconalign, HUD_Get_Num_Color(hp, maxtotal, true), 1);
- if(fuel)
- HUD_Panel_DrawProgressBar(pos, vec2(mySize.x, 0.2 * mySize.y), "progressbar", fuel / 100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, fuel_alpha * panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
if(air_time)
HUD_Panel_DrawProgressBar(pos + eY * 0.8 * mySize.y, vec2(mySize.x, 0.2 * mySize.y), "progressbar", air_time / 10, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_oxygen_color, air_alpha * panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
armor_offset.y = mySize.y;
}
- bool health_baralign, armor_baralign, fuel_baralign, air_align;
+ bool health_baralign, armor_baralign, air_align;
bool health_iconalign, armor_iconalign;
if (autocvar_hud_panel_healtharmor_flip)
{
armor_baralign = (autocvar_hud_panel_healtharmor_baralign == 2 || autocvar_hud_panel_healtharmor_baralign == 1);
health_baralign = (autocvar_hud_panel_healtharmor_baralign == 3 || autocvar_hud_panel_healtharmor_baralign == 1);
- air_align = fuel_baralign = health_baralign;
+ air_align = health_baralign;
armor_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 2 || autocvar_hud_panel_healtharmor_iconalign == 1);
health_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 3 || autocvar_hud_panel_healtharmor_iconalign == 1);
}
{
health_baralign = (autocvar_hud_panel_healtharmor_baralign == 2 || autocvar_hud_panel_healtharmor_baralign == 1);
armor_baralign = (autocvar_hud_panel_healtharmor_baralign == 3 || autocvar_hud_panel_healtharmor_baralign == 1);
- air_align = fuel_baralign = armor_baralign;
+ air_align = armor_baralign;
health_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 2 || autocvar_hud_panel_healtharmor_iconalign == 1);
armor_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 3 || autocvar_hud_panel_healtharmor_iconalign == 1);
}
}
vector cell_size = mySize;
- if (fuel || air_time)
+ if (air_time)
{
if (is_vertical)
mySize.x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits
mySize.x *= 2; //restore full panel size
else if (panel_ar < 1/4)
mySize.y *= 2; //restore full panel size
- if (fuel)
- HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel / 100, is_vertical, fuel_baralign, autocvar_hud_progressbar_fuel_color, fuel_alpha * panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
if (air_time)
{
if (panel_ar > 1 && panel_ar < 4)
int autocvar_hud_panel_healtharmor_iconalign;
int autocvar_hud_panel_healtharmor_maxarmor;
int autocvar_hud_panel_healtharmor_maxhealth;
-float autocvar_hud_panel_healtharmor_fuelbar_startalpha = 0.3;
float autocvar_hud_panel_healtharmor_oxygenbar_startalpha = 0.2;
bool autocvar_hud_panel_healtharmor_progressbar;
string autocvar_hud_panel_healtharmor_progressbar_armor;
int autocvar_hud_panel_healtharmor_text;
vector autocvar_hud_progressbar_armor_color;
-vector autocvar_hud_progressbar_fuel_color;
vector autocvar_hud_progressbar_health_color;
vector autocvar_hud_progressbar_oxygen_color = '0.1 1 1';
// declarations
WepSet weapons_stat = WepSet_GetFromStat();
int i;
- float f, a;
+ float f;
float screen_ar;
vector center = '0 0 0';
int weapon_count, weapon_id;
if(!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RES_NONE))
{
float ammo_full;
- a = getstati(GetAmmoStat(it.ammo_type)); // how much ammo do we have?
+ float ammo = GetAmmoStat(it.ammo_type);
- if(a > 0)
+ if(ammo > 0)
{
// TODO: registry handles
switch (it.ammo_type)
drawsetcliparea(
weapon_pos.x + baroffset.x,
weapon_pos.y + baroffset.y,
- barsize.x * bound(0, a/ammo_full, 1),
+ barsize.x * bound(0, ammo / ammo_full, 1),
barsize.y
);
// draw the complain message
if(it == complain_weapon)
{
+ float a;
if(fadetime)
a = ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1));
else
this.m_name = _("Fuel");
this.m_icon = "ammo_fuel";
#ifdef CSQC
- this.m_hidden = true; // displayed in a separate panel
#endif
}
// TODO: handle networking via resources
switch (ammotype)
{
- case RES_SHELLS: return STAT_SHELLS;
- case RES_BULLETS: return STAT_NAILS;
- case RES_ROCKETS: return STAT_ROCKETS;
- case RES_CELLS: return STAT_CELLS;
- case RES_PLASMA: return STAT_PLASMA.m_id;
- case RES_FUEL: return STAT_FUEL.m_id;
+ case RES_SHELLS: return STAT(SHELLS);
+ case RES_BULLETS: return STAT(NAILS);
+ case RES_ROCKETS: return STAT(ROCKETS);
+ case RES_CELLS: return STAT(CELLS);
+ case RES_PLASMA: return STAT(PLASMA);
+ case RES_FUEL: return STAT(FUEL);
default: return -1;
}
}