]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify modicons panel fading code
authorterencehill <piuntn@gmail.com>
Mon, 9 Jan 2017 18:51:20 +0000 (19:51 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 9 Jan 2017 18:51:20 +0000 (19:51 +0100)
qcsrc/client/hud/panel/modicons.qc

index bf302fdfa3f3cff6f2fcc701e269821a4a8b1f7f..a728f244786977115598f0c178af2fd617283313 100644 (file)
@@ -715,9 +715,7 @@ void HUD_ModIcons_SetFunc()
        HUD_ModIcons_GameType = gametype.m_modicons;
 }
 
-int mod_prev; // previous state of mod_active to check for a change
 float mod_alpha;
-float mod_change; // "time" when mod_active changed
 
 void HUD_ModIcons()
 {
@@ -727,16 +725,10 @@ void HUD_ModIcons()
                if(!HUD_ModIcons_GameType) return;
        }
 
-
-       if(mod_active != mod_prev) {
-               mod_change = time;
-               mod_prev = mod_active;
-       }
-
        if(mod_active || autocvar__hud_configure)
-               mod_alpha = bound(0, (time - mod_change) * 2, 1);
+               mod_alpha = min(mod_alpha + frametime * 2, 1);
        else
-               mod_alpha = bound(0, 1 - (time - mod_change) * 2, 1);
+               mod_alpha = max(mod_alpha - frametime * 2, 0);
 
        //if(mod_alpha <= 0)
        //      return;