]> git.jsancho.org Git - lugaru.git/commitdiff
Using the right type for animation height and type
authorCôme Chilliet <come@chilliet.eu>
Fri, 9 Dec 2016 11:27:48 +0000 (18:27 +0700)
committerCôme Chilliet <come@chilliet.eu>
Fri, 9 Dec 2016 11:27:48 +0000 (18:27 +0700)
Source/Animation/Animation.cpp
Source/Animation/Animation.def
Source/Animation/Animation.h
Source/GameTick.cpp

index af6c31955293c23826739819478f8f8832b26d92..f28861ca9452892ef1c29b6ade5157aeb179acd6 100644 (file)
@@ -28,8 +28,7 @@ std::vector<Animation> Animation::animations;
 
 void Animation::loadAll()
 {
-    int i = 0;
-#define DECLARE_ANIM(id, file, height, attack, ...) if (i++ < loadable_anim_end) animations.emplace_back(file, height, attack);
+#define DECLARE_ANIM(id, file, height, attack, ...) if (id < loadable_anim_end) animations.emplace_back(file, height, attack);
 #include "Animation.def"
 #undef DECLARE_ANIM
 }
@@ -73,8 +72,8 @@ void AnimationFrame::loadWeaponTarget(FILE* tfile)
 }
 
 Animation::Animation():
-    height(0),
-    attack(0),
+    height(lowheight),
+    attack(neutral),
     numjoints(0)
 {
 }
@@ -82,7 +81,7 @@ Animation::Animation():
 /* EFFECT
  * load an animation from file
  */
-Animation::Animation(const std::string& filename, int aheight, int aattack):
+Animation::Animation(const std::string& filename, anim_height_type aheight, anim_attack_type aattack):
     Animation()
 {
     FILE *tfile;
index 2a48c427601bdda6e9b92211363aa42f3570dd94..a487b28d8a710172c7f6cb440a8d9152df8404f1 100644 (file)
@@ -141,27 +141,27 @@ DECLARE_ANIM(dead2anim, "Dead2", lowheight, neutral, ab_sleep)
 DECLARE_ANIM(dead3anim, "Dead3", lowheight, neutral, ab_sleep)
 DECLARE_ANIM(dead4anim, "Dead4", lowheight, neutral, ab_sleep)
 
-DECLARE_ANIM(tempanim, "", 0, 0, 0)
+DECLARE_ANIM(tempanim, "", lowheight, neutral, 0)
 
-DECLARE_ANIM(loadable_anim_end, "", 0, 0, 0)
+DECLARE_ANIM(loadable_anim_end, "", lowheight, neutral, 0)
 
 /* Not implemented.  */
-DECLARE_ANIM(rabbittacklereversal, "", 0, 0, 0)
-DECLARE_ANIM(rabbittacklereversed, "", 0, 0, 0)
-DECLARE_ANIM(sworddisarmanim, "", 0, 0, 0)
-DECLARE_ANIM(swordslashleftanim, "", 0, 0, 0)
-DECLARE_ANIM(swordslashrightanim, "", 0, 0, 0)
-DECLARE_ANIM(swordstabanim, "", 0, 0, 0)
-DECLARE_ANIM(wolfbashanim, "", 0, 0, 0)
-DECLARE_ANIM(wolfclawanim, "", 0, 0, 0)
-DECLARE_ANIM(wolffightidle, "", 0, 0, 0)
-DECLARE_ANIM(wolfhurtidle, "", 0, 0, 0)
-DECLARE_ANIM(wolfsneakanim, "", 0, 0, 0)
-DECLARE_ANIM(wolfswordidle, "", 0, 0, 0)
-DECLARE_ANIM(wolftackleanim, "", 0, 0, 0)
-DECLARE_ANIM(wolftackledbacanim, "", 0, 0, 0)
-DECLARE_ANIM(wolftackledfrontanim, "", 0, 0, 0)
-DECLARE_ANIM(wolftacklereversal, "", 0, 0, 0)
-DECLARE_ANIM(wolftacklereversed, "", 0, 0, 0)
-DECLARE_ANIM(wolftacklinganim, "", 0, 0, 0)
+DECLARE_ANIM(rabbittacklereversal, "", lowheight, neutral, 0)
+DECLARE_ANIM(rabbittacklereversed, "", lowheight, neutral, 0)
+DECLARE_ANIM(sworddisarmanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(swordslashleftanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(swordslashrightanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(swordstabanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolfbashanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolfclawanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolffightidle, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolfhurtidle, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolfsneakanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolfswordidle, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolftackleanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolftackledbacanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolftackledfrontanim, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolftacklereversal, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolftacklereversed, "", lowheight, neutral, 0)
+DECLARE_ANIM(wolftacklinganim, "", lowheight, neutral, 0)
 #endif
index 4ed5dbefa88926c21a36b38c3be1d43e48ec21d9..91bdd4ce80bdb6fa75b9124d064f696bc1cb6b8d 100644 (file)
@@ -84,8 +84,8 @@ public:
     static std::vector<Animation> animations;
     static void loadAll();
 
-    int height;
-    int attack;
+    anim_height_type height;
+    anim_attack_type attack;
     int numjoints;
 
     std::vector<AnimationFrame> frames;
@@ -93,7 +93,7 @@ public:
     XYZ offset;
 
     Animation();
-    Animation(const std::string& fileName, int aheight, int aattack);
+    Animation(const std::string& fileName, anim_height_type aheight, anim_attack_type aattack);
     ~Animation();
 };
 #endif
index 06a59fb96a52a3bd2a6f6a4b96124b59412c2e0d..8ec62250fe9f871e7716958c9e8436b84d4b75bf 100644 (file)
@@ -1159,7 +1159,7 @@ void Game::Loadlevel(const std::string& name)
             Person::players[i]->proportionlegs.z = 0;
         }
 
-        Person::players[i]->tempanimation = Animation("Tempanim", 0, 0);
+        Person::players[i]->tempanimation = Animation("Tempanim", lowheight, neutral);
 
         if (i == 0) {
             Person::players[i]->headmorphness = 0;
@@ -2238,7 +2238,7 @@ void doDebugKeys()
                     Person::players.back()->proportionlegs.z = 0;
                 }
 
-                Person::players.back()->tempanimation = Animation("Tempanim", 0, 0);
+                Person::players.back()->tempanimation = Animation("Tempanim", lowheight, neutral);
 
                 Person::players.back()->damagetolerance = 200;