From f8fa22ccc085d7dad238bb0510a1c94b4ae7b14c Mon Sep 17 00:00:00 2001 From: Wedge009 Date: Fri, 7 Apr 2017 13:16:51 +1000 Subject: [PATCH] Prevent alpha underflow (bug #14503) Shadows - like most ghost units - have varying alpha levels as part of their animation, however, the Shadow also has the Nightstalker ability which reduces alpha by 0.5 (invisible unit). As a result, there is an alpha underflow when the animation frames vary from -0.1 to 0.3. By using a multiplication instead of an addition-1, as suggested by CelticMinstrel, the alpha variation becomes 0.2 to 0.4, avoiding the underflow and making the Shadow slightly less translucent at night. --- src/units/frame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/units/frame.cpp b/src/units/frame.cpp index 51e1491e58c9..91e56bb83142 100644 --- a/src/units/frame.cpp +++ b/src/units/frame.cpp @@ -888,7 +888,7 @@ const frame_parameters unit_frame::merge_parameters(int current_time, const fram /** The engine provides a highlight ratio for selected units and visible "invisible" units */ result.highlight_ratio = current_val.highlight_ratio != 1.0 ? current_val.highlight_ratio : animation_val.highlight_ratio; if(primary && engine_val.highlight_ratio != 1.0) { - result.highlight_ratio = result.highlight_ratio + engine_val.highlight_ratio - 1.0; // selected unit + result.highlight_ratio = result.highlight_ratio * engine_val.highlight_ratio; // selected unit } assert(engine_val.offset == 0);