]> git.localhorst.tv Git - l2e.git/commitdiff
added capsule feed menu dummy
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 5 Dec 2012 19:46:51 +0000 (20:46 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 5 Dec 2012 19:46:51 +0000 (20:46 +0100)
src/menu/CapsuleFeedMenu.cpp [new file with mode: 0644]
src/menu/CapsuleFeedMenu.h [new file with mode: 0644]
src/menu/CapsuleMenu.cpp
src/menu/CapsuleMenu.h
src/menu/Resources.cpp
src/menu/Resources.h
src/menu/fwd.h
test-data/test.l2s

diff --git a/src/menu/CapsuleFeedMenu.cpp b/src/menu/CapsuleFeedMenu.cpp
new file mode 100644 (file)
index 0000000..184212d
--- /dev/null
@@ -0,0 +1,224 @@
+#include "CapsuleFeedMenu.h"
+
+#include "CapsuleMenu.h"
+#include "Resources.h"
+#include "../app/Application.h"
+#include "../app/Input.h"
+#include "../common/Inventory.h"
+#include "../common/Item.h"
+#include "../common/GameConfig.h"
+#include "../common/GameState.h"
+#include "../graphics/Font.h"
+#include "../graphics/Frame.h"
+
+using app::Input;
+using common::Capsule;
+using common::Inventory;
+using common::Item;
+using geometry::Vector;
+using graphics::Font;
+using graphics::Frame;
+
+namespace menu {
+
+CapsuleFeedMenu::CapsuleFeedMenu(CapsuleMenu *parent)
+: parent(parent)
+, menu(*parent->Res().capsuleFeedMenuProperties)
+, itemMenu(*parent->Res().inventoryMenuProperties) {
+       menu.Add(parent->Res().itemMenuSelectText, CHOICE_SELECT);
+       menu.Add(parent->Res().itemMenuSortText, CHOICE_SORT);
+       LoadInventory();
+}
+
+
+void CapsuleFeedMenu::OnEnterState(SDL_Surface *) {
+       menu.SetSelected();
+       itemMenu.SetActive();
+}
+
+void CapsuleFeedMenu::LoadInventory() {
+       const Inventory &inv(parent->Game().state->inventory);
+       itemMenu.Clear();
+       itemMenu.Reserve(inv.MaxItems());
+       for (int i(0); i < inv.MaxItems(); ++i) {
+               const Item *item(inv.ItemAt(i));
+               if (item) {
+                       // TODO: find out which items are impossible to feed to a capsule
+                       itemMenu.Add(item->Name(), item, true, item->MenuIcon(), inv.ItemCountAt(i));
+               } else {
+                       itemMenu.AddEmptyEntry();
+               }
+       }
+}
+
+void CapsuleFeedMenu::OnExitState(SDL_Surface *) {
+
+}
+
+void CapsuleFeedMenu::OnResumeState(SDL_Surface *) {
+
+}
+
+void CapsuleFeedMenu::OnPauseState(SDL_Surface *) {
+
+}
+
+
+void CapsuleFeedMenu::OnResize(int width, int height) {
+
+}
+
+
+void CapsuleFeedMenu::HandleEvents(const Input &input) {
+       if (menu.IsActive()) {
+               if (input.JustPressed(Input::PAD_LEFT)) {
+                       menu.PreviousItem();
+               }
+               if (input.JustPressed(Input::PAD_RIGHT)) {
+                       menu.NextItem();
+               }
+       } else {
+               if (input.JustPressed(Input::PAD_UP)) {
+                       itemMenu.PreviousItem();
+               }
+               if (input.JustPressed(Input::PAD_DOWN)) {
+                       itemMenu.NextItem();
+               }
+       }
+
+       if (input.JustPressed(Input::ACTION_A)) {
+               if (menu.IsActive()) {
+                       if (menu.Selected() == CHOICE_SORT) {
+                               parent->Game().state->inventory.Sort();
+                               LoadInventory();
+                       } else {
+                               menu.SetSelected();
+                               itemMenu.SetActive();
+                       }
+               } else if (itemMenu.IsActive()) {
+                       itemMenu.SetDualSelection();
+               } else if (itemMenu.SelectedIndex() == itemMenu.SecondaryIndex()) {
+                       switch (menu.Selected()) {
+                               case CHOICE_SELECT:
+                                       if (true /* can feed */) {
+                                               // TODO: implement capsule feeding
+                                       }
+                                       itemMenu.SetActive();
+                                       break;
+                               case CHOICE_SORT:
+                                       // invalid state, recover
+                                       menu.SetActive();
+                                       itemMenu.SetInactive();
+                                       break;
+                       }
+               } else {
+                       parent->Game().state->inventory.SwapEntriesAt(
+                                       itemMenu.SelectedIndex(),
+                                       itemMenu.SecondaryIndex());
+                       itemMenu.SwapSelected();
+                       itemMenu.SetActive();
+               }
+       }
+       if (input.JustPressed(Input::ACTION_B)) {
+               if (menu.IsActive()) {
+                       Ctrl().PopState();
+               } else if (itemMenu.IsActive()) {
+                       menu.SetActive();
+                       itemMenu.SetInactive();
+               } else {
+                       itemMenu.SetActive();
+               }
+       }
+}
+
+void CapsuleFeedMenu::UpdateWorld(float deltaT) {
+
+}
+
+void CapsuleFeedMenu::Render(SDL_Surface *screen) {
+       const Font &font(*parent->Res().statusFont);
+       const Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
+       const Vector<int> nameOffset(
+                       font.CharWidth(),
+                       2 * font.CharHeight() - font.CharHeight() / 8);
+       const Vector<int> spriteOffset(
+                               3 * font.CharWidth() + font.CharWidth() * 3 / 4,
+                               4 * font.CharHeight() + font.CharHeight() / 4);
+       const Vector<int> hungerOffset(
+                       13 * font.CharWidth(),
+                       9 * font.CharHeight() + font.CharHeight() / 8);
+       const Vector<int> menuOffset(
+                       font.CharWidth(),
+                       13 * font.CharHeight() + font.CharHeight() / 8);
+       const Vector<int> itemsOffset(
+                       font.CharWidth(),
+                       16 * font.CharHeight() + font.CharHeight() / 8);
+
+       parent->RenderBackground(screen);
+       RenderName(screen, offset + nameOffset);
+       RenderSprite(screen, offset + spriteOffset);
+       RenderHunger(screen, offset + hungerOffset);
+       RenderMenu(screen, offset + menuOffset);
+       RenderItems(screen, offset + itemsOffset);
+}
+
+void CapsuleFeedMenu::RenderName(SDL_Surface *screen, const Vector<int> &offset) const {
+       const Font &font(*parent->Res().statusFont);
+       const Vector<int> separatorOffset(5 * font.CharWidth(), 0);
+       const Vector<int> nameOffset(6 * font.CharWidth(), 0);
+
+       font.DrawString(parent->Res().capsuleNameLabel, screen, offset, 5);
+       font.DrawChar(':', screen, offset + separatorOffset);
+       font.DrawString(GetCapsule().Name(), screen, offset + nameOffset);
+}
+
+void CapsuleFeedMenu::RenderSprite(SDL_Surface *screen, const Vector<int> &offset) const {
+       // TODO: sitting ground
+       GetCapsule().BattleSprite()->Draw(screen, offset);
+}
+
+void CapsuleFeedMenu::RenderHunger(SDL_Surface *screen, const Vector<int> &offset) const {
+       const Font &font(*parent->Res().normalFont);
+       const Frame &frame(*parent->Res().statusFrame);
+       const Vector<int> textOffset(2 * font.CharWidth(), font.CharHeight());
+
+       frame.Draw(screen, offset, 18 * font.CharWidth(), 3 * font.CharHeight());
+       font.DrawString(parent->Res().capsuleNotHungryText, screen, offset + textOffset, 15);
+}
+
+void CapsuleFeedMenu::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) const {
+       const Font &font(*parent->Res().normalFont);
+       const Frame &frame(*parent->Res().statusFrame);
+       const Vector<int> labelOffset(2 * font.CharWidth(), font.CharHeight());
+       const Vector<int> menubgOffset(8 * font.CharWidth(), 0);
+       const Vector<int> menuOffset(11 * font.CharWidth(), font.CharHeight());
+
+       frame.Draw(screen, offset, 8 * font.CharWidth(), 3 * font.CharHeight());
+       font.DrawString(parent->Res().capsuleFeedLabel, screen, offset + labelOffset);
+       frame.Draw(screen, offset + menubgOffset, 22 * font.CharWidth(), 3 * font.CharHeight());
+       menu.Draw(screen, offset + menuOffset);
+}
+
+void CapsuleFeedMenu::RenderItems(SDL_Surface *screen, const Vector<int> &offset) const {
+       const Font &font(*parent->Res().normalFont);
+       const Frame &frame(*parent->Res().statusFrame);
+       const Vector<int> menuOffset(3 * font.CharWidth(), font.CharHeight() * 5 / 4);
+
+       frame.Draw(screen, offset, 30 * font.CharWidth(), 11 * font.CharHeight());
+       itemMenu.Draw(screen, offset + menuOffset);
+}
+
+
+int CapsuleFeedMenu::Width() const {
+       return parent->Width();
+}
+
+int CapsuleFeedMenu::Height() const {
+       return parent->Height();
+}
+
+const Capsule &CapsuleFeedMenu::GetCapsule() const {
+       return parent->GetCapsule();
+}
+
+}
diff --git a/src/menu/CapsuleFeedMenu.h b/src/menu/CapsuleFeedMenu.h
new file mode 100644 (file)
index 0000000..8c75edd
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef MENU_CAPSULEFEEDMENU_H_
+#define MENU_CAPSULEFEEDMENU_H_
+
+#include "fwd.h"
+#include "../app/State.h"
+#include "../common/fwd.h"
+#include "../geometry/Vector.h"
+#include "../graphics/Menu.h"
+
+namespace menu {
+
+class CapsuleMenu;
+
+class CapsuleFeedMenu
+: public app::State {
+
+public:
+       explicit CapsuleFeedMenu(CapsuleMenu *parent);
+
+public:
+       virtual void HandleEvents(const app::Input &);
+       virtual void UpdateWorld(float deltaT);
+       virtual void Render(SDL_Surface *);
+
+public:
+       int Width() const;
+       int Height() const;
+
+private:
+       virtual void OnEnterState(SDL_Surface *screen);
+       virtual void OnExitState(SDL_Surface *screen);
+       virtual void OnResumeState(SDL_Surface *screen);
+       virtual void OnPauseState(SDL_Surface *screen);
+
+       virtual void OnResize(int width, int height);
+
+       const common::Capsule &GetCapsule() const;
+
+       void LoadInventory();
+
+       void RenderName(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderSprite(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderHunger(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderItems(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+
+private:
+       CapsuleMenu *parent;
+       enum Choice {
+               CHOICE_SELECT,
+               CHOICE_SORT,
+       };
+       graphics::Menu<Choice> menu;
+       graphics::Menu<const common::Item *> itemMenu;
+
+};
+
+}
+
+#endif /* MENU_CAPSULEFEEDMENU_H_ */
index 7837ea5976e3e6143256cfdd9c6488c8f4ed4928..6d0fba8f0a68a3b518428d557e3df494e8f29379 100644 (file)
@@ -1,5 +1,6 @@
 #include "CapsuleMenu.h"
 
+#include "CapsuleFeedMenu.h"
 #include "PartyMenu.h"
 #include "Resources.h"
 #include "../app/Application.h"
@@ -23,10 +24,10 @@ namespace menu {
 
 CapsuleMenu::CapsuleMenu(PartyMenu *parent)
 : parent(parent)
-, menu(*parent->Res().capsuleMenuProperties) {
-       menu.Add(parent->Res().capsuleFeedLabel, 0);
-       menu.Add(parent->Res().capsuleChangeLabel, 1);
-       menu.Add(parent->Res().capsuleNameLabel, 2);
+, menu(*Res().capsuleMenuProperties) {
+       menu.Add(Res().capsuleFeedLabel, CHOICE_FEED);
+       menu.Add(Res().capsuleChangeLabel, CHOICE_CHANGE);
+       menu.Add(Res().capsuleNameLabel, CHOICE_NAME);
 }
 
 
@@ -39,7 +40,7 @@ void CapsuleMenu::OnExitState(SDL_Surface *) {
 }
 
 void CapsuleMenu::OnResumeState(SDL_Surface *) {
-
+       menu.SetActive();
 }
 
 void CapsuleMenu::OnPauseState(SDL_Surface *) {
@@ -60,7 +61,22 @@ void CapsuleMenu::HandleEvents(const Input &input) {
                menu.NextItem();
        }
 
-       if (input.JustPressed(Input::ACTION_B)) {
+       if (input.JustPressed(Input::ACTION_A)) {
+               switch (menu.Selected()) {
+                       case CHOICE_FEED:
+                               Ctrl().PushState(new CapsuleFeedMenu(this));
+                               menu.SetSelected();
+                               break;
+                       case CHOICE_CHANGE:
+                               // push change menu
+                               menu.SetSelected();
+                               break;
+                       case CHOICE_NAME:
+                               // push name menu
+                               menu.SetSelected();
+                               break;
+               }
+       } else if (input.JustPressed(Input::ACTION_B)) {
                Ctrl().PopState();
        }
 }
@@ -70,7 +86,7 @@ void CapsuleMenu::UpdateWorld(float deltaT) {
 }
 
 void CapsuleMenu::Render(SDL_Surface *screen) {
-       const Font &font(*parent->Res().statusFont);
+       const Font &font(*Res().statusFont);
        const Vector<int> offset((screen->w - Width()) / 2, (screen->h - Height()) / 2);
        const Vector<int> capsuleOffset(
                        6 * font.CharWidth(),
@@ -96,7 +112,7 @@ void CapsuleMenu::Render(SDL_Surface *screen) {
 }
 
 void CapsuleMenu::RenderBackground(SDL_Surface *screen) const {
-       parent->Res().capsulebg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
+       Res().capsulebg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
 }
 
 void CapsuleMenu::RenderCapsule(SDL_Surface *screen, const Vector<int> &offset) const {
@@ -105,56 +121,56 @@ void CapsuleMenu::RenderCapsule(SDL_Surface *screen, const Vector<int> &offset)
 
 void CapsuleMenu::RenderInfo(SDL_Surface *screen, const Vector<int> &offset) const {
        const Capsule &capsule(GetCapsule());
-       const Font &font(*parent->Res().statusFont);
+       const Font &font(*Res().statusFont);
        const Vector<int> delimiterOffset(5 * font.CharWidth(), 0);
        const Vector<int> valueOffset(6 * font.CharWidth(), 0);
        const Vector<int> lineBreak(0, font.CharHeight() + font.CharHeight() / 2);
        Vector<int> lineHead(offset);
 
-       font.DrawString(parent->Res().capsuleNameLabel, screen, lineHead, 5);
+       font.DrawString(Res().capsuleNameLabel, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        font.DrawString(capsule.Name(), screen, lineHead + valueOffset);
 
        lineHead += lineBreak;
-       font.DrawString(parent->Res().capsuleClassLabel, screen, lineHead, 5);
+       font.DrawString(Res().capsuleClassLabel, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        font.DrawString(capsule.ClassName(), screen, lineHead + valueOffset);
 
        lineHead += lineBreak;
-       font.DrawString(parent->Res().capsuleAlignmentLabel, screen, lineHead, 5);
+       font.DrawString(Res().capsuleAlignmentLabel, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        font.DrawString(capsule.Alignment(), screen, lineHead + valueOffset);
 
        lineHead += lineBreak;
-       font.DrawString(parent->Res().capsuleTribeLabel, screen, lineHead, 5);
+       font.DrawString(Res().capsuleTribeLabel, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        font.DrawString(capsule.Tribe(), screen, lineHead + valueOffset);
 
        lineHead += lineBreak;
-       font.DrawString(parent->Res().capsuleAttack1Label, screen, lineHead, 5);
+       font.DrawString(Res().capsuleAttack1Label, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        if (capsule.Attack1()) {
                font.DrawString(capsule.Attack1()->Name(), screen, lineHead + valueOffset);
        } else {
-               font.DrawString(parent->Res().capsuleNoAttackText, screen, lineHead + valueOffset);
+               font.DrawString(Res().capsuleNoAttackText, screen, lineHead + valueOffset);
        }
 
        lineHead += lineBreak;
-       font.DrawString(parent->Res().capsuleAttack1Label, screen, lineHead, 5);
+       font.DrawString(Res().capsuleAttack1Label, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        if (capsule.Attack2()) {
                font.DrawString(capsule.Attack2()->Name(), screen, lineHead + valueOffset);
        } else {
-               font.DrawString(parent->Res().capsuleNoAttackText, screen, lineHead + valueOffset);
+               font.DrawString(Res().capsuleNoAttackText, screen, lineHead + valueOffset);
        }
 
        lineHead += lineBreak;
-       font.DrawString(parent->Res().capsuleAttack1Label, screen, lineHead, 5);
+       font.DrawString(Res().capsuleAttack1Label, screen, lineHead, 5);
        font.DrawChar(':', screen, lineHead + delimiterOffset);
        if (capsule.Attack3()) {
                font.DrawString(capsule.Attack3()->Name(), screen, lineHead + valueOffset);
        } else {
-               font.DrawString(parent->Res().capsuleNoAttackText, screen, lineHead + valueOffset);
+               font.DrawString(Res().capsuleNoAttackText, screen, lineHead + valueOffset);
        }
 }
 
@@ -165,42 +181,42 @@ void CapsuleMenu::RenderWheel(SDL_Surface *screen, const Vector<int> &offset) co
 void CapsuleMenu::RenderStats(SDL_Surface *screen, const Vector<int> &offset) const {
        const Capsule &capsule(GetCapsule());
        Stats stats(capsule.GetStats());
-       const Font &font(*parent->Res().statusFont);
+       const Font &font(*Res().statusFont);
        const Vector<int> lineBreak(0, font.CharHeight());
        Vector<int> lineHead(offset);
 
-       RenderStatsLine(screen, lineHead, parent->Res().hpLabel, capsule.MaxHealth());
+       RenderStatsLine(screen, lineHead, Res().hpLabel, capsule.MaxHealth());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().atpLabel, stats.Attack());
+       RenderStatsLine(screen, lineHead, Res().atpLabel, stats.Attack());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().dfpLabel, stats.Defense());
+       RenderStatsLine(screen, lineHead, Res().dfpLabel, stats.Defense());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().strLabel, stats.Strength());
+       RenderStatsLine(screen, lineHead, Res().strLabel, stats.Strength());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().aglLabel, stats.Agility());
+       RenderStatsLine(screen, lineHead, Res().aglLabel, stats.Agility());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().intLabel, stats.Intelligence());
+       RenderStatsLine(screen, lineHead, Res().intLabel, stats.Intelligence());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().gutLabel, stats.Gut());
+       RenderStatsLine(screen, lineHead, Res().gutLabel, stats.Gut());
        lineHead += lineBreak;
-       RenderStatsLine(screen, lineHead, parent->Res().mgrLabel, stats.MagicResistance());
+       RenderStatsLine(screen, lineHead, Res().mgrLabel, stats.MagicResistance());
 
        lineHead = offset + Vector<int>(18 * font.CharWidth(), 0);
-       font.DrawStringRight(parent->Res().levelLabel, screen, lineHead);
+       font.DrawStringRight(Res().levelLabel, screen, lineHead);
        lineHead += lineBreak;
        font.DrawNumberRight(capsule.Level(), screen, lineHead);
        lineHead += 2 * lineBreak;
-       font.DrawStringRight(parent->Res().experienceLabel, screen, lineHead);
+       font.DrawStringRight(Res().experienceLabel, screen, lineHead);
        lineHead += lineBreak;
        font.DrawNumberRight(capsule.Experience(), screen, lineHead);
        lineHead += 2 * lineBreak;
-       font.DrawStringRight(parent->Res().nextLevelLabel, screen, lineHead);
+       font.DrawStringRight(Res().nextLevelLabel, screen, lineHead);
        lineHead += lineBreak;
        font.DrawNumberRight(capsule.NextLevel(), screen, lineHead);
 }
 
 void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const geometry::Vector<int> &offset, const char *name, int value) const {
-       const Font &font(*parent->Res().statusFont);
+       const Font &font(*Res().statusFont);
        const Vector<int> numberOffset(4 * font.CharWidth(), 0);
 
        font.DrawString(name, screen, offset, 4);
@@ -208,14 +224,32 @@ void CapsuleMenu::RenderStatsLine(SDL_Surface *screen, const geometry::Vector<in
 }
 
 void CapsuleMenu::RenderMenu(SDL_Surface *screen, const Vector<int> &offset) const {
-       const Font &font(*parent->Res().normalFont);
-       const Frame &frame(*parent->Res().statusFrame);
+       const Font &font(*Res().normalFont);
+       const Frame &frame(*Res().statusFrame);
        const Vector<int> menuOffset(3 * font.CharWidth(), font.CharHeight());
 
        frame.Draw(screen, offset, 30 * font.CharWidth(), 3 * font.CharHeight());
        menu.Draw(screen, offset + menuOffset);
 }
 
+
+common::GameConfig &CapsuleMenu::Game() {
+       return parent->Game();
+}
+
+const common::GameConfig &CapsuleMenu::Game() const {
+       return parent->Game();
+}
+
+Resources &CapsuleMenu::Res() {
+       return parent->Res();
+}
+
+const Resources &CapsuleMenu::Res() const {
+       return parent->Res();
+}
+
+
 int CapsuleMenu::Width() const {
        return parent->Width();
 }
@@ -225,7 +259,7 @@ int CapsuleMenu::Height() const {
 }
 
 const Capsule &CapsuleMenu::GetCapsule() const {
-       return *parent->Game().state->capsule;
+       return *Game().state->capsule;
 }
 
 }
index ce57bd280534bfbc9ff7720b71ca1f3c46a3d020..1491f391d294b5e70cbdf479d6d4b3aff7a1f41f 100644 (file)
@@ -20,7 +20,21 @@ public:
        virtual void UpdateWorld(float deltaT);
        virtual void Render(SDL_Surface *);
 
+       void RenderBackground(SDL_Surface *screen) const;
+       void RenderCapsule(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderWheel(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderStats(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderStatsLine(SDL_Surface *screen, const geometry::Vector<int> &offset, const char *name, int value) const;
+       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+
 public:
+       common::GameConfig &Game();
+       const common::GameConfig &Game() const;
+       Resources &Res();
+       const Resources &Res() const;
+       const common::Capsule &GetCapsule() const;
+
        int Width() const;
        int Height() const;
 
@@ -32,19 +46,14 @@ private:
 
        virtual void OnResize(int width, int height);
 
-       const common::Capsule &GetCapsule() const;
-
-       void RenderBackground(SDL_Surface *screen) const;
-       void RenderCapsule(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderWheel(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderStats(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-       void RenderStatsLine(SDL_Surface *screen, const geometry::Vector<int> &offset, const char *name, int value) const;
-       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
-
 private:
        PartyMenu *parent;
-       graphics::Menu<int> menu;
+       enum Choice {
+               CHOICE_FEED,
+               CHOICE_CHANGE,
+               CHOICE_NAME,
+       };
+       graphics::Menu<Choice> menu;
 
 };
 
index f625e67421119dc816f5b4cd28164b2911033dcf..a355909d87b1412bba23871fdd8102a0b060e1a6 100644 (file)
@@ -71,6 +71,7 @@ Resources::Resources()
 , itemMenuUseText(0)
 , itemMenuSortText(0)
 , itemMenuDropText(0)
+, itemMenuSelectText(0)
 
 , inventoryMenuProperties(0)
 
@@ -103,6 +104,7 @@ Resources::Resources()
 , capsulebg(0)
 
 , capsuleMenuProperties(0)
+, capsuleFeedMenuProperties(0)
 
 , capsuleFeedLabel(0)
 , capsuleChangeLabel(0)
@@ -114,6 +116,7 @@ Resources::Resources()
 , capsuleAttack2Label(0)
 , capsuleAttack3Label(0)
 , capsuleNoAttackText(0)
+, capsuleNotHungryText(0)
 
 { }
 
@@ -177,6 +180,7 @@ void Resources::CreateTypeDescription() {
        td.AddField("itemMenuUseText", FieldDescription(((char *)&r.itemMenuUseText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
        td.AddField("itemMenuSortText", FieldDescription(((char *)&r.itemMenuSortText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
        td.AddField("itemMenuDropText", FieldDescription(((char *)&r.itemMenuDropText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("itemMenuSelectText", FieldDescription(((char *)&r.itemMenuSelectText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
 
        td.AddField("inventoryMenu", FieldDescription(((char *)&r.inventoryMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the inventory menu"));
        td.AddField("spellMenu", FieldDescription(((char *)&r.spellMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the spell menu"));
@@ -208,6 +212,7 @@ void Resources::CreateTypeDescription() {
        td.AddField("capsulebg", FieldDescription(((char *)&r.capsulebg) - ((char *)&r), Texture::TYPE_ID).SetReferenced().SetDescription("background texture for the capsule menus"));
 
        td.AddField("capsuleMenu", FieldDescription(((char *)&r.capsuleMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the capsule main menu (the bottom bar)"));
+       td.AddField("capsuleFeedMenu", FieldDescription(((char *)&r.capsuleFeedMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the capsule feed menu (above the inventory)"));
 
        td.AddField("capsuleFeedLabel", FieldDescription(((char *)&r.capsuleFeedLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
        td.AddField("capsuleChangeLabel", FieldDescription(((char *)&r.capsuleChangeLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
@@ -219,6 +224,7 @@ void Resources::CreateTypeDescription() {
        td.AddField("capsuleAttack2Label", FieldDescription(((char *)&r.capsuleAttack2Label) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
        td.AddField("capsuleAttack3Label", FieldDescription(((char *)&r.capsuleAttack3Label) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
        td.AddField("capsuleNoAttackText", FieldDescription(((char *)&r.capsuleNoAttackText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("capsuleNotHungryText", FieldDescription(((char *)&r.capsuleNotHungryText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
 }
 
 void Resources::Construct(void *data) {
index 5b581e6bd9dc97ba3c9db8104892b4b52e90f031..be2fb2559284568a753346e6404d221710be49c1 100644 (file)
@@ -61,6 +61,7 @@ struct Resources {
        const char *itemMenuUseText;
        const char *itemMenuSortText;
        const char *itemMenuDropText;
+       const char *itemMenuSelectText;
 
        graphics::MenuProperties *inventoryMenuProperties;
 
@@ -93,6 +94,7 @@ struct Resources {
        graphics::Texture *capsulebg;
 
        graphics::MenuProperties *capsuleMenuProperties;
+       graphics::MenuProperties *capsuleFeedMenuProperties;
 
        const char *capsuleFeedLabel;
        const char *capsuleChangeLabel;
@@ -104,6 +106,7 @@ struct Resources {
        const char *capsuleAttack2Label;
        const char *capsuleAttack3Label;
        const char *capsuleNoAttackText;
+       const char *capsuleNotHungryText;
 
        Resources();
 
index 8f689ae8abda0d0eeb8dc32c4c50d0e1905d34e2..15e0f83b7bedf492332329168a65bfc48f3b33e4 100644 (file)
@@ -3,6 +3,7 @@
 
 namespace menu {
 
+class CapsuleFeedMenu;
 class CapsuleMenu;
 class ChangeHero;
 class ConfigMenu;
index 2ea517ac9e514e95e14550a07a4f18930a51e72c..722043d1a8cf73e1089b32885eaa11d62eb9ee20 100644 (file)
@@ -760,6 +760,7 @@ export MenuResources menuResources {
        itemMenuUseText: "USE",
        itemMenuSortText: "SORT",
        itemMenuDropText: "DROP",
+       itemMenuSelectText: "SELECT",
        inventoryMenu: MenuProperties {
                cols: 1,
                rows: 6,
@@ -854,6 +855,15 @@ export MenuResources menuResources {
                font: menuFont,
                thirdColumnHack: 2
        },
+       capsuleFeedMenu: MenuProperties {
+               cols: 2,
+               rows: 1,
+               charsPerEntry: 7,
+               colGap: 32,
+               cursor: menuCursor,
+               selectedCursor: menuActiveCursor,
+               font: menuFont
+       },
        capsuleFeedLabel: "FEED",
        capsuleChangeLabel: "CHANGE",
        capsuleNameLabel: "NAME",
@@ -863,5 +873,6 @@ export MenuResources menuResources {
        capsuleAttack1Label: "SP.1",
        capsuleAttack2Label: "SP.2",
        capsuleAttack3Label: "SP.3",
-       capsuleNoAttackText: "Nothing"
+       capsuleNoAttackText: "Nothing",
+       capsuleNotHungryText: "I'm not hungry."
 }