X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FPartyMenu.cpp;h=577772ea88eba74054987f269d3d7361500bd855;hb=a3ba4dc677ad7c92eeb78b20b642241563605c9d;hp=79b2be06d7dc436c27d9be5d264ef77a639fad86;hpb=243cb7d922fe888be8d18241de138ad5949de430;p=l2e.git diff --git a/src/menu/PartyMenu.cpp b/src/menu/PartyMenu.cpp index 79b2be0..577772e 100644 --- a/src/menu/PartyMenu.cpp +++ b/src/menu/PartyMenu.cpp @@ -1,27 +1,27 @@ -/* - * PartyMenu.cpp - * - * Created on: Oct 21, 2012 - * Author: holy - */ - #include "PartyMenu.h" +#include "CapsuleMenu.h" +#include "ChangeHero.h" +#include "ConfigMenu.h" +#include "EquipMenu.h" +#include "InventoryMenu.h" #include "Resources.h" +#include "ScenarioMenu.h" #include "SelectHero.h" +#include "SpellMenu.h" #include "StatusMenu.h" #include "../app/Application.h" #include "../app/Input.h" #include "../common/GameConfig.h" #include "../common/GameState.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Font.h" #include "../graphics/Frame.h" #include "../graphics/Texture.h" using app::Input; using common::GameConfig; -using geometry::Vector; +using math::Vector; namespace menu { @@ -29,7 +29,7 @@ PartyMenu::PartyMenu(GameConfig *game) : game(game) , mainMenu(*game->menuResources->mainMenuProperties) { for (int i(0); i < 4; ++i) { - status[i].SetHero(game->state->party[i]); + status[i].SetHero(game->state->party, i); status[i].SetResources(game->menuResources); } statusPositions[0] = Vector(0, 0); @@ -41,7 +41,7 @@ PartyMenu::PartyMenu(GameConfig *game) mainMenu.Add(Res().mainMenuStatusText, 4); mainMenu.Add(Res().mainMenuSpellText, 1); mainMenu.Add(Res().mainMenuChangeText, 5); - mainMenu.Add(Res().mainMenuCapsuleText, 2); + mainMenu.Add(Res().mainMenuCapsuleText, 2, game->state->capsule); mainMenu.Add(Res().mainMenuConfigText, 6); mainMenu.Add(Res().mainMenuEquipmentText, 3); mainMenu.Add(Res().mainMenuScenarioText, 7); @@ -93,21 +93,32 @@ void PartyMenu::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { switch (mainMenu.Selected()) { case MENU_ITEM_ITEM: + Ctrl().PushState(new InventoryMenu(this)); break; case MENU_ITEM_SPELL: + Ctrl().PushState(new SelectHero(this, this, this, OnSpellSelect)); break; case MENU_ITEM_CAPSULE: + if (game->state->capsule) { + Ctrl().PushState(new CapsuleMenu(this)); + } else { + // noise and blur + } break; case MENU_ITEM_EQUIP: + Ctrl().PushState(new SelectHero(this, this, this, OnEquipSelect)); break; case MENU_ITEM_STATUS: - Ctrl().PushState(new SelectHero(this, OnStatusSelect)); + Ctrl().PushState(new SelectHero(this, this, this, OnStatusSelect)); break; case MENU_ITEM_CHANGE: + Ctrl().PushState(new ChangeHero(this)); break; case MENU_ITEM_CONFIG: + Ctrl().PushState(new ConfigMenu(this)); break; case MENU_ITEM_SCENARIO: + Ctrl().PushState(new ScenarioMenu(this)); break; default: break; @@ -196,8 +207,22 @@ const Resources &PartyMenu::Res() const { return *game->menuResources; } -void PartyMenu::OnStatusSelect(PartyMenu *self, int index) { - self->Ctrl().ChangeState(new StatusMenu(self, index)); +void PartyMenu::OnEquipSelect(void *ref, int index) { + PartyMenu *self(reinterpret_cast(ref)); + self->Ctrl().ChangeState( + new EquipMenu(self, index)); +} + +void PartyMenu::OnSpellSelect(void *ref, int index) { + PartyMenu *self(reinterpret_cast(ref)); + self->Ctrl().ChangeState( + new SpellMenu(self, index)); +} + +void PartyMenu::OnStatusSelect(void *ref, int index) { + PartyMenu *self(reinterpret_cast(ref)); + self->Ctrl().ChangeState( + new StatusMenu(self, index)); } }