-/*
- * 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;
void EquipMenu::OnEnterState(SDL_Surface *) {
+ actionMenu.StartAnimation(Ctrl());
equipmentMenu.SetInactive();
+ equipmentMenu.StartAnimation(Ctrl());
inventoryMenu.SetInactive();
+ inventoryMenu.StartAnimation(Ctrl());
}
void EquipMenu::OnExitState(SDL_Surface *) {
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();
equipmentMenu.SetActive();
break;
case CHOICE_STRONGEST:
- // TODO
+ // TODO: implement "equip strongest" when items' stat effects are done
break;
case CHOICE_REMOVE:
actionMenu.SetSelected();
}
}
-void EquipMenu::UpdateWorld(float deltaT) {
+void EquipMenu::UpdateWorld(Uint32 deltaT) {
}
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() {
const Item *item(GetHero().Equipment(Hero::EquipSlot(i)));
equipmentMenu.Add(item->Name(), item, true, item->MenuIcon());
} else {
- equipmentMenu.Add(parent->Res().noEquipmentText, 0, false);
+ equipmentMenu.Add(parent->Res().noEquipmentText, 0);
}
}
}