diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 5 | ||||
-rw-r--r-- | src/being.h | 4 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 6 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 44 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 16 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 8 |
9 files changed, 81 insertions, 20 deletions
diff --git a/src/being.cpp b/src/being.cpp index d24ba1374..baf9ae651 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2176,6 +2176,9 @@ void Being::recalcSpritesOrder() int dir = mSpriteDirection; if (dir < 0 || dir >= 9) dir = 0; + // hack for allow different logic in dead player + if (mAction == DEAD) + dir = 9; for (unsigned slot = 0; slot < sz; slot ++) { @@ -2199,7 +2202,7 @@ void Being::recalcSpritesOrder() if (info.isRemoveSprites()) { SpriteToItemMap *const spriteToItems - = info.getSpriteToItemReplaceMap(mSpriteDirection); + = info.getSpriteToItemReplaceMap(dir); if (spriteToItems) { diff --git a/src/being.h b/src/being.h index 453a30a18..019c9eec8 100644 --- a/src/being.h +++ b/src/being.h @@ -820,6 +820,8 @@ class Being : public ActorSprite, public ConfigListener int getSpriteID(const int slot) const; + void recalcSpritesOrder(); + static uint8_t genderToInt(const Gender sex); static Gender intToGender(uint8_t sex); @@ -835,8 +837,6 @@ class Being : public ActorSprite, public ConfigListener */ virtual void updateCoords(); - void recalcSpritesOrder(); - void showName(); BeingInfo *mInfo; diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 5a3ca3cc7..d8fd49fe2 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -401,7 +401,11 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) if (msg.readInt8() == 1) { - dstBeing->setAction(Being::DEAD); + if (dstBeing->getCurrentAction() != Being::DEAD) + { + dstBeing->setAction(Being::DEAD); + dstBeing->recalcSpritesOrder(); + } if (dstBeing->getName() == "Jack O" && killStats) killStats->jackoDead(id); } diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index aa998158c..b73782d3e 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -443,7 +443,11 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) deathNotice = new OkDialog(_("Message"), randomDeathMessage(), DIALOG_OK, false); deathNotice->addActionListener(&deathListener); - player_node->setAction(Being::DEAD); + if (player_node->getCurrentAction() != Being::DEAD) + { + player_node->setAction(Being::DEAD); + player_node->recalcSpritesOrder(); + } } } diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 1af410632..cfe90f198 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -586,7 +586,11 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) break; case 1: - dstBeing->setAction(Being::DEAD); + if (dstBeing->getCurrentAction() != Being::DEAD) + { + dstBeing->setAction(Being::DEAD); + dstBeing->recalcSpritesOrder(); + } break; case 2: diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 9a2827ee5..a4ab0f48b 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -600,7 +600,11 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) break; case 1: - dstBeing->setAction(Being::DEAD); + if (dstBeing->getCurrentAction() != Being::DEAD) + { + dstBeing->setAction(Being::DEAD); + dstBeing->recalcSpritesOrder(); + } break; case 2: diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 1ae7c2c59..03894d8bc 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -366,6 +366,43 @@ void ItemDB::load() } } +/* + logger->log("start dump item: %d", id); + if (itemInfo->isRemoveSprites()) + { + for (int f = 0; f < 10; f ++) + { + logger->log("dir: %d", f); + SpriteToItemMap *const spriteToItems + = itemInfo->getSpriteToItemReplaceMap(f); + if (!spriteToItems) + { + logger->log("null"); + continue; + } + for (SpriteToItemMapCIter itr = spriteToItems->begin(), + itr_end = spriteToItems->end(); itr != itr_end; ++ itr) + { + const int remSprite = itr->first; + const std::map<int, int> &itemReplacer = itr->second; + logger->log("sprite: %d", remSprite); + + for (std::map<int, int>::const_iterator + repIt = itemReplacer.begin(), + repIt_end = itemReplacer.end(); + repIt != repIt_end; ++ repIt) + { + logger->log("from %d to %d", repIt->first, + repIt->second); + } + } + } + } + + logger->log("--------------------------------"); + logger->log("end dump item"); +*/ + itemInfo->setDisplay(display); mItemInfos[id] = itemInfo; @@ -601,6 +638,11 @@ int parseDirectionName(std::string name) { id = -3; } + // hack for died action. + else if (name == "died") + { + id = 9; + } return id; } @@ -675,7 +717,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode) { case -1: { - for (int f = 0; f < 9; f ++) + for (int f = 0; f < 10; f ++) { std::map<int, int> *mapList = itemInfo->addReplaceSprite( diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 57ccfb2e2..ed3e95e4e 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -84,7 +84,7 @@ ItemInfo::ItemInfo() : mHitEffectId(0), mCriticalHitEffectId(0) { - for (int f = 0; f < 9; f ++) + for (int f = 0; f < 10; f ++) { mSpriteToItemReplaceMap[f] = nullptr; mDrawBefore[f] = -1; @@ -97,7 +97,7 @@ ItemInfo::~ItemInfo() { delete_all(mSpriteToItemReplaceList); mSpriteToItemReplaceList.clear(); - for (int f = 0; f < 9; f ++) + for (int f = 0; f < 10; f ++) mSpriteToItemReplaceMap[f] = nullptr; } @@ -153,7 +153,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const std::map<int, int> *ItemInfo::addReplaceSprite(int sprite, int direction) { - if (direction < 0 || direction >= 9) + if (direction < 0 || direction >= 10) return nullptr; SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction]; @@ -239,7 +239,7 @@ const std::string ItemInfo::replaceColors(std::string str, SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(int direction) const { - if (direction < 0 || direction >= 9) + if (direction < 0 || direction >= 10) return nullptr; SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction]; @@ -258,7 +258,7 @@ void ItemInfo::setSpriteOrder(int *ptr, int direction, int n, int def) { if (direction == -1) { - for (int f = 0; f < 9; f ++) + for (int f = 0; f < 10; f ++) { if (ptr[f] == def) ptr[f] = n; @@ -302,21 +302,21 @@ void ItemInfo::setDrawPriority(int direction, int n) int ItemInfo::getDrawBefore(int direction) const { - if (direction < 0 || direction >= 9) + if (direction < 0 || direction >= 10) return -1; return mDrawBefore[direction]; } int ItemInfo::getDrawAfter(int direction) const { - if (direction < 0 || direction >= 9) + if (direction < 0 || direction >= 10) return -1; return mDrawAfter[direction]; } int ItemInfo::getDrawPriority(int direction) const { - if (direction < 0 || direction >= 9) + if (direction < 0 || direction >= 10) return 0; return mDrawPriority[direction]; } diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index f1d44f24d..655bc049c 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -261,9 +261,9 @@ class ItemInfo const std::string replaceColors(std::string str, unsigned char color) const; - int mDrawBefore[9]; - int mDrawAfter[9]; - int mDrawPriority[9]; + int mDrawBefore[10]; + int mDrawAfter[10]; + int mDrawPriority[10]; protected: SpriteDisplay mDisplay; /**< Display info (like icon) */ @@ -277,7 +277,7 @@ class ItemInfo int mId; /**< Item ID */ bool mIsRemoveSprites; // sprite, <itemfrom, itemto> [direction] - SpriteToItemMap *mSpriteToItemReplaceMap[9]; + SpriteToItemMap *mSpriteToItemReplaceMap[10]; std::vector<SpriteToItemMap*> mSpriteToItemReplaceList; |