]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectAttackType.cpp
removed some outdated TODOs
[l2e.git] / src / battle / states / SelectAttackType.cpp
index 90d483ca693cd5018110252dddda6dd215262a20..3603e1bb529aeb7eb587e06c691037786ddcf925 100644 (file)
@@ -36,8 +36,8 @@ void SelectAttackType::ExitState(Application &c, SDL_Surface *screen) {
 }
 
 void SelectAttackType::ResumeState(Application &ctrl, SDL_Surface *screen) {
-       if (battle->ActiveHeroTargets().HasSelected()) {
-               battle->SetAttackType(battle->GetAttackTypeMenu().Selected());
+       if (battle->ActiveHeroAttackChoice().Selection().HasSelected()) {
+               battle->ActiveHeroAttackChoice().SetType(battle->GetAttackTypeMenu().Selected());
                battle->NextHero();
        }
        if (battle->AttackSelectionDone()) {
@@ -56,7 +56,7 @@ void SelectAttackType::Resize(int width, int height) {
 }
 
 
-void SelectAttackType::HandleInput(const Input &input) {
+void SelectAttackType::HandleEvents(const Input &input) {
        if (input.IsDown(Input::PAD_UP)) {
                battle->GetAttackTypeMenu().Select(AttackChoice::MAGIC);
        } else if (input.IsDown(Input::PAD_RIGHT)) {
@@ -73,9 +73,9 @@ void SelectAttackType::HandleInput(const Input &input) {
                switch (battle->GetAttackTypeMenu().Selected()) {
                        case AttackChoice::SWORD:
                                // TODO: detect single/multiple/all attack mode
-                               battle->ActiveHeroTargets().SetSingle();
-                               battle->ActiveHeroTargets().Reset();
-                               ctrl->PushState(new SelectTarget(battle, this, &battle->ActiveHeroTargets(), battle->Res().weaponTargetCursor));
+                               battle->ActiveHeroAttackChoice().Selection().SetSingle();
+                               battle->ActiveHeroAttackChoice().Selection().Reset();
+                               ctrl->PushState(new SelectTarget(battle, this, &battle->ActiveHeroAttackChoice().Selection(), battle->Res().weaponTargetCursor));
                                break;
                        case AttackChoice::MAGIC:
                                if (battle->ActiveHero().CanUseMagic()) {
@@ -83,7 +83,7 @@ void SelectAttackType::HandleInput(const Input &input) {
                                }
                                break;
                        case AttackChoice::DEFEND:
-                               battle->SetAttackType(AttackChoice::DEFEND);
+                               battle->ActiveHeroAttackChoice().SetType(AttackChoice::DEFEND);
                                battle->NextHero();
                                break;
                        case AttackChoice::IKARI:
@@ -106,7 +106,6 @@ void SelectAttackType::HandleInput(const Input &input) {
        }
 
        if (battle->AttackSelectionDone()) {
-               // TODO: switch to battle animation instead
                ctrl->PopState();
        }
 }
@@ -125,8 +124,8 @@ void SelectAttackType::Render(SDL_Surface *screen) {
 
 void SelectAttackType::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
        Point<int> position(
-                       (battle->BackgroundWidth() - battle->GetAttackTypeMenu().Width()) / 2,
-                       battle->BackgroundHeight() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2);
+                       (battle->Width() - battle->GetAttackTypeMenu().Width()) / 2,
+                       battle->Height() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2);
        battle->GetAttackTypeMenu().Render(screen, position + offset);
 }