X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FObjects%2FPerson.cpp;h=27bd61d804dfaaddb93b5aaa2d43f225058c4cb2;hb=0aab437dc560d2afa982e61cc2547756ad7b0761;hp=073ad0b8737770dca97542883feed494f2724e79;hpb=b9a46d8e2b7e7e22c706e7dd3734f31015db4408;p=lugaru.git diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index 073ad0b..27bd61d 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2003, 2010 - Wolfire Games -Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) +Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file) This file is part of Lugaru. @@ -2177,13 +2177,9 @@ void Person::DoAnimations() } if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) { float gLoc[3]; - float vel[3]; gLoc[0] = coords.x; gLoc[1] = coords.y; gLoc[2] = coords.z; - vel[0] = velocity.x; - vel[1] = velocity.y; - vel[2] = velocity.z; if (id == 0) { OPENAL_3D_SetAttributes(channels[whooshsound], gLoc); @@ -4800,13 +4796,9 @@ void Person::DoStuff() if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) { float gLoc[3]; - float vel[3]; gLoc[0] = coords.x; gLoc[1] = coords.y; gLoc[2] = coords.z; - vel[0] = velocity.x; - vel[1] = velocity.y; - vel[2] = velocity.z; if (id == 0) { OPENAL_3D_SetAttributes(channels[whooshsound], gLoc); @@ -7601,7 +7593,7 @@ void Person::doAI() if (aitype == pathfindtype) { if (finalpathfindpoint == -1) { float closestdistance; - float tempdist; + float tempdist = 0.0f; int closest; XYZ colpoint; closest = -1; @@ -7631,7 +7623,7 @@ void Person::doAI() } if (targetpathfindpoint == -1) { float closestdistance; - float tempdist; + float tempdist = 0.0f; int closest; XYZ colpoint; closest = -1; @@ -8144,7 +8136,6 @@ void Person::doAI() closestdist = distance; closest = k; } - closest = k; } } if (closest != -1) { @@ -8245,7 +8236,6 @@ void Person::doAI() closestdist = distance; closest = k; } - closest = k; } } if (closest != -1) { @@ -8453,8 +8443,8 @@ void Person::doAI() //chase player XYZ rotatetarget = Person::players[0]->coords + Person::players[0]->velocity; XYZ targetpoint = Person::players[0]->coords; - if (distsq(&Person::players[0]->coords, &coords) < - distsq(&rotatetarget, &coords)) { + if (findLength(&velocity) != 0 && + distsq(&Person::players[0]->coords, &coords) < distsq(&rotatetarget, &coords)) { targetpoint += Person::players[0]->velocity * findDistance(&Person::players[0]->coords, &coords) / findLength(&velocity); }