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/npc.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/npc.cpp')
-rw-r--r-- | src/npc.cpp | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/npc.cpp b/src/npc.cpp index cdfe5193..bdbcfb76 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -38,7 +38,7 @@ #include "resources/npcdb.h" NPC::NPC(int id, int subtype, Map *map): - Player(id, subtype, map, true) + Being(id, subtype, map) { setSubtype(subtype); @@ -60,32 +60,7 @@ void NPC::setSubtype(Uint16 subtype) { Being::setSubtype(subtype); - NPCInfo info = NPCDB::get(subtype); - - mSprites.clear(); - // Setup NPC sprites - for (std::list<NPCsprite*>::const_iterator i = info.sprites.begin(); - i != info.sprites.end(); - i++) - { - std::string file = "graphics/sprites/" + (*i)->sprite; - int variant = (*i)->variant; - mSprites.push_back(AnimatedSprite::load(file, variant)); - mSpriteIDs.push_back(0); - mSpriteColors.push_back(""); - } - - if (Particle::enabled) - { - //setup particle effects - for (std::list<std::string>::const_iterator i = info.particles.begin(); - i != info.particles.end(); - i++) - { - Particle *p = particleEngine->addEffect(*i, 0, 0); - this->controlParticle(p); - } - } + setupSpriteDisplay(NPCDB::get(subtype), false); } void NPC::talk() @@ -93,11 +68,6 @@ void NPC::talk() Net::getNpcHandler()->talk(mId); } -void NPC::setSprite(unsigned int slot, int id, const std::string &color) -{ - // Do nothing -} - bool NPC::isTalking() { return NpcDialog::isActive() || BuyDialog::isActive() || |