]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/SimpleAnimation.cpp
added script assembler
[l2e.git] / src / graphics / SimpleAnimation.cpp
index 4e16b81658ec4a6dee2eec4a0eaeaffd7a7c2e01..7ed79931257a64e39a447ed83501abcd76dc0f04 100644 (file)
@@ -17,16 +17,26 @@ namespace graphics {
 void SimpleAnimation::CreateTypeDescription() {
        SimpleAnimation sa;
        Animation *a(&sa);
-       TypeDescription &td(TypeDescription::CreateOrGet("SimpleAnimation"));
 
+       int animationId(TypeDescription::GetTypeId("Animation"));
+       int boolId(TypeDescription::GetTypeId("Boolean"));
+       int numberId(TypeDescription::GetTypeId("Number"));
+       int spriteId(TypeDescription::GetTypeId("Sprite"));
+
+       TypeDescription &td(TypeDescription::CreateOrGet("SimpleAnimation"));
+       td.SetDescription("An animation that uses a fixed column and increasing row of a sprite based on the frame number.");
+       td.SetConstructor(&Construct);
        td.SetSize(sizeof(SimpleAnimation));
-       td.AddSupertype(TypeDescription::GetTypeId("Animation"), ((char *)a) - ((char *)&sa));
+       td.AddSupertype(animationId, ((char *)a) - ((char *)&sa));
 
-       int numberId(TypeDescription::GetTypeId("Number"));
+       Animation::AddFields(td, sa, ((char *)a) - ((char *)&sa), boolId, numberId, spriteId);
+       td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), numberId).SetDescription("number of frames of a single run"));
+       td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), numberId).SetDescription("the column of the sprite to draw from"));
+       td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), numberId).SetDescription("the row of the sprite of the first frame"));
+}
 
-       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 SimpleAnimation::Construct(void *data) {
+       new (data) SimpleAnimation;
 }
 
 }