X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSkeleton.cpp;h=af343d6b3261b3a405f876f877e665a7a6813c85;hb=d9af94bbebdd8ab2b276a0a66492c9d97677d4f4;hp=562ec8ed5e71d05a97e2dfa9f0422d96707d7a3e;hpb=6c36b920245ca8b1e3d9aaede5f9d2a6210538a1;p=lugaru.git diff --git a/Source/Skeleton.cpp b/Source/Skeleton.cpp index 562ec8e..af343d6 100644 --- a/Source/Skeleton.cpp +++ b/Source/Skeleton.cpp @@ -1,5 +1,6 @@ /* Copyright (C) 2003, 2010 - Wolfire Games +Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) This file is part of Lugaru. @@ -25,17 +26,12 @@ along with Lugaru. If not, see . extern float multiplier; extern float gravity; -extern Skeleton testskeleton; extern Terrain terrain; extern Objects objects; extern int environment; extern float camerashake; extern bool freeze; extern int detail; -extern XYZ envsound[30]; -extern float envsoundvol[30]; -extern int numenvsounds; -extern float envsoundlife[30]; extern int tutoriallevel; extern int whichjointstartarray[26]; @@ -350,10 +346,7 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) emit_sound_at(breaksound2, joints[i].position * (*scale) + *coords); - envsound[numenvsounds] = *coords; - envsoundvol[numenvsounds] = 64; - envsoundlife[numenvsounds] = .4; - numenvsounds++; + addEnvSound(*coords, 64); } if (findLengthfast(&bounceness) > 2500) { @@ -438,10 +431,7 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) emit_sound_at(breaksound2, joints[i].position * (*scale) + *coords); - envsound[numenvsounds] = *coords; - envsoundvol[numenvsounds] = 64; - envsoundlife[numenvsounds] = .4; - numenvsounds++; + addEnvSound(*coords, 64); } if (objects.type[k] == treetrunktype) { objects.rotx[k] += joints[i].velocity.x * multiplier * .4; @@ -682,7 +672,7 @@ void Animation::Load(const char *filename, int aheight, int aattack) { FILE *tfile; int i, j; - XYZ startoffset, endoffset; + XYZ endoffset; // path to dir const char *anim_prefix = ":Data:Animations:"; @@ -781,18 +771,14 @@ void Animation::Load(const char *filename, int aheight, int aattack) fclose(tfile); } - startoffset = 0; endoffset = 0; - // find average position of certain joints on first and last frames - // and save in startoffset, endoffset + // 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 < joints; j++) { - if (position[j][0].y < 1) - startoffset += position[j][0]; if (position[j][numframes - 1].y < 1) endoffset += position[j][numframes - 1]; } - startoffset /= joints; endoffset /= joints; offset = endoffset; offset.y = 0;