X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FMonster.cpp;h=7cb4185f13209bf31cc327051718a3034dd5d004;hb=b02da898c7c8a08141df4e797774a61cf5e0163f;hp=f0b9f3782f0587c1d289d671b669c73c970427b7;hpb=d5959073b2c413ba1bd6f3d14bc8bcf59304e488;p=l2e.git diff --git a/src/battle/Monster.cpp b/src/battle/Monster.cpp index f0b9f37..7cb4185 100644 --- a/src/battle/Monster.cpp +++ b/src/battle/Monster.cpp @@ -7,6 +7,11 @@ #include "Monster.h" +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + namespace battle { Monster::Monster() @@ -46,4 +51,37 @@ void Monster::SubtractHealth(int amount) { } } + +void Monster::CreateTypeDescription() { + Monster m; + + int animationId(TypeDescription::GetTypeId("Animation")); + int numberId(TypeDescription::GetTypeId("Number")); + int spriteId(TypeDescription::GetTypeId("Sprite")); + int statsId(TypeDescription::GetTypeId("Stats")); + int stringId(TypeDescription::GetTypeId("String")); + + TypeDescription &td(TypeDescription::CreateOrGet("Monster")); + td.SetConstructor(&Construct); + 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)); + + td.AddField("maxHealth", FieldDescription(((char *)&m.maxHealth) - ((char *)&m), numberId, false)); + td.AddField("health", FieldDescription(((char *)&m.health) - ((char *)&m), numberId, false)); + td.AddField("maxMana", FieldDescription(((char *)&m.maxMana) - ((char *)&m), numberId, false)); + td.AddField("mana", FieldDescription(((char *)&m.mana) - ((char *)&m), numberId, false)); + td.AddField("stats", FieldDescription(((char *)&m.stats) - ((char *)&m), statsId, false)); + + td.AddField("attackAnimation", FieldDescription(((char *)&m.attackAnimation) - ((char *)&m), animationId, true)); + td.AddField("spellAnimation", FieldDescription(((char *)&m.spellAnimation) - ((char *)&m), animationId, true)); + td.AddField("meleeAnimation", FieldDescription(((char *)&m.meleeAnimation) - ((char *)&m), animationId, true)); +} + +void Monster::Construct(void *data) { + new (data) Monster; +} + }