From d6d77b62f44e04f2bae82017961c5e4b9b1f31b5 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Wed, 5 Sep 2012 21:46:07 +0200 Subject: [PATCH] added type description of battle::Resources --- src/battle/Resources.cpp | 168 +++++++++++++++++++++++++++++++++++++++ src/battle/Resources.h | 68 +--------------- 2 files changed, 171 insertions(+), 65 deletions(-) create mode 100644 src/battle/Resources.cpp diff --git a/src/battle/Resources.cpp b/src/battle/Resources.cpp new file mode 100644 index 0000000..a1365d0 --- /dev/null +++ b/src/battle/Resources.cpp @@ -0,0 +1,168 @@ +/* + * Resources.cpp + * + * Created on: Sep 4, 2012 + * Author: holy + */ + +#include "Resources.h" + +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + +namespace battle { + +Resources::Resources() +: swapCursor(0) +, moveIcons(0) +, attackIcons(0) +, attackChoiceIcons(0) + +, titleFrame(0) +, titleFont(0) + +, heroTagFrame(0) +, activeHeroTagFrame(0) +, smallHeroTagFrame(0) +, lastSmallHeroTagFrame(0) + +, heroTagFont(0) +, heroTagLabels(0) + +, healthGauge(0) +, manaGauge(0) +, ikariGauge(0) + +, selectFrame(0) + +, normalFont(0) +, disabledFont(0) + +, menuCursor(0) +, weaponTargetCursor(0) +, magicTargetCursor(0) +, itemTargetCursor(0) + +, spellMenuHeadline("") +, spellMenuProperties(0) +, inventory(0) +, itemMenuHeadline("") +, itemMenuProperties(0) +, ikariMenuHeadline("") +, ikariMenuProperties(0) +, noEquipmentText("") + +, escapeText("") + +, numberAnimationPrototype(0) +, bigNumberSprite(0) +, greenNumberSprite(0) + +, weaponMenuIcon(0) +, armorMenuIcon(0) +, shieldMenuIcon(0) +, helmetMenuIcon(0) +, ringMenuIcon(0) +, jewelMenuIcon(0) + +, levelLabelCol(0) +, levelLabelRow(0) +, healthLabelCol(0) +, healthLabelRow(0) +, manaLabelCol(0) +, manaLabelRow(0) +, moveLabelCol(0) +, moveLabelRow(0) +, ikariLabelCol(0) +, ikariLabelRow(0) + +{ } + + +void Resources::CreateTypeDescription() { + Resources r; + TypeDescription &td(TypeDescription::CreateOrGet("BattleResources")); + + td.SetSize(sizeof(Resources)); + + 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")); + + td.AddField("swapCursor", FieldDescription(((char *)&r.swapCursor) - ((char *)&r), spriteId, true)); + td.AddField("moveIcons", FieldDescription(((char *)&r.moveIcons) - ((char *)&r), spriteId, true)); + td.AddField("attackIcons", FieldDescription(((char *)&r.attackIcons) - ((char *)&r), spriteId, true)); + td.AddField("attackChoiceIcons", FieldDescription(((char *)&r.attackChoiceIcons) - ((char *)&r), spriteId, true)); + + td.AddField("titleFrame", FieldDescription(((char *)&r.titleFrame) - ((char *)&r), frameId, true)); + td.AddField("titleFont", FieldDescription(((char *)&r.titleFont) - ((char *)&r), fontId, true)); + + td.AddField("heroTagFrame", FieldDescription(((char *)&r.heroTagFrame) - ((char *)&r), frameId, true)); + td.AddField("activeHeroTagFrame", FieldDescription(((char *)&r.activeHeroTagFrame) - ((char *)&r), frameId, true)); + td.AddField("smallHeroTagFrame", FieldDescription(((char *)&r.smallHeroTagFrame) - ((char *)&r), frameId, true)); + td.AddField("lastSmallHeroTagFrame", FieldDescription(((char *)&r.lastSmallHeroTagFrame) - ((char *)&r), frameId, true)); + + td.AddField("heroTagFont", FieldDescription(((char *)&r.heroTagFont) - ((char *)&r), fontId, true)); + td.AddField("heroTagLabels", FieldDescription(((char *)&r.heroTagLabels) - ((char *)&r), spriteId, true)); + + td.AddField("healthGauge", FieldDescription(((char *)&r.healthGauge) - ((char *)&r), gaugeId, true)); + td.AddField("manaGauge", FieldDescription(((char *)&r.manaGauge) - ((char *)&r), gaugeId, true)); + td.AddField("ikariGauge", FieldDescription(((char *)&r.ikariGauge) - ((char *)&r), gaugeId, true)); + + td.AddField("selectFrame", FieldDescription(((char *)&r.selectFrame) - ((char *)&r), frameId, true)); + + td.AddField("normalFont", FieldDescription(((char *)&r.normalFont) - ((char *)&r), fontId, true)); + td.AddField("disabledFont", FieldDescription(((char *)&r.disabledFont) - ((char *)&r), fontId, true)); + + td.AddField("menuCursor", FieldDescription(((char *)&r.menuCursor) - ((char *)&r), spriteId, true)); + td.AddField("weaponTargetCursor", FieldDescription(((char *)&r.weaponTargetCursor) - ((char *)&r), spriteId, true)); + td.AddField("magicTargetCursor", FieldDescription(((char *)&r.magicTargetCursor) - ((char *)&r), spriteId, true)); + td.AddField("itemTargetCursor", FieldDescription(((char *)&r.itemTargetCursor) - ((char *)&r), spriteId, true)); + + td.AddField("spellMenuHeadline", FieldDescription(((char *)&r.spellMenuHeadline) - ((char *)&r), stringId, true)); + td.AddField("spellMenuProperties", FieldDescription(((char *)&r.spellMenuProperties) - ((char *)&r), menuPropertiesId, true)); + + td.AddField("itemMenuHeadline", FieldDescription(((char *)&r.itemMenuHeadline) - ((char *)&r), stringId, true)); + td.AddField("itemMenuProperties", FieldDescription(((char *)&r.itemMenuProperties) - ((char *)&r), menuPropertiesId, true)); + + td.AddField("ikariMenuHeadline", FieldDescription(((char *)&r.ikariMenuHeadline) - ((char *)&r), stringId, true)); + td.AddField("ikariMenuProperties", FieldDescription(((char *)&r.ikariMenuProperties) - ((char *)&r), menuPropertiesId, true)); + td.AddField("noEquipmentText", FieldDescription(((char *)&r.noEquipmentText) - ((char *)&r), stringId, true)); + + td.AddField("escapeText", FieldDescription(((char *)&r.escapeText) - ((char *)&r), stringId, true)); + + td.AddField("numberAnimationPrototype", FieldDescription(((char *)&r.numberAnimationPrototype) - ((char *)&r), animationId, true)); + + td.AddField("bigNumberSprite", FieldDescription(((char *)&r.bigNumberSprite) - ((char *)&r), spriteId, true)); + td.AddField("greenNumberSprite", FieldDescription(((char *)&r.greenNumberSprite) - ((char *)&r), spriteId, true)); + + td.AddField("weaponMenuIcon", FieldDescription(((char *)&r.weaponMenuIcon) - ((char *)&r), spriteId, true)); + td.AddField("armorMenuIcon", FieldDescription(((char *)&r.armorMenuIcon) - ((char *)&r), spriteId, true)); + td.AddField("shieldMenuIcon", FieldDescription(((char *)&r.shieldMenuIcon) - ((char *)&r), spriteId, true)); + td.AddField("helmetMenuIcon", FieldDescription(((char *)&r.helmetMenuIcon) - ((char *)&r), spriteId, true)); + td.AddField("ringMenuIcon", FieldDescription(((char *)&r.ringMenuIcon) - ((char *)&r), spriteId, true)); + td.AddField("jewelMenuIcon", FieldDescription(((char *)&r.jewelMenuIcon) - ((char *)&r), spriteId, true)); + + td.AddField("levelLabelCol", FieldDescription(((char *)&r.levelLabelCol) - ((char *)&r), numberId, false)); + td.AddField("levelLabelCol", FieldDescription(((char *)&r.levelLabelCol) - ((char *)&r), numberId, false)); + td.AddField("healthLabelRow", FieldDescription(((char *)&r.healthLabelRow) - ((char *)&r), numberId, false)); + td.AddField("healthLabelCol", FieldDescription(((char *)&r.healthLabelCol) - ((char *)&r), numberId, false)); + td.AddField("manaLabelRow", FieldDescription(((char *)&r.manaLabelRow) - ((char *)&r), numberId, false)); + td.AddField("manaLabelCol", FieldDescription(((char *)&r.manaLabelCol) - ((char *)&r), numberId, false)); + td.AddField("moveLabelRow", FieldDescription(((char *)&r.moveLabelRow) - ((char *)&r), numberId, false)); + td.AddField("moveLabelCol", FieldDescription(((char *)&r.moveLabelCol) - ((char *)&r), numberId, false)); + td.AddField("ikariLabelRow", FieldDescription(((char *)&r.ikariLabelRow) - ((char *)&r), numberId, false)); + td.AddField("ikariLabelRow", FieldDescription(((char *)&r.ikariLabelRow) - ((char *)&r), numberId, false)); + + td.AddField("heroesBgColor", FieldDescription(((char *)&r.heroesBgColor) - ((char *)&r), colorId, false)); +} + +} diff --git a/src/battle/Resources.h b/src/battle/Resources.h index 719eec4..64fc8e7 100644 --- a/src/battle/Resources.h +++ b/src/battle/Resources.h @@ -98,71 +98,9 @@ struct Resources { graphics::Color heroesBgColor; - Resources() - : swapCursor(0) - , moveIcons(0) - , attackIcons(0) - , attackChoiceIcons(0) - - , titleFrame(0) - , titleFont(0) - - , heroTagFrame(0) - , activeHeroTagFrame(0) - , smallHeroTagFrame(0) - , lastSmallHeroTagFrame(0) - - , heroTagFont(0) - , heroTagLabels(0) - - , healthGauge(0) - , manaGauge(0) - , ikariGauge(0) - - , selectFrame(0) - - , normalFont(0) - , disabledFont(0) - - , menuCursor(0) - , weaponTargetCursor(0) - , magicTargetCursor(0) - , itemTargetCursor(0) - - , spellMenuHeadline("") - , spellMenuProperties(0) - , inventory(0) - , itemMenuHeadline("") - , itemMenuProperties(0) - , ikariMenuHeadline("") - , ikariMenuProperties(0) - , noEquipmentText("") - - , escapeText("") - - , numberAnimationPrototype(0) - , bigNumberSprite(0) - , greenNumberSprite(0) - - , weaponMenuIcon(0) - , armorMenuIcon(0) - , shieldMenuIcon(0) - , helmetMenuIcon(0) - , ringMenuIcon(0) - , jewelMenuIcon(0) - - , levelLabelCol(0) - , levelLabelRow(0) - , healthLabelCol(0) - , healthLabelRow(0) - , manaLabelCol(0) - , manaLabelRow(0) - , moveLabelCol(0) - , moveLabelRow(0) - , ikariLabelCol(0) - , ikariLabelRow(0) - - { } + Resources(); + + static void CreateTypeDescription(); }; -- 2.39.2