From 6243e38c2f13754d11b750ffee069dd1542f905e Mon Sep 17 00:00:00 2001 From: ewew ukek Date: Wed, 20 Mar 2024 23:59:46 +0000 Subject: Color setting for attack range of monsters from ignore list This MR displays attack range of monsters from ignore attack list in different color. I picked magenta as default, this may be changed if needed. There are actor types other than monsters but looks like it's not possible to add them to ignore list anyway. * Flip if branches for readability * Color setting for attack range of monsters from ignore list **** --- src/being/being.cpp | 12 ++++++++++-- src/enums/gui/usercolorid.h | 1 + src/gui/userpalette.cpp | 7 +++++++ src/gui/widgets/tabs/setup_colors.cpp | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 3f30ae4b0..1aef0abea 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -4046,8 +4046,16 @@ void Being::drawMonsterSpriteAt(Graphics *restrict const graphics, else attackRange = mapTileSize; - graphics->setColor(userPalette->getColorWithAlpha( - UserColorId::MONSTER_ATTACK_RANGE)); + if (actorManager->isInIgnoreAttackList(mName)) + { + graphics->setColor(userPalette->getColorWithAlpha( + UserColorId::IGNORED_MONSTER_ATTACK_RANGE)); + } + else + { + graphics->setColor(userPalette->getColorWithAlpha( + UserColorId::MONSTER_ATTACK_RANGE)); + } graphics->fillRectangle(Rect( x - attackRange, y - attackRange, diff --git a/src/enums/gui/usercolorid.h b/src/enums/gui/usercolorid.h index ddda8955b..541060899 100644 --- a/src/enums/gui/usercolorid.h +++ b/src/enums/gui/usercolorid.h @@ -88,6 +88,7 @@ enumStart(UserColorId) ATTACK_RANGE, ATTACK_RANGE_BORDER, MONSTER_ATTACK_RANGE, + IGNORED_MONSTER_ATTACK_RANGE, SKILL_ATTACK_RANGE, LABEL_OTHER, FLOOR_ITEM_TEXT, diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 246cbac1b..ca86fbb28 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -94,6 +94,7 @@ const std::string ColorTypeNames[CAST_SIZE( "ColorAttackRange", "ColorAttackRangeBorder", "ColorMonsterAttackRange", + "ColorIgnoredMonsterAttackRange", "ColorSkillAttackRange", "", "ColorFloorItemText", @@ -464,6 +465,12 @@ UserPalette::UserPalette() : // TRANSLATORS: palette color _("Monster attack range"), 20); + addColor(UserColorId::IGNORED_MONSTER_ATTACK_RANGE, + 0xff00ff, + GradientType::STATIC, + // TRANSLATORS: palette color + _("Ignored monster attack range"), + 15); addColor(UserColorId::SKILL_ATTACK_RANGE, 0x0, GradientType::STATIC, diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 3851c871d..8c8e29467 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -331,6 +331,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) case UserColorId::HIT_LOCAL_PLAYER_MISS: case UserColorId::ATTACK_RANGE: case UserColorId::MONSTER_ATTACK_RANGE: + case UserColorId::IGNORED_MONSTER_ATTACK_RANGE: case UserColorId::FLOOR_ITEM_TEXT: case UserColorId::SKILL_ATTACK_RANGE: mTextPreview->setShadow(false); @@ -345,6 +346,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) case UserColorId::ATTACK_RANGE: case UserColorId::ATTACK_RANGE_BORDER: case UserColorId::MONSTER_ATTACK_RANGE: + case UserColorId::IGNORED_MONSTER_ATTACK_RANGE: case UserColorId::SKILL_ATTACK_RANGE: case UserColorId::HOME_PLACE: case UserColorId::HOME_PLACE_BORDER: -- cgit v1.2.3-70-g09d2