diff options
author | David Athay <ko2fan@gmail.com> | 2008-08-29 09:32:39 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-13 20:45:29 +0100 |
commit | e7662dbaaa6178b9bbe6b5933538b0127810409f (patch) | |
tree | f45a622a8f029dcce2220d87369e752cd517710d /src/monster.cpp | |
parent | c2d2d078724fb579552717aa45f67e835cf47c7a (diff) | |
download | mana-e7662dbaaa6178b9bbe6b5933538b0127810409f.tar.gz mana-e7662dbaaa6178b9bbe6b5933538b0127810409f.tar.bz2 mana-e7662dbaaa6178b9bbe6b5933538b0127810409f.tar.xz mana-e7662dbaaa6178b9bbe6b5933538b0127810409f.zip |
Mantis #406 by jaxad0127
(cherry picked from eAthena client)
Conflicts:
src/monster.cpp
src/resources/monsterinfo.h
Diffstat (limited to 'src/monster.cpp')
-rw-r--r-- | src/monster.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/monster.cpp b/src/monster.cpp index a62c1f4c..c472a21b 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -35,12 +35,26 @@ Monster::Monster(Uint16 id, Uint16 job, Map *map): Being(id, job, map) { const MonsterInfo& info = getInfo(); - std::string filename = info.getSprite(); - if (filename.empty()) - filename = "error.xml"; - mSprites[BASE_SPRITE] = - AnimatedSprite::load("graphics/sprites/" + 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++) + { + if (c == VECTOREND_SPRITE) break; + + std::string file = "graphics/sprites/" + *i; + mSprites[c] = AnimatedSprite::load(file); + c++; + } + + // Ensure that something is shown + if (c == BASE_SPRITE) + { + mSprites[c] = AnimatedSprite::load("graphics/sprites/error.xml"); + } const std::list<std::string> &particleEffects = info.getParticleEffects(); for (std::list<std::string>::const_iterator i = particleEffects.begin(); @@ -111,7 +125,13 @@ Monster::setAction(Action action, int attackType) 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; } } |