X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=9830e8c6a0b976f41f26642f024d34d2032e6e6e;hb=e1edc92c4fb834c8061118e89c0d7e239742b030;hp=36b4af53752714d58d1fc356230709b2aeaec988;hpb=a67f7e662c85b2b8d46f26a3c6e018b2df6eb318;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 36b4af5..9830e8c 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -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 &offset) { } } +void BattleState::RenderCapsule(SDL_Surface *screen, const Vector &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 &offset) { assert(screen); int tagHeight(attackTypeMenu.Height());