summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-16 16:40:49 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-16 16:40:49 +0300
commitbb58d4020ff5d8ade0fec58d3e311ac211c262ef (patch)
treed7ce1aa93672c87901680282951a86b30f281f12 /src/being
parent93a94dba623aa1f04107d23c96082ba9e2990469 (diff)
downloadmv-bb58d4020ff5d8ade0fec58d3e311ac211c262ef.tar.gz
mv-bb58d4020ff5d8ade0fec58d3e311ac211c262ef.tar.bz2
mv-bb58d4020ff5d8ade0fec58d3e311ac211c262ef.tar.xz
mv-bb58d4020ff5d8ade0fec58d3e311ac211c262ef.zip
Allow set team color to being.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp35
-rw-r--r--src/being/being.h8
2 files changed, 40 insertions, 3 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index c15c80df3..08f055ed2 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -216,6 +216,7 @@ Being::Being(const BeingId id,
mKarma(0),
mManner(0),
mAreaSize(11),
+ mTeamId(0U),
mLook(0U),
mHairColor(0),
mErased(false),
@@ -2049,18 +2050,37 @@ void Being::showName()
updateCoords();
}
+void Being::setDefaultNameColor(const UserColorIdT defaultColor)
+{
+ switch (mTeamId)
+ {
+ case 0:
+ mNameColor = &userPalette->getColor(defaultColor);
+ break;
+ case 1:
+ mNameColor = &userPalette->getColor(UserColorId::TEAM1);
+ break;
+ case 2:
+ mNameColor = &userPalette->getColor(UserColorId::TEAM2);
+ break;
+ case 3:
+ mNameColor = &userPalette->getColor(UserColorId::TEAM3);
+ break;
+ }
+}
+
void Being::updateColors()
{
if (userPalette)
{
if (mType == ActorType::Monster)
{
- mNameColor = &userPalette->getColor(UserColorId::MONSTER);
+ setDefaultNameColor(UserColorId::MONSTER);
mTextColor = &userPalette->getColor(UserColorId::MONSTER);
}
else if (mType == ActorType::Npc)
{
- mNameColor = &userPalette->getColor(UserColorId::NPC);
+ setDefaultNameColor(UserColorId::NPC);
mTextColor = &userPalette->getColor(UserColorId::NPC);
}
else if (this == localPlayer)
@@ -2119,7 +2139,7 @@ void Being::updateColors()
}
else
{
- mNameColor = &userPalette->getColor(UserColorId::PC);
+ setDefaultNameColor(UserColorId::PC);
}
}
@@ -3647,6 +3667,15 @@ void Being::recreateItemParticles()
}
}
+void Being::setTeamId(const uint16_t teamId)
+{
+ if (mTeamId != teamId)
+ {
+ mTeamId = teamId;
+ updateColors();
+ }
+}
+
#ifdef EATHENA_SUPPORT
void Being::setChat(ChatObject *const obj)
{
diff --git a/src/being/being.h b/src/being/being.h
index ebce57c41..521a554cf 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -925,6 +925,11 @@ class Being notfinal : public ActorSprite,
void setAreaSize(const int areaSize)
{ mAreaSize = areaSize; }
+ void setTeamId(const uint16_t teamId);
+
+ uint16_t getTeamId() const
+ { return mTeamId; }
+
protected:
/**
* Updates name's location.
@@ -941,6 +946,8 @@ class Being notfinal : public ActorSprite,
void createSpeechBubble();
+ void setDefaultNameColor(const UserColorIdT defaultColor);
+
static int getDefaultEffectId(const AttackTypeT &type);
BeingInfo *mInfo;
@@ -1105,6 +1112,7 @@ class Being notfinal : public ActorSprite,
int mKarma;
int mManner;
int mAreaSize;
+ uint16_t mTeamId;
uint16_t mLook;
unsigned char mHairColor;
bool mErased;