diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-21 22:12:51 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-21 22:12:51 +0200 |
commit | 05ea95733e9ec89626e08989e0688e73d1408d3a (patch) | |
tree | 2351a8f2b6b81eb48a6f5f4dd068a9a13d117fb1 /src | |
parent | 7be91e6213aadb0405bdd2fa3a9210598b254041 (diff) | |
download | mv-05ea95733e9ec89626e08989e0688e73d1408d3a.tar.gz mv-05ea95733e9ec89626e08989e0688e73d1408d3a.tar.bz2 mv-05ea95733e9ec89626e08989e0688e73d1408d3a.tar.xz mv-05ea95733e9ec89626e08989e0688e73d1408d3a.zip |
Add floor items attribute for drawing floor items.
Diffstat (limited to 'src')
-rw-r--r-- | src/actorsprite.cpp | 14 | ||||
-rw-r--r-- | src/actorsprite.h | 2 | ||||
-rw-r--r-- | src/flooritem.cpp | 2 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 5 | ||||
-rw-r--r-- | src/resources/spritedef.h | 1 |
5 files changed, 20 insertions, 4 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index 3af80ef0d..cb01a2118 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -300,7 +300,7 @@ void ActorSprite::handleStatusEffect(StatusEffect *effect, int effectId) } void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, - bool forceDisplay) + bool forceDisplay, int imageType) { clear(); @@ -324,7 +324,17 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, else { ResourceManager *resman = ResourceManager::getInstance(); - std::string imagePath = "graphics/items/" + display.image; + std::string imagePath; + switch (imageType) + { + case 0: + default: + imagePath = "graphics/items/" + display.image; + break; + case 1: + imagePath = "graphics/items/" + display.floor; + break; + } Image *img = resman->getImage(imagePath); if (!img) diff --git a/src/actorsprite.h b/src/actorsprite.h index 9d648355e..adec76196 100644 --- a/src/actorsprite.h +++ b/src/actorsprite.h @@ -210,7 +210,7 @@ protected: virtual void handleStatusEffect(StatusEffect *effect, int effectId); void setupSpriteDisplay(const SpriteDisplay &display, - bool forceDisplay = true); + bool forceDisplay = true, int imageType = 0); int mId; Uint16 mStunMode; /**< Stun mode; zero if not stunned */ diff --git a/src/flooritem.cpp b/src/flooritem.cpp index b669bece3..88a8971b9 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -68,7 +68,7 @@ FloorItem::FloorItem(int id, mPos.y = 0; } - setupSpriteDisplay(ItemDB::get(itemId).getDisplay()); + setupSpriteDisplay(ItemDB::get(itemId).getDisplay(), true, 1); } const ItemInfo &FloorItem::getInfo() const diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index e2775c8e8..826912b33 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -199,6 +199,7 @@ void ItemDB::load() std::string name = XML::getProperty(node, "name", ""); std::string image = XML::getProperty(node, "image", ""); + std::string floor = XML::getProperty(node, "floor", ""); std::string description = XML::getProperty(node, "description", ""); std::string attackAction = XML::getProperty(node, "attack-action", ""); std::string drawBefore = XML::getProperty(node, "drawBefore", ""); @@ -218,6 +219,10 @@ void ItemDB::load() SpriteDisplay display; display.image = image; + if (floor != "") + display.floor = floor; + else + display.floor = image; ItemInfo *itemInfo = new ItemInfo; itemInfo->setId(id); diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 84582c779..5ab4bcc2b 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -51,6 +51,7 @@ struct SpriteReference struct SpriteDisplay { std::string image; + std::string floor; std::list<SpriteReference*> sprites; std::list<std::string> particles; }; |