summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-28 13:25:35 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-29 00:49:52 +0300
commit46696c84bad31e35e003b5c09998503119b128eb (patch)
tree7449b98a62fa7ff520d995b27511878d2605c7d4 /src/resources
parentc79403e1341ac533df1771b866d1f5cee15e12b5 (diff)
downloadplus-46696c84bad31e35e003b5c09998503119b128eb.tar.gz
plus-46696c84bad31e35e003b5c09998503119b128eb.tar.bz2
plus-46696c84bad31e35e003b5c09998503119b128eb.tar.xz
plus-46696c84bad31e35e003b5c09998503119b128eb.zip
Add to replace/reorder sprites pseudo direction "died"
It allow change sprites in dead players.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/itemdb.cpp44
-rw-r--r--src/resources/iteminfo.cpp16
-rw-r--r--src/resources/iteminfo.h8
3 files changed, 55 insertions, 13 deletions
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;