From 7022a771a84dc9e75aefdcc85d16d6688e9e1eee Mon Sep 17 00:00:00 2001 From: Derek Hoagland Date: Tue, 1 Nov 2011 14:47:32 +0000 Subject: [PATCH] Slowed units are now tinted to be recognizable at a glance --- changelog | 1 + players_changelog | 1 + src/unit.cpp | 23 ++++++++++++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index 2513628b44d..750c0c8efa4 100644 --- a/changelog +++ b/changelog @@ -62,6 +62,7 @@ Version 1.9.9+svn: * Chanaged: Disable pango markup in unit names (bug #17788) * It is now possible to remove multiple installed add-ons at the same time + * Slowed units are now tinted to be recognizable at a glance * WML engine: * Readded the liminal alignment * Added four-difficulty versions of certain macros: QUANTITY4, diff --git a/players_changelog b/players_changelog index ec4d2646b3a..6c3192e038a 100644 --- a/players_changelog +++ b/players_changelog @@ -48,6 +48,7 @@ Version 1.9.9+svn: * Added option in advanced preferences that allows the twelve-hour clock format to be used. * Reenabled "delay shroud updates". + * Slowed units are now tinted to be recognizable at a glance. * Miscellaneous and bug fixes: * Reintroduced the "Liminal" alignment. Liminal units fight best during diff --git a/src/unit.cpp b/src/unit.cpp index ecc3c1268bf..12b051bfbd7 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -1863,10 +1863,27 @@ void unit::redraw_unit() } params.y -= height_adjust; params.halo_y -= height_adjust; - if (get_state(STATE_POISONED)){ - params.blend_with = disp.rgb(0,255,0); - params.blend_ratio = 0.25; + + int red = 0,green = 0,blue = 0,tints = 0; + double blend_ratio = 0; + // Add future colored states here + if(get_state(STATE_POISONED)) { + green += 255; + blend_ratio += 0.25; + tints += 1; } + if(get_state(STATE_SLOWED)) { + red += 191; + green += 191; + blue += 255; + blend_ratio += 0.25; + tints += 1; + } + if(tints > 0) { + params.blend_with = disp.rgb((red/tints),(green/tints),(blue/tints)); + params.blend_ratio = ((blend_ratio/tints)); + } + //hackish : see unit_frame::merge_parameters // we use image_mod on the primary image // and halo_mod on secondary images and all haloes