]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectMoveAction.cpp
removed useless comments
[l2e.git] / src / battle / states / SelectMoveAction.cpp
index 4a19d48a00643e74f82b1d97a0616d8d9cc7d638..d7898742be336598aec7946c4ea9e4badaa2373a 100644 (file)
@@ -1,40 +1,43 @@
-/*
- * SelectMoveAction.cpp
- *
- *  Created on: Aug 7, 2012
- *      Author: holy
- */
-
 #include "SelectMoveAction.h"
 
+#include "RunState.h"
 #include "SelectAttackType.h"
+#include "SwapHeroes.h"
 #include "../BattleState.h"
 #include "../MoveMenu.h"
 #include "../../app/Application.h"
 #include "../../app/Input.h"
-#include "../../geometry/operators.h"
+#include "../../math/Vector.h"
 
+using app::Application;
 using app::Input;
-using geometry::Point;
-using geometry::Vector;
+using math::Vector;
 
 namespace battle {
 
-void SelectMoveAction::EnterState(app::Application &c, SDL_Surface *screen) {
-       ctrl = &c;
+void SelectMoveAction::OnEnterState(SDL_Surface *screen) {
+
+}
+
+void SelectMoveAction::OnExitState(SDL_Surface *screen) {
+
 }
 
-void SelectMoveAction::ExitState() {
-       ctrl = 0;
+void SelectMoveAction::OnResumeState(SDL_Surface *screen) {
+
+}
+
+void SelectMoveAction::OnPauseState(SDL_Surface *screen) {
+
 }
 
 
-void SelectMoveAction::Resize(int width, int height) {
+void SelectMoveAction::OnResize(int width, int height) {
 
 }
 
 
-void SelectMoveAction::HandleInput(const app::Input &input) {
+void SelectMoveAction::HandleEvents(const Input &input) {
        if (input.IsDown(Input::PAD_UP)) {
                battle->GetMoveMenu().Select(MoveMenu::CHANGE);
        } else if (input.IsDown(Input::PAD_DOWN)) {
@@ -46,19 +49,20 @@ void SelectMoveAction::HandleInput(const app::Input &input) {
        if (input.JustPressed(Input::ACTION_A)) {
                switch (battle->GetMoveMenu().Selected()) {
                        case MoveMenu::ATTACK:
-                               ctrl->ChangeState(new SelectAttackType(battle));
+                               Ctrl().ChangeState(new SelectAttackType(battle));
+                               battle->NextHero();
                                break;
                        case MoveMenu::CHANGE:
-                               // TODO: switch to change state
+                               Ctrl().PushState(new SwapHeroes(battle, this));
                                break;
                        case MoveMenu::RUN:
-                               // TODO: switch to run state
+                               Ctrl().ChangeState(new RunState(battle));
                                break;
                }
        }
 }
 
-void SelectMoveAction::UpdateWorld(float deltaT) {
+void SelectMoveAction::UpdateWorld(Uint32 deltaT) {
 
 }
 
@@ -71,9 +75,9 @@ void SelectMoveAction::Render(SDL_Surface *screen) {
 }
 
 void SelectMoveAction::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
-       Point<int> position(
-                       (battle->BackgroundWidth() - battle->GetMoveMenu().Width()) / 2,
-                       (battle->BackgroundHeight() * 3 / 4) - (battle->GetMoveMenu().Height() / 2));
+       Vector<int> position(
+                       (battle->Width() - battle->GetMoveMenu().Width()) / 2,
+                       battle->Height() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2);
        battle->GetMoveMenu().Render(screen, position + offset);
 }