X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FResources.cpp;h=d50571f10bb3fd1c20686b3174ac61ff49b0d0ef;hb=cc3d698b8c1ad09d7a3f9e3f28bc84e0ac1735ea;hp=bb0c0adfbc272919ed239149e5cd406f6e40d071;hpb=4bc70f5311dcbcca4e6b9e852bbcb19602f50eeb;p=l2e.git diff --git a/src/battle/Resources.cpp b/src/battle/Resources.cpp index bb0c0ad..d50571f 100644 --- a/src/battle/Resources.cpp +++ b/src/battle/Resources.cpp @@ -1,15 +1,22 @@ -/* - * Resources.cpp - * - * Created on: Sep 4, 2012 - * Author: holy - */ - #include "Resources.h" +#include "../graphics/Animation.h" +#include "../graphics/Font.h" +#include "../graphics/Frame.h" +#include "../graphics/Gauge.h" +#include "../graphics/Menu.h" +#include "../graphics/Sprite.h" +#include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" +using graphics::Animation; +using graphics::Font; +using graphics::Frame; +using graphics::Gauge; +using graphics::MenuProperties; +using graphics::Sprite; using loader::FieldDescription; +using loader::Interpreter; using loader::TypeDescription; namespace battle { @@ -47,7 +54,6 @@ Resources::Resources() , spellMenuHeadline("") , spellMenuProperties(0) -, inventory(0) , itemMenuHeadline("") , itemMenuProperties(0) , ikariMenuHeadline("") @@ -84,86 +90,76 @@ Resources::Resources() void Resources::CreateTypeDescription() { Resources r; - int animationId(TypeDescription::GetTypeId("Animation")); - int colorId(TypeDescription::GetTypeId("Color")); - int fontId(TypeDescription::GetTypeId("Font")); - int frameId(TypeDescription::GetTypeId("Frame")); - int gaugeId(TypeDescription::GetTypeId("Gauge")); - int menuPropertiesId(TypeDescription::GetTypeId("MenuProperties")); - int numberId(TypeDescription::GetTypeId("Number")); - int spriteId(TypeDescription::GetTypeId("Sprite")); - int stringId(TypeDescription::GetTypeId("String")); - - TypeDescription &td(TypeDescription::CreateOrGet("BattleResources")); + TypeDescription &td(TypeDescription::Create(TYPE_ID, "BattleResources")); td.SetConstructor(&Construct); td.SetSize(sizeof(Resources)); - td.AddField("swapCursor", FieldDescription(((char *)&r.swapCursor) - ((char *)&r), spriteId).SetReferenced().SetDescription("the cursor sprite for swapping heroes")); - td.AddField("moveIcons", FieldDescription(((char *)&r.moveIcons) - ((char *)&r), spriteId).SetReferenced().SetDescription("the icons of the move selection menu")); - td.AddField("attackIcons", FieldDescription(((char *)&r.attackIcons) - ((char *)&r), spriteId).SetReferenced().SetDescription("the icons of the attack selection menu")); - td.AddField("attackChoiceIcons", FieldDescription(((char *)&r.attackChoiceIcons) - ((char *)&r), spriteId).SetReferenced().SetDescription("the icons showing the hero's attack choice in the respective tag")); + td.AddField("swapCursor", FieldDescription(((char *)&r.swapCursor) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite for swapping heroes")); + td.AddField("moveIcons", FieldDescription(((char *)&r.moveIcons) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("the icons of the move selection menu")); + td.AddField("attackIcons", FieldDescription(((char *)&r.attackIcons) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("the icons of the attack selection menu")); + td.AddField("attackChoiceIcons", FieldDescription(((char *)&r.attackChoiceIcons) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("the icons showing the hero's attack choice in the respective tag")); - td.AddField("titleFrame", FieldDescription(((char *)&r.titleFrame) - ((char *)&r), frameId).SetReferenced().SetDescription("frame for title headings (spell names, status information, etc.)")); - td.AddField("titleFont", FieldDescription(((char *)&r.titleFont) - ((char *)&r), fontId).SetReferenced().SetDescription("the font for title headings")); + td.AddField("titleFrame", FieldDescription(((char *)&r.titleFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for title headings (spell names, status information, etc.)")); + td.AddField("titleFont", FieldDescription(((char *)&r.titleFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("the font for title headings")); - td.AddField("heroTagFrame", FieldDescription(((char *)&r.heroTagFrame) - ((char *)&r), frameId).SetReferenced().SetDescription("frame for hero tags")); - td.AddField("activeHeroTagFrame", FieldDescription(((char *)&r.activeHeroTagFrame) - ((char *)&r), frameId).SetReferenced().SetDescription("frame for the active hero's tag")); - td.AddField("smallHeroTagFrame", FieldDescription(((char *)&r.smallHeroTagFrame) - ((char *)&r), frameId).SetReferenced().SetDescription("frame for small hero tags (during attack animation)")); - td.AddField("lastSmallHeroTagFrame", FieldDescription(((char *)&r.lastSmallHeroTagFrame) - ((char *)&r), frameId).SetReferenced().SetDescription("frame for the last small hero tag")); + td.AddField("heroTagFrame", FieldDescription(((char *)&r.heroTagFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for hero tags")); + td.AddField("activeHeroTagFrame", FieldDescription(((char *)&r.activeHeroTagFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for the active hero's tag")); + td.AddField("smallHeroTagFrame", FieldDescription(((char *)&r.smallHeroTagFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for small hero tags (during attack animation)")); + td.AddField("lastSmallHeroTagFrame", FieldDescription(((char *)&r.lastSmallHeroTagFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for the last small hero tag")); - td.AddField("heroTagFont", FieldDescription(((char *)&r.heroTagFont) - ((char *)&r), fontId).SetReferenced().SetDescription("font for hero tags (hero names)")); - td.AddField("heroTagLabels", FieldDescription(((char *)&r.heroTagLabels) - ((char *)&r), spriteId).SetReferenced().SetDescription("labels on the hero tag (hp/mp/ip/lvl/move)")); + td.AddField("heroTagFont", FieldDescription(((char *)&r.heroTagFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("font for hero tags (hero names)")); + td.AddField("heroTagLabels", FieldDescription(((char *)&r.heroTagLabels) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("labels on the hero tag (hp/mp/ip/lvl/move)")); - td.AddField("healthGauge", FieldDescription(((char *)&r.healthGauge) - ((char *)&r), gaugeId).SetReferenced().SetDescription("health gauge")); - td.AddField("manaGauge", FieldDescription(((char *)&r.manaGauge) - ((char *)&r), gaugeId).SetReferenced().SetDescription("mana gauge")); - td.AddField("ikariGauge", FieldDescription(((char *)&r.ikariGauge) - ((char *)&r), gaugeId).SetReferenced().SetDescription("ikari gauge")); + td.AddField("healthGauge", FieldDescription(((char *)&r.healthGauge) - ((char *)&r), Gauge::TYPE_ID).SetReferenced().SetDescription("health gauge")); + td.AddField("manaGauge", FieldDescription(((char *)&r.manaGauge) - ((char *)&r), Gauge::TYPE_ID).SetReferenced().SetDescription("mana gauge")); + td.AddField("ikariGauge", FieldDescription(((char *)&r.ikariGauge) - ((char *)&r), Gauge::TYPE_ID).SetReferenced().SetDescription("ikari gauge")); - td.AddField("selectFrame", FieldDescription(((char *)&r.selectFrame) - ((char *)&r), frameId).SetReferenced().SetDescription("frame for spell, item, and ikari menus")); + td.AddField("selectFrame", FieldDescription(((char *)&r.selectFrame) - ((char *)&r), Frame::TYPE_ID).SetReferenced().SetDescription("frame for spell, item, and ikari menus")); - td.AddField("normalFont", FieldDescription(((char *)&r.normalFont) - ((char *)&r), fontId).SetReferenced().SetDescription("font for menus")); - td.AddField("disabledFont", FieldDescription(((char *)&r.disabledFont) - ((char *)&r), fontId).SetReferenced().SetDescription("font for disabled entries in menus")); + td.AddField("normalFont", FieldDescription(((char *)&r.normalFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("font for menus")); + td.AddField("disabledFont", FieldDescription(((char *)&r.disabledFont) - ((char *)&r), Font::TYPE_ID).SetReferenced().SetDescription("font for disabled entries in menus")); - td.AddField("menuCursor", FieldDescription(((char *)&r.menuCursor) - ((char *)&r), spriteId).SetReferenced().SetDescription("selection indicator for menus")); - td.AddField("weaponTargetCursor", FieldDescription(((char *)&r.weaponTargetCursor) - ((char *)&r), spriteId).SetReferenced().SetDescription("cursor for selectiong attack targets")); - td.AddField("magicTargetCursor", FieldDescription(((char *)&r.magicTargetCursor) - ((char *)&r), spriteId).SetReferenced().SetDescription("cursor for selectiong spell targets")); - td.AddField("itemTargetCursor", FieldDescription(((char *)&r.itemTargetCursor) - ((char *)&r), spriteId).SetReferenced().SetDescription("cursor for selectiong item targets")); + td.AddField("menuCursor", FieldDescription(((char *)&r.menuCursor) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("selection indicator for menus")); + td.AddField("weaponTargetCursor", FieldDescription(((char *)&r.weaponTargetCursor) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("cursor for selectiong attack targets")); + td.AddField("magicTargetCursor", FieldDescription(((char *)&r.magicTargetCursor) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("cursor for selectiong spell targets")); + td.AddField("itemTargetCursor", FieldDescription(((char *)&r.itemTargetCursor) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("cursor for selectiong item targets")); - td.AddField("spellMenuHeadline", FieldDescription(((char *)&r.spellMenuHeadline) - ((char *)&r), stringId).SetReferenced().SetDescription("headline of the spell menu")); - td.AddField("spellMenuProperties", FieldDescription(((char *)&r.spellMenuProperties) - ((char *)&r), menuPropertiesId).SetReferenced().SetDescription("properties of the spell menu")); + td.AddField("spellMenuHeadline", FieldDescription(((char *)&r.spellMenuHeadline) - ((char *)&r), Interpreter::STRING_ID).SetReferenced().SetDescription("headline of the spell menu")); + td.AddField("spellMenuProperties", FieldDescription(((char *)&r.spellMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the spell menu")); - td.AddField("itemMenuHeadline", FieldDescription(((char *)&r.itemMenuHeadline) - ((char *)&r), stringId).SetReferenced().SetDescription("headline of the item menu")); - td.AddField("itemMenuProperties", FieldDescription(((char *)&r.itemMenuProperties) - ((char *)&r), menuPropertiesId).SetReferenced().SetDescription("properties of the item menu")); + td.AddField("itemMenuHeadline", FieldDescription(((char *)&r.itemMenuHeadline) - ((char *)&r), Interpreter::STRING_ID).SetReferenced().SetDescription("headline of the item menu")); + td.AddField("itemMenuProperties", FieldDescription(((char *)&r.itemMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the item menu")); - td.AddField("ikariMenuHeadline", FieldDescription(((char *)&r.ikariMenuHeadline) - ((char *)&r), stringId).SetReferenced().SetDescription("headline of the ikari menu")); - td.AddField("ikariMenuProperties", FieldDescription(((char *)&r.ikariMenuProperties) - ((char *)&r), menuPropertiesId).SetReferenced().SetDescription("properties of the ikari menu")); - td.AddField("noEquipmentText", FieldDescription(((char *)&r.noEquipmentText) - ((char *)&r), stringId).SetReferenced().SetDescription("text to show for missing equipment")); + td.AddField("ikariMenuHeadline", FieldDescription(((char *)&r.ikariMenuHeadline) - ((char *)&r), Interpreter::STRING_ID).SetReferenced().SetDescription("headline of the ikari menu")); + td.AddField("ikariMenuProperties", FieldDescription(((char *)&r.ikariMenuProperties) - ((char *)&r), MenuProperties::TYPE_ID).SetReferenced().SetDescription("properties of the ikari menu")); + td.AddField("noEquipmentText", FieldDescription(((char *)&r.noEquipmentText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced().SetDescription("text to show for missing equipment")); - td.AddField("escapeText", FieldDescription(((char *)&r.escapeText) - ((char *)&r), stringId).SetReferenced().SetDescription("displayed when the party escapes")); + td.AddField("escapeText", FieldDescription(((char *)&r.escapeText) - ((char *)&r), Interpreter::STRING_ID).SetReferenced().SetDescription("displayed when the party escapes")); - td.AddField("numberAnimationPrototype", FieldDescription(((char *)&r.numberAnimationPrototype) - ((char *)&r), animationId).SetReferenced().SetDescription("animation of an attack's result digit")); + td.AddField("numberAnimationPrototype", FieldDescription(((char *)&r.numberAnimationPrototype) - ((char *)&r), Animation::TYPE_ID).SetReferenced().SetDescription("animation of an attack's result digit")); - td.AddField("bigNumberSprite", FieldDescription(((char *)&r.bigNumberSprite) - ((char *)&r), spriteId).SetReferenced().SetDescription("sprite containing the damage numbers")); - td.AddField("greenNumberSprite", FieldDescription(((char *)&r.greenNumberSprite) - ((char *)&r), spriteId).SetReferenced().SetDescription("sprite containing the healing numbers")); + td.AddField("bigNumberSprite", FieldDescription(((char *)&r.bigNumberSprite) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("sprite containing the damage numbers")); + td.AddField("greenNumberSprite", FieldDescription(((char *)&r.greenNumberSprite) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("sprite containing the healing numbers")); - td.AddField("weaponMenuIcon", FieldDescription(((char *)&r.weaponMenuIcon) - ((char *)&r), spriteId).SetReferenced().SetDescription("weapon icon for ikari menu")); - td.AddField("armorMenuIcon", FieldDescription(((char *)&r.armorMenuIcon) - ((char *)&r), spriteId).SetReferenced().SetDescription("armor icon for ikari menu")); - td.AddField("shieldMenuIcon", FieldDescription(((char *)&r.shieldMenuIcon) - ((char *)&r), spriteId).SetReferenced().SetDescription("shield icon for ikari menu")); - td.AddField("helmetMenuIcon", FieldDescription(((char *)&r.helmetMenuIcon) - ((char *)&r), spriteId).SetReferenced().SetDescription("helmet icon for ikari menu")); - td.AddField("ringMenuIcon", FieldDescription(((char *)&r.ringMenuIcon) - ((char *)&r), spriteId).SetReferenced().SetDescription("ring icon for ikari menu")); - td.AddField("jewelMenuIcon", FieldDescription(((char *)&r.jewelMenuIcon) - ((char *)&r), spriteId).SetReferenced().SetDescription("jewel icon for ikari menu")); + td.AddField("weaponMenuIcon", FieldDescription(((char *)&r.weaponMenuIcon) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("weapon icon for ikari menu")); + td.AddField("armorMenuIcon", FieldDescription(((char *)&r.armorMenuIcon) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("armor icon for ikari menu")); + td.AddField("shieldMenuIcon", FieldDescription(((char *)&r.shieldMenuIcon) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("shield icon for ikari menu")); + td.AddField("helmetMenuIcon", FieldDescription(((char *)&r.helmetMenuIcon) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("helmet icon for ikari menu")); + td.AddField("ringMenuIcon", FieldDescription(((char *)&r.ringMenuIcon) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("ring icon for ikari menu")); + td.AddField("jewelMenuIcon", FieldDescription(((char *)&r.jewelMenuIcon) - ((char *)&r), Sprite::TYPE_ID).SetReferenced().SetDescription("jewel icon for ikari menu")); - td.AddField("levelLabelRow", FieldDescription(((char *)&r.levelLabelRow) - ((char *)&r), numberId).SetDescription("column of the level label in heroTagLabels")); - td.AddField("levelLabelCol", FieldDescription(((char *)&r.levelLabelCol) - ((char *)&r), numberId).SetDescription("row of the level label in heroTagLabels")); - td.AddField("healthLabelRow", FieldDescription(((char *)&r.healthLabelRow) - ((char *)&r), numberId).SetDescription("column of the health label in heroTagLabels")); - td.AddField("healthLabelCol", FieldDescription(((char *)&r.healthLabelCol) - ((char *)&r), numberId).SetDescription("row of the health label in heroTagLabels")); - td.AddField("manaLabelRow", FieldDescription(((char *)&r.manaLabelRow) - ((char *)&r), numberId).SetDescription("column of the mana label in heroTagLabels")); - td.AddField("manaLabelCol", FieldDescription(((char *)&r.manaLabelCol) - ((char *)&r), numberId).SetDescription("row of the mana label in heroTagLabels")); - td.AddField("moveLabelRow", FieldDescription(((char *)&r.moveLabelRow) - ((char *)&r), numberId).SetDescription("column of the move label in heroTagLabels")); - td.AddField("moveLabelCol", FieldDescription(((char *)&r.moveLabelCol) - ((char *)&r), numberId).SetDescription("row of the move label in heroTagLabels")); - td.AddField("ikariLabelRow", FieldDescription(((char *)&r.ikariLabelRow) - ((char *)&r), numberId).SetDescription("column of the ikari label in heroTagLabels")); - td.AddField("ikariLabelCol", FieldDescription(((char *)&r.ikariLabelCol) - ((char *)&r), numberId).SetDescription("row of the ikari label in heroTagLabels")); + td.AddField("levelLabelRow", FieldDescription(((char *)&r.levelLabelRow) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("column of the level label in heroTagLabels")); + td.AddField("levelLabelCol", FieldDescription(((char *)&r.levelLabelCol) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("row of the level label in heroTagLabels")); + td.AddField("healthLabelRow", FieldDescription(((char *)&r.healthLabelRow) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("column of the health label in heroTagLabels")); + td.AddField("healthLabelCol", FieldDescription(((char *)&r.healthLabelCol) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("row of the health label in heroTagLabels")); + td.AddField("manaLabelRow", FieldDescription(((char *)&r.manaLabelRow) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("column of the mana label in heroTagLabels")); + td.AddField("manaLabelCol", FieldDescription(((char *)&r.manaLabelCol) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("row of the mana label in heroTagLabels")); + td.AddField("moveLabelRow", FieldDescription(((char *)&r.moveLabelRow) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("column of the move label in heroTagLabels")); + td.AddField("moveLabelCol", FieldDescription(((char *)&r.moveLabelCol) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("row of the move label in heroTagLabels")); + td.AddField("ikariLabelRow", FieldDescription(((char *)&r.ikariLabelRow) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("column of the ikari label in heroTagLabels")); + td.AddField("ikariLabelCol", FieldDescription(((char *)&r.ikariLabelCol) - ((char *)&r), Interpreter::NUMBER_ID).SetDescription("row of the ikari label in heroTagLabels")); - td.AddField("heroesBgColor", FieldDescription(((char *)&r.heroesBgColor) - ((char *)&r), colorId).SetDescription("background color of the small tags during attack animation")); + td.AddField("heroesBgColor", FieldDescription(((char *)&r.heroesBgColor) - ((char *)&r), Interpreter::COLOR_ID).SetDescription("background color of the small tags during attack animation")); } void Resources::Construct(void *data) {