From 6cb245d6d347e0f610b2851d08273087fff9c0d0 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sun, 11 Dec 2016 15:16:14 -0500 Subject: [PATCH] abs() -> fabs() --- Source/GameDraw.cpp | 4 ++-- Source/Objects/Person.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 7c0673d..f1768f3 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -416,7 +416,7 @@ int Game::DrawGLScene(StereoSide side) if (distance >= 1) glDisable(GL_BLEND); if (distance >= .5) { - checkpoint = DoRotation(Person::players[k]->skeleton.joints[abs(Random() % Person::players[k]->skeleton.joints.size())].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords; + checkpoint = DoRotation(Person::players[k]->skeleton.joints[fabs(Random() % Person::players[k]->skeleton.joints.size())].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords; checkpoint.y += 1; int i = -1; if (Person::players[k]->occluded != 0) @@ -481,7 +481,7 @@ int Game::DrawGLScene(StereoSide side) if (distance >= 1) glDisable(GL_BLEND); if (distance >= .5) { - checkpoint = DoRotation(Person::players[k]->skeleton.joints[abs(Random() % Person::players[k]->skeleton.joints.size())].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords; + checkpoint = DoRotation(Person::players[k]->skeleton.joints[fabs(Random() % Person::players[k]->skeleton.joints.size())].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords; checkpoint.y += 1; int i = -1; if (Person::players[k]->occluded != 0) diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index 6af3c02..bc54a0d 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -531,7 +531,7 @@ void Person::CatchFire() XYZ flatfacing, flatvelocity; int howmany; for (int i = 0; i < 10; i++) { - howmany = abs(Random() % (skeleton.joints.size())); + howmany = fabs(Random() % (skeleton.joints.size())); if (skeleton.free) { flatvelocity = skeleton.joints[howmany].velocity; flatfacing = skeleton.joints[howmany].position * scale + coords; @@ -1762,13 +1762,13 @@ void Person::RagDoll(bool checkcollision) change.y = (float)(Random() % 100) / 100; change.z = (float)(Random() % 100) / 100; skeleton.joints[i].velocity += change; - skeleton.joints[abs(Random() % skeleton.joints.size())].velocity -= change; + skeleton.joints[fabs(Random() % skeleton.joints.size())].velocity -= change; change.x = (float)(Random() % 100) / 100; change.y = (float)(Random() % 100) / 100; change.z = (float)(Random() % 100) / 100; skeleton.joints[i].velchange += change; - skeleton.joints[abs(Random() % skeleton.joints.size())].velchange -= change; + skeleton.joints[fabs(Random() % skeleton.joints.size())].velchange -= change; } if (checkcollision) { @@ -4387,7 +4387,7 @@ void Person::DoStuff() } while (flamedelay < 0 && onfire) { flamedelay += .006; - howmany = abs(Random() % (skeleton.joints.size())); + howmany = fabs(Random() % (skeleton.joints.size())); if (skeleton.free) { flatvelocity = skeleton.joints[howmany].velocity * scale / 2; flatfacing = skeleton.joints[howmany].position * scale + coords; @@ -4400,7 +4400,7 @@ void Person::DoStuff() while (flamedelay < 0 && !onfire && tutoriallevel == 1 && id != 0) { flamedelay += .05; - howmany = abs(Random() % (skeleton.joints.size())); + howmany = fabs(Random() % (skeleton.joints.size())); if (skeleton.free) { flatvelocity = skeleton.joints[howmany].velocity * scale / 2; flatfacing = skeleton.joints[howmany].position * scale + coords; -- 2.39.5