From 8955ef08ff2be813fc2c2e7d20d7f2f173f9b56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix-Antoine=20Constantin?= Date: Mon, 30 Dec 2024 21:14:38 -0500 Subject: [PATCH] Gray out morale with undead army --- src/fheroes2/dialog/dialog_quickinfo.cpp | 8 +++++++- src/fheroes2/heroes/heroes_indicator.cpp | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/fheroes2/dialog/dialog_quickinfo.cpp b/src/fheroes2/dialog/dialog_quickinfo.cpp index 7a168b7c08e..d0d19ab74eb 100644 --- a/src/fheroes2/dialog/dialog_quickinfo.cpp +++ b/src/fheroes2/dialog/dialog_quickinfo.cpp @@ -55,6 +55,7 @@ #include "maps_tiles_helper.h" #include "math_base.h" #include "mp2.h" +#include "pal.h" #include "profit.h" #include "resource.h" #include "screen.h" @@ -760,7 +761,12 @@ namespace // morale if ( isFullInfo ) { const int32_t morale = hero.GetMorale(); - const fheroes2::Sprite & sprite = fheroes2::AGG::GetICN( ICN::MINILKMR, ( 0 > morale ? 3 : ( 0 < morale ? 4 : 5 ) ) ); + fheroes2::Sprite sprite = fheroes2::AGG::GetICN( ICN::MINILKMR, ( 0 > morale ? 3 : ( 0 < morale ? 4 : 5 ) ) ); + if(hero.GetArmy().AllTroopsAreUndead()) + { + fheroes2::ApplyPalette(sprite, PAL::GetPalette(PAL::PaletteType::GRAY)); + fheroes2::ApplyPalette(sprite, PAL::GetPalette(PAL::PaletteType::DARKENING)); + } uint32_t count = ( 0 == morale ? 1 : std::abs( morale ) ); dst_pt.x = cur_rt.x + 10; dst_pt.y = cur_rt.y + ( count == 1 ? 20 : 13 ); diff --git a/src/fheroes2/heroes/heroes_indicator.cpp b/src/fheroes2/heroes/heroes_indicator.cpp index d86f0b94cff..a4409486bec 100644 --- a/src/fheroes2/heroes/heroes_indicator.cpp +++ b/src/fheroes2/heroes/heroes_indicator.cpp @@ -33,7 +33,9 @@ #include "dialog.h" #include "heroes.h" #include "icn.h" +#include "image.h" #include "localevent.h" +#include "pal.h" #include "screen.h" #include "tools.h" #include "translations.h" @@ -149,12 +151,14 @@ void MoraleIndicator::Redraw() _description.append( modificators ); } + fheroes2::Sprite sprite = fheroes2::AGG::GetICN( ICN::HSICONS, ( 0 > _morale ? 5 : ( 0 < _morale ? 4 : 7 ) ) ); if ( _hero->GetArmy().AllTroopsAreUndead() ) { _description.append( "\n\n" ); _description.append( _( "Entire army is undead, so morale does not apply." ) ); + fheroes2::ApplyPalette( sprite, PAL::GetPalette( PAL::PaletteType::GRAY ) ); + fheroes2::ApplyPalette( sprite, PAL::GetPalette( PAL::PaletteType::DARKENING ) ); } - const fheroes2::Sprite & sprite = fheroes2::AGG::GetICN( ICN::HSICONS, ( 0 > _morale ? 5 : ( 0 < _morale ? 4 : 7 ) ) ); const int32_t inter = 6; int32_t count = ( 0 == _morale ? 1 : std::abs( _morale ) ); int32_t cx = _area.x + ( _area.width - ( sprite.width() + inter * ( count - 1 ) ) ) / 2;