]> git.localhorst.tv Git - l2e.git/commitdiff
moved menu resources to data files
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 30 Nov 2012 15:38:21 +0000 (16:38 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 30 Nov 2012 15:38:21 +0000 (16:38 +0100)
src/graphics/Menu.cpp
src/graphics/Texture.cpp
src/graphics/Texture.h
src/loader/Caster.cpp
src/loader/Caster.h
src/main.cpp
src/menu/Resources.cpp
src/menu/Resources.h
test-data/test.l2s

index b1e6af9c966a9d9f13e3970bca841325b76a13f8..6527e3e2c7325a8ed8baa087a270b87af1bcee4a 100644 (file)
@@ -19,6 +19,7 @@ void MenuProperties::CreateTypeDescription() {
        td.AddField("font", FieldDescription(((char *)&p.font) - ((char *)&p), Font::TYPE_ID).SetReferenced().SetDescription("the font to use for normal/enabled entries"));
        td.AddField("disabledFont", FieldDescription(((char *)&p.disabledFont) - ((char *)&p), Font::TYPE_ID).SetReferenced().SetDescription("the font for disabled entries"));
        td.AddField("cursor", FieldDescription(((char *)&p.cursor) - ((char *)&p), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite indicating the current selection"));
+       td.AddField("selectedCursor", FieldDescription(((char *)&p.selectedCursor) - ((char *)&p), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite used when fixating a selection"));
        td.AddField("charsPerEntry", FieldDescription(((char *)&p.charsPerEntry) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("width of an entry in characters"));
        td.AddField("rows", FieldDescription(((char *)&p.rows) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("number of visible rows"));
        td.AddField("rowGap", FieldDescription(((char *)&p.rowGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between rows in pixles"));
@@ -29,6 +30,8 @@ void MenuProperties::CreateTypeDescription() {
        td.AddField("charsPerNumber", FieldDescription(((char *)&p.charsPerNumber) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("maximum width of a number in chars"));
        td.AddField("charsPerAdditionalText", FieldDescription(((char *)&p.charsPerAdditionalText) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("maximum number of additional text characters"));
        td.AddField("additionalTextGap", FieldDescription(((char *)&p.additionalTextGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between normal and additional text in pixels"));
+       td.AddField("wrapX", FieldDescription(((char *)&p.wrapX) - ((char *)&p), Interpreter::BOOLEAN_ID).SetDescription("horizontally wrap cursor movement"));
+       td.AddField("wrapY", FieldDescription(((char *)&p.wrapY) - ((char *)&p), Interpreter::BOOLEAN_ID).SetDescription("vertically wrap cursor movement"));
 }
 
 void MenuProperties::Construct(void *data) {
index f4a0385897ec42da9108363f01be7e7fda32684e..f53c82fd7030f6219332e5368ae1d435b4a4481e 100644 (file)
@@ -1,8 +1,13 @@
 #include "Texture.h"
 
+#include "../loader/Interpreter.h"
+#include "../loader/TypeDescription.h"
 #include "../sdl/utility.h"
 
 using geometry::Vector;
+using loader::FieldDescription;
+using loader::Interpreter;
+using loader::TypeDescription;
 
 namespace graphics {
 
@@ -55,4 +60,21 @@ void Texture::Render(SDL_Surface *dest, const Vector<int> &from, const Vector<in
        }
 }
 
+
+void Texture::CreateTypeDescription() {
+       Texture t;
+
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "Texture"));
+       td.SetConstructor(&Construct);
+       td.SetSize(sizeof(Texture));
+
+       td.AddField("image", FieldDescription(((char *)&t.surface) - ((char *)&t), Interpreter::IMAGE_ID).SetReferenced().SetDescription("image containing the texture"));
+       td.AddField("size", FieldDescription(((char *)&t.size) - ((char *)&t), Interpreter::VECTOR_ID).SetDescription("offset into the image in pixels"));
+       td.AddField("offset", FieldDescription(((char *)&t.offset) - ((char *)&t), Interpreter::VECTOR_ID).SetDescription("size of the texture in pixels"));
+}
+
+void Texture::Construct(void *data) {
+       new (data) Texture;
+}
+
 }
index ef4256b83228b39e5e0301fc80fc85f2070e214a..bd85aaafb1fe5d4b9258e30894b7888b5af6db19 100644 (file)
@@ -16,6 +16,8 @@ public:
                        const geometry::Vector<int> &offset = geometry::Vector<int>());
        ~Texture();
 
+       static const int TYPE_ID = 410;
+
 public:
        void Render(SDL_Surface *dest, const geometry::Vector<int> &from, const geometry::Vector<int> &to) const;
 
@@ -24,6 +26,9 @@ public:
        void SetSize(const geometry::Vector<int> &s) { size = s; }
        void SetOffset(const geometry::Vector<int> &o) { offset = o; }
 
+       static void CreateTypeDescription();
+       static void Construct(void *);
+
 private:
        SDL_Surface *surface;
        geometry::Vector<int> size;
index 876e1282ff9fb5a5e3ac92b9e59127fa4d0d1dff..78a31b548db4737e0cd4cba08ee104fd73a9313f 100644 (file)
@@ -1,6 +1,14 @@
 #include "Caster.h"
 
 #include "TypeDescription.h"
+#include "../battle/Resources.h"
+#include "../battle/Monster.h"
+#include "../battle/PartyLayout.h"
+#include "../common/Hero.h"
+#include "../common/Item.h"
+#include "../common/Spell.h"
+#include "../map/Map.h"
+#include "../menu/Resources.h"
 
 using battle::Monster;
 using battle::PartyLayout;
@@ -14,44 +22,44 @@ using std::string;
 namespace loader {
 
 Caster::Caster(Interpreter &intp)
-: intp(intp)
-, battleResourcesId(TypeDescription::GetTypeId("BattleResources"))
-, heroId(TypeDescription::GetTypeId("Hero"))
-, itemId(TypeDescription::GetTypeId("Item"))
-, mapId(TypeDescription::GetTypeId("Map"))
-, monsterId(TypeDescription::GetTypeId("Monster"))
-, partyLayoutId(TypeDescription::GetTypeId("PartyLayout"))
-, spellId(TypeDescription::GetTypeId("Spell")) {
+: intp(intp) {
 
 }
 
 
 battle::Resources *Caster::GetBattleResources(const string &ident) {
-       return reinterpret_cast<battle::Resources *>(intp.GetObject(battleResourcesId, ident));
+       return reinterpret_cast<battle::Resources *>(
+                       intp.GetObject(battle::Resources::TYPE_ID, ident));
 }
 
 Hero *Caster::GetHero(const string &ident) {
-       return reinterpret_cast<Hero *>(intp.GetObject(heroId, ident));
+       return reinterpret_cast<Hero *>(intp.GetObject(Hero::TYPE_ID, ident));
 }
 
 Item *Caster::GetItem(const string &ident) {
-       return reinterpret_cast<Item *>(intp.GetObject(itemId, ident));
+       return reinterpret_cast<Item *>(intp.GetObject(Item::TYPE_ID, ident));
 }
 
 Map *Caster::GetMap(const string &ident) {
-       return reinterpret_cast<Map *>(intp.GetObject(mapId, ident));
+       return reinterpret_cast<Map *>(intp.GetObject(Map::TYPE_ID, ident));
+}
+
+menu::Resources *Caster::GetMenuResources(const string &ident) {
+       return reinterpret_cast<menu::Resources *>(
+                       intp.GetObject(menu::Resources::TYPE_ID, ident));
 }
 
 Monster *Caster::GetMonster(const string &ident) {
-       return reinterpret_cast<Monster *>(intp.GetObject(monsterId, ident));
+       return reinterpret_cast<Monster *>(intp.GetObject(Monster::TYPE_ID, ident));
 }
 
 PartyLayout *Caster::GetPartyLayout(const string &ident) {
-       return reinterpret_cast<PartyLayout *>(intp.GetObject(partyLayoutId, ident));
+       return reinterpret_cast<PartyLayout *>(
+                       intp.GetObject(PartyLayout::TYPE_ID, ident));
 }
 
 Spell *Caster::GetSpell(const string &ident) {
-       return reinterpret_cast<Spell *>(intp.GetObject(spellId, ident));
+       return reinterpret_cast<Spell *>(intp.GetObject(Spell::TYPE_ID, ident));
 }
 
 }
index c095cc90bf79c900b37942c3b6879e5cfca5bf3a..2aa6be09ed5762d8dae481bf321813d10f94e851 100644 (file)
@@ -5,6 +5,7 @@
 #include "../battle/fwd.h"
 #include "../common/fwd.h"
 #include "../map/fwd.h"
+#include "../menu/fwd.h"
 
 #include <string>
 
@@ -24,6 +25,7 @@ public:
        common::Hero *GetHero(const std::string &identifier);
        common::Item *GetItem(const std::string &identifier);
        map::Map *GetMap(const std::string &identifier);
+       menu::Resources *GetMenuResources(const std::string &identifier);
        battle::Monster *GetMonster(const std::string &identifier);
        battle::PartyLayout *GetPartyLayout(const std::string &identifier);
        common::Spell *GetSpell(const std::string &identifier);
@@ -31,14 +33,6 @@ public:
 private:
        Interpreter &intp;
 
-       int battleResourcesId;
-       int heroId;
-       int itemId;
-       int mapId;
-       int monsterId;
-       int partyLayoutId;
-       int spellId;
-
 };
 
 }
index 0e12f5b92ca0bce784a0daf5940eec610a020c1d..31724d5b22acd42f67b0222f8a954234c77981ad 100644 (file)
@@ -114,6 +114,7 @@ int main(int argc, char **argv) {
                graphics::MenuProperties::CreateTypeDescription();
                graphics::SimpleAnimation::CreateTypeDescription();
                graphics::Sprite::CreateTypeDescription();
+               graphics::Texture::CreateTypeDescription();
 
                map::Area::CreateTypeDescription();
                map::Entity::CreateTypeDescription();
@@ -121,6 +122,8 @@ int main(int argc, char **argv) {
                map::Tile::CreateTypeDescription();
                map::Trigger::CreateTypeDescription();
 
+               menu::Resources::CreateTypeDescription();
+
                Arguments args;
                args.Read(argc, argv);
 
@@ -191,6 +194,7 @@ int main(int argc, char **argv) {
                gameConfig.state = &gameState;
                gameConfig.heroesLayout = caster.GetPartyLayout("heroesLayout");
                gameConfig.battleResources = caster.GetBattleResources("battleResources");
+               gameConfig.menuResources = caster.GetMenuResources("menuResources");
 
                // temporary test data
                SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
@@ -273,200 +277,6 @@ int main(int argc, char **argv) {
                gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING);
                gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity());
 
-               menu::Resources menuResources;
-               gameConfig.menuResources = &menuResources;
-
-               Texture menubg;
-               menubg.SetSurface(IMG_Load("test-data/menubg.png"));
-               menubg.SetSize(Vector<int>(64, 64));
-               menuResources.menubg = &menubg;
-
-               menuResources.statusFont = gameConfig.battleResources->normalFont;
-
-               graphics::Sprite statusLabels(IMG_Load("test-data/status-labels.png"), 32, 16);
-               menuResources.statusLabels = &statusLabels;
-
-               graphics::Frame statusFrame(IMG_Load("test-data/status-frame.png"), 32, 32, 32, 32);
-               menuResources.statusFrame = &statusFrame;
-
-               graphics::Sprite menuFontSprite(IMG_Load("test-data/menu-font.png"), 16, 16);
-               graphics::Font menuFont(&menuFontSprite, 0, -2);
-               graphics::Sprite menuInactiveFontSprite(IMG_Load("test-data/menu-font-inactive.png"), 16, 16);
-               graphics::Font menuInactiveFont(&menuInactiveFontSprite, 0, -2);
-
-               menuResources.normalFont = &menuFont;
-               menuResources.inactiveFont = &menuInactiveFont;
-
-               graphics::Sprite menuCursor(IMG_Load("test-data/menu-cursor.png"), 32, 16);
-               menuResources.menuCursor = &menuCursor;
-               graphics::Sprite menuActiveCursor(IMG_Load("test-data/menu-cursor-active.png"), 32, 18);
-               menuResources.menuActiveCursor = &menuActiveCursor;
-
-               graphics::MenuProperties mainMenuProperties;
-               mainMenuProperties.cols = 2;
-               mainMenuProperties.rows = 4;
-               mainMenuProperties.charsPerEntry = 8;
-               mainMenuProperties.rowGap = 8;
-               mainMenuProperties.colGap = 32;
-               mainMenuProperties.cursor = &menuCursor;
-               mainMenuProperties.font = &menuFont;
-               mainMenuProperties.wrapX = true;
-               mainMenuProperties.wrapY = true;
-               menuResources.mainMenuProperties = &mainMenuProperties;
-
-               menuResources.mainMenuItemText = "ITEM";
-               menuResources.mainMenuSpellText = "SPELL";
-               menuResources.mainMenuCapsuleText = "CAPSULE";
-               menuResources.mainMenuEquipmentText = "EQUIP";
-               menuResources.mainMenuStatusText = "STATUS";
-               menuResources.mainMenuChangeText = "CHANGE";
-               menuResources.mainMenuConfigText = "CONFIG";
-               menuResources.mainMenuScenarioText = "SCENARIO";
-
-               menuResources.mainMenuTimeText = "TIME";
-               menuResources.mainMenuGoldText = "GOLD";
-
-               graphics::Sprite heroCursor(IMG_Load("test-data/hero-cursor.png"), 64, 16);
-               menuResources.heroCursor = &heroCursor;
-               menuResources.heroCursorBlinkTime = 532;
-
-               menuResources.noEquipmentText = "No equip";
-
-               graphics::Sprite shoulderNav(IMG_Load("test-data/shoulder-nav.png"), 160, 16);
-               menuResources.shoulderNav = &shoulderNav;
-
-               menuResources.atpLabel = "ATP";
-               menuResources.dfpLabel = "DFP";
-               menuResources.strLabel = "STR";
-               menuResources.aglLabel = "AGL";
-               menuResources.intLabel = "INT";
-               menuResources.gutLabel = "GUT";
-               menuResources.mgrLabel = "MGR";
-
-               menuResources.ipLabel = "IP";
-               menuResources.experienceLabel = "NOW EXP";
-               menuResources.nextLevelLabel = "NEXT LEVEL";
-
-               graphics::MenuProperties statusMenuProperties;
-               statusMenuProperties.cols = 2;
-               statusMenuProperties.rows = 1;
-               statusMenuProperties.charsPerEntry = 6;
-               statusMenuProperties.rowGap = 0;
-               statusMenuProperties.colGap = 16;
-               statusMenuProperties.cursor = &menuCursor;
-               statusMenuProperties.font = &menuFont;
-               statusMenuProperties.wrapX = true;
-               menuResources.statusMenuProperties = &statusMenuProperties;
-
-               menuResources.nextLabel = "NEXT";
-               menuResources.returnLabel = "RETURN";
-
-               graphics::MenuProperties itemMenuProperties;
-               itemMenuProperties.cols = 3;
-               itemMenuProperties.rows = 1;
-               itemMenuProperties.charsPerEntry = 5;
-               itemMenuProperties.rowGap = 8;
-               itemMenuProperties.colGap = 16;
-               itemMenuProperties.cursor = &menuCursor;
-               itemMenuProperties.selectedCursor = &menuActiveCursor;
-               itemMenuProperties.font = &menuFont;
-               itemMenuProperties.wrapX = true;
-               itemMenuProperties.wrapY = true;
-               menuResources.itemMenuProperties = &itemMenuProperties;
-               menuResources.itemMenuUseText = "USE";
-               menuResources.itemMenuSortText = "SORT";
-               menuResources.itemMenuDropText = "DROP";
-
-               graphics::MenuProperties inventoryMenuProperties;
-               inventoryMenuProperties.cols = 1;
-               inventoryMenuProperties.rows = 6;
-               inventoryMenuProperties.charsPerEntry = 13;
-               inventoryMenuProperties.rowGap = 8;
-               inventoryMenuProperties.cursor = &menuCursor;
-               inventoryMenuProperties.selectedCursor = &menuActiveCursor;
-               inventoryMenuProperties.font = &menuFont;
-               inventoryMenuProperties.disabledFont = &menuInactiveFont;
-               inventoryMenuProperties.iconSpace = 16;
-               inventoryMenuProperties.charsPerNumber = 2;
-               inventoryMenuProperties.delimiter = ':';
-               menuResources.inventoryMenuProperties = &inventoryMenuProperties;
-
-               graphics::MenuProperties spellMenuProperties;
-               spellMenuProperties.cols = 2;
-               spellMenuProperties.rows = 6;
-               spellMenuProperties.charsPerEntry = 8;
-               spellMenuProperties.rowGap = 8;
-               spellMenuProperties.colGap = 48;
-               spellMenuProperties.cursor = &menuCursor;
-               spellMenuProperties.selectedCursor = &menuActiveCursor;
-               spellMenuProperties.font = &menuFont;
-               spellMenuProperties.disabledFont = &menuInactiveFont;
-               spellMenuProperties.iconSpace = 0;
-               spellMenuProperties.charsPerNumber = 2;
-               spellMenuProperties.delimiter = ':';
-               menuResources.spellMenuProperties = &spellMenuProperties;
-
-               graphics::MenuProperties equipmentActionMenuProperties;
-               equipmentActionMenuProperties.cols = 1;
-               equipmentActionMenuProperties.rows = 5;
-               equipmentActionMenuProperties.charsPerEntry = 10;
-               equipmentActionMenuProperties.rowGap = 8;
-               equipmentActionMenuProperties.cursor = &menuCursor;
-               equipmentActionMenuProperties.selectedCursor = &menuActiveCursor;
-               equipmentActionMenuProperties.font = &menuFont;
-               equipmentActionMenuProperties.iconSpace = 0;
-               menuResources.equipmentActionMenuProperties = &equipmentActionMenuProperties;
-
-               graphics::MenuProperties equipmentMenuProperties;
-               equipmentMenuProperties.cols = 1;
-               equipmentMenuProperties.rows = 6;
-               equipmentMenuProperties.charsPerEntry = 12;
-               equipmentMenuProperties.rowGap = 16;
-               equipmentMenuProperties.cursor = &menuCursor;
-               equipmentMenuProperties.selectedCursor = &menuActiveCursor;
-               equipmentMenuProperties.font = menuResources.statusFont;
-               equipmentMenuProperties.iconSpace = 16;
-               equipmentMenuProperties.wrapY = true;
-               menuResources.equipmentMenuProperties = &equipmentMenuProperties;
-
-               menuResources.equipMenuEquipLabel = "EQUIP";
-               menuResources.equipMenuStrongestLabel = "STRONGEST";
-               menuResources.equipMenuRemoveLabel = "REMOVE";
-               menuResources.equipMenuRemoveAllLabel = "REMOVE ALL";
-               menuResources.equipMenuDropLabel = "DROP";
-
-               graphics::MenuProperties configMenuProperties;
-               configMenuProperties.cols = 1;
-               configMenuProperties.rows = 4;
-               configMenuProperties.charsPerEntry = 8;
-               configMenuProperties.rowGap = 32;
-               configMenuProperties.cursor = &menuCursor;
-               configMenuProperties.font = &menuFont;
-               configMenuProperties.wrapY = true;
-               menuResources.configMenuProperties = &configMenuProperties;
-
-               menuResources.configMessageSpeedLabel = "MESSAGE\n   SPEED";
-               menuResources.configMessageSpeedFast = "FAST";
-               menuResources.configMessageSpeedNormal = "NORMAL";
-               menuResources.configMessageSpeedSlow = "SLOW";
-               menuResources.configBattleCursorLabel = "BATTLE\n  CURSOR";
-               menuResources.configStatusCursorLabel = "STATUS\n  CURSOR";
-               menuResources.configCursorClear = "CLEAR";
-               menuResources.configCursorMemory = "MEMORY";
-               menuResources.configMusicLabel = "MUSIC";
-               menuResources.configMusicStereo = "STEREO";
-               menuResources.configMusicMono = "MONO";
-
-               graphics::MenuProperties scenarioMenuProperties;
-               scenarioMenuProperties.cols = 1;
-               scenarioMenuProperties.rows = 6;
-               scenarioMenuProperties.charsPerEntry = 14;
-               scenarioMenuProperties.rowGap = 8;
-               scenarioMenuProperties.cursor = &menuCursor;
-               scenarioMenuProperties.font = &menuFont;
-               menuResources.scenarioMenuProperties = &scenarioMenuProperties;
-               menuResources.scenarioMenuHeadline = "SCENARIO ITEM";
-
                InitScreen screen(width, height);
 
                app::State *state(0);
index 5020b9c60e18c924aca240ad5c2d52838a43f43d..79aecf6ea1f424df934a2118cf87631f46f908fa 100644 (file)
@@ -1,5 +1,22 @@
 #include "Resources.h"
 
+#include "../graphics/Font.h"
+#include "../graphics/Frame.h"
+#include "../graphics/Menu.h"
+#include "../graphics/Sprite.h"
+#include "../graphics/Texture.h"
+#include "../loader/Interpreter.h"
+#include "../loader/TypeDescription.h"
+
+using graphics::Font;
+using graphics::Frame;
+using graphics::MenuProperties;
+using graphics::Sprite;
+using graphics::Texture;
+using loader::FieldDescription;
+using loader::Interpreter;
+using loader::TypeDescription;
+
 namespace menu {
 
 Resources::Resources()
@@ -8,9 +25,6 @@ Resources::Resources()
 , inactiveFont(0)
 , statusFont(0)
 
-, menuCursor(0)
-, menuActiveCursor(0)
-
 , statusLabels(0)
 , statusFrame(0)
 
@@ -82,8 +96,99 @@ Resources::Resources()
 , configMusicMono(0)
 
 , scenarioMenuProperties(0)
-, scenarioMenuHeadline(0) {
+, scenarioMenuHeadline(0)
+
+{ }
+
+
+void Resources::CreateTypeDescription() {
+       Resources r;
+
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "MenuResources"));
+       td.SetConstructor(&Construct);
+       td.SetSize(sizeof(Resources));
+
+       td.AddField("menubg", FieldDescription(((char *)&r.menubg) - ((char *)&r), Texture::TYPE_ID).SetReferenced().SetDescription("background texture for menus"));
+
+       td.AddField("normalFont", FieldDescription(((char *)&r.normalFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("normal menu font"));
+       td.AddField("inactiveFont", FieldDescription(((char *)&r.inactiveFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("inactive menu font"));
+       td.AddField("statusFont", FieldDescription(((char *)&r.statusFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("status font"));
+
+       td.AddField("statusLabels", FieldDescription(((char *)&r.statusLabels) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("labels for the hero status"));
+       td.AddField("statusFrame", FieldDescription(((char *)&r.statusFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for almost every menu"));
+
+       td.AddField("mainMenu", FieldDescription(((char *)&r.mainMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the main menu"));
+       td.AddField("mainMenuItemText", FieldDescription(((char *)&r.mainMenuItemText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuSpellText", FieldDescription(((char *)&r.mainMenuSpellText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuCapsuleText", FieldDescription(((char *)&r.mainMenuCapsuleText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuEquipmentText", FieldDescription(((char *)&r.mainMenuEquipmentText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuStatusText", FieldDescription(((char *)&r.mainMenuStatusText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuChangeText", FieldDescription(((char *)&r.mainMenuChangeText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuConfigText", FieldDescription(((char *)&r.mainMenuConfigText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuScenarioText", FieldDescription(((char *)&r.mainMenuScenarioText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("mainMenuTimeText", FieldDescription(((char *)&r.mainMenuTimeText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mainMenuGoldText", FieldDescription(((char *)&r.mainMenuGoldText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("heroCursor", FieldDescription(((char *)&r.heroCursor) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("cursor for selecting a hero"));
+       td.AddField("heroCursorBlinkTime", FieldDescription(((char *)&r.heroCursorBlinkTime) - ((char *)&r), Interpreter::NUMBER_ID).SetReferenced().SetDescription("blinking interval (half) for the hero cursor"));
+
+       td.AddField("noEquipmentText", FieldDescription(((char *)&r.noEquipmentText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("shoulderNav", FieldDescription(((char *)&r.shoulderNav) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("visual aid for the hero navigation via shoulder buttons in some sub menus"));
+
+       td.AddField("atpLabel", FieldDescription(((char *)&r.atpLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("dfpLabel", FieldDescription(((char *)&r.dfpLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("strLabel", FieldDescription(((char *)&r.strLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("aglLabel", FieldDescription(((char *)&r.aglLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("intLabel", FieldDescription(((char *)&r.intLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("gutLabel", FieldDescription(((char *)&r.gutLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("mgrLabel", FieldDescription(((char *)&r.mgrLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("ipLabel", FieldDescription(((char *)&r.ipLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("experienceLabel", FieldDescription(((char *)&r.experienceLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("nextLevelLabel", FieldDescription(((char *)&r.nextLevelLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("statusMenu", FieldDescription(((char *)&r.statusMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the status menu"));
+
+       td.AddField("nextLabel", FieldDescription(((char *)&r.nextLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("returnLabel", FieldDescription(((char *)&r.returnLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("itemMenu", FieldDescription(((char *)&r.itemMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the item menu"));
+       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("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"));
+
+       td.AddField("equipmentActionMenu", FieldDescription(((char *)&r.equipmentActionMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the equipment action menu (the lower one)"));
+       td.AddField("equipmentMenu", FieldDescription(((char *)&r.equipmentMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the equipment menu (the one with the equipped items)"));
+       td.AddField("equipMenuEquipLabel", FieldDescription(((char *)&r.equipMenuEquipLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("equipMenuStrongestLabel", FieldDescription(((char *)&r.equipMenuStrongestLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("equipMenuRemoveLabel", FieldDescription(((char *)&r.equipMenuRemoveLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("equipMenuRemoveAllLabel", FieldDescription(((char *)&r.equipMenuRemoveAllLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("equipMenuDropLabel", FieldDescription(((char *)&r.equipMenuDropLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("configMenu", FieldDescription(((char *)&r.configMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the configuration menu"));
+       td.AddField("configMessageSpeedLabel", FieldDescription(((char *)&r.configMessageSpeedLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configMessageSpeedFast", FieldDescription(((char *)&r.configMessageSpeedFast) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configMessageSpeedNormal", FieldDescription(((char *)&r.configMessageSpeedNormal) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configMessageSpeedSlow", FieldDescription(((char *)&r.configMessageSpeedSlow) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configBattleCursorLabel", FieldDescription(((char *)&r.configBattleCursorLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configStatusCursorLabel", FieldDescription(((char *)&r.configStatusCursorLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configCursorClear", FieldDescription(((char *)&r.configCursorClear) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configCursorMemory", FieldDescription(((char *)&r.configCursorMemory) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configMusicLabel", FieldDescription(((char *)&r.configMusicLabel) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configMusicStereo", FieldDescription(((char *)&r.configMusicStereo) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+       td.AddField("configMusicMono", FieldDescription(((char *)&r.configMusicMono) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+
+       td.AddField("scenarioMenu", FieldDescription(((char *)&r.scenarioMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the scenario menu"));
+       td.AddField("scenarioMenuHeadline", FieldDescription(((char *)&r.scenarioMenuHeadline) - ((char *)&r), Interpreter::STRING_ID).SetReferenced());
+}
 
+void Resources::Construct(void *data) {
+       new (data) Resources;
 }
 
 }
index ec1fdf4741ddd9a8409c5d638d421d12c820dc80..9ea26e665000270d0b024e7ef5eaa550cd9b07b3 100644 (file)
@@ -7,15 +7,14 @@ namespace menu {
 
 struct Resources {
 
+       static const int TYPE_ID = 701;
+
        graphics::Texture *menubg;
 
        graphics::Font *normalFont;
        graphics::Font *inactiveFont;
        graphics::Font *statusFont;
 
-       graphics::Sprite *menuCursor;
-       graphics::Sprite *menuActiveCursor;
-
        graphics::Sprite *statusLabels;
        graphics::Frame *statusFrame;
 
@@ -91,6 +90,9 @@ struct Resources {
 
        Resources();
 
+       static void CreateTypeDescription();
+       static void Construct(void *);
+
 };
 
 }
index 5f4fe2c034e0bb2a7c07b3b410625e22f5987c64..8491b37316fa9867848ba3cae311a35fa826ff14 100644 (file)
@@ -647,4 +647,193 @@ export BattleResources battleResources {
        noEquipmentText: "No equip",
        
        escapeText: "Escapes."
-}
\ No newline at end of file
+}
+
+Font menuFont {
+       sprite: Sprite {
+               image: :"menu-font.png",
+               size: <16, 16>
+       },
+       rowoffset: -2
+}
+Font menuInactiveFont {
+       sprite: Sprite {
+               image: :"menu-font-inactive.png",
+               size: <16, 16>
+       },
+       rowoffset: -2
+}
+Sprite menuCursor {
+       image: :"menu-cursor.png",
+       size: <32, 16>
+}
+Sprite menuActiveCursor {
+       image: :"menu-cursor-active.png",
+       size: <32, 18>
+}
+
+export MenuResources menuResources {
+       menubg: Texture {
+               image: :"menubg.png",
+               size: <64, 64>
+       },
+       normalFont: menuFont,
+       inactiveFont: menuInactiveFont,
+       statusFont: normalFont,
+       statusLabels: Sprite {
+               image: :"status-labels.png",
+               size: <32, 16>
+       },
+       statusFrame: Frame {
+               image: :"status-frame.png",
+               border: <32, 32>,
+               repeat: <32, 32>
+       },
+       mainMenu: MenuProperties {
+               cols: 2,
+               rows: 4,
+               charsPerEntry: 8,
+               rowGap: 8,
+               colGap: 32,
+               cursor: menuCursor,
+               font: menuFont,
+               wrapX: true,
+               wrapY: true
+       },
+       mainMenuItemText: "ITEM",
+       mainMenuSpellText: "SPELL",
+       mainMenuCapsuleText: "CAPSULE",
+       mainMenuEquipmentText: "EQUIP",
+       mainMenuStatusText: "STATUS",
+       mainMenuChangeText: "CHANGE",
+       mainMenuConfigText: "CONFIG",
+       mainMenuScenarioText: "SCENARIO",
+       mainMenuTimeText: "TIME",
+       mainMenuGoldText: "GOLD",
+       heroCursor: Sprite {
+               image: :"hero-cursor.png",
+               size: <64, 16>
+       },
+       heroCursorBlinkTime: 532,
+       noEquipmentText: "No equip",
+       shoulderNav: Sprite {
+               image: :"shoulder-nav.png",
+               size: <160, 16>
+       },
+       atpLabel: "ATP",
+       dfpLabel: "DFP",
+       strLabel: "STR",
+       aglLabel: "AGL",
+       intLabel: "INT",
+       gutLabel: "GUT",
+       mgrLabel: "MGR",
+       ipLabel: "IP",
+       experienceLabel: "NOW EXP",
+       nextLevelLabel: "NEXT LEVEL",
+       statusMenu: MenuProperties {
+               cols: 2,
+               rows: 1,
+               charsPerEntry: 6,
+               colGap: 16,
+               cursor: menuCursor,
+               font: menuFont,
+               wrapX: true
+       },
+       nextLabel: "NEXT",
+       returnLabel: "RETURN",
+       itemMenu: MenuProperties {
+               cols: 3,
+               rows: 1,
+               charsPerEntry: 5,
+               rowGap: 8,
+               colGap: 16,
+               cursor: menuCursor,
+               selectedCursor: menuActiveCursor,
+               font: menuFont,
+               wrapX: true,
+               wrapY: true
+       },
+       itemMenuUseText: "USE",
+       itemMenuSortText: "SORT",
+       itemMenuDropText: "DROP",
+       inventoryMenu: MenuProperties {
+               cols: 1,
+               rows: 6,
+               charsPerEntry: 13,
+               rowGap: 8,
+               cursor: menuCursor,
+               selectedCursor: menuActiveCursor,
+               font: menuFont,
+               disabledFont: menuInactiveFont,
+               iconSpace: 16,
+               charsPerNumber: 2,
+               delimiter: ":"
+       },
+       spellMenu: MenuProperties {
+               cols: 2,
+               rows: 6,
+               charsPerEntry: 8,
+               rowGap: 8,
+               colGap: 48,
+               cursor: menuCursor,
+               selectedCursor: menuActiveCursor,
+               font: menuFont,
+               disabledFont: menuInactiveFont,
+               charsPerNumber: 2,
+               delimiter: ":"
+       },
+       equipmentActionMenu: MenuProperties {
+               cols: 1,
+               rows: 5,
+               charsPerEntry: 10,
+               rowGap: 8,
+               cursor: menuCursor,
+               selectedCursor: menuActiveCursor,
+               font: menuFont
+       },
+       equipmentMenu: MenuProperties {
+               cols: 1,
+               rows: 6,
+               charsPerEntry: 12,
+               rowGap: 16,
+               cursor: menuCursor,
+               selectedCursor: menuActiveCursor,
+               font: normalFont,
+               iconSpace: 16,
+               wrapY: true
+       },
+       equipMenuEquipLabel: "EQUIP",
+       equipMenuStrongestLabel: "STRONGEST",
+       equipMenuRemoveLabel: "REMOVE",
+       equipMenuRemoveAllLabel: "REMOVE ALL",
+       equipMenuDropLabel: "DROP",
+       configMenu: MenuProperties {
+               cols: 1,
+               rows: 4,
+               charsPerEntry: 8,
+               rowGap: 32,
+               cursor: menuCursor,
+               font: menuFont,
+               wrapY: true
+       },
+       configMessageSpeedLabel: "MESSAGE\n   SPEED",
+       configMessageSpeedFast: "FAST",
+       configMessageSpeedNormal: "NORMAL",
+       configMessageSpeedSlow: "SLOW",
+       configBattleCursorLabel: "BATTLE\n  CURSOR",
+       configStatusCursorLabel: "STATUS\n  CURSOR",
+       configCursorClear: "CLEAR",
+       configCursorMemory: "MEMORY",
+       configMusicLabel: "MUSIC",
+       configMusicStereo: "STEREO",
+       configMusicMono: "MONO",
+       scenarioMenu: MenuProperties {
+               cols: 1,
+               rows: 6,
+               charsPerEntry: 14,
+               rowGap: 8,
+               cursor: menuCursor,
+               font: menuFont
+       },
+       scenarioMenuHeadline: "SCENARIO ITEM"
+}