From ea8d69de580ecc676ff00a2c770b34a79296342a Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 5 Aug 2016 02:13:08 +0200 Subject: [PATCH] Fix incorrect scoreboard/HUD fading on quick (repeated) press/release of the scoreboard key --- qcsrc/client/hud/panel/scoreboard.qc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 216371d46..4bf1ddbd5 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1244,32 +1244,23 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl, vector rgb, vector bg_s return end_pos; } -float hud_woulddrawscoreboard_prev; -float hud_woulddrawscoreboard_change; // "time" at which HUD_WouldDrawScoreboard() changed void HUD_DrawScoreboard() { if(!autocvar__hud_configure) { - float hud_woulddrawscoreboard; - hud_woulddrawscoreboard = scoreboard_active; - if(hud_woulddrawscoreboard != hud_woulddrawscoreboard_prev) { - hud_woulddrawscoreboard_change = time; - hud_woulddrawscoreboard_prev = hud_woulddrawscoreboard; - } - - if(hud_woulddrawscoreboard) { + if(scoreboard_active) { if(menu_enabled == 1) scoreboard_fade_alpha = 1; float scoreboard_fadeinspeed = autocvar_hud_panel_scoreboard_fadeinspeed; if (scoreboard_fadeinspeed) - scoreboard_fade_alpha = bound (0, (time - hud_woulddrawscoreboard_change) * scoreboard_fadeinspeed, 1); + scoreboard_fade_alpha = min(1, scoreboard_fade_alpha + frametime * scoreboard_fadeinspeed); else scoreboard_fade_alpha = 1; } else { float scoreboard_fadeoutspeed = autocvar_hud_panel_scoreboard_fadeoutspeed; if (scoreboard_fadeoutspeed) - scoreboard_fade_alpha = bound (0, (1/scoreboard_fadeoutspeed - (time - hud_woulddrawscoreboard_change)) * scoreboard_fadeoutspeed, 1); + scoreboard_fade_alpha = max(0, scoreboard_fade_alpha - frametime * scoreboard_fadeoutspeed); else scoreboard_fade_alpha = 0; } -- 2.39.2