]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.cpp
fixed popping all states on application exit
[l2e.git] / src / battle / BattleState.cpp
index 7ea17d82c4e0c29f99e19444baf5fff338331b1b..b934039ef0a0a55b799a96d4d5af6e6a7ab26dbb 100644 (file)
@@ -420,7 +420,14 @@ void BattleState::RenderBackground(SDL_Surface *screen, const Vector<int> &offse
 void BattleState::RenderMonsters(SDL_Surface *screen, const Vector<int> &offset) {
        for (vector<Monster>::size_type i(0), end(monsters.size()); i < end; ++i) {
                if (MonsterPositionOccupied(i)) {
-                       monsters[i].Sprite()->DrawCenter(screen, monsterPositions[i] + offset);
+                       // TODO: better solution for running animations
+                       if (monsters[i].AttackAnimation() && monsters[i].AttackAnimation()->Running()) {
+                               monsters[i].AttackAnimation()->DrawCenter(screen, monsterPositions[i] + offset);
+                       } else if (monsters[i].SpellAnimation() && monsters[i].SpellAnimation()->Running()) {
+                               monsters[i].SpellAnimation()->DrawCenter(screen, monsterPositions[i] + offset);
+                       } else {
+                               monsters[i].Sprite()->DrawCenter(screen, monsterPositions[i] + offset);
+                       }
                }
        }
 }