diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 8 | ||||
-rw-r--r-- | src/resources/beinginfo.cpp | 4 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 14 | ||||
-rw-r--r-- | src/resources/monsterdb.cpp | 6 | ||||
-rw-r--r-- | src/resources/npcdb.cpp | 7 |
5 files changed, 36 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index 465ee42dd..b08e95e96 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -307,13 +307,17 @@ void Being::setSubtype(const uint16_t subtype) { setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay()); + mYDiff = mInfo->getSortOffsetY(); } } else if (mType == NPC) { mInfo = NPCDB::get(mSubType); if (mInfo) + { setupSpriteDisplay(mInfo->getDisplay(), false); + mYDiff = mInfo->getSortOffsetY(); + } } else if (mType == PLAYER) { @@ -1058,8 +1062,8 @@ void Being::setAction(const Action &action, const int attackType A_UNUSED) currentAction = SpriteAction::DEAD; if (mInfo) sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE), mX, mY); - if (mType == MONSTER) - mYDiff = 31; + if (mType == MONSTER || mType == NPC) + mYDiff = mInfo->getDeadSortOffsetY(); break; case STAND: currentAction = SpriteAction::STAND; diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 1559f594c..5ffdb887d 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -43,7 +43,9 @@ BeingInfo::BeingInfo() : mTargetOffsetY(0), mMaxHP(0), mStaticMaxHP(false), - mTargetSelection(true) + mTargetSelection(true), + mSortOffsetY(0), + mDeadSortOffsetY(31) { SpriteDisplay display; display.sprites.push_back(SpriteReference::Empty); diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index 2d5971f91..8b25b4564 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -151,6 +151,18 @@ class BeingInfo bool isTargetSelection() const { return mTargetSelection; } + int getSortOffsetY() + { return mSortOffsetY; } + + void setSortOffsetY(const int n) + { mSortOffsetY = n; } + + int getDeadSortOffsetY() + { return mDeadSortOffsetY; } + + void setDeadSortOffsetY(const int n) + { mDeadSortOffsetY = n; } + static void clear(); private: @@ -166,6 +178,8 @@ class BeingInfo int mMaxHP; bool mStaticMaxHP; bool mTargetSelection; + int mSortOffsetY; + int mDeadSortOffsetY; }; typedef std::map<int, BeingInfo*> BeingInfos; diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index 26c72ed2f..f4987afb0 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -95,6 +95,12 @@ void MonsterDB::load() currentInfo->setMaxHP(XML::getProperty(monsterNode, "maxHP", 0)); + currentInfo->setSortOffsetY(XML::getProperty( + monsterNode, "sortOffsetY", 0)); + + currentInfo->setDeadSortOffsetY(XML::getProperty( + monsterNode, "deadSortOffsetY", 31)); + unsigned char block = 0; std::string walkStr = XML::getProperty( monsterNode, "walkType", "walk"); diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 3ce300138..81a89b611 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -85,6 +85,13 @@ void NPCDB::load() currentInfo->setTargetOffsetY(XML::getProperty(npcNode, "targetOffsetY", 0)); + + currentInfo->setSortOffsetY(XML::getProperty(npcNode, + "sortOffsetY", 0)); + + currentInfo->setDeadSortOffsetY(XML::getProperty(npcNode, + "deadSortOffsetY", 31)); + SpriteDisplay display; for_each_xml_child_node(spriteNode, npcNode) { |