X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FAnimation%2FMuscle.cpp;h=c65bbbdcf389fb45cdf8b4c51ac72fcafbf4f056;hb=8f372db25c010303cc25868b48cb5c0d0a540067;hp=da43de4f02bb5258513ce1bb8f465eadd2d821f1;hpb=8b6e8f3ad7390309795eb35c0959264cb7924402;p=lugaru.git diff --git a/Source/Animation/Muscle.cpp b/Source/Animation/Muscle.cpp index da43de4..c65bbbd 100644 --- a/Source/Animation/Muscle.cpp +++ b/Source/Animation/Muscle.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. @@ -135,27 +135,34 @@ void Muscle::DoConstraint(bool spinny) } // clamp strength - if (strength < 0) + if (strength < 0) { strength = 0; - if (strength > 1) + } + if (strength > 1) { strength = 1; + } length -= (length - relaxlength) * (1 - strength) * multiplier * 10000; length -= (length - targetlength) * strength * multiplier * 10000; - if (strength == 0) + if (strength == 0) { length = relaxlength; + } - if ((relaxlength - length > 0 && relaxlength - oldlength < 0) || (relaxlength - length < 0 && relaxlength - oldlength > 0)) + if ((relaxlength - length > 0 && relaxlength - oldlength < 0) || (relaxlength - length < 0 && relaxlength - oldlength > 0)) { length = relaxlength; + } // clamp length - if (length < minlength) + if (length < minlength) { length = minlength; - if (length > maxlength) + } + if (length > maxlength) { length = maxlength; + } - if (length == relaxlength) + if (length == relaxlength) { return; + } // relax muscle?