]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show full fuel bar with a low alpha, fade it in until fuel reaches the middle of...
authorterencehill <piuntn@gmail.com>
Tue, 16 Nov 2021 16:51:20 +0000 (17:51 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 16 Nov 2021 16:51:20 +0000 (17:51 +0100)
_hud_common.cfg
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/healtharmor.qh

index 2d5aa2cfa1a374d2fbc80ab89328177984611af9..c5d37c1dc11a628cebf9d54c9bfd1a759f87240c 100644 (file)
@@ -84,6 +84,7 @@ seta hud_panel_ammo_hide_ondeath 0 "hide this panel when dead"
 
 seta hud_panel_powerups_hide_ondeath 0 "hide this panel when dead"
 
+seta hud_panel_healtharmor_fuelbar_startalpha "0.3" "start alpha of the fuel bar"
 seta hud_panel_healtharmor_oxygenbar_startalpha "0.2" "start alpha of the oxygen bar"
 seta hud_panel_healtharmor_maxhealth "200" "when you have this much health, the health status bar is full"
 seta hud_panel_healtharmor_maxarmor "200" "when you have this much armor, the armor status bar is full"
index bc5b68b0a94c53bf9b0c782482c3eaa3586e6d4f..f84a3733027ca22cebc904f0926749fef1a4d04e 100644 (file)
@@ -110,6 +110,16 @@ void HUD_HealthArmor()
                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;
 
@@ -142,7 +152,7 @@ void HUD_HealthArmor()
                        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, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                       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);
        }
@@ -298,7 +308,7 @@ void HUD_HealthArmor()
                        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, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                               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)
index 538d18780b7ba2b036a352731febc1c6dd29e25d..47a101738b57507dc0565e3dcf329b0cc9ef9eb5 100644 (file)
@@ -10,6 +10,7 @@ bool autocvar_hud_panel_healtharmor_hide_ondeath  = false;
 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;