diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-05-02 14:43:40 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-05-06 22:21:57 -0600 |
commit | 9baedc27191c82bbf1fedee2a7e738bc5b267c0e (patch) | |
tree | f0986c6839d1e79b402d5d4ec36e4994741955ea /src/resources/npcdb.cpp | |
parent | 844e9a7a72faca6a212e788a3adc45e17f41dca6 (diff) | |
download | mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.gz mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.bz2 mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.xz mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.zip |
Add support for floor item sprites
This commit adds a sprite hierarchy (Sprite->ImageSprite,AnimatedSprite,CompundSprite;
CompoundSprite,Actor->ActorSprite;ActorSprite->Being,FloorItem) to collect common
functionailty into new base classes which will make other Mantis tickets easier to do.
Also allows monsters to use particle effects.
Reviewed-by: Bertram
Diffstat (limited to 'src/resources/npcdb.cpp')
-rw-r--r-- | src/resources/npcdb.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 4bc5a6e4..e2628257 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -28,7 +28,7 @@ namespace { NPCInfos mNPCInfos; - NPCInfo mUnknown; + SpriteDisplay mUnknown; bool mLoaded = false; } @@ -37,10 +37,12 @@ void NPCDB::load() if (mLoaded) return; - NPCsprite *unknownSprite = new NPCsprite; - unknownSprite->sprite = "error.xml"; - unknownSprite->variant = 0; - mUnknown.sprites.push_back(unknownSprite); + { + SpriteReference *unknownSprite = new SpriteReference; + unknownSprite->sprite = "error.xml"; + unknownSprite->variant = 0; + mUnknown.sprites.push_back(unknownSprite); + } logger->log("Initializing NPC database..."); @@ -65,13 +67,13 @@ void NPCDB::load() continue; } - NPCInfo *currentInfo = new NPCInfo; + SpriteDisplay *currentInfo = new SpriteDisplay; for_each_xml_child_node(spriteNode, npcNode) { if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) { - NPCsprite *currentSprite = new NPCsprite; + SpriteReference *currentSprite = new SpriteReference; currentSprite->sprite = (const char*)spriteNode->xmlChildrenNode->content; currentSprite->variant = XML::getProperty(spriteNode, "variant", 0); currentInfo->sprites.push_back(currentSprite); @@ -113,7 +115,7 @@ void NPCDB::unload() mLoaded = false; } -const NPCInfo& NPCDB::get(int id) +const SpriteDisplay& NPCDB::get(int id) { NPCInfosIterator i = mNPCInfos.find(id); |