X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=fe1b309a3a65b36543de7d8585290f6503b9139f;hb=9718062e6ed305d9f8f1674ff172079688e78088;hp=649470e894dd20e9db70c690a02d39cc938c15ac;hpb=8967f42789c619df6e5874f5c6a9ea4b6b6c33db;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 649470e..fe1b309 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -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 &offset) for (vector::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 &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); } } }