X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=9830e8c6a0b976f41f26642f024d34d2032e6e6e;hb=e1edc92c4fb834c8061118e89c0d7e239742b030;hp=7c8b3306e8c29947c9a4868c8de8c2d20c8f408f;hpb=f552d26f537af9fa48255bd71cdc1a0a1b860bac;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 7c8b330..9830e8c 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -1,10 +1,3 @@ -/* - * BattleState.cpp - * - * Created on: Aug 5, 2012 - * Author: holy - */ - #include "BattleState.h" #include "PartyLayout.h" @@ -54,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) { @@ -90,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); } @@ -401,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());