]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectAttackType.cpp
switched geometric scalars from floating to fixed
[l2e.git] / src / battle / states / SelectAttackType.cpp
index 3157ca7642981a9c822ea2adc0093005684e9f2b..0dd5bc472a4aff0177dbd15ccb244a0d026d0ceb 100644 (file)
 #include "../../app/Application.h"
 #include "../../app/Input.h"
 #include "../../common/Item.h"
-#include "../../geometry/operators.h"
 
 #include <stdexcept>
 
 using app::Application;
 using app::Input;
 using common::Item;
-using geometry::Point;
-using geometry::Vector;
+using math::Vector;
 
 namespace battle {
 
-void SelectAttackType::EnterState(Application &c, SDL_Surface *screen) {
-       ctrl = &c;
+void SelectAttackType::OnEnterState(SDL_Surface *screen) {
+
 }
 
-void SelectAttackType::ExitState(Application &c, SDL_Surface *screen) {
-       ctrl = 0;
+void SelectAttackType::OnExitState(SDL_Surface *screen) {
+
 }
 
-void SelectAttackType::ResumeState(Application &ctrl, SDL_Surface *screen) {
+void SelectAttackType::OnResumeState(SDL_Surface *screen) {
        if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) {
                battle->ActiveHero().GetAttackChoice().SetType(battle->GetAttackTypeMenu().Selected());
                battle->NextHero();
        }
        if (battle->AttackSelectionDone()) {
                // pass through
-               ctrl.PopState();
+               Ctrl().PopState();
        }
 }
 
-void SelectAttackType::PauseState(Application &ctrl, SDL_Surface *screen) {
+void SelectAttackType::OnPauseState(SDL_Surface *screen) {
 
 }
 
 
-void SelectAttackType::Resize(int width, int height) {
+void SelectAttackType::OnResize(int width, int height) {
 
 }
 
@@ -88,11 +86,11 @@ void SelectAttackType::HandleEvents(const Input &input) {
                                        ac.Selection().SetSingle();
                                }
                                ac.Selection().Reset();
-                               ctrl->PushState(new SelectTarget(battle, this, &ac.Selection(), battle->Res().weaponTargetCursor));
+                               Ctrl().PushState(new SelectTarget(battle, this, &ac.Selection(), battle->Res().weaponTargetCursor));
                                break;
                        case AttackChoice::MAGIC:
                                if (battle->ActiveHero().CanUseMagic()) {
-                                       ctrl->PushState(new SelectSpell(battle, this));
+                                       Ctrl().PushState(new SelectSpell(battle, this));
                                }
                                break;
                        case AttackChoice::DEFEND:
@@ -100,10 +98,10 @@ void SelectAttackType::HandleEvents(const Input &input) {
                                battle->NextHero();
                                break;
                        case AttackChoice::IKARI:
-                               ctrl->PushState(new SelectIkari(battle, this));
+                               Ctrl().PushState(new SelectIkari(battle, this));
                                break;
                        case AttackChoice::ITEM:
-                               ctrl->PushState(new SelectItem(battle, this));
+                               Ctrl().PushState(new SelectItem(battle, this));
                                break;
                        default:
                                throw std::logic_error("selected invalid attack type");
@@ -112,18 +110,18 @@ void SelectAttackType::HandleEvents(const Input &input) {
                ac.Reset();
                battle->PreviousHero();
                if (battle->BeforeFirstHero()) {
-                       ctrl->ChangeState(new SelectMoveAction(battle));
+                       Ctrl().ChangeState(new SelectMoveAction(battle));
                } else {
-                       ac.Reset();
+                       battle->ActiveHero().GetAttackChoice().Reset();
                }
        }
 
        if (battle->AttackSelectionDone()) {
-               ctrl->PopState();
+               Ctrl().PopState();
        }
 }
 
-void SelectAttackType::UpdateWorld(float deltaT) {
+void SelectAttackType::UpdateWorld(Uint32 deltaT) {
 
 }
 
@@ -136,7 +134,7 @@ void SelectAttackType::Render(SDL_Surface *screen) {
 }
 
 void SelectAttackType::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
-       Point<int> position(
+       Vector<int> position(
                        (battle->Width() - battle->GetAttackTypeMenu().Width()) / 2,
                        battle->Height() - battle->GetAttackTypeMenu().Height() - battle->GetAttackTypeMenu().Height() / 2);
        battle->GetAttackTypeMenu().Render(screen, position + offset);