]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/EquipMenu.cpp
added menu cursor animations
[l2e.git] / src / menu / EquipMenu.cpp
index 0caff55467b5779a00f72b559d647c6e80cf16d5..1a433beae3d2fb95b24340e495b7828ff340041a 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * EquipMenu.cpp
- *
- *  Created on: Nov 18, 2012
- *      Author: holy
- */
-
 #include "EquipMenu.h"
 
 #include "HeroStatus.h"
 #include "../common/Stats.h"
 #include "../graphics/Font.h"
 #include "../graphics/Frame.h"
+#include "../math/Vector.h"
 
 using app::Input;
 using common::Hero;
 using common::Inventory;
 using common::Item;
 using common::Stats;
-using geometry::Vector;
+using math::Vector;
 using graphics::Font;
 using graphics::Frame;
 
@@ -49,8 +43,11 @@ EquipMenu::EquipMenu(PartyMenu *parent, int cursor)
 
 
 void EquipMenu::OnEnterState(SDL_Surface *) {
+       actionMenu.StartAnimation(Ctrl());
        equipmentMenu.SetInactive();
+       equipmentMenu.StartAnimation(Ctrl());
        inventoryMenu.SetInactive();
+       inventoryMenu.StartAnimation(Ctrl());
 }
 
 void EquipMenu::OnExitState(SDL_Surface *) {
@@ -72,6 +69,12 @@ void EquipMenu::OnResize(int width, int height) {
 
 
 void EquipMenu::HandleEvents(const Input &input) {
+       if (input.JustPressed(Input::SHOULDER_LEFT)) {
+               PreviousHero();
+       }
+       if (input.JustPressed(Input::SHOULDER_RIGHT)) {
+               NextHero();
+       }
        if (actionMenu.IsActive()) {
                if (input.JustPressed(Input::PAD_UP)) {
                        actionMenu.PreviousRow();
@@ -87,7 +90,7 @@ void EquipMenu::HandleEvents(const Input &input) {
                                        equipmentMenu.SetActive();
                                        break;
                                case CHOICE_STRONGEST:
-                                       // TODO
+                                       // TODO: implement "equip strongest" when items' stat effects are done
                                        break;
                                case CHOICE_REMOVE:
                                        actionMenu.SetSelected();
@@ -158,7 +161,7 @@ void EquipMenu::HandleEvents(const Input &input) {
        }
 }
 
-void EquipMenu::UpdateWorld(float deltaT) {
+void EquipMenu::UpdateWorld(Uint32 deltaT) {
 
 }
 
@@ -264,11 +267,17 @@ void EquipMenu::RenderInventoryMenu(SDL_Surface *screen, const Vector<int> &offs
 void EquipMenu::NextHero() {
        cursor = (cursor + 1) % parent->Game().state->partySize;
        LoadEquipment();
+       if (InventoryVisible()) {
+               LoadInventory();
+       }
 }
 
 void EquipMenu::PreviousHero() {
        cursor = (cursor + parent->Game().state->partySize - 1) % parent->Game().state->partySize;
        LoadEquipment();
+       if (InventoryVisible()) {
+               LoadInventory();
+       }
 }
 
 Hero &EquipMenu::GetHero() {