Skip to content

Commit

Permalink
Prevent alpha underflow (bug #14503)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Wedge009 committed Apr 8, 2017
1 parent fb3cae6 commit f8fa22c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/units/frame.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit f8fa22c

Please sign in to comment.