void Hero::CreateTypeDescription() {
Hero h;
- TypeDescription &td(TypeDescription::CreateOrGet("Hero"));
-
- td.SetSize(sizeof(Hero));
int animationId(TypeDescription::GetTypeId("Animation"));
int numberId(TypeDescription::GetTypeId("Number"));
int statsId(TypeDescription::GetTypeId("Stats"));
int stringId(TypeDescription::GetTypeId("String"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Hero"));
+ td.SetSize(sizeof(Hero));
+
td.AddField("name", FieldDescription(((char *)&h.name) - ((char *)&h), stringId, true));
td.AddField("sprite", FieldDescription(((char *)&h.sprite) - ((char *)&h), spriteId, true));
td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), numberId, false));
void Monster::CreateTypeDescription() {
Monster m;
- TypeDescription &td(TypeDescription::CreateOrGet("Monster"));
-
- td.SetSize(sizeof(Monster));
int animationId(TypeDescription::GetTypeId("Animation"));
int numberId(TypeDescription::GetTypeId("Number"));
int statsId(TypeDescription::GetTypeId("Stats"));
int stringId(TypeDescription::GetTypeId("String"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Monster"));
+ td.SetSize(sizeof(Monster));
+
td.AddField("name", FieldDescription(((char *)&m.name) - ((char *)&m), stringId, true));
td.AddField("sprite", FieldDescription(((char *)&m.sprite) - ((char *)&m), spriteId, true));
td.AddField("level", FieldDescription(((char *)&m.level) - ((char *)&m), numberId, false));
void PartyLayout::CreateTypeDescription() {
PartyLayout p;
- TypeDescription &td(TypeDescription::CreateOrGet("PartyLayout"));
-
- td.SetSize(sizeof(PartyLayout));
int vectorId(TypeDescription::GetTypeId("Vector"));
+ TypeDescription &td(TypeDescription::CreateOrGet("PartyLayout"));
+ td.SetSize(sizeof(PartyLayout));
+
td.AddField("positions", FieldDescription(((char *)&p.positions) - ((char *)&p), vectorId, true, true));
}
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 spriteId(TypeDescription::GetTypeId("Sprite"));
int stringId(TypeDescription::GetTypeId("String"));
+ TypeDescription &td(TypeDescription::CreateOrGet("BattleResources"));
+ td.SetSize(sizeof(Resources));
+
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));
void Stats::CreateTypeDescription() {
Stats s;
- TypeDescription &td(TypeDescription::CreateOrGet("Stats"));
-
- td.SetSize(sizeof(Stats));
int numberId(TypeDescription::GetTypeId("Number"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Stats"));
+ td.SetSize(sizeof(Stats));
+
td.AddField("atp", FieldDescription(((char *)&s.attack) - ((char *)&s), numberId, false));
td.AddField("dfp", FieldDescription(((char *)&s.defense) - ((char *)&s), numberId, false));
td.AddField("str", FieldDescription(((char *)&s.strength) - ((char *)&s), numberId, false));
void Ikari::CreateTypeDescription() {
Ikari i;
- TypeDescription &td(TypeDescription::CreateOrGet("Ikari"));
-
- td.SetSize(sizeof(Ikari));
int boolId(TypeDescription::GetTypeId("Boolean"));
int numberId(TypeDescription::GetTypeId("Number")); // FIXME: need small number type
int stringId(TypeDescription::GetTypeId("String"));
int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Ikari"));
+ td.SetSize(sizeof(Ikari));
+
td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
td.AddField("cost", FieldDescription(((char *)&i.cost) - ((char *)&i), numberId, false));
td.AddField("targets", FieldDescription(((char *)&i.targetingMode) - ((char *)&i), targetsId, false));
void Item::CreateTypeDescription() {
Item i;
- TypeDescription &td(TypeDescription::CreateOrGet("Item"));
-
- td.SetSize(sizeof(Item));
int animationId(TypeDescription::GetTypeId("Animation"));
int ikariId(TypeDescription::GetTypeId("Ikari"));
int stringId(TypeDescription::GetTypeId("String"));
int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Item"));
+ td.SetSize(sizeof(Item));
+
td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
td.AddField("menuicon", FieldDescription(((char *)&i.menuIcon) - ((char *)&i), spriteId, true));
// TODO: implement flags/fields (e.g. for usability)
void Spell::CreateTypeDescription() {
Spell s;
- TypeDescription &td(TypeDescription::CreateOrGet("Spell"));
-
- td.SetSize(sizeof(Spell));
// TODO: flags
int numberId(TypeDescription::GetTypeId("Number"));
int stringId(TypeDescription::GetTypeId("String"));
int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Spell"));
+ td.SetSize(sizeof(Spell));
+
td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), stringId, true));
td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), numberId, false));
td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), targetsId, false));
void TargetingMode::CreateTypeDescription() {
TargetingMode t;
- TypeDescription &td(TypeDescription::CreateOrGet("TargetingMode"));
+ TypeDescription &td(TypeDescription::CreateOrGet("TargetingMode"));
td.SetSize(sizeof(TargetingMode));
// TODO: fields
void ComplexAnimation::CreateTypeDescription() {
ComplexAnimation ca;
Animation *a(&ca);
- TypeDescription &td(TypeDescription::CreateOrGet("ComplexAnimation"));
-
- td.SetSize(sizeof(ComplexAnimation));
- td.AddSupertype(TypeDescription::GetTypeId("Animation"), ((char *)a) - ((char *)&ca));
+ int animationId(TypeDescription::GetTypeId("Animation"));
int frameId(TypeDescription::GetTypeId("ComplexAnimationFrame"));
+ TypeDescription &td(TypeDescription::CreateOrGet("ComplexAnimation"));
+ td.SetSize(sizeof(ComplexAnimation));
+ td.AddSupertype(animationId, ((char *)a) - ((char *)&ca));
+
td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), frameId, true, true));
FrameProp fp;
- TypeDescription &ftd(TypeDescription::CreateOrGet("ComplexAnimationFrame"));
-
- ftd.SetSize(sizeof(FrameProp));
int numberId(TypeDescription::GetTypeId("Number"));
int vectorId(TypeDescription::GetTypeId("Vector"));
+ TypeDescription &ftd(TypeDescription::CreateOrGet("ComplexAnimationFrame"));
+ ftd.SetSize(sizeof(FrameProp));
+
ftd.AddField("column", FieldDescription(((char *)&fp.col) - ((char *)&fp), numberId, false));
ftd.AddField("row", FieldDescription(((char *)&fp.row) - ((char *)&fp), numberId, false));
ftd.AddField("disposition", FieldDescription(((char *)&fp.disposition) - ((char *)&fp), vectorId, false));
void Font::CreateTypeDescription() {
Font f;
- TypeDescription &td(TypeDescription::CreateOrGet("Font"));
-
- td.SetSize(sizeof(Font));
int numberId(TypeDescription::GetTypeId("Number"));
int spriteId(TypeDescription::GetTypeId("Sprite"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Font"));
+ td.SetSize(sizeof(Font));
+
td.AddField("sprite", FieldDescription(((char *)&f.sprite) - ((char *)&f), spriteId, true));
td.AddField("columnoffset", FieldDescription(((char *)&f.colOffset) - ((char *)&f), numberId, false));
td.AddField("rowoffset", FieldDescription(((char *)&f.rowOffset) - ((char *)&f), numberId, false));
void Frame::CreateTypeDescription() {
Frame f;
- TypeDescription &td(TypeDescription::CreateOrGet("Frame"));
-
- td.SetSize(sizeof(Frame));
int imageId(TypeDescription::GetTypeId("Image"));
int vectorId(TypeDescription::GetTypeId("Vector"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Frame"));
+ td.SetSize(sizeof(Frame));
+
td.AddField("surface", FieldDescription(((char *)&f.surface) - ((char *)&f), imageId, true));
td.AddField("borderSize", FieldDescription(((char *)&f.borderSize) - ((char *)&f), vectorId, false));
td.AddField("repeatSize", FieldDescription(((char *)&f.repeatSize) - ((char *)&f), vectorId, false));
void Gauge::CreateTypeDescription() {
Gauge g;
- TypeDescription &td(TypeDescription::CreateOrGet("Gauge"));
-
- td.SetSize(sizeof(Gauge));
int imageId(TypeDescription::GetTypeId("Image"));
int numberId(TypeDescription::GetTypeId("Number"));
int vectorId(TypeDescription::GetTypeId("Vector"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Gauge"));
+ td.SetSize(sizeof(Gauge));
+
td.AddField("image", FieldDescription(((char *)&g.surface) - ((char *)&g), imageId, true));
td.AddField("full", FieldDescription(((char *)&g.fullOffset) - ((char *)&g), vectorId, false));
td.AddField("empty", FieldDescription(((char *)&g.emptyOffset) - ((char *)&g), vectorId, false));
void MenuProperties::CreateTypeDescription() {
MenuProperties p;
- TypeDescription &td(TypeDescription::CreateOrGet("MenuProperties"));
-
- td.SetSize(sizeof(MenuProperties));
int fontId(TypeDescription::GetTypeId("Font"));
int numberId(TypeDescription::GetTypeId("Number"));
int spriteId(TypeDescription::GetTypeId("Sprite"));
int stringId(TypeDescription::GetTypeId("String"));
+ TypeDescription &td(TypeDescription::CreateOrGet("MenuProperties"));
+ td.SetSize(sizeof(MenuProperties));
+
td.AddField("font", FieldDescription(((char *)&p.font) - ((char *)&p), fontId, true));
td.AddField("disabledFont", FieldDescription(((char *)&p.disabledFont) - ((char *)&p), fontId, true));
td.AddField("cursor", FieldDescription(((char *)&p.cursor) - ((char *)&p), spriteId, true));
void SimpleAnimation::CreateTypeDescription() {
SimpleAnimation sa;
Animation *a(&sa);
- TypeDescription &td(TypeDescription::CreateOrGet("SimpleAnimation"));
-
- td.SetSize(sizeof(SimpleAnimation));
- td.AddSupertype(TypeDescription::GetTypeId("Animation"), ((char *)a) - ((char *)&sa));
+ int animationId(TypeDescription::GetTypeId("Animation"));
int numberId(TypeDescription::GetTypeId("Number"));
+ TypeDescription &td(TypeDescription::CreateOrGet("SimpleAnimation"));
+ td.SetSize(sizeof(SimpleAnimation));
+ td.AddSupertype(animationId, ((char *)a) - ((char *)&sa));
+
td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), numberId, false));
td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), numberId, false));
td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), numberId, false));
void Sprite::CreateTypeDescription() {
Sprite s;
- TypeDescription &td(TypeDescription::CreateOrGet("Sprite"));
-
- td.SetSize(sizeof(Sprite));
int imageId(TypeDescription::GetTypeId("Image"));
int vectorId(TypeDescription::GetTypeId("Vector"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Sprite"));
+ td.SetSize(sizeof(Sprite));
+
td.AddField("image", FieldDescription(((char *)&s.surface) - ((char *)&s), imageId, true));
td.AddField("size", FieldDescription(((char *)&s.size) - ((char *)&s), vectorId, false));
td.AddField("offset", FieldDescription(((char *)&s.offset) - ((char *)&s), vectorId, false));
td.SetSize(sizeof(int));
}
{
+ int stringId(TypeDescription::GetTypeId("String"));
TypeDescription &td(TypeDescription::CreateOrGet("Path"));
td.SetSize(1);
- td.AddSupertype(TypeDescription::GetTypeId("String"), 0);
+ td.AddSupertype(stringId, 0);
}
{
TypeDescription &td(TypeDescription::CreateOrGet("String"));