From d3f16728298e0639a3b2e916386f4e8cea4018ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Tue, 10 Jan 2017 00:48:44 +0100 Subject: [PATCH] Fixed a few parentheses --- Source/Animation/Muscle.cpp | 2 +- Source/Environment/Terrain.cpp | 18 +++++++++--------- Source/GameDraw.cpp | 2 +- Source/Objects/Person.cpp | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/Animation/Muscle.cpp b/Source/Animation/Muscle.cpp index da8c64c..6ccad18 100644 --- a/Source/Animation/Muscle.cpp +++ b/Source/Animation/Muscle.cpp @@ -133,7 +133,7 @@ void Muscle::DoConstraint(bool spinny) strength = 1; length -= (length - relaxlength) * (1 - strength) * multiplier * 10000; - length -= (length - targetlength) * (strength) * multiplier * 10000; + length -= (length - targetlength) * strength * multiplier * 10000; if (strength == 0) length = relaxlength; diff --git a/Source/Environment/Terrain.cpp b/Source/Environment/Terrain.cpp index 4e4971f..6d195e2 100644 --- a/Source/Environment/Terrain.cpp +++ b/Source/Environment/Terrain.cpp @@ -635,7 +635,7 @@ bool Terrain::load(const std::string& fileName) Game::LoadingScreen(); patch_size = size / subdivision; - patch_elements = (patch_size) * (patch_size) * 54; + patch_elements = patch_size * patch_size * 54; CalculateNormals(); return true; @@ -932,17 +932,17 @@ void Terrain::draw(int layer) viewdistsquared = viewdistance * viewdistance; //Only nearby blocks - beginx = (viewer.x - viewdistance) / (patch_size) - 1; + beginx = ((viewer.x - viewdistance) / patch_size) - 1; if (beginx < 0) beginx = 0; - beginz = (viewer.z - viewdistance) / (patch_size) - 1; + beginz = ((viewer.z - viewdistance) / patch_size) - 1; if (beginz < 0) beginz = 0; - endx = (viewer.x + viewdistance) / (patch_size) + 1; + endx = ((viewer.x + viewdistance) / patch_size) + 1; if (endx > subdivision) endx = subdivision; - endz = (viewer.z + viewdistance) / (patch_size) + 1; + endz = ((viewer.z + viewdistance) / patch_size) + 1; if (endz > subdivision) endz = subdivision; @@ -1255,13 +1255,13 @@ void Terrain::DoShadows() //Calculate shadows for (short int i = 0; i < size; i++) { for (short int j = 0; j < size; j++) { - terrainpoint.x = (float)(i) * scale; - terrainpoint.z = (float)(j) * scale; + terrainpoint.x = (float)i * scale; + terrainpoint.z = (float)j * scale; terrainpoint.y = heightmap[i][j] * scale; shadowed = 0; - patchx = (float)(i) * subdivision / size; - patchz = (float)(j) * subdivision / size; + patchx = (float)i * subdivision / size; + patchz = (float)j * subdivision / size; if (patchobjects[patchx][patchz].size()) { for (unsigned int k = 0; k < patchobjects[patchx][patchz].size(); k++) { unsigned int l = patchobjects[patchx][patchz][k]; diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index c569a76..7ec4b65 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -1554,7 +1554,7 @@ int Game::DrawGLScene(StereoSide side) offset = consoleselected - 60; textmono->glPrint(10, 30, " ]", 0, 1, 1024, 768); if (consoleblink) { - textmono->glPrint(30 + (float)(consoleselected) * 10 - offset * 10, 30, "_", 0, 1, 1024, 768); + textmono->glPrint(30 + (float)consoleselected * 10 - offset * 10, 30, "_", 0, 1, 1024, 768); } for (unsigned i = 0; i < 15; i++) { textmono->glPrint(30 - offset * 10, 30 + i * 20, consoletext[i], 0, 1, 1024, 768); diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index ba26f80..a6f2bc1 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -4255,15 +4255,15 @@ void Person::DoAnimations() oldframeCurrent = frameCurrent; for (unsigned i = 0; i < skeleton.joints.size(); i++) { - skeleton.joints[i].velocity = (currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * (target) - skeleton.joints[i].position) / multiplier; - skeleton.joints[i].position = currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * (target); + skeleton.joints[i].velocity = (currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * target - skeleton.joints[i].position) / multiplier; + skeleton.joints[i].position = currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * target; } offset = currentoffset * (1 - target) + targetoffset * target; for (unsigned i = 0; i < skeleton.muscles.size(); i++) { if (skeleton.muscles[i].visible) { - skeleton.muscles[i].rotate1 = skeleton.muscles[i].oldrotate1 * (1 - target) + skeleton.muscles[i].newrotate1 * (target); - skeleton.muscles[i].rotate2 = skeleton.muscles[i].oldrotate2 * (1 - target) + skeleton.muscles[i].newrotate2 * (target); - skeleton.muscles[i].rotate3 = skeleton.muscles[i].oldrotate3 * (1 - target) + skeleton.muscles[i].newrotate3 * (target); + skeleton.muscles[i].rotate1 = skeleton.muscles[i].oldrotate1 * (1 - target) + skeleton.muscles[i].newrotate1 * target; + skeleton.muscles[i].rotate2 = skeleton.muscles[i].oldrotate2 * (1 - target) + skeleton.muscles[i].newrotate2 * target; + skeleton.muscles[i].rotate3 = skeleton.muscles[i].oldrotate3 * (1 - target) + skeleton.muscles[i].newrotate3 * target; } } } -- 2.39.5