From e7662dbaaa6178b9bbe6b5933538b0127810409f Mon Sep 17 00:00:00 2001 From: David Athay Date: Fri, 29 Aug 2008 09:32:39 +0000 Subject: Mantis #406 by jaxad0127 (cherry picked from eAthena client) Conflicts: src/monster.cpp src/resources/monsterinfo.h --- src/monster.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/monster.cpp') 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 &sprites = info.getSprites(); + for (std::list::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 &particleEffects = info.getParticleEffects(); for (std::list::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; } } -- cgit v1.2.3-70-g09d2