diff options
author | Lloyd Bryant <lloyd_bryant@netzero.net> | 2008-08-29 21:13:19 +0000 |
---|---|---|
committer | Lloyd Bryant <lloyd_bryant@netzero.net> | 2008-08-29 21:13:19 +0000 |
commit | c43c4cfc69133c1d1da4e89c3879b96d8edfa981 (patch) | |
tree | 3a15cf416c55fb30429ed77ad698fd17027ebd88 /src/monster.cpp | |
parent | af742ceb85512edd1d6883a5ea4f4188e64725be (diff) | |
download | mana-c43c4cfc69133c1d1da4e89c3879b96d8edfa981.tar.gz mana-c43c4cfc69133c1d1da4e89c3879b96d8edfa981.tar.bz2 mana-c43c4cfc69133c1d1da4e89c3879b96d8edfa981.tar.xz mana-c43c4cfc69133c1d1da4e89c3879b96d8edfa981.zip |
Committed complex (multi-sprite) monster patch - from TMW Mantis, by Jaxad0127
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 e5f9f4b2..d3e52520 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -44,15 +44,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(); @@ -122,7 +131,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; } } |