diff options
author | David Athay <ko2fan@gmail.com> | 2008-08-29 09:32:39 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-08-29 09:32:39 +0000 |
commit | 970b31227bde94f92af392870fc91844f063f167 (patch) | |
tree | b5568efe8ac1a7516bad164c2d02dea41eb9a3a4 /src/monster.cpp | |
parent | 250fd9d43087d6798e3c2dbb2efa566fefcbebeb (diff) | |
download | mana-970b31227bde94f92af392870fc91844f063f167.tar.gz mana-970b31227bde94f92af392870fc91844f063f167.tar.bz2 mana-970b31227bde94f92af392870fc91844f063f167.tar.xz mana-970b31227bde94f92af392870fc91844f063f167.zip |
#406 by jaxad0127v0.0.26
Diffstat (limited to 'src/monster.cpp')
-rw-r--r-- | src/monster.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/monster.cpp b/src/monster.cpp index bea37b3f..d7a2add1 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -45,15 +45,24 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map): { const MonsterInfo& info = MonsterDB::get(job - 1002); - std::string filename = info.getSprite(); - if (filename != "") + // Setup Monster sprites + int c = BASE_SPRITE; + const std::list<std::string> &sprites = info.getSprites(); + for (std::list<std::string>::const_iterator i = sprites.begin(); + i != sprites.end(); + i++) { - mSprites[BASE_SPRITE] = AnimatedSprite::load( - "graphics/sprites/" + filename); + if (c == VECTOREND_SPRITE) break; + + std::string file = "graphics/sprites/" + *i; + mSprites[c] = AnimatedSprite::load(file); + c++; } - else + + // Ensure that something is shown + if (c == BASE_SPRITE) { - mSprites[BASE_SPRITE] = AnimatedSprite::load("graphics/sprites/error.xml"); + mSprites[c] = AnimatedSprite::load("graphics/sprites/error.xml"); } const std::list<std::string> &particleEffects = info.getParticleEffects(); @@ -124,7 +133,13 @@ Monster::setAction(Uint8 action) if (currentAction != ACTION_INVALID) { - mSprites[BASE_SPRITE]->play(currentAction); + for (int i = 0; i < VECTOREND_SPRITE; i++) + { + if (mSprites[i]) + { + mSprites[i]->play(currentAction); + } + } mAction = action; } } |