X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectIkari.cpp;h=d66f8b5458dff6fccd822a38d278e6b61ea5a776;hb=2147d00bbcb43f5cb4499091f646057cb6944cb3;hp=7928888d2bb031805d703001be8733336a180e0d;hpb=41983a2cd8dbbfe6adc02cdfccbf5c2887306e51;p=l2e.git diff --git a/src/battle/states/SelectIkari.cpp b/src/battle/states/SelectIkari.cpp index 7928888..d66f8b5 100644 --- a/src/battle/states/SelectIkari.cpp +++ b/src/battle/states/SelectIkari.cpp @@ -36,7 +36,9 @@ void SelectIkari::ExitState(Application &c, SDL_Surface *screen) { } void SelectIkari::ResumeState(Application &ctrl, SDL_Surface *screen) { - if (battle->ActiveHeroTargets().HasSelected()) { + if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) { + battle->ActiveHero().GetAttackChoice().SetType(AttackChoice::IKARI); + battle->ActiveHero().GetAttackChoice().SetItem(battle->GetIkariMenu().Selected()); ctrl.PopState(); } } @@ -51,29 +53,30 @@ void SelectIkari::Resize(int width, int height) { } -void SelectIkari::HandleInput(const Input &input) { +void SelectIkari::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { if (battle->GetIkariMenu().SelectedIsEnabled() && battle->GetIkariMenu().Selected()->HasIkari()) { + AttackChoice &ac(battle->ActiveHero().GetAttackChoice()); const Ikari *ikari(battle->GetIkariMenu().Selected()->GetIkari()); - battle->ActiveHeroTargets().Reset(); + ac.Selection().Reset(); if (ikari->GetTargetingMode().TargetsAlly()) { - battle->ActiveHeroTargets().SelectHeroes(); + ac.Selection().SelectHeroes(); } else { - battle->ActiveHeroTargets().SelectEnemies(); + ac.Selection().SelectEnemies(); } if (ikari->GetTargetingMode().TargetsAll()) { - battle->SetAttackType(AttackChoice::MAGIC); + ac.SetType(AttackChoice::MAGIC); // TODO: remove item from inventory - battle->ActiveHeroAttackChoice().SetItem(battle->GetIkariMenu().Selected()); + ac.SetItem(battle->GetIkariMenu().Selected()); battle->NextHero(); ctrl->PopState(); } else { if (ikari->GetTargetingMode().TargetsSingle()) { - battle->ActiveHeroTargets().SetSingle(); + ac.Selection().SetSingle(); } else { - battle->ActiveHeroTargets().SetMultiple(); + ac.Selection().SetMultiple(); } - ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroTargets(), ikari->IsMagical() ? battle->Res().magicTargetCursor : battle->Res().weaponTargetCursor)); + ctrl->PushState(new SelectTarget(battle, parent, &ac.Selection(), ikari->IsMagical() ? battle->Res().magicTargetCursor : battle->Res().weaponTargetCursor)); } } } @@ -109,7 +112,7 @@ void SelectIkari::Render(SDL_Surface *screen) { void SelectIkari::RenderFrame(SDL_Surface *screen, const Vector &offset) { const Frame *frame(battle->Res().selectFrame); Point position(frame->BorderWidth(), frame->BorderHeight()); - int width(battle->BackgroundWidth() - 2 * frame->BorderWidth()); + int width(battle->Width() - 2 * frame->BorderWidth()); int height(battle->Res().normalFont->CharHeight() * 13); frame->Draw(screen, position + offset, width, height); }