X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=4e12f7929a5be2ada8fa319e6ce275827375fae0;hb=558fd3d14ad1a9dc347998691a0b300fd334a16a;hp=758d9d8224a097d2b0cdd731dfc00dac17117b59;hpb=010a336797f1419945bed60560cc61fb492793f4;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 758d9d8..4e12f79 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -8,6 +8,7 @@ #include "BattleState.h" #include "PartyLayout.h" +#include "states/SelectMoveAction.h" #include "../app/Application.h" #include "../app/Input.h" #include "../geometry/operators.h" @@ -50,6 +51,7 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) { for (vector::size_type i(0), end(heroes.size()); i < end; ++i) { heroTags.push_back(HeroTag(&heroes[i], HeroTag::Alignment((i + 1) % 2))); } + ctrl.PushState(new SelectMoveAction(this)); } void BattleState::ExitState() { @@ -58,7 +60,7 @@ void BattleState::ExitState() { void BattleState::HandleInput(const Input &input) { - attackTypeMenu.ReadInput(input); + } void BattleState::UpdateWorld(float deltaT) { @@ -66,9 +68,7 @@ void BattleState::UpdateWorld(float deltaT) { } void BattleState::Render(SDL_Surface *screen) { - Vector offset( - (screen->w - background->w) / 2, - (screen->h - background->h) / 2); + Vector offset(CalculateScreenOffset(screen)); RenderBackground(screen, offset); RenderMonsters(screen, offset); @@ -101,9 +101,9 @@ void BattleState::RenderHeroes(SDL_Surface *screen, const Vector &offset) { } void BattleState::RenderHeroTags(SDL_Surface *screen, const Vector &offset) { - int uiHeight(background->h / 2), uiOffset(uiHeight); + int uiHeight(BackgroundHeight() / 2), uiOffset(uiHeight); int tagHeight((uiHeight - attackTypeMenu.IconHeight()) / 2); - int tagWidth((background->w - attackTypeMenu.IconWidth()) / 2); + int tagWidth((BackgroundWidth() - attackTypeMenu.IconWidth()) / 2); Point tagPosition[4]; tagPosition[0] = Point(0, uiOffset); @@ -112,14 +112,14 @@ void BattleState::RenderHeroTags(SDL_Surface *screen, const Vector &offset) tagPosition[3] = Point(tagWidth + attackTypeMenu.IconWidth(), uiOffset + tagHeight + attackTypeMenu.IconHeight()); for (vector::size_type i(0), end(heroTags.size()); i < end; ++i) { - heroTags[i].Render(screen, tagWidth, tagHeight, tagPosition[i] + offset); + heroTags[i].Render(screen, tagWidth, tagHeight, tagPosition[i] + offset, i == activeHero); } } void BattleState::RenderAttackTypeMenu(SDL_Surface *screen, const Vector &offset) { Point position( - (background->w - attackTypeMenu.Width()) / 2, - (background->h * 3 / 4) - (attackTypeMenu.Height() / 2)); + (BackgroundWidth() - attackTypeMenu.Width()) / 2, + (BackgroundHeight() * 3 / 4) - (attackTypeMenu.Height() / 2)); attackTypeMenu.Render(screen, position + offset); }