summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-03 22:10:59 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-03 22:10:59 +0300
commit6a0345c70155f9ff00e52f8952c1e79f61e0d445 (patch)
tree80d7fc2390c2a0103b10c508c317b5c9b40f2248 /src/being/being.cpp
parentabeecf1255d28a7870aef9f70dc3353d9b5f4f2d (diff)
downloadManaVerse-6a0345c70155f9ff00e52f8952c1e79f61e0d445.tar.gz
ManaVerse-6a0345c70155f9ff00e52f8952c1e79f61e0d445.tar.bz2
ManaVerse-6a0345c70155f9ff00e52f8952c1e79f61e0d445.tar.xz
ManaVerse-6a0345c70155f9ff00e52f8952c1e79f61e0d445.zip
Add support for elemental db and draw elementals sprites.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp56
1 files changed, 39 insertions, 17 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 35e9356bc..9a4cc2be3 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -79,6 +79,7 @@
#include "resources/db/avatardb.h"
#include "resources/db/badgesdb.h"
+#include "resources/db/elementaldb.h"
#include "resources/db/emotedb.h"
#include "resources/db/homunculusdb.h"
#include "resources/db/horsedb.h"
@@ -270,32 +271,42 @@ Being::Being(const BeingId id,
setMap(map);
setSubtype(subtype, 0);
- if (mType == ActorType::Player
- || mType == ActorType::Mercenary
- || mType == ActorType::Pet
- || mType == ActorType::Homunculus)
- {
- mShowName = config.getBoolValue("visiblenames");
- }
- else if (mType != ActorType::Npc)
- {
- mGotComment = true;
- }
+ bool showName = false;
- if (mType == ActorType::Portal ||
- mType == ActorType::SkillUnit)
+ switch (mType)
{
- mShowName = false;
+ case ActorType::Player:
+ case ActorType::Mercenary:
+ case ActorType::Pet:
+ case ActorType::Homunculus:
+ case ActorType::Elemental:
+ showName = config.getBoolValue("visiblenames");
+ break;
+ case ActorType::Portal:
+ case ActorType::SkillUnit:
+ showName = false;
+ break;
+ default:
+ case ActorType::Unknown:
+ case ActorType::Npc:
+ case ActorType::Monster:
+ case ActorType::FloorItem:
+ case ActorType::LocalPet:
+ case ActorType::Avatar:
+ break;
}
+ if (mType != ActorType::Npc)
+ mGotComment = true;
+
config.addListener("visiblenames", this);
reReadConfig();
if (mType == ActorType::Npc)
setShowName(true);
- else
- setShowName(mShowName);
+ else if (showName)
+ setShowName(showName);
updateColors();
updatePercentHP();
@@ -430,6 +441,18 @@ void Being::setSubtype(const BeingTypeId subtype,
mYDiff = mInfo->getSortOffsetY();
}
break;
+ case ActorType::Elemental:
+ mInfo = ElementalDb::get(mSubType);
+ if (mInfo)
+ {
+ setName(mInfo->getName());
+ setupSpriteDisplay(mInfo->getDisplay(),
+ ForceDisplay_false,
+ 0,
+ mInfo->getColor(fromInt(mLook, ItemColor)));
+ mYDiff = mInfo->getSortOffsetY();
+ }
+ break;
case ActorType::Npc:
mInfo = NPCDB::get(mSubType);
if (mInfo)
@@ -498,7 +521,6 @@ void Being::setSubtype(const BeingTypeId subtype,
break;
case ActorType::Unknown:
case ActorType::FloorItem:
- case ActorType::Elemental:
default:
reportAlways("Wrong being type %d in setSubType",
CAST_S32(mType));