summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-12-22 02:51:13 +0300
committerAndrei Karas <akaras@inbox.ru>2017-12-22 02:51:27 +0300
commitc58b6c63c89e18a9feef819f584426d329ff38ac (patch)
treec4a79de160b0cd21f99677a0ca8d547b9f40705b /src
parentb54c0e944974669c4b5c1eb3f8018547c2179630 (diff)
downloadmv-c58b6c63c89e18a9feef819f584426d329ff38ac.tar.gz
mv-c58b6c63c89e18a9feef819f584426d329ff38ac.tar.bz2
mv-c58b6c63c89e18a9feef819f584426d329ff38ac.tar.xz
mv-c58b6c63c89e18a9feef819f584426d329ff38ac.zip
Remove default parameters from userpalette.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp85
-rw-r--r--src/being/flooritem.cpp3
-rw-r--r--src/being/localplayer.cpp4
-rw-r--r--src/gui/userpalette.cpp96
-rw-r--r--src/gui/userpalette.h4
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp4
-rw-r--r--src/gui/windows/minimap.cpp6
-rw-r--r--src/resources/map/mapitem.cpp2
8 files changed, 132 insertions, 72 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 6bb49a0c8..769c0d93f 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -642,7 +642,7 @@ void Being::setSpeech(const std::string &restrict text) restrict2
mPixelX,
mPixelY - getHeight(),
Graphics::CENTER,
- &userPalette->getColor(UserColorId::PARTICLE),
+ &userPalette->getColor(UserColorId::PARTICLE, 255U),
Speech_true,
nullptr);
mText->adviseXY(mPixelX,
@@ -688,11 +688,13 @@ void Being::takeDamage(Being *restrict const attacker,
if (attacker == localPlayer)
{
color = &userPalette->getColor(
- UserColorId::HIT_LOCAL_PLAYER_CRITICAL);
+ UserColorId::HIT_LOCAL_PLAYER_CRITICAL,
+ 255U);
}
else
{
- color = &userPalette->getColor(UserColorId::HIT_CRITICAL);
+ color = &userPalette->getColor(UserColorId::HIT_CRITICAL,
+ 255U);
}
}
else if (amount == 0)
@@ -701,11 +703,13 @@ void Being::takeDamage(Being *restrict const attacker,
{
// This is intended to be the wrong direction to visually
// differentiate between hits and misses
- color = &userPalette->getColor(UserColorId::HIT_LOCAL_PLAYER_MISS);
+ color = &userPalette->getColor(UserColorId::HIT_LOCAL_PLAYER_MISS,
+ 255U);
}
else
{
- color = &userPalette->getColor(UserColorId::MISS);
+ color = &userPalette->getColor(UserColorId::MISS,
+ 255U);
}
}
else if (mType == ActorType::Monster ||
@@ -717,12 +721,14 @@ void Being::takeDamage(Being *restrict const attacker,
if (attacker == localPlayer)
{
color = &userPalette->getColor(
- UserColorId::HIT_LOCAL_PLAYER_MONSTER);
+ UserColorId::HIT_LOCAL_PLAYER_MONSTER,
+ 255U);
}
else
{
color = &userPalette->getColor(
- UserColorId::HIT_PLAYER_MONSTER);
+ UserColorId::HIT_PLAYER_MONSTER,
+ 255U);
}
}
else if (mType == ActorType::Player &&
@@ -730,13 +736,15 @@ void Being::takeDamage(Being *restrict const attacker,
this == localPlayer)
{
// here player was attacked by other player. mark him as enemy.
- color = &userPalette->getColor(UserColorId::HIT_PLAYER_PLAYER);
+ color = &userPalette->getColor(UserColorId::HIT_PLAYER_PLAYER,
+ 255U);
attacker->setEnemy(true);
attacker->updateColors();
}
else
{
- color = &userPalette->getColor(UserColorId::HIT_MONSTER_PLAYER);
+ color = &userPalette->getColor(UserColorId::HIT_MONSTER_PLAYER,
+ 255U);
}
if (chatWindow != nullptr && mShowBattleEvents)
@@ -2605,16 +2613,20 @@ void Being::setDefaultNameColor(const UserColorIdT defaultColor) restrict2
{
case 0:
default:
- mNameColor = &userPalette->getColor(defaultColor);
+ mNameColor = &userPalette->getColor(defaultColor,
+ 255U);
break;
case 1:
- mNameColor = &userPalette->getColor(UserColorId::TEAM1);
+ mNameColor = &userPalette->getColor(UserColorId::TEAM1,
+ 255U);
break;
case 2:
- mNameColor = &userPalette->getColor(UserColorId::TEAM2);
+ mNameColor = &userPalette->getColor(UserColorId::TEAM2,
+ 255U);
break;
case 3:
- mNameColor = &userPalette->getColor(UserColorId::TEAM3);
+ mNameColor = &userPalette->getColor(UserColorId::TEAM3,
+ 255U);
break;
}
}
@@ -2626,31 +2638,36 @@ void Being::updateColors()
if (mType == ActorType::Monster)
{
setDefaultNameColor(UserColorId::MONSTER);
- mTextColor = &userPalette->getColor(UserColorId::MONSTER);
+ mTextColor = &userPalette->getColor(UserColorId::MONSTER,
+ 255U);
}
else if (mType == ActorType::Npc)
{
setDefaultNameColor(UserColorId::NPC);
- mTextColor = &userPalette->getColor(UserColorId::NPC);
+ mTextColor = &userPalette->getColor(UserColorId::NPC,
+ 255U);
}
else if (mType == ActorType::Pet)
{
setDefaultNameColor(UserColorId::PET);
- mTextColor = &userPalette->getColor(UserColorId::PET);
+ mTextColor = &userPalette->getColor(UserColorId::PET,
+ 255U);
}
else if (mType == ActorType::Homunculus)
{
setDefaultNameColor(UserColorId::HOMUNCULUS);
- mTextColor = &userPalette->getColor(UserColorId::HOMUNCULUS);
+ mTextColor = &userPalette->getColor(UserColorId::HOMUNCULUS,
+ 255U);
}
else if (mType == ActorType::SkillUnit)
{
setDefaultNameColor(UserColorId::SKILLUNIT);
- mTextColor = &userPalette->getColor(UserColorId::SKILLUNIT);
+ mTextColor = &userPalette->getColor(UserColorId::SKILLUNIT,
+ 255U);
}
else if (this == localPlayer)
{
- mNameColor = &userPalette->getColor(UserColorId::SELF);
+ mNameColor = &userPalette->getColor(UserColorId::SELF, 255U);
mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255);
}
else
@@ -2664,43 +2681,52 @@ void Being::updateColors()
if (mIsGM)
{
- mTextColor = &userPalette->getColor(UserColorId::GM);
- mNameColor = &userPalette->getColor(UserColorId::GM);
+ mTextColor = &userPalette->getColor(UserColorId::GM,
+ 255U);
+ mNameColor = &userPalette->getColor(UserColorId::GM,
+ 255U);
}
else if (mEnemy)
{
- mNameColor = &userPalette->getColor(UserColorId::ENEMY);
+ mNameColor = &userPalette->getColor(UserColorId::ENEMY,
+ 255U);
}
else if ((mParty != nullptr) && (localPlayer != nullptr)
&& mParty == localPlayer->getParty())
{
- mNameColor = &userPalette->getColor(UserColorId::PARTY);
+ mNameColor = &userPalette->getColor(UserColorId::PARTY,
+ 255U);
}
else if ((localPlayer != nullptr) && (getGuild() != nullptr)
&& getGuild() == localPlayer->getGuild())
{
- mNameColor = &userPalette->getColor(UserColorId::GUILD);
+ mNameColor = &userPalette->getColor(UserColorId::GUILD,
+ 255U);
}
else if (playerRelations.getRelation(mName) == Relation::FRIEND)
{
- mNameColor = &userPalette->getColor(UserColorId::FRIEND);
+ mNameColor = &userPalette->getColor(UserColorId::FRIEND,
+ 255U);
}
else if (playerRelations.getRelation(mName) ==
Relation::DISREGARDED
|| playerRelations.getRelation(mName) ==
Relation::BLACKLISTED)
{
- mNameColor = &userPalette->getColor(UserColorId::DISREGARDED);
+ mNameColor = &userPalette->getColor(UserColorId::DISREGARDED,
+ 255U);
}
else if (playerRelations.getRelation(mName)
== Relation::IGNORED ||
playerRelations.getRelation(mName) == Relation::ENEMY2)
{
- mNameColor = &userPalette->getColor(UserColorId::IGNORED);
+ mNameColor = &userPalette->getColor(UserColorId::IGNORED,
+ 255U);
}
else if (playerRelations.getRelation(mName) == Relation::ERASED)
{
- mNameColor = &userPalette->getColor(UserColorId::ERASED);
+ mNameColor = &userPalette->getColor(UserColorId::ERASED,
+ 255U);
}
else
{
@@ -4189,7 +4215,8 @@ void Being::drawPortalSpriteAt(Graphics *restrict const graphics,
if (mDrawHotKeys && !mName.empty())
{
- const Color &color = userPalette->getColor(UserColorId::BEING);
+ const Color &color = userPalette->getColor(UserColorId::BEING,
+ 255U);
gui->getFont()->drawString(graphics, color, color, mName, x, y);
}
}
diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp
index 041531e86..2652d8c35 100644
--- a/src/being/flooritem.cpp
+++ b/src/being/flooritem.cpp
@@ -207,7 +207,8 @@ void FloorItem::draw(Graphics *const graphics,
if (font != nullptr && mAmount > 1)
{
const Color &color = userPalette->getColor(
- UserColorId::FLOOR_ITEM_TEXT);
+ UserColorId::FLOOR_ITEM_TEXT,
+ 255U);
font->drawString(graphics,
color, color,
toString(mAmount),
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 9cfdc4d82..35cfbda38 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -189,7 +189,7 @@ LocalPlayer::LocalPlayer(const BeingId id,
mAdvanced = true;
mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255);
if (userPalette != nullptr)
- mNameColor = &userPalette->getColor(UserColorId::SELF);
+ mNameColor = &userPalette->getColor(UserColorId::SELF, 255U);
else
mNameColor = nullptr;
@@ -296,7 +296,7 @@ void LocalPlayer::logic()
info.first,
mPixelX,
mPixelY - 48,
- &userPalette->getColor(info.second),
+ &userPalette->getColor(info.second, 255U),
gui->getInfoParticleFont(),
true);
}
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 79e3758ac..dfa583a7b 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -142,102 +142,122 @@ UserPalette::UserPalette() :
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Being"));
+ _("Being"),
+ GRADIENT_DELAY);
addColor(UserColorId::FRIEND,
0xb0ffb0,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Friend names"));
+ _("Friend names"),
+ GRADIENT_DELAY);
addColor(UserColorId::DISREGARDED,
0xa00000,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Disregarded names"));
+ _("Disregarded names"),
+ GRADIENT_DELAY);
addColor(UserColorId::IGNORED,
0xff0000,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Ignored names"));
+ _("Ignored names"),
+ GRADIENT_DELAY);
addColor(UserColorId::ERASED,
0xff0000,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Erased names"));
+ _("Erased names"),
+ GRADIENT_DELAY);
addColor(UserColorId::ENEMY,
0xff4040,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Enemy"));
+ _("Enemy"),
+ GRADIENT_DELAY);
addColor(UserColorId::PC,
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Other players names"));
+ _("Other players names"),
+ GRADIENT_DELAY);
addColor(UserColorId::SELF,
0xff8040,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Own name"));
+ _("Own name"),
+ GRADIENT_DELAY);
addColor(UserColorId::GM,
0x00ff00,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("GM names"));
+ _("GM names"),
+ GRADIENT_DELAY);
addColor(UserColorId::NPC,
0xc8c8ff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("NPCs"));
+ _("NPCs"),
+ GRADIENT_DELAY);
addColor(UserColorId::MONSTER,
0xff4040,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Monsters"));
+ _("Monsters"),
+ GRADIENT_DELAY);
addColor(UserColorId::PET,
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Pets"));
+ _("Pets"),
+ GRADIENT_DELAY);
addColor(UserColorId::MERCENARY,
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Mercenary"));
+ _("Mercenary"),
+ GRADIENT_DELAY);
addColor(UserColorId::HOMUNCULUS,
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Homunculus"));
+ _("Homunculus"),
+ GRADIENT_DELAY);
addColor(UserColorId::SKILLUNIT,
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Skill unit"));
+ _("Skill unit"),
+ GRADIENT_DELAY);
addColor(UserColorId::PARTY,
0xff00d8,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Party members"));
+ _("Party members"),
+ GRADIENT_DELAY);
addColor(UserColorId::GUILD,
0xff00d8,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Guild members"));
+ _("Guild members"),
+ GRADIENT_DELAY);
addColor(UserColorId::TEAM1,
0x0000ff,
GradientType::STATIC,
// TRANSLATORS: palette color
- strprintf(_("Team %d"), 1));
+ strprintf(_("Team %d"), 1),
+ GRADIENT_DELAY);
addColor(UserColorId::TEAM2,
0x00a020,
GradientType::STATIC,
// TRANSLATORS: palette color
- strprintf(_("Team %d"), 2));
+ strprintf(_("Team %d"), 2),
+ GRADIENT_DELAY);
addColor(UserColorId::TEAM3,
0xffff20,
GradientType::STATIC,
// TRANSLATORS: palette color
- strprintf(_("Team %d"), 3));
+ strprintf(_("Team %d"), 3),
+ GRADIENT_DELAY);
addLabel(UserColorId::LABEL_PARTICLES,
// TRANSLATORS: palette label
_("Particles"));
@@ -245,17 +265,20 @@ UserPalette::UserPalette() :
0xffffff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Particle effects"));
+ _("Particle effects"),
+ GRADIENT_DELAY);
addColor(UserColorId::PICKUP_INFO,
0x28dc28,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Pickup notification"));
+ _("Pickup notification"),
+ GRADIENT_DELAY);
addColor(UserColorId::EXP_INFO,
0xffff00,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Exp notification"));
+ _("Exp notification"),
+ GRADIENT_DELAY);
addLabel(UserColorId::LABEL_HP,
// TRANSLATORS: palette label
_("Hp bars"));
@@ -326,41 +349,49 @@ UserPalette::UserPalette() :
0x0064ff,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Player hits monster"));
+ _("Player hits monster"),
+ GRADIENT_DELAY);
addColor(UserColorId::HIT_MONSTER_PLAYER,
0xff3232,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Monster hits player"));
+ _("Monster hits player"),
+ GRADIENT_DELAY);
addColor(UserColorId::HIT_PLAYER_PLAYER,
0xff5050,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Other player hits local player"));
+ _("Other player hits local player"),
+ GRADIENT_DELAY);
addColor(UserColorId::HIT_CRITICAL,
0xff0000,
GradientType::RAINBOW,
// TRANSLATORS: palette color
- _("Critical Hit"));
+ _("Critical Hit"),
+ GRADIENT_DELAY);
addColor(UserColorId::HIT_LOCAL_PLAYER_MONSTER,
0x00ff00,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Local player hits monster"));
+ _("Local player hits monster"),
+ GRADIENT_DELAY);
addColor(UserColorId::HIT_LOCAL_PLAYER_CRITICAL,
0xff0000,
GradientType::RAINBOW,
// TRANSLATORS: palette color
- _("Local player critical hit"));
+ _("Local player critical hit"),
+ GRADIENT_DELAY);
addColor(UserColorId::HIT_LOCAL_PLAYER_MISS,
0x00ffa6,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Local player miss"));
+ _("Local player miss"),
+ GRADIENT_DELAY);
addColor(UserColorId::MISS, 0xffff00,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Misses"));
+ _("Misses"),
+ GRADIENT_DELAY);
addLabel(UserColorId::LABEL_TILES,
// TRANSLATORS: palette label
_("Tiles"));
@@ -368,7 +399,8 @@ UserPalette::UserPalette() :
0xC80000,
GradientType::STATIC,
// TRANSLATORS: palette color
- _("Portal highlight"));
+ _("Portal highlight"),
+ GRADIENT_DELAY);
addColor(UserColorId::COLLISION_HIGHLIGHT,
0x0000C8,
GradientType::STATIC,
diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h
index 4f7e0e941..bc20fb486 100644
--- a/src/gui/userpalette.h
+++ b/src/gui/userpalette.h
@@ -157,7 +157,7 @@ class UserPalette final : public Palette, public ListModel
* @return the requested color
*/
inline const Color &getColor(UserColorIdT type,
- const unsigned int alpha = 255U)
+ const unsigned int alpha)
A_WARN_UNUSED
{
if (CAST_SIZE(type) >= mColors.size())
@@ -239,7 +239,7 @@ class UserPalette final : public Palette, public ListModel
const unsigned rgb,
GradientTypeT grad,
const std::string &text,
- int delay = GRADIENT_DELAY);
+ int delay);
void addLabel(const UserColorIdT type,
const std::string &text);
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 4f2b35113..224bc9799 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -252,7 +252,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
mSelected = mColorBox->getSelected();
const UserColorIdT type = static_cast<UserColorIdT>(
userPalette->getColorTypeAt(mSelected));
- const Color *col = &userPalette->getColor(type);
+ const Color *col = &userPalette->getColor(type, 255U);
const GradientTypeT grad = userPalette->getGradientType(type);
const int delay = userPalette->getGradientDelay(type);
const Visible showControls = fromBool(grad != GradientType::LABEL,
@@ -418,7 +418,7 @@ void Setup_Colors::cancel()
userPalette->rollback();
const UserColorIdT type = static_cast<UserColorIdT>(
userPalette->getColorTypeAt(mSelected));
- const Color *const col = &userPalette->getColor(type);
+ const Color *const col = &userPalette->getColor(type, 255U);
mGradTypeSlider->setValue(CAST_S32(
userPalette->getGradientType(type)));
const int delay = userPalette->getGradientDelay(type);
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index cf46bb6c6..b65dee620 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -386,7 +386,7 @@ void Minimap::draw2(Graphics *const graphics)
}
if (userPalette != nullptr)
- graphics->setColor(userPalette->getColor(type));
+ graphics->setColor(userPalette->getColor(type, 255U));
const int offsetHeight = CAST_S32(static_cast<float>(
dotSize - 1) * mHeightProportion);
@@ -422,7 +422,7 @@ void Minimap::draw2(Graphics *const graphics)
if (userPalette != nullptr)
{
graphics->setColor(userPalette->getColor(
- UserColorId::PARTY));
+ UserColorId::PARTY, 255U));
}
const int offsetHeight = CAST_S32(
@@ -472,7 +472,7 @@ void Minimap::draw2(Graphics *const graphics)
y = a.height - h;
}
- graphics->setColor(userPalette->getColor(UserColorId::PC));
+ graphics->setColor(userPalette->getColor(UserColorId::PC, 255U));
graphics->drawRectangle(Rect(x, y, w, h));
graphics->popClipArea();
BLOCK_END("Minimap::draw")
diff --git a/src/resources/map/mapitem.cpp b/src/resources/map/mapitem.cpp
index ff4b6b13e..de057e753 100644
--- a/src/resources/map/mapitem.cpp
+++ b/src/resources/map/mapitem.cpp
@@ -163,7 +163,7 @@ void MapItem::draw(Graphics *const graphics, const int x, const int y,
&& mType != MapItemType::EMPTY)
{
Font *const font = gui->getFont();
- const Color &color = userPalette->getColor(UserColorId::BEING);
+ const Color &color = userPalette->getColor(UserColorId::BEING, 255U);
font->drawString(graphics,
color,
color,