]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.cpp
added capsule mockup (battle)
[l2e.git] / src / battle / BattleState.cpp
index 36b4af53752714d58d1fc356230709b2aeaec988..9830e8c6a0b976f41f26642f024d34d2032e6e6e 100644 (file)
@@ -47,6 +47,10 @@ void BattleState::AddHero(const Hero &h) {
        ++numHeroes;
 }
 
+void BattleState::SetCapsule(const Capsule &c) {
+       capsule = c;
+}
+
 void BattleState::NextHero() {
        ++activeHero;
        while (activeHero < numHeroes && heroes[activeHero].Health() == 0) {
@@ -83,6 +87,8 @@ void BattleState::OnEnterState(SDL_Surface *screen) {
                smallHeroTags[i] = SmallHeroTag(this, i);
        }
 
+       capsule.Position() = heroesLayout->CalculatePosition(4, background->w, background->h);
+
        for (int i(0); i < int(monsters.size()); ++i) {
                monsters[i].Position() = monstersLayout->CalculatePosition(i, background->w, background->h);
        }
@@ -394,6 +400,15 @@ void BattleState::RenderHeroes(SDL_Surface *screen, const Vector<int> &offset) {
        }
 }
 
+void BattleState::RenderCapsule(SDL_Surface *screen, const Vector<int> &offset) {
+       if (capsule.Health() <= 0) return;
+       if (capsule.GetAnimation().Running()) {
+               capsule.GetAnimation().DrawCenter(screen, capsule.Position() + offset);
+       } else {
+               capsule.Sprite()->DrawCenter(screen, capsule.Position() + offset);
+       }
+}
+
 void BattleState::RenderHeroTags(SDL_Surface *screen, const Vector<int> &offset) {
        assert(screen);
        int tagHeight(attackTypeMenu.Height());