From: terencehill Date: Sat, 21 Mar 2020 11:25:49 +0000 (+0100) Subject: Blink oxygen bar when player starts drowning X-Git-Tag: xonotic-v0.8.5~1144^2~8^2~3 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=cc3a2180092298af213ee6de4dd64fb599bd4ca5 Blink oxygen bar when player starts drowning --- diff --git a/qcsrc/client/hud/panel/healtharmor.qc b/qcsrc/client/hud/panel/healtharmor.qc index 36e3a8d907..1dc0e52c03 100644 --- a/qcsrc/client/hud/panel/healtharmor.qc +++ b/qcsrc/client/hud/panel/healtharmor.qc @@ -81,6 +81,16 @@ void HUD_HealthArmor() mySize -= '2 2 0' * panel_bg_padding; } + float BLINK_FACTOR = 0.5; + float BLINK_BASE = 0.5; + float BLINK_FREQ = 7; + float air_alpha = 1; + if (STAT(AIR_FINISHED) && time > STAT(AIR_FINISHED)) + { + air_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); + air_time = 10; + } + int baralign = autocvar_hud_panel_healtharmor_baralign; int iconalign = autocvar_hud_panel_healtharmor_iconalign; @@ -115,7 +125,7 @@ void HUD_HealthArmor() 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); 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, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); + 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); } else { @@ -283,7 +293,7 @@ void HUD_HealthArmor() pos.x += cell_size.x - mySize.x; else pos.y += cell_size.y - mySize.y; - HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", air_time / 10, is_vertical, air_align, autocvar_hud_progressbar_oxygen_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", air_time / 10, is_vertical, air_align, autocvar_hud_progressbar_oxygen_color, air_alpha * panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); } } }