]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Animation/Animation.h
Cleaned up Animation by using vectors and classes
[lugaru.git] / Source / Animation / Animation.h
index 3633de9e373d67231d05092e3102a830ae8c0243..4ed5dbefa88926c21a36b38c3be1d43e48ec21d9 100644 (file)
@@ -56,35 +56,44 @@ static const int animation_bits[animation_count] = {
 #undef DECLARE_ANIM
 };
 
+struct AnimationFrameJointInfo
+{
+    XYZ  position;
+    float twist;
+    float twist2;
+    bool onground;
+};
+
+struct AnimationFrame
+{
+    void loadBaseInfo(FILE* tfile);
+    void loadTwist2(FILE* tfile);
+    void loadLabel(FILE* tfile);
+    void loadWeaponTarget(FILE* tfile);
+
+    std::vector<AnimationFrameJointInfo> joints;
+    XYZ forward;
+    int label;
+    XYZ weapontarget;
+    float speed;
+};
+
 class Animation
 {
 public:
     static std::vector<Animation> animations;
     static void loadAll();
 
-    int numframes;
     int height;
     int attack;
-    int joints;
-    int weapontargetnum;
-
-    XYZ**  position;
-    float** twist;
-    float** twist2;
-    float* speed;
-    bool** onground;
-    XYZ* forward;
-    int* label;
-    XYZ* weapontarget;
+    int numjoints;
+
+    std::vector<AnimationFrame> frames;
 
     XYZ offset;
 
     Animation();
     Animation(const std::string& fileName, int aheight, int aattack);
     ~Animation();
-    Animation & operator = (const Animation & ani);
-
-protected:
-    void deallocate();
 };
 #endif