]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show full oxygen bar with a low alpha, fade it in until oxygen reaches the middle...
authorterencehill <piuntn@gmail.com>
Sat, 5 Dec 2020 09:09:49 +0000 (10:09 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 5 Dec 2020 09:09:49 +0000 (10:09 +0100)
_hud_common.cfg
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/healtharmor.qh

index f2be854d5b1d9603ad9ae1ca5e66ca4d2d66662b..0b289322482c9634c4b178f2b414e9a1ed312215 100644 (file)
@@ -83,6 +83,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_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"
 seta hud_panel_healtharmor_progressbar_gfx_damage 5 "show damage effect when damaged at least by this amount; 0 disables the effect"
index 993bf091d73f0c46156b2ed5bed93ee225ba2f1f..7e6e33339cdf68704ddd68ac79bcb46ed0bc6f42 100644 (file)
@@ -94,12 +94,21 @@ void HUD_HealthArmor()
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       float air_alpha = 1;
-       if (STAT(AIR_FINISHED) && time > STAT(AIR_FINISHED))
+       float air_alpha;
+       if (!STAT(AIR_FINISHED))
+               air_alpha = 0;
+       else if (time > STAT(AIR_FINISHED))
        {
                air_alpha = blink_synced(0.5, 0.5, 7, STAT(AIR_FINISHED), -1);
                air_time = 10;
        }
+       else
+       {
+               float fade_time = 10 / 2;
+               float start_alpha = autocvar_hud_panel_healtharmor_oxygenbar_startalpha;
+               float f = (STAT(AIR_FINISHED) - time - fade_time) / fade_time;
+               air_alpha = bound(0, start_alpha + (1 - start_alpha) * (1 - f), 1);
+       }
 
        int baralign = autocvar_hud_panel_healtharmor_baralign;
        int iconalign = autocvar_hud_panel_healtharmor_iconalign;
index 7bd7b889341534ccd7012f193fd708f95a5291ac..538d18780b7ba2b036a352731febc1c6dd29e25d 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_oxygenbar_startalpha = 0.2;
 bool autocvar_hud_panel_healtharmor_progressbar;
 string autocvar_hud_panel_healtharmor_progressbar_armor;
 string autocvar_hud_panel_healtharmor_progressbar_health;