]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.cpp
removed invalid TODO :o
[l2e.git] / src / battle / BattleState.cpp
index 649470e894dd20e9db70c690a02d39cc938c15ac..fe1b309a3a65b36543de7d8585290f6503b9139f 100644 (file)
@@ -78,9 +78,8 @@ void BattleState::Resize(int w, int h) {
 
 
 void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
-       monstersLayout->CalculatePositions(background->w, background->h, monsterPositions);
-       heroesLayout->CalculatePositions(background->w, background->h, heroesPositions);
        for (int i(0); i < 4; ++i) {
+               heroes[i].Position() = heroesLayout->CalculatePosition(i, background->w, background->h);
                heroes[i].SpellMenu() = res->spellMenuPrototype;
                heroes[i].UpdateSpellMenu();
                heroes[i].IkariMenu() = res->ikariMenuPrototype;
@@ -89,6 +88,10 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
                smallHeroTags[i] = SmallHeroTag(this, i);
        }
 
+       for (int i(0); i < int(monsters.size()); ++i) {
+               monsters[i].Position() = monstersLayout->CalculatePosition(i, background->w, background->h);
+       }
+
        int tagHeight(attackTypeMenu.Height());
        int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2);
        int xOffset((Width() - 2 * tagWidth) / 2);
@@ -369,9 +372,9 @@ 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)) {
                        if (monsters[i].GetAnimation().Running()) {
-                               monsters[i].GetAnimation().DrawCenter(screen, monsterPositions[i] + offset);
+                               monsters[i].GetAnimation().DrawCenter(screen, monsters[i].Position() + offset);
                        } else {
-                               monsters[i].Sprite()->DrawCenter(screen, monsterPositions[i] + offset);
+                               monsters[i].Sprite()->DrawCenter(screen, monsters[i].Position() + offset);
                        }
                }
        }
@@ -381,10 +384,10 @@ void BattleState::RenderHeroes(SDL_Surface *screen, const Vector<int> &offset) {
        assert(screen);
        for (int i(0); i < numHeroes; ++i) {
                if (heroes[i].GetAnimation().Running()) {
-                       heroes[i].GetAnimation().DrawCenter(screen, heroesPositions[i] + offset);
+                       heroes[i].GetAnimation().DrawCenter(screen, heroes[i].Position() + offset);
                } else {
                        int row(heroes[i].Health() > 0 ? 0 : 2);
-                       heroes[i].Sprite()->DrawCenter(screen, heroesPositions[i] + offset, 1, row);
+                       heroes[i].Sprite()->DrawCenter(screen, heroes[i].Position() + offset, 1, row);
                }
        }
 }