From 05dffb5744dc3f845e0c874f45229134393c50a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Fri, 9 Dec 2016 18:27:48 +0700 Subject: [PATCH] Using the right type for animation height and type --- Source/Animation/Animation.cpp | 9 ++++---- Source/Animation/Animation.def | 40 +++++++++++++++++----------------- Source/Animation/Animation.h | 6 ++--- Source/GameTick.cpp | 4 ++-- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/Source/Animation/Animation.cpp b/Source/Animation/Animation.cpp index af6c319..f28861c 100644 --- a/Source/Animation/Animation.cpp +++ b/Source/Animation/Animation.cpp @@ -28,8 +28,7 @@ std::vector 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; diff --git a/Source/Animation/Animation.def b/Source/Animation/Animation.def index 2a48c42..a487b28 100644 --- a/Source/Animation/Animation.def +++ b/Source/Animation/Animation.def @@ -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 diff --git a/Source/Animation/Animation.h b/Source/Animation/Animation.h index 4ed5dbe..91bdd4c 100644 --- a/Source/Animation/Animation.h +++ b/Source/Animation/Animation.h @@ -84,8 +84,8 @@ public: static std::vector animations; static void loadAll(); - int height; - int attack; + anim_height_type height; + anim_attack_type attack; int numjoints; std::vector 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 diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 06a59fb..8ec6225 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -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; -- 2.39.5