summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-30 16:28:38 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-30 16:29:31 +0300
commit2b8e0b02338400b215b73cec900ffa1fddbac60a (patch)
tree0920d2980bf60aeeb5b9a44140f4537353ced0d9
parentdc8422dbac2c45a082153240138d699c1bfc3b88 (diff)
downloadmv-2b8e0b02338400b215b73cec900ffa1fddbac60a.tar.gz
mv-2b8e0b02338400b215b73cec900ffa1fddbac60a.tar.bz2
mv-2b8e0b02338400b215b73cec900ffa1fddbac60a.tar.xz
mv-2b8e0b02338400b215b73cec900ffa1fddbac60a.zip
Move user defined colors enum into separate file.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/being/being.cpp58
-rw-r--r--src/being/localplayer.cpp8
-rw-r--r--src/being/localplayer.h4
-rw-r--r--src/enums/gui/usercolorid.h80
-rw-r--r--src/flooritem.cpp4
-rw-r--r--src/gui/userpalette.cpp106
-rw-r--r--src/gui/userpalette.h50
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp84
-rw-r--r--src/gui/windows/minimap.cpp24
-rw-r--r--src/resources/map/map.cpp6
-rw-r--r--src/resources/map/mapitem.cpp10
-rw-r--r--src/resources/map/maplayer.cpp4
15 files changed, 243 insertions, 201 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index df0be0da1..29a51bc55 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1130,6 +1130,7 @@ SET(SRCS
enums/gui/gradienttype.h
enums/gui/progresscolorid.h
enums/gui/themecolorid.h
+ enums/gui/usercolorid.h
listeners/errorlistener.cpp
listeners/errorlistener.h
listeners/widgetdeathlistener.h
diff --git a/src/Makefile.am b/src/Makefile.am
index f3ef622df..7db06392f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -195,6 +195,7 @@ manaplus_SOURCES += events/actionevent.h \
enums/gui/gradienttype.h \
enums/gui/progresscolorid.h \
enums/gui/themecolorid.h \
+ enums/gui/usercolorid.h \
listeners/errorlistener.cpp \
listeners/errorlistener.h \
listeners/widgetdeathlistener.h \
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 121564ccc..49a044150 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -572,7 +572,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel,
getPixelX(),
getPixelY() - getHeight(),
Graphics::CENTER,
- &userPalette->getColor(UserPalette::PARTICLE),
+ &userPalette->getColor(UserColorId::PARTICLE),
Speech_true);
}
else
@@ -614,11 +614,11 @@ void Being::takeDamage(Being *const attacker,
if (attacker == localPlayer)
{
color = &userPalette->getColor(
- UserPalette::HIT_LOCAL_PLAYER_CRITICAL);
+ UserColorId::HIT_LOCAL_PLAYER_CRITICAL);
}
else
{
- color = &userPalette->getColor(UserPalette::HIT_CRITICAL);
+ color = &userPalette->getColor(UserColorId::HIT_CRITICAL);
}
}
else if (!amount)
@@ -627,11 +627,11 @@ void Being::takeDamage(Being *const attacker,
{
// This is intended to be the wrong direction to visually
// differentiate between hits and misses
- color = &userPalette->getColor(UserPalette::HIT_LOCAL_PLAYER_MISS);
+ color = &userPalette->getColor(UserColorId::HIT_LOCAL_PLAYER_MISS);
}
else
{
- color = &userPalette->getColor(UserPalette::MISS);
+ color = &userPalette->getColor(UserColorId::MISS);
}
}
else if (mType == ActorType::Monster
@@ -645,25 +645,25 @@ void Being::takeDamage(Being *const attacker,
if (attacker == localPlayer)
{
color = &userPalette->getColor(
- UserPalette::HIT_LOCAL_PLAYER_MONSTER);
+ UserColorId::HIT_LOCAL_PLAYER_MONSTER);
}
else
{
color = &userPalette->getColor(
- UserPalette::HIT_PLAYER_MONSTER);
+ UserColorId::HIT_PLAYER_MONSTER);
}
}
else if (mType == ActorType::Player && attacker != localPlayer
&& this == localPlayer)
{
// here player was attacked by other player. mark him as enemy.
- color = &userPalette->getColor(UserPalette::HIT_PLAYER_PLAYER);
+ color = &userPalette->getColor(UserColorId::HIT_PLAYER_PLAYER);
attacker->setEnemy(true);
attacker->updateColors();
}
else
{
- color = &userPalette->getColor(UserPalette::HIT_MONSTER_PLAYER);
+ color = &userPalette->getColor(UserColorId::HIT_MONSTER_PLAYER);
}
if (chatWindow && mShowBattleEvents)
@@ -2062,17 +2062,17 @@ void Being::updateColors()
{
if (mType == ActorType::Monster)
{
- mNameColor = &userPalette->getColor(UserPalette::MONSTER);
- mTextColor = &userPalette->getColor(UserPalette::MONSTER);
+ mNameColor = &userPalette->getColor(UserColorId::MONSTER);
+ mTextColor = &userPalette->getColor(UserColorId::MONSTER);
}
else if (mType == ActorType::Npc)
{
- mNameColor = &userPalette->getColor(UserPalette::NPC);
- mTextColor = &userPalette->getColor(UserPalette::NPC);
+ mNameColor = &userPalette->getColor(UserColorId::NPC);
+ mTextColor = &userPalette->getColor(UserColorId::NPC);
}
else if (this == localPlayer)
{
- mNameColor = &userPalette->getColor(UserPalette::SELF);
+ mNameColor = &userPalette->getColor(UserColorId::SELF);
mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255);
}
else
@@ -2086,50 +2086,50 @@ void Being::updateColors()
if (mIsGM)
{
- mTextColor = &userPalette->getColor(UserPalette::GM);
- mNameColor = &userPalette->getColor(UserPalette::GM);
+ mTextColor = &userPalette->getColor(UserColorId::GM);
+ mNameColor = &userPalette->getColor(UserColorId::GM);
}
else if (mEnemy)
{
- mNameColor = &userPalette->getColor(UserPalette::MONSTER);
+ mNameColor = &userPalette->getColor(UserColorId::MONSTER);
}
else if (mParty && localPlayer
&& mParty == localPlayer->getParty())
{
- mNameColor = &userPalette->getColor(UserPalette::PARTY);
+ mNameColor = &userPalette->getColor(UserColorId::PARTY);
}
else if (localPlayer && getGuild()
&& getGuild() == localPlayer->getGuild())
{
- mNameColor = &userPalette->getColor(UserPalette::GUILD);
+ mNameColor = &userPalette->getColor(UserColorId::GUILD);
}
else if (player_relations.getRelation(mName) ==
PlayerRelation::FRIEND)
{
- mNameColor = &userPalette->getColor(UserPalette::FRIEND);
+ mNameColor = &userPalette->getColor(UserColorId::FRIEND);
}
else if (player_relations.getRelation(mName) ==
PlayerRelation::DISREGARDED
|| player_relations.getRelation(mName) ==
PlayerRelation::BLACKLISTED)
{
- mNameColor = &userPalette->getColor(UserPalette::DISREGARDED);
+ mNameColor = &userPalette->getColor(UserColorId::DISREGARDED);
}
else if (player_relations.getRelation(mName) ==
PlayerRelation::IGNORED
|| player_relations.getRelation(mName) ==
PlayerRelation::ENEMY2)
{
- mNameColor = &userPalette->getColor(UserPalette::IGNORED);
+ mNameColor = &userPalette->getColor(UserColorId::IGNORED);
}
else if (player_relations.getRelation(mName) ==
PlayerRelation::ERASED)
{
- mNameColor = &userPalette->getColor(UserPalette::ERASED);
+ mNameColor = &userPalette->getColor(UserColorId::ERASED);
}
else
{
- mNameColor = &userPalette->getColor(UserPalette::PC);
+ mNameColor = &userPalette->getColor(UserColorId::PC);
}
}
@@ -2560,7 +2560,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
!mMap->getHasWarps())
{
graphics->setColor(userPalette->
- getColorWithAlpha(UserPalette::PORTAL_HIGHLIGHT));
+ getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT));
graphics->fillRectangle(Rect(x, y,
mapTileSize, mapTileSize));
@@ -2570,7 +2570,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
Font *const font = gui->getFont();
if (font)
{
- const Color &color = userPalette->getColor(UserPalette::BEING);
+ const Color &color = userPalette->getColor(UserColorId::BEING);
font->drawString(graphics, color, color, mName, x, y);
}
}
@@ -2586,7 +2586,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
attackRange = mapTileSize;
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::MONSTER_ATTACK_RANGE));
+ UserColorId::MONSTER_ATTACK_RANGE));
graphics->fillRectangle(Rect(
x - attackRange, y - attackRange,
@@ -2602,7 +2602,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
maxHP = mInfo->getMaxHP();
drawHpBar(graphics, maxHP, mHP, mDamageTaken,
- UserPalette::MONSTER_HP, UserPalette::MONSTER_HP2,
+ UserColorId::MONSTER_HP, UserColorId::MONSTER_HP2,
x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
2 * 50, 4);
@@ -2614,7 +2614,7 @@ void Being::drawSpriteAt(Graphics *const graphics,
{
drawHpBar(graphics, PlayerInfo::getAttribute(Attributes::MAX_HP),
PlayerInfo::getAttribute(Attributes::HP), 0,
- UserPalette::PLAYER_HP, UserPalette::PLAYER_HP2,
+ UserColorId::PLAYER_HP, UserColorId::PLAYER_HP2,
x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
2 * 50, 4);
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 6251cc5e5..5c47c55a8 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -185,7 +185,7 @@ LocalPlayer::LocalPlayer(const BeingId id,
mAdvanced = true;
mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255);
if (userPalette)
- mNameColor = &userPalette->getColor(UserPalette::SELF);
+ mNameColor = &userPalette->getColor(UserColorId::SELF);
else
mNameColor = nullptr;
@@ -881,7 +881,7 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo,
if (mMap && config.getBoolValue("showpickupparticle"))
{
// Show pickup notification
- addMessageToQueue(gettext(msg), UserPalette::PICKUP_INFO);
+ addMessageToQueue(gettext(msg), UserColorId::PICKUP_INFO);
}
}
else
@@ -908,11 +908,11 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo,
if (amount > 1)
{
addMessageToQueue(strprintf("%d x %s", amount,
- str.c_str()), UserPalette::PICKUP_INFO);
+ str.c_str()), UserColorId::PICKUP_INFO);
}
else
{
- addMessageToQueue(str, UserPalette::PICKUP_INFO);
+ addMessageToQueue(str, UserColorId::PICKUP_INFO);
}
}
}
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 59bd34d4c..e5ae09ae9 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -27,6 +27,8 @@
#include "enums/being/pickup.h"
+#include "enums/gui/usercolorid.h"
+
#include "enums/simpletypes/keep.h"
#include "gui/userpalette.h"
@@ -278,7 +280,7 @@ class LocalPlayer final : public Being,
void setMap(Map *const map) override final;
void addMessageToQueue(const std::string &message,
- const int color = UserPalette::EXP_INFO);
+ const int color = UserColorId::EXP_INFO);
/**
* Called when a option (set with config.addListener()) is changed
diff --git a/src/enums/gui/usercolorid.h b/src/enums/gui/usercolorid.h
new file mode 100644
index 000000000..0a66cf6b9
--- /dev/null
+++ b/src/enums/gui/usercolorid.h
@@ -0,0 +1,80 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
+ * Copyright (C) 2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_GUI_USERCOLORID_H
+#define ENUMS_GUI_USERCOLORID_H
+
+namespace UserColorId
+{
+ /** List of all colors that are configurable. */
+ enum T
+ {
+ BEING = 0,
+ FRIEND,
+ DISREGARDED,
+ IGNORED,
+ ERASED,
+ PC,
+ SELF,
+ GM,
+ NPC,
+ MONSTER,
+ MONSTER_HP,
+ MONSTER_HP2,
+ PARTY,
+ GUILD,
+ PARTICLE,
+ PICKUP_INFO,
+ EXP_INFO,
+ PLAYER_HP,
+ PLAYER_HP2,
+ HIT_PLAYER_MONSTER,
+ HIT_MONSTER_PLAYER,
+ HIT_PLAYER_PLAYER,
+ HIT_CRITICAL,
+ HIT_LOCAL_PLAYER_MONSTER,
+ HIT_LOCAL_PLAYER_CRITICAL,
+ HIT_LOCAL_PLAYER_MISS,
+ MISS,
+ PORTAL_HIGHLIGHT,
+ COLLISION_HIGHLIGHT,
+ AIR_COLLISION_HIGHLIGHT,
+ WATER_COLLISION_HIGHLIGHT,
+ GROUNDTOP_COLLISION_HIGHLIGHT,
+ WALKABLE_HIGHLIGHT,
+ ATTACK_RANGE,
+ ATTACK_RANGE_BORDER,
+ MONSTER_ATTACK_RANGE,
+ FLOOR_ITEM_TEXT,
+ HOME_PLACE,
+ HOME_PLACE_BORDER,
+ ROAD_POINT,
+ NET,
+ PET,
+ MERCENARY,
+ HOMUNCULUS,
+ USER_COLOR_LAST
+ };
+} // namespace UserColorId
+
+#endif // ENUMS_GUI_USERCOLORID_H
diff --git a/src/flooritem.cpp b/src/flooritem.cpp
index 664beecf8..a3ad4385c 100644
--- a/src/flooritem.cpp
+++ b/src/flooritem.cpp
@@ -24,6 +24,8 @@
#include "configuration.h"
+#include "enums/gui/usercolorid.h"
+
#include "render/graphics.h"
#include "gui/gui.h"
@@ -166,7 +168,7 @@ void FloorItem::draw(Graphics *const graphics,
if (font && mAmount > 1)
{
const Color &color = userPalette->getColor(
- UserPalette::FLOOR_ITEM_TEXT);
+ UserColorId::FLOOR_ITEM_TEXT);
font->drawString(graphics,
color, color,
toString(mAmount),
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 38cf4cfe1..d0e6c2c9a 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -23,6 +23,8 @@
#include "gui/userpalette.h"
+#include "enums/gui/usercolorid.h"
+
#include "configuration.h"
#include "utils/gettext.h"
@@ -103,126 +105,126 @@ std::string UserPalette::getConfigName(const std::string &typeName)
}
UserPalette::UserPalette() :
- Palette(USER_COLOR_LAST)
+ Palette(UserColorId::USER_COLOR_LAST)
{
- mColors[BEING] = ColorElem();
- mColors[PC] = ColorElem();
- mColors[SELF] = ColorElem();
- mColors[GM] = ColorElem();
- mColors[NPC] = ColorElem();
- mColors[MONSTER] = ColorElem();
+ mColors[UserColorId::BEING] = ColorElem();
+ mColors[UserColorId::PC] = ColorElem();
+ mColors[UserColorId::SELF] = ColorElem();
+ mColors[UserColorId::GM] = ColorElem();
+ mColors[UserColorId::NPC] = ColorElem();
+ mColors[UserColorId::MONSTER] = ColorElem();
// TRANSLATORS: palette color
- addColor(BEING, 0xffffff, GradientType::STATIC, _("Being"));
+ addColor(UserColorId::BEING, 0xffffff, GradientType::STATIC, _("Being"));
// TRANSLATORS: palette color
- addColor(FRIEND, 0xb0ffb0, GradientType::STATIC, _("Friend names"));
+ addColor(UserColorId::FRIEND, 0xb0ffb0, GradientType::STATIC, _("Friend names"));
// TRANSLATORS: palette color
- addColor(DISREGARDED, 0xa00000, GradientType::STATIC, _("Disregarded names"));
+ addColor(UserColorId::DISREGARDED, 0xa00000, GradientType::STATIC, _("Disregarded names"));
// TRANSLATORS: palette color
- addColor(IGNORED, 0xff0000, GradientType::STATIC, _("Ignored names"));
+ addColor(UserColorId::IGNORED, 0xff0000, GradientType::STATIC, _("Ignored names"));
// TRANSLATORS: palette color
- addColor(ERASED, 0xff0000, GradientType::STATIC, _("Erased names"));
+ addColor(UserColorId::ERASED, 0xff0000, GradientType::STATIC, _("Erased names"));
// TRANSLATORS: palette color
- addColor(PC, 0xffffff, GradientType::STATIC, _("Other players names"));
+ addColor(UserColorId::PC, 0xffffff, GradientType::STATIC, _("Other players names"));
// TRANSLATORS: palette color
- addColor(SELF, 0xff8040, GradientType::STATIC, _("Own name"));
+ addColor(UserColorId::SELF, 0xff8040, GradientType::STATIC, _("Own name"));
// TRANSLATORS: palette color
- addColor(GM, 0x00ff00, GradientType::STATIC, _("GM names"));
+ addColor(UserColorId::GM, 0x00ff00, GradientType::STATIC, _("GM names"));
// TRANSLATORS: palette color
- addColor(NPC, 0xc8c8ff, GradientType::STATIC, _("NPCs"));
+ addColor(UserColorId::NPC, 0xc8c8ff, GradientType::STATIC, _("NPCs"));
// TRANSLATORS: palette color
- addColor(MONSTER, 0xff4040, GradientType::STATIC, _("Monsters"));
+ addColor(UserColorId::MONSTER, 0xff4040, GradientType::STATIC, _("Monsters"));
// TRANSLATORS: palette color
- addColor(MONSTER_HP, 0x00ff00, GradientType::STATIC, _("Monster HP bar"), 50);
- addColor(MONSTER_HP2, 0xff0000, GradientType::STATIC,
+ addColor(UserColorId::MONSTER_HP, 0x00ff00, GradientType::STATIC, _("Monster HP bar"), 50);
+ addColor(UserColorId::MONSTER_HP2, 0xff0000, GradientType::STATIC,
// TRANSLATORS: palette color
_("Monster HP bar (second color)"), 50);
// TRANSLATORS: palette color
- addColor(PARTY, 0xff00d8, GradientType::STATIC, _("Party members"));
+ addColor(UserColorId::PARTY, 0xff00d8, GradientType::STATIC, _("Party members"));
// TRANSLATORS: palette color
- addColor(GUILD, 0xff00d8, GradientType::STATIC, _("Guild members"));
+ addColor(UserColorId::GUILD, 0xff00d8, GradientType::STATIC, _("Guild members"));
// TRANSLATORS: palette color
- addColor(PARTICLE, 0xffffff, GradientType::STATIC, _("Particle effects"));
+ addColor(UserColorId::PARTICLE, 0xffffff, GradientType::STATIC, _("Particle effects"));
// TRANSLATORS: palette color
- addColor(PICKUP_INFO, 0x28dc28, GradientType::STATIC, _("Pickup notification"));
+ addColor(UserColorId::PICKUP_INFO, 0x28dc28, GradientType::STATIC, _("Pickup notification"));
// TRANSLATORS: palette color
- addColor(EXP_INFO, 0xffff00, GradientType::STATIC, _("Exp notification"));
+ addColor(UserColorId::EXP_INFO, 0xffff00, GradientType::STATIC, _("Exp notification"));
// TRANSLATORS: palette color
- addColor(PLAYER_HP, 0x00ff00, GradientType::STATIC, _("Player HP bar"), 50);
+ addColor(UserColorId::PLAYER_HP, 0x00ff00, GradientType::STATIC, _("Player HP bar"), 50);
// TRANSLATORS: palette color
- addColor(PLAYER_HP2, 0xff0000, GradientType::STATIC,
+ addColor(UserColorId::PLAYER_HP2, 0xff0000, GradientType::STATIC,
// TRANSLATORS: palette color
_("Player HP bar (second color)"), 50);
// TRANSLATORS: palette color
- addColor(HIT_PLAYER_MONSTER, 0x0064ff, GradientType::STATIC, _("Player hits monster"));
+ addColor(UserColorId::HIT_PLAYER_MONSTER, 0x0064ff, GradientType::STATIC, _("Player hits monster"));
// TRANSLATORS: palette color
- addColor(HIT_MONSTER_PLAYER, 0xff3232, GradientType::STATIC, _("Monster hits player"));
+ addColor(UserColorId::HIT_MONSTER_PLAYER, 0xff3232, GradientType::STATIC, _("Monster hits player"));
// TRANSLATORS: palette color
- addColor(HIT_PLAYER_PLAYER, 0xff5050, GradientType::STATIC,
+ addColor(UserColorId::HIT_PLAYER_PLAYER, 0xff5050, GradientType::STATIC,
// TRANSLATORS: palette color
_("Other player hits local player"));
// TRANSLATORS: palette color
- addColor(HIT_CRITICAL, 0xff0000, GradientType::RAINBOW, _("Critical Hit"));
+ addColor(UserColorId::HIT_CRITICAL, 0xff0000, GradientType::RAINBOW, _("Critical Hit"));
// TRANSLATORS: palette color
- addColor(HIT_LOCAL_PLAYER_MONSTER, 0x00ff00, GradientType::STATIC,
+ addColor(UserColorId::HIT_LOCAL_PLAYER_MONSTER, 0x00ff00, GradientType::STATIC,
// TRANSLATORS: palette color
_("Local player hits monster"));
- addColor(HIT_LOCAL_PLAYER_CRITICAL, 0xff0000, GradientType::RAINBOW,
+ addColor(UserColorId::HIT_LOCAL_PLAYER_CRITICAL, 0xff0000, GradientType::RAINBOW,
// TRANSLATORS: palette color
_("Local player critical hit"));
- addColor(HIT_LOCAL_PLAYER_MISS, 0x00ffa6, GradientType::STATIC,
+ addColor(UserColorId::HIT_LOCAL_PLAYER_MISS, 0x00ffa6, GradientType::STATIC,
// TRANSLATORS: palette color
_("Local player miss"));
// TRANSLATORS: palette color
- addColor(MISS, 0xffff00, GradientType::STATIC, _("Misses"));
+ addColor(UserColorId::MISS, 0xffff00, GradientType::STATIC, _("Misses"));
// TRANSLATORS: palette color
- addColor(PORTAL_HIGHLIGHT, 0xC80000, GradientType::STATIC, _("Portal highlight"));
- addColor(COLLISION_HIGHLIGHT, 0x0000C8, GradientType::STATIC,
+ addColor(UserColorId::PORTAL_HIGHLIGHT, 0xC80000, GradientType::STATIC, _("Portal highlight"));
+ addColor(UserColorId::COLLISION_HIGHLIGHT, 0x0000C8, GradientType::STATIC,
// TRANSLATORS: palette color
_("Default collision highlight"), 64);
- addColor(AIR_COLLISION_HIGHLIGHT, 0xe0e0ff, GradientType::STATIC,
+ addColor(UserColorId::AIR_COLLISION_HIGHLIGHT, 0xe0e0ff, GradientType::STATIC,
// TRANSLATORS: palette color
_("Air collision highlight"), 64);
- addColor(WATER_COLLISION_HIGHLIGHT, 0x2050e0, GradientType::STATIC,
+ addColor(UserColorId::WATER_COLLISION_HIGHLIGHT, 0x2050e0, GradientType::STATIC,
// TRANSLATORS: palette color
_("Water collision highlight"), 64);
- addColor(GROUNDTOP_COLLISION_HIGHLIGHT, 0xffff00, GradientType::STATIC,
+ addColor(UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT, 0xffff00, GradientType::STATIC,
// TRANSLATORS: palette color
_("Special ground collision highlight"), 20);
- addColor(WALKABLE_HIGHLIGHT, 0x00D000, GradientType::STATIC,
+ addColor(UserColorId::WALKABLE_HIGHLIGHT, 0x00D000, GradientType::STATIC,
// TRANSLATORS: palette color
_("Walkable highlight"), 255);
- addColor(ATTACK_RANGE, 0xffffff, GradientType::STATIC,
+ addColor(UserColorId::ATTACK_RANGE, 0xffffff, GradientType::STATIC,
// TRANSLATORS: palette color
_("Local player attack range"), 5);
- addColor(ATTACK_RANGE_BORDER, 0x0, GradientType::STATIC,
+ addColor(UserColorId::ATTACK_RANGE_BORDER, 0x0, GradientType::STATIC,
// TRANSLATORS: palette color
_("Local player attack range border"), 76);
- addColor(MONSTER_ATTACK_RANGE, 0xff0000, GradientType::STATIC,
+ addColor(UserColorId::MONSTER_ATTACK_RANGE, 0xff0000, GradientType::STATIC,
// TRANSLATORS: palette color
_("Monster attack range"), 20);
- addColor(FLOOR_ITEM_TEXT, 0xffffff, GradientType::STATIC,
+ addColor(UserColorId::FLOOR_ITEM_TEXT, 0xffffff, GradientType::STATIC,
// TRANSLATORS: palette color
_("Floor item amount color"), 100);
- addColor(HOME_PLACE, 0xffffff, GradientType::STATIC,
+ addColor(UserColorId::HOME_PLACE, 0xffffff, GradientType::STATIC,
// TRANSLATORS: palette color
_("Home place"), 20);
- addColor(HOME_PLACE_BORDER, 0xffff00, GradientType::STATIC,
+ addColor(UserColorId::HOME_PLACE_BORDER, 0xffff00, GradientType::STATIC,
// TRANSLATORS: palette color
_("Home place border"), 200);
- addColor(ROAD_POINT, 0x000000, GradientType::STATIC,
+ addColor(UserColorId::ROAD_POINT, 0x000000, GradientType::STATIC,
// TRANSLATORS: palette color
_("Road point"), 100);
- addColor(NET, 0x000000, GradientType::STATIC,
+ addColor(UserColorId::NET, 0x000000, GradientType::STATIC,
// TRANSLATORS: palette color
_("Tiles border"), 64);
// TRANSLATORS: palette color
- addColor(PET, 0xffffff, GradientType::STATIC, _("Pets"));
+ addColor(UserColorId::PET, 0xffffff, GradientType::STATIC, _("Pets"));
// TRANSLATORS: palette color
- addColor(MERCENARY, 0xffffff, GradientType::STATIC, _("Mercenary"));
+ addColor(UserColorId::MERCENARY, 0xffffff, GradientType::STATIC, _("Mercenary"));
// TRANSLATORS: palette color
- addColor(HOMUNCULUS, 0xffffff, GradientType::STATIC, _("Homunculus"));
+ addColor(UserColorId::HOMUNCULUS, 0xffffff, GradientType::STATIC, _("Homunculus"));
commit(true);
}
@@ -329,7 +331,7 @@ void UserPalette::rollback()
int UserPalette::getColorTypeAt(const int i)
{
if (i < 0 || i >= getNumberOfElements())
- return BEING;
+ return UserColorId::BEING;
return mColors[i].type;
}
diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h
index 61f4a1799..3b3bd9d67 100644
--- a/src/gui/userpalette.h
+++ b/src/gui/userpalette.h
@@ -34,56 +34,6 @@
class UserPalette final : public Palette, public ListModel
{
public:
- /** List of all colors that are configurable. */
- enum
- {
- BEING = 0,
- FRIEND,
- DISREGARDED,
- IGNORED,
- ERASED,
- PC,
- SELF,
- GM,
- NPC,
- MONSTER,
- MONSTER_HP,
- MONSTER_HP2,
- PARTY,
- GUILD,
- PARTICLE,
- PICKUP_INFO,
- EXP_INFO,
- PLAYER_HP,
- PLAYER_HP2,
- HIT_PLAYER_MONSTER,
- HIT_MONSTER_PLAYER,
- HIT_PLAYER_PLAYER,
- HIT_CRITICAL,
- HIT_LOCAL_PLAYER_MONSTER,
- HIT_LOCAL_PLAYER_CRITICAL,
- HIT_LOCAL_PLAYER_MISS,
- MISS,
- PORTAL_HIGHLIGHT,
- COLLISION_HIGHLIGHT,
- AIR_COLLISION_HIGHLIGHT,
- WATER_COLLISION_HIGHLIGHT,
- GROUNDTOP_COLLISION_HIGHLIGHT,
- WALKABLE_HIGHLIGHT,
- ATTACK_RANGE,
- ATTACK_RANGE_BORDER,
- MONSTER_ATTACK_RANGE,
- FLOOR_ITEM_TEXT,
- HOME_PLACE,
- HOME_PLACE_BORDER,
- ROAD_POINT,
- NET,
- PET,
- MERCENARY,
- HOMUNCULUS,
- USER_COLOR_LAST
- };
-
/**
* Constructor
*/
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 5a91f24b9..78b66b930 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -330,7 +330,7 @@ void Viewport::drawDebugPath(Graphics *const graphics)
lastMouseDestination = mouseDestination;
}
drawPath(graphics, debugPath, userPalette->getColorWithAlpha(
- UserPalette::ROAD_POINT));
+ UserColorId::ROAD_POINT));
const ActorSprites &actors = actorManager->getAll();
FOR_EACH (ActorSpritesConstIterator, it, actors)
@@ -340,7 +340,7 @@ void Viewport::drawDebugPath(Graphics *const graphics)
{
const Path &beingPath = being->getPath();
drawPath(graphics, beingPath, userPalette->getColorWithAlpha(
- UserPalette::ROAD_POINT));
+ UserColorId::ROAD_POINT));
}
}
}
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index b511a1446..ce567bfa7 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -21,6 +21,8 @@
#include "gui/widgets/tabs/setup_colors.h"
+#include "enums/gui/usercolorid.h"
+
#include "gui/gui.h"
#include "gui/userpalette.h"
@@ -265,40 +267,40 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
switch (type)
{
- case UserPalette::AIR_COLLISION_HIGHLIGHT:
- case UserPalette::WATER_COLLISION_HIGHLIGHT:
- case UserPalette::GROUNDTOP_COLLISION_HIGHLIGHT:
- case UserPalette::COLLISION_HIGHLIGHT:
- case UserPalette::PORTAL_HIGHLIGHT:
- case UserPalette::HOME_PLACE:
- case UserPalette::ROAD_POINT:
- case UserPalette::NET:
+ case UserColorId::AIR_COLLISION_HIGHLIGHT:
+ case UserColorId::WATER_COLLISION_HIGHLIGHT:
+ case UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT:
+ case UserColorId::COLLISION_HIGHLIGHT:
+ case UserColorId::PORTAL_HIGHLIGHT:
+ case UserColorId::HOME_PLACE:
+ case UserColorId::ROAD_POINT:
+ case UserColorId::NET:
mTextPreview->setBGColor(col);
mTextPreview->setOpaque(true);
mTextPreview->setOutline(false);
mTextPreview->setShadow(false);
break;
- case UserPalette::ATTACK_RANGE_BORDER:
- case UserPalette::HOME_PLACE_BORDER:
+ case UserColorId::ATTACK_RANGE_BORDER:
+ case UserColorId::HOME_PLACE_BORDER:
if (gui)
mTextPreview->setFont(gui->getFont());
mTextPreview->setTextColor(col);
mTextPreview->setOutline(false);
mTextPreview->setShadow(false);
break;
- case UserPalette::PARTICLE:
- case UserPalette::EXP_INFO:
- case UserPalette::PICKUP_INFO:
- case UserPalette::HIT_PLAYER_MONSTER:
- case UserPalette::HIT_MONSTER_PLAYER:
- case UserPalette::HIT_CRITICAL:
- case UserPalette::MISS:
- case UserPalette::HIT_LOCAL_PLAYER_MONSTER:
- case UserPalette::HIT_LOCAL_PLAYER_CRITICAL:
- case UserPalette::HIT_LOCAL_PLAYER_MISS:
- case UserPalette::ATTACK_RANGE:
- case UserPalette::MONSTER_ATTACK_RANGE:
- case UserPalette::FLOOR_ITEM_TEXT:
+ case UserColorId::PARTICLE:
+ case UserColorId::EXP_INFO:
+ case UserColorId::PICKUP_INFO:
+ case UserColorId::HIT_PLAYER_MONSTER:
+ case UserColorId::HIT_MONSTER_PLAYER:
+ case UserColorId::HIT_CRITICAL:
+ case UserColorId::MISS:
+ case UserColorId::HIT_LOCAL_PLAYER_MONSTER:
+ case UserColorId::HIT_LOCAL_PLAYER_CRITICAL:
+ case UserColorId::HIT_LOCAL_PLAYER_MISS:
+ case UserColorId::ATTACK_RANGE:
+ case UserColorId::MONSTER_ATTACK_RANGE:
+ case UserColorId::FLOOR_ITEM_TEXT:
mTextPreview->setShadow(false);
break;
default:
@@ -307,24 +309,24 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
switch (type)
{
- case UserPalette::PORTAL_HIGHLIGHT:
- case UserPalette::ATTACK_RANGE:
- case UserPalette::ATTACK_RANGE_BORDER:
- case UserPalette::MONSTER_ATTACK_RANGE:
- case UserPalette::HOME_PLACE:
- case UserPalette::HOME_PLACE_BORDER:
- case UserPalette::AIR_COLLISION_HIGHLIGHT:
- case UserPalette::WATER_COLLISION_HIGHLIGHT:
- case UserPalette::GROUNDTOP_COLLISION_HIGHLIGHT:
- case UserPalette::COLLISION_HIGHLIGHT:
- case UserPalette::WALKABLE_HIGHLIGHT:
- case UserPalette::ROAD_POINT:
- case UserPalette::MONSTER_HP:
- case UserPalette::MONSTER_HP2:
- case UserPalette::PLAYER_HP:
- case UserPalette::PLAYER_HP2:
- case UserPalette::FLOOR_ITEM_TEXT:
- case UserPalette::NET:
+ case UserColorId::PORTAL_HIGHLIGHT:
+ case UserColorId::ATTACK_RANGE:
+ case UserColorId::ATTACK_RANGE_BORDER:
+ case UserColorId::MONSTER_ATTACK_RANGE:
+ case UserColorId::HOME_PLACE:
+ case UserColorId::HOME_PLACE_BORDER:
+ case UserColorId::AIR_COLLISION_HIGHLIGHT:
+ case UserColorId::WATER_COLLISION_HIGHLIGHT:
+ case UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT:
+ case UserColorId::COLLISION_HIGHLIGHT:
+ case UserColorId::WALKABLE_HIGHLIGHT:
+ case UserColorId::ROAD_POINT:
+ case UserColorId::MONSTER_HP:
+ case UserColorId::MONSTER_HP2:
+ case UserColorId::PLAYER_HP:
+ case UserColorId::PLAYER_HP2:
+ case UserColorId::FLOOR_ITEM_TEXT:
+ case UserColorId::NET:
// TRANSLATORS: colors tab. label.
mGradDelayLabel->setCaption(_("Alpha:"));
mGradDelayText->setRange(0, 255);
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 279b3e840..2f73d50e6 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -312,51 +312,51 @@ void Minimap::draw2(Graphics *const graphics)
continue;
int dotSize = 2;
- int type = UserPalette::PC;
+ int type = UserColorId::PC;
if (being == localPlayer)
{
- type = UserPalette::SELF;
+ type = UserColorId::SELF;
dotSize = 3;
}
else if (being->isGM())
{
- type = UserPalette::GM;
+ type = UserColorId::GM;
}
else if (being->getGuild() == localPlayer->getGuild()
|| being->getGuildName() == localPlayer->getGuildName())
{
- type = UserPalette::GUILD;
+ type = UserColorId::GUILD;
}
else
{
switch (being->getType())
{
case ActorType::Monster:
- type = UserPalette::MONSTER;
+ type = UserColorId::MONSTER;
break;
case ActorType::Npc:
- type = UserPalette::NPC;
+ type = UserColorId::NPC;
break;
case ActorType::Portal:
- type = UserPalette::PORTAL_HIGHLIGHT;
+ type = UserColorId::PORTAL_HIGHLIGHT;
break;
case ActorType::LocalPet:
#ifdef EATHENA_SUPPORT
case ActorType::Pet:
#endif
- type = UserPalette::PET;
+ type = UserColorId::PET;
break;
#ifdef EATHENA_SUPPORT
case ActorType::Mercenary:
- type = UserPalette::MERCENARY;
+ type = UserColorId::MERCENARY;
break;
case ActorType::Homunculus:
- type = UserPalette::HOMUNCULUS;
+ type = UserColorId::HOMUNCULUS;
break;
#endif
case ActorType::Avatar:
@@ -407,7 +407,7 @@ void Minimap::draw2(Graphics *const graphics)
if (userPalette)
{
graphics->setColor(userPalette->getColor(
- UserPalette::PARTY));
+ UserColorId::PARTY));
}
const int offsetHeight = static_cast<int>(
@@ -459,7 +459,7 @@ void Minimap::draw2(Graphics *const graphics)
y = a.height - h;
}
- graphics->setColor(userPalette->getColor(UserPalette::PC));
+ graphics->setColor(userPalette->getColor(UserColorId::PC));
graphics->drawRectangle(Rect(x, y, w, h));
graphics->popClipArea();
BLOCK_END("Minimap::draw")
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 111e7c26b..6ccc7b7a4 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -354,7 +354,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
if (mDrawLayersFlags == MapType::BLACKWHITE && userPalette)
{
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::WALKABLE_HIGHLIGHT));
+ UserColorId::WALKABLE_HIGHLIGHT));
graphics->fillRectangle(Rect(0, 0,
graphics->mWidth, graphics->mHeight));
@@ -541,7 +541,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
if (width && userPalette)\
{\
graphics->setColor(userPalette->getColorWithAlpha(\
- UserPalette::color));\
+ UserColorId::color));\
graphics->fillRectangle(Rect(\
x0 * mTileWidth - scrollX, \
y * mTileHeight - scrollY, \
@@ -570,7 +570,7 @@ void Map::drawCollision(Graphics *const graphics,
if (drawFlags < MapType::SPECIAL)
{
- graphics->setColor(userPalette->getColorWithAlpha(UserPalette::NET));
+ graphics->setColor(userPalette->getColorWithAlpha(UserColorId::NET));
graphics->drawNet(
startX * mTileWidth - scrollX,
startY * mTileHeight - scrollY,
diff --git a/src/resources/map/mapitem.cpp b/src/resources/map/mapitem.cpp
index 3037dfb4a..29f2b8eff 100644
--- a/src/resources/map/mapitem.cpp
+++ b/src/resources/map/mapitem.cpp
@@ -20,6 +20,8 @@
#include "resources/map/mapitem.h"
+#include "enums/gui/usercolorid.h"
+
#include "gui/gui.h"
#include "gui/userpalette.h"
@@ -141,17 +143,17 @@ void MapItem::draw(Graphics *const graphics, const int x, const int y,
case MapItemType::ROAD:
case MapItemType::CROSS:
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::ROAD_POINT));
+ UserColorId::ROAD_POINT));
graphics->fillRectangle(Rect(x + dx / 3, y + dy / 3,
dx / 3, dy / 3));
break;
case MapItemType::HOME:
{
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::HOME_PLACE));
+ UserColorId::HOME_PLACE));
graphics->fillRectangle(Rect(x, y, dx, dy));
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::HOME_PLACE_BORDER));
+ UserColorId::HOME_PLACE_BORDER));
graphics->drawRectangle(Rect(x, y, dx, dy));
break;
}
@@ -165,7 +167,7 @@ void MapItem::draw(Graphics *const graphics, const int x, const int y,
Font *const font = gui->getFont();
if (font)
{
- const Color &color = userPalette->getColor(UserPalette::BEING);
+ const Color &color = userPalette->getColor(UserColorId::BEING);
font->drawString(graphics,
color,
color,
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 9b73046bd..d7aaa8e72 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -626,10 +626,10 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
if (userPalette)
{
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::ATTACK_RANGE));
+ UserColorId::ATTACK_RANGE));
graphics->fillRectangle(Rect(x, y, w, h));
graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::ATTACK_RANGE_BORDER));
+ UserColorId::ATTACK_RANGE_BORDER));
graphics->drawRectangle(Rect(x, y, w, h));
}
}