]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectItem.cpp
renamed state callbacks
[l2e.git] / src / battle / states / SelectItem.cpp
index 4c197ff3c362b42e05e7099b1413c1cc9d2c5cff..86f11c25bf3e79547671a9cb507ce85c974a2c94 100644 (file)
 #include "../../app/Application.h"
 #include "../../app/Input.h"
 #include "../../common/Item.h"
-#include "../../geometry/Point.h"
-#include "../../geometry/operators.h"
 #include "../../graphics/Frame.h"
 
 using app::Application;
 using app::Input;
 using common::Item;
-using geometry::Point;
 using geometry::Vector;
 using graphics::Frame;
 
 namespace battle {
 
-void SelectItem::EnterState(Application &c, SDL_Surface *screen) {
+void SelectItem::OnEnterState(Application &c, SDL_Surface *screen) {
        ctrl = &c;
 }
 
-void SelectItem::ExitState(Application &c, SDL_Surface *screen) {
+void SelectItem::OnExitState(Application &c, SDL_Surface *screen) {
        ctrl = 0;
 }
 
-void SelectItem::ResumeState(Application &ctrl, SDL_Surface *screen) {
+void SelectItem::OnResumeState(Application &ctrl, SDL_Surface *screen) {
        if (battle->ActiveHero().GetAttackChoice().Selection().HasSelected()) {
                battle->ActiveHero().GetAttackChoice().SetType(AttackChoice::ITEM);
                battle->ActiveHero().GetAttackChoice().SetItem(battle->ItemMenu().Selected());
@@ -42,7 +39,7 @@ void SelectItem::ResumeState(Application &ctrl, SDL_Surface *screen) {
        }
 }
 
-void SelectItem::PauseState(Application &ctrl, SDL_Surface *screen) {
+void SelectItem::OnPauseState(Application &ctrl, SDL_Surface *screen) {
 
 }
 
@@ -65,7 +62,6 @@ void SelectItem::HandleEvents(const Input &input) {
                        }
                        if (item->GetTargetingMode().TargetsAll()) {
                                ac.SetType(AttackChoice::ITEM);
-                               // TODO: remove item from inventory
                                ac.SetItem(item);
                                battle->NextHero();
                                ctrl->PopState();
@@ -110,7 +106,7 @@ void SelectItem::Render(SDL_Surface *screen) {
 
 void SelectItem::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
        const Frame *frame(battle->Res().selectFrame);
-       Point<int> position(frame->BorderWidth(), frame->BorderHeight());
+       Vector<int> position(frame->BorderSize());
        int width(battle->Width() - 2 * frame->BorderWidth());
        int height(battle->Res().normalFont->CharHeight() * 13);
        frame->Draw(screen, position + offset, width, height);
@@ -118,7 +114,7 @@ void SelectItem::RenderFrame(SDL_Surface *screen, const Vector<int> &offset) {
 
 void SelectItem::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight());
        res.normalFont->DrawString(res.itemMenuHeadline, screen, position + offset);
@@ -126,7 +122,7 @@ void SelectItem::RenderHeadline(SDL_Surface *screen, const Vector<int> &offset)
 
 void SelectItem::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) {
        const Resources &res(battle->Res());
-       Point<int> position(
+       Vector<int> position(
                        2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(),
                        2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight());
        battle->ItemMenu().Draw(screen, position + offset);