X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectAttackType.cpp;h=2664295929ca873055902587c0764a1f93b310a0;hb=c8dccd84477d10dcd3ec884478a9f26c16b54ad7;hp=c0548132b536c115d5cee98265ce4afd43856ace;hpb=4d0a650b178d81387caa36953ed06cc5d6c28213;p=l2e.git diff --git a/src/battle/states/SelectAttackType.cpp b/src/battle/states/SelectAttackType.cpp index c054813..2664295 100644 --- a/src/battle/states/SelectAttackType.cpp +++ b/src/battle/states/SelectAttackType.cpp @@ -9,25 +9,35 @@ #include "../AttackChoice.h" #include "../BattleState.h" +#include "../../app/Application.h" #include "../../app/Input.h" #include "../../geometry/operators.h" #include +using app::Application; using app::Input; using geometry::Point; using geometry::Vector; namespace battle { -void SelectAttackType::EnterState(app::Application &c, SDL_Surface *screen) { +void SelectAttackType::EnterState(Application &c, SDL_Surface *screen) { ctrl = &c; } -void SelectAttackType::ExitState() { +void SelectAttackType::ExitState(Application &c, SDL_Surface *screen) { ctrl = 0; } +void SelectAttackType::ResumeState(Application &ctrl, SDL_Surface *screen) { + +} + +void SelectAttackType::PauseState(Application &ctrl, SDL_Surface *screen) { + +} + void SelectAttackType::Resize(int width, int height) { @@ -48,15 +58,16 @@ void SelectAttackType::HandleInput(const Input &input) { } if (input.JustPressed(Input::ACTION_A)) { + battle->SetAttackType(battle->GetAttackTypeMenu().Selected()); switch (battle->GetAttackTypeMenu().Selected()) { case AttackChoice::SWORD: - // TODO: switch to next character + battle->NextHero(); break; case AttackChoice::MAGIC: // TODO: switch to spell select break; case AttackChoice::DEFEND: - // TODO: switch to next character + battle->NextHero(); break; case AttackChoice::IKARI: // TODO: switch to ikari attack select @@ -68,6 +79,11 @@ void SelectAttackType::HandleInput(const Input &input) { throw std::logic_error("selected invalid attack type"); } } + + if (battle->AttackSelectionDone()) { + // TODO: switch to battle animation instead + ctrl->PopState(); + } } void SelectAttackType::UpdateWorld(float deltaT) { @@ -85,7 +101,7 @@ void SelectAttackType::Render(SDL_Surface *screen) { void SelectAttackType::RenderMenu(SDL_Surface *screen, const Vector &offset) { Point position( (battle->BackgroundWidth() - battle->GetAttackTypeMenu().Width()) / 2, - (battle->BackgroundHeight() * 3 / 4) - (battle->GetAttackTypeMenu().Height() / 2)); + battle->BackgroundHeight() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2); battle->GetAttackTypeMenu().Render(screen, position + offset); }