]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.h
added AttackAnimation
[l2e.git] / src / battle / BattleState.h
index f5bf9cb1b915ee9e60de2a3516104adac9842052..3acc0b7699c79dd9ffeaef66c686d263c2a4d29e 100644 (file)
 #include "Monster.h"
 #include "MoveMenu.h"
 #include "Resources.h"
+#include "SmallHeroTag.h"
 #include "../app/State.h"
 #include "../geometry/Point.h"
 #include "../geometry/Vector.h"
+#include "../graphics/Animation.h"
 #include "../graphics/Menu.h"
 
 #include <vector>
@@ -83,8 +85,7 @@ public:
        graphics::Menu<const common::Item *> &GetItemMenu() { return itemMenu; }
        const graphics::Menu<const common::Item *> &GetItemMenu() const { return itemMenu; }
 
-       bool HasMoreHeroes() const { return activeHero < numHeroes; }
-       void NextHero() { ++activeHero; }
+       void NextHero();
        bool BeforeFirstHero() const { return activeHero < 0; }
        void PreviousHero() { --activeHero; }
        void SwapHeroes(int lhs, int rhs);
@@ -106,29 +107,40 @@ public:
        bool AttackSelectionDone() const { return activeHero >= numHeroes; }
 
        int NumHeroes() const { return numHeroes; }
+       int MaxHeroes() const { return 4; }
        int MaxMonsters() const { return monsters.size(); }
 
        const std::vector<geometry::Point<int> > &MonsterPositions() const { return monsterPositions; }
        bool MonsterPositionOccupied(int index) { return index >= 0 && index < int(monsters.size()) && monsters[index].Health() > 0; }
        const std::vector<geometry::Point<int> > &HeroesPositions() const { return heroesPositions; }
-       bool HeroPositionOccupied(int index) { return index >= 0 && index < numHeroes; }
+       bool HeroPositionOccupied(int index) const { return index >= 0 && index < numHeroes; }
 
        void SetRunaway() { ranAway = true; }
        void ClearAllAttacks();
 
+       struct Order {
+               Order(int index, bool isMonster)
+               : index(index), isMonster(isMonster) { }
+               int index;
+               bool isMonster;
+       };
+
+       void WriteOrder(std::vector<Order> &);
+
 public:
        geometry::Vector<int> CalculateScreenOffset(SDL_Surface *screen) const {
                return geometry::Vector<int>(
                                (screen->w - background->w) / 2,
                                (screen->h - background->h) / 2);
        }
-       int BackgroundWidth() const { return background->w; }
-       int BackgroundHeight() const { return background->h; }
+       int Width() const { return background->w; }
+       int Height() const { return background->h; }
 
        void RenderBackground(SDL_Surface *screen, const geometry::Vector<int> &offset);
        void RenderMonsters(SDL_Surface *screen, const geometry::Vector<int> &offset);
        void RenderHeroes(SDL_Surface *screen, const geometry::Vector<int> &offset);
        void RenderHeroTags(SDL_Surface *screen, const geometry::Vector<int> &offset);
+       void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector<int> &offset);
 
 private:
        void LoadSpellMenu(std::vector<Hero>::size_type heroIndex);
@@ -151,7 +163,9 @@ private:
        graphics::Menu<const common::Item *> itemMenu;
        graphics::Menu<const common::Item *> ikariMenus[4];
        HeroTag heroTags[4];
+       SmallHeroTag smallHeroTags[4];
        geometry::Point<int> heroTagPositions[4];
+       geometry::Point<int> smallHeroTagPositions[4];
        AttackChoice attackChoices[4];
        int numHeroes;
        int activeHero;