X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FAnimation%2FAnimation.cpp;h=89aa9f4da02f6a671b878c935f71e6eb239b85aa;hb=6cb245d6d347e0f610b2851d08273087fff9c0d0;hp=af6c31955293c23826739819478f8f8832b26d92;hpb=9bd0be2befdf81aa4b5d377eaf29656935044faf;p=lugaru.git diff --git a/Source/Animation/Animation.cpp b/Source/Animation/Animation.cpp index af6c319..89aa9f4 100644 --- a/Source/Animation/Animation.cpp +++ b/Source/Animation/Animation.cpp @@ -17,10 +17,11 @@ You should have received a copy of the GNU General Public License along with Lugaru. If not, see . */ -#include "Animation/Skeleton.h" -#include "Animation/Animation.h" -#include "Utils/Folders.h" -#include "Game.h" +#include "Animation/Animation.hpp" + +#include "Animation/Skeleton.hpp" +#include "Game.hpp" +#include "Utils/Folders.hpp" extern bool visibleloading; @@ -28,8 +29,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 +73,8 @@ void AnimationFrame::loadWeaponTarget(FILE* tfile) } Animation::Animation(): - height(0), - attack(0), + height(lowheight), + attack(neutral), numjoints(0) { } @@ -82,11 +82,12 @@ 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; - int i, j, numframes; + int numframes; + unsigned i; LOGFUNC; @@ -141,16 +142,12 @@ Animation::Animation(const std::string& filename, int aheight, int aattack): // find average position of certain joints on last frames // and save in endoffset // (not sure what exactly this accomplishes. the y < 1 test confuses me.) - for (j = 0; j < numjoints; j++) { - if (frames.back().joints[j].position.y < 1) { - endoffset += frames.back().joints[j].position; + for (i = 0; i < frames.back().joints.size(); i++) { + if (frames.back().joints[i].position.y < 1) { + endoffset += frames.back().joints[i].position; } } endoffset /= numjoints; offset = endoffset; offset.y = 0; } - -Animation::~Animation() -{ -}