summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp19
-rw-r--r--src/being.h1
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.h7
4 files changed, 29 insertions, 0 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 8cde401f2..7851725d4 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -207,9 +207,13 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map):
mPvpRank(0)
{
mSpriteRemap = new int[20];
+ mSpriteHide = new int[20];
for (int f = 0; f < 20; f ++)
+ {
mSpriteRemap[f] = f;
+ mSpriteHide[f] = 0;
+ }
setMap(map);
setSubtype(subtype);
@@ -238,6 +242,8 @@ Being::~Being()
delete[] mSpriteRemap;
mSpriteRemap = 0;
+ delete[] mSpriteHide;
+ mSpriteHide = 0;
delete mSpeechBubble;
mSpeechBubble = 0;
@@ -1699,6 +1705,9 @@ void Being::drawSprites(Graphics* graphics, int posX, int posY) const
// CompoundSprite::drawSprites(graphics, posX, posY);
for (int f = 0; f < getNumberOfLayers(); f ++)
{
+ if (mSpriteHide[mSpriteRemap[f]])
+ continue;
+
Sprite *sprite = getSprite(mSpriteRemap[f]);
if (sprite)
{
@@ -1716,6 +1725,9 @@ void Being::drawSpritesSDL(Graphics* graphics, int posX, int posY) const
for (unsigned f = 0; f < size(); f ++)
{
+ if (mSpriteHide[mSpriteRemap[f]])
+ continue;
+
Sprite *sprite = getSprite(mSpriteRemap[f]);
if (sprite)
sprite->draw(graphics, posX, posY);
@@ -1875,6 +1887,10 @@ void Being::recalcSpritesOrder()
// logger->log("preparation start");
std::vector<int>::iterator it;
+
+ for (unsigned slot = 0; slot < sz; slot ++)
+ mSpriteHide[slot] = 0;
+
for (unsigned slot = 0; slot < sz; slot ++)
{
slotRemap.push_back(slot);
@@ -1884,6 +1900,9 @@ void Being::recalcSpritesOrder()
continue;
const ItemInfo &info = ItemDB::get(id);
+ if (info.getRemoveSprite() > 0)
+ mSpriteHide[info.getRemoveSprite()] = 1;
+
if (info.getDrawBefore() > 0)
{
int id2 = mSpriteIDs[info.getDrawBefore()];
diff --git a/src/being.h b/src/being.h
index f9731366a..db170af30 100644
--- a/src/being.h
+++ b/src/being.h
@@ -764,6 +764,7 @@ class Being : public ActorSprite, public ConfigListener
std::string mIp;
unsigned int mPvpRank;
int *mSpriteRemap;
+ int *mSpriteHide;
};
extern std::list<BeingCacheEntry*> beingInfoCache;
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 826912b33..075104516 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -204,6 +204,7 @@ void ItemDB::load()
std::string attackAction = XML::getProperty(node, "attack-action", "");
std::string drawBefore = XML::getProperty(node, "drawBefore", "");
std::string drawAfter = XML::getProperty(node, "drawAfter", "");
+ std::string removeSprite = XML::getProperty(node, "removeSprite", "");
std::string tags[3];
tags[0] = XML::getProperty(node, "tag",
@@ -263,6 +264,7 @@ void ItemDB::load()
itemInfo->setDrawBefore(parseSpriteName(drawBefore));
itemInfo->setDrawAfter(parseSpriteName(drawAfter));
itemInfo->setDrawPriority(drawPriority);
+ itemInfo->setRemoveSprite(parseSpriteName(removeSprite));
std::string effect;
for (int i = 0; i < int(sizeof(fields) / sizeof(fields[0])); ++i)
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 25a30407a..fe07d016a 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -207,6 +207,12 @@ class ItemInfo
void setDrawPriority(int n)
{ mDrawPriority = n; }
+ int getRemoveSprite() const
+ { return mRemoveSprite; }
+
+ void setRemoveSprite(int n)
+ { mRemoveSprite = n; }
+
std::map<int, int> getTags() const
{ return mTags; }
@@ -226,6 +232,7 @@ class ItemInfo
int mDrawBefore;
int mDrawAfter;
int mDrawPriority;
+ int mRemoveSprite;
// Equipment related members.
/** Attack type, in case of weapon.