]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix incorrect scoreboard/HUD fading on quick (repeated) press/release of the scoreboa...
authorterencehill <piuntn@gmail.com>
Fri, 5 Aug 2016 00:13:08 +0000 (02:13 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 5 Aug 2016 00:13:08 +0000 (02:13 +0200)
qcsrc/client/hud/panel/scoreboard.qc

index 216371d46bb0183a03df8fcc4e4320a805e7880d..4bf1ddbd51b778a36a27307893f7e022e6a49e54 100644 (file)
@@ -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;
                }