From: Côme Chilliet Date: Sun, 11 Dec 2016 17:44:47 +0000 (+0700) Subject: Fixed a lot of GCC warnings X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=5dfd07829a5eecc87d100dd8825a81eafbaa86be;p=lugaru.git Fixed a lot of GCC warnings --- diff --git a/Source/Animation/Animation.cpp b/Source/Animation/Animation.cpp index 27b82ad..89aa9f4 100644 --- a/Source/Animation/Animation.cpp +++ b/Source/Animation/Animation.cpp @@ -86,7 +86,8 @@ Animation::Animation(const std::string& filename, anim_height_type aheight, anim Animation() { FILE *tfile; - int i, j, numframes; + int numframes; + unsigned i; LOGFUNC; @@ -141,9 +142,9 @@ Animation::Animation(const std::string& filename, anim_height_type aheight, anim // 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 < numjoints; j++) { - if (frames.back().joints[j].position.y < 1) { - endoffset += frames.back().joints[j].position; + for (i = 0; i < frames.back().joints.size(); i++) { + if (frames.back().joints[i].position.y < 1) { + endoffset += frames.back().joints[i].position; } } endoffset /= numjoints; diff --git a/Source/Animation/Skeleton.cpp b/Source/Animation/Skeleton.cpp index 3f5e65c..c756598 100644 --- a/Source/Animation/Skeleton.cpp +++ b/Source/Animation/Skeleton.cpp @@ -115,7 +115,8 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) XYZ bounceness; const int numrepeats = 3; float groundlevel = .15; - int i, j, k, m; + int k, m; + unsigned i; XYZ temp; XYZ terrainnormal; int whichhit; @@ -163,7 +164,7 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) float tempmult = multiplier; //multiplier/=numrepeats; - for (j = 0; j < numrepeats; j++) { + for (int j = 0; j < numrepeats; j++) { float r = .05; // right leg constraints? if (!joint(rightknee).locked && !joint(righthip).locked) { @@ -218,7 +219,7 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) joints[i].locked = 0; if (joints[i].delay > 0) { bool freely = true; - for (j = 0; j < joints.size(); j++) { + for (unsigned j = 0; j < joints.size(); j++) { if (joints[j].locked) freely = false; } @@ -420,7 +421,7 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) whichhit = objects.model[k].LineCheckSlidePossible(&start, &end, &temp, &objects.position[k], &objects.yaw[k]); if (whichhit != -1) { joints[jointlabels[whichjointendarray[i]]].position = (end - *coords) / (*scale); - for (j = 0; j < muscles.size(); j++) { + for (unsigned j = 0; j < muscles.size(); j++) { if ((muscles[j].parent1->label == whichjointstartarray[i] && muscles[j].parent2->label == whichjointendarray[i]) || (muscles[j].parent2->label == whichjointstartarray[i] && muscles[j].parent1->label == whichjointendarray[i])) muscles[j].DoConstraint(spinny); } @@ -476,8 +477,7 @@ float Skeleton::DoConstraints(XYZ *coords, float *scale) */ void Skeleton::DoGravity(float *scale) { - static int i; - for (i = 0; i < joints.size(); i++) { + for (unsigned i = 0; i < joints.size(); i++) { if ( ( ((joints[i].label != leftknee) && (joints[i].label != rightknee)) || @@ -487,8 +487,9 @@ void Skeleton::DoGravity(float *scale) ((joints[i].label != leftelbow) && (joints[i].label != rightelbow)) || (forward.y < .3) ) - ) + ) { joints[i].velocity.y += gravity * multiplier / (*scale); + } } } @@ -615,7 +616,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil GLfloat M[16]; FILE *tfile; float lSize; - int i, j, num_joints, num_muscles; + int j, num_joints, num_muscles; LOGFUNC; @@ -632,7 +633,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil model[5].loadnotex(model6filename); model[6].loadnotex(model7filename); - for (i = 0; i < num_models; i++) { + for (int i = 0; i < num_models; i++) { model[i].Rotate(180, 0, 0); model[i].Scale(.04, .04, .04); model[i].CalculateNormals(0); @@ -689,7 +690,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil joints.resize(num_joints); // read info for each joint - for (i = 0; i < num_joints; i++) { + for (int i = 0; i < num_joints; i++) { joints[i].load(tfile, joints); } @@ -700,7 +701,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil muscles.resize(num_muscles); // for each muscle... - for (i = 0; i < num_muscles; i++) { + for (int i = 0; i < num_muscles; i++) { muscles[i].load(tfile, model[0].vertexNum, joints); } @@ -715,22 +716,23 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil // ??? for (j = 0; j < num_muscles; j++) { - for (i = 0; i < muscles[j].vertices.size(); i++) { + for (unsigned i = 0; i < muscles[j].vertices.size(); i++) { for (int k = 0; k < num_models; k++) { - if (muscles[j].vertices[i] < model[k].vertexNum) + if (muscles[j].vertices[i] < model[k].vertexNum) { model[k].owner[muscles[j].vertices[i]] = j; + } } } } // calculate some stuff FindForwards(); - for (i = 0; i < num_muscles; i++) { + for (int i = 0; i < num_muscles; i++) { FindRotationMuscle(i, -1); } // this seems to use opengl purely for matrix calculations for (int k = 0; k < num_models; k++) { - for (i = 0; i < model[k].vertexNum; i++) { + for (int i = 0; i < model[k].vertexNum; i++) { model[k].vertex[i] = model[k].vertex[i] - (muscles[model[k].owner[i]].parent1->position + muscles[model[k].owner[i]].parent2->position) / 2; glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -756,7 +758,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil // skip joints section fseek(tfile, sizeof(num_joints), SEEK_CUR); - for (i = 0; i < num_joints; i++) { + for (int i = 0; i < num_joints; i++) { // skip joint info lSize = sizeof(XYZ) + sizeof(float) @@ -776,7 +778,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil // skip num_muscles fseek(tfile, sizeof(num_muscles), SEEK_CUR); - for (i = 0; i < num_muscles; i++) { + for (int i = 0; i < num_muscles; i++) { // skip muscle info lSize = sizeof(float) + sizeof(float) @@ -797,14 +799,15 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil } for (j = 0; j < num_muscles; j++) { - for (i = 0; i < muscles[j].verticeslow.size(); i++) { - if (muscles[j].verticeslow[i] < modellow.vertexNum) + for (unsigned i = 0; i < muscles[j].verticeslow.size(); i++) { + if (muscles[j].verticeslow[i] < modellow.vertexNum) { modellow.owner[muscles[j].verticeslow[i]] = j; + } } } // use opengl for its matrix math - for (i = 0; i < modellow.vertexNum; i++) { + for (int i = 0; i < modellow.vertexNum; i++) { modellow.vertex[i] = modellow.vertex[i] - (muscles[modellow.owner[i]].parent1->position + muscles[modellow.owner[i]].parent2->position) / 2; glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -830,7 +833,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil // skip num_joints fseek(tfile, sizeof(num_joints), SEEK_CUR); - for (i = 0; i < num_joints; i++) { + for (int i = 0; i < num_joints; i++) { // skip joint info lSize = sizeof(XYZ) + sizeof(float) @@ -850,7 +853,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil // skip num_muscles fseek(tfile, sizeof(num_muscles), SEEK_CUR); - for (i = 0; i < num_muscles; i++) { + for (int i = 0; i < num_muscles; i++) { // skip muscle info lSize = sizeof(float) + sizeof(float) @@ -873,14 +876,15 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil // ??? lSize = sizeof(int); for (j = 0; j < num_muscles; j++) { - for (i = 0; i < muscles[j].verticesclothes.size(); i++) { - if (muscles[j].verticesclothes.size() && muscles[j].verticesclothes[i] < modelclothes.vertexNum) + for (unsigned i = 0; i < muscles[j].verticesclothes.size(); i++) { + if (muscles[j].verticesclothes.size() && muscles[j].verticesclothes[i] < modelclothes.vertexNum) { modelclothes.owner[muscles[j].verticesclothes[i]] = j; + } } } // use opengl for its matrix math - for (i = 0; i < modelclothes.vertexNum; i++) { + for (int i = 0; i < modelclothes.vertexNum; i++) { modelclothes.vertex[i] = modelclothes.vertex[i] - (muscles[modelclothes.owner[i]].parent1->position + muscles[modelclothes.owner[i]].parent2->position) / 2; glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -900,7 +904,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfil } fclose(tfile); - for (i = 0; i < num_joints; i++) { + for (int i = 0; i < num_joints; i++) { for (j = 0; j < num_joints; j++) { if (joints[i].label == j) jointlabels[j] = i; diff --git a/Source/Devtools/ConsoleCmds.cpp b/Source/Devtools/ConsoleCmds.cpp index a65315b..6b30e3f 100644 --- a/Source/Devtools/ConsoleCmds.cpp +++ b/Source/Devtools/ConsoleCmds.cpp @@ -217,7 +217,7 @@ void ch_save(const char *args) objects.position[k].x, objects.position[k].y, objects.position[k].z, objects.scale[k]); fpackf(tfile, "Bi", Hotspot::hotspots.size()); - for (int i = 0; i < Hotspot::hotspots.size(); i++) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { fpackf(tfile, "Bi Bf Bf Bf Bf", Hotspot::hotspots[i].type, Hotspot::hotspots[i].size, Hotspot::hotspots[i].position.x, Hotspot::hotspots[i].position.y, Hotspot::hotspots[i].position.z); int templength = strlen(Hotspot::hotspots[i].text); fpackf(tfile, "Bi", templength); @@ -262,7 +262,8 @@ void ch_save(const char *args) bodyprop = Person::players[j]->proportionbody.x / 1.1; armprop = Person::players[j]->proportionarms.x / 1.1; legprop = Person::players[j]->proportionlegs.x / 1.1; - } else if (Person::players[j]->creature == rabbittype) { + } else { + // rabbittype headprop = Person::players[j]->proportionhead.x / 1.2; bodyprop = Person::players[j]->proportionbody.x / 1.05; armprop = Person::players[j]->proportionarms.x / 1.00; @@ -656,7 +657,7 @@ void ch_play(const char *args) sscanf(args, "%d", &dlg); Dialog::whichdialogue = dlg; - if (Dialog::whichdialogue >= Dialog::dialogs.size()) { + if (Dialog::whichdialogue >= int(Dialog::dialogs.size())) { return; } diff --git a/Source/Environment/Skybox.cpp b/Source/Environment/Skybox.cpp index 47bd28a..97dcd6d 100644 --- a/Source/Environment/Skybox.cpp +++ b/Source/Environment/Skybox.cpp @@ -167,5 +167,4 @@ SkyBox::~SkyBox() right.destroy(); up.destroy(); down.destroy(); -}; - +} diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index fcee8b5..7c0673d 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -305,7 +305,7 @@ int Game::DrawGLScene(StereoSide side) for (unsigned k = 0; k < Person::players.size(); k++) { if (!Person::players[k]->skeleton.free && Person::players[k]->playerdetail && Person::players[k]->howactive < typesleeping) if (frustum.SphereInFrustum(Person::players[k]->coords.x, Person::players[k]->coords.y + Person::players[k]->scale * 3, Person::players[k]->coords.z, Person::players[k]->scale * 7) && Person::players[k]->occluded < 25) - for (int i = 0; i < Person::players[k]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[k]->skeleton.joints.size(); i++) { if (Person::players[k]->skeleton.joints[i].label == leftknee || Person::players[k]->skeleton.joints[i].label == rightknee || Person::players[k]->skeleton.joints[i].label == groin) { point = DoRotation(Person::players[k]->skeleton.joints[i].position, 0, Person::players[k]->yaw, 0) * Person::players[k]->scale + Person::players[k]->coords; size = .4f; @@ -330,7 +330,7 @@ int Game::DrawGLScene(StereoSide side) } if ((Person::players[k]->skeleton.free || Person::players[k]->howactive >= typesleeping) && Person::players[k]->playerdetail) if (frustum.SphereInFrustum(Person::players[k]->coords.x, Person::players[k]->coords.y, Person::players[k]->coords.z, Person::players[k]->scale * 5) && Person::players[k]->occluded < 25) - for (int i = 0; i < Person::players[k]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[k]->skeleton.joints.size(); i++) { if (Person::players[k]->skeleton.joints[i].label == leftknee || Person::players[k]->skeleton.joints[i].label == rightknee || Person::players[k]->skeleton.joints[i].label == groin || Person::players[k]->skeleton.joints[i].label == leftelbow || Person::players[k]->skeleton.joints[i].label == rightelbow || Person::players[k]->skeleton.joints[i].label == neck) { if (Person::players[k]->skeleton.free) point = Person::players[k]->skeleton.joints[i].position * Person::players[k]->scale + Person::players[k]->coords; @@ -891,7 +891,7 @@ int Game::DrawGLScene(StereoSide side) float closestdist = -1; float distance = 0; int closest = Hotspot::current; - for (int i = 0; i < Hotspot::hotspots.size(); i++) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { distance = distsq(&Person::players[0]->coords, &Hotspot::hotspots[i].position); if (closestdist == -1 || distance < closestdist) { if (distsq(&Person::players[0]->coords, &Hotspot::hotspots[i].position) < Hotspot::hotspots[i].size && ((Hotspot::hotspots[i].type <= 10 && Hotspot::hotspots[i].type >= 0) || (Hotspot::hotspots[i].type <= 40 && Hotspot::hotspots[i].type >= 20))) { @@ -983,18 +983,20 @@ int Game::DrawGLScene(StereoSide side) float starty; startx = screenwidth * 1 / 5; - if (Dialog::currentScene().location == 1) + if (Dialog::currentScene().location == 1) { starty = screenheight / 16 + screenheight * 4 / 5; - if (Dialog::currentScene().location == 2) + } else { starty = screenheight * 1 / 5 - screenheight / 16; + } + // FIXME - What is that char[] building for? char tempname[264]; int tempnum = 0; for (int i = 0; i < 264; i++) { tempname[i] = '\0'; } - for (int i = 0; i < Dialog::currentScene().name.size(); i++) { + for (unsigned i = 0; i < Dialog::currentScene().name.size(); i++) { tempname[tempnum] = Dialog::currentScene().name[i]; if (tempname[tempnum] == '#' || tempname[tempnum] == '\0') tempname[tempnum] = '\0'; @@ -1015,7 +1017,7 @@ int Game::DrawGLScene(StereoSide side) } tempnum = 0; - for (int i = 0; i < Dialog::currentScene().text.size() + 1; i++) { + for (unsigned i = 0; i < Dialog::currentScene().text.size() + 1; i++) { tempname[tempnum] = Dialog::currentScene().text[i]; if (Dialog::currentScene().text[i] != '#') tempnum++; diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index d950c2e..fefba87 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -656,7 +656,6 @@ void Game::LoadStuff() { static float temptexdetail; static float viewdistdetail; - static int i, j; float megascale = 1; LOGFUNC; @@ -669,7 +668,6 @@ void Game::LoadStuff() p->skeleton.drawmodel.textureptr.destroy(); } - i = abs(Random() % 4); visibleloading = 0; //don't use loadscreentexture yet loadscreentexture.load("Textures/Fire.jpg", 1); visibleloading = 1; @@ -685,12 +683,13 @@ void Game::LoadStuff() if (detail == 2) { texdetail = 1; - } - if (detail == 1) { + kTextureSize = 1024; + } else if (detail == 1) { texdetail = 2; - } - if (detail == 0) { + kTextureSize = 512; + } else { texdetail = 4; + kTextureSize = 256; } realtexdetail = texdetail; @@ -757,14 +756,6 @@ void Game::LoadStuff() viewer = 0; - - if (detail) - kTextureSize = 1024; - if (detail == 1) - kTextureSize = 512; - if (detail == 0) - kTextureSize = 256; - //Set up distant light light.color[0] = .95; light.color[1] = .95; @@ -828,23 +819,23 @@ void Game::LoadStuff() moveamount.z = 2; // FIXME - Why this uses skeleton.joints.size() and not Animation::numjoints? (are they equal?) // It seems skeleton.joints.size() is 0 at this point, so this is useless. - for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { - for (j = 0; j < Animation::animations[knifesneakattackanim].frames.size(); j++) { + for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { + for (unsigned j = 0; j < Animation::animations[knifesneakattackanim].frames.size(); j++) { Animation::animations[knifesneakattackanim].frames[j].joints[i].position += moveamount; } } LoadingScreen(); - for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { - for (j = 0; j < Animation::animations[knifesneakattackedanim].frames.size(); j++) { + for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { + for (unsigned j = 0; j < Animation::animations[knifesneakattackedanim].frames.size(); j++) { Animation::animations[knifesneakattackedanim].frames[j].joints[i].position += moveamount; } } LoadingScreen(); - for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { Animation::animations[dead1anim].frames[1].joints[i].position = Animation::animations[dead1anim].frames[0].joints[i].position; Animation::animations[dead2anim].frames[1].joints[i].position = Animation::animations[dead2anim].frames[0].joints[i].position; Animation::animations[dead3anim].frames[1].joints[i].position = Animation::animations[dead3anim].frames[0].joints[i].position; @@ -860,20 +851,20 @@ void Game::LoadStuff() Animation::animations[dead3anim].frames[1].speed = 0.001; Animation::animations[dead4anim].frames[1].speed = 0.001; - for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { - for (j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) { + for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { + for (unsigned j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) { Animation::animations[swordsneakattackanim].frames[j].joints[i].position += moveamount; } } LoadingScreen(); - for (j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) { + for (unsigned j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) { Animation::animations[swordsneakattackanim].frames[j].weapontarget += moveamount; } LoadingScreen(); - for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { - for (j = 0; j < Animation::animations[swordsneakattackedanim].frames.size(); j++) { + for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { + for (unsigned j = 0; j < Animation::animations[swordsneakattackedanim].frames.size(); j++) { Animation::animations[swordsneakattackedanim].frames[j].joints[i].position += moveamount; } } diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index ed61f24..aff6c86 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -863,7 +863,7 @@ void Game::Loadlevel(const std::string& name) numhotspots = 0; } Hotspot::hotspots.resize(numhotspots); - for (int i = 0; i < Hotspot::hotspots.size(); i++) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { funpackf(tfile, "Bi Bf Bf Bf Bf", &Hotspot::hotspots[i].type, &Hotspot::hotspots[i].size, &Hotspot::hotspots[i].position.x, &Hotspot::hotspots[i].position.y, &Hotspot::hotspots[i].position.z); funpackf(tfile, "Bi", &templength); if (templength) @@ -1177,7 +1177,7 @@ void doTutorial() emit_sound_at(fireendsound, Person::players[1]->coords); - for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { if (Random() % 2 == 0) { if (!Person::players[1]->skeleton.free) temp2 = (Person::players[1]->coords - Person::players[1]->oldcoords) / multiplier / 2; //velocity/2; @@ -1447,7 +1447,7 @@ void doTutorial() XYZ temp, temp2; emit_sound_at(fireendsound, Person::players[1]->coords); - for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { if (Random() % 2 == 0) { if (!Person::players[1]->skeleton.free) temp2 = (Person::players[1]->coords - Person::players[1]->oldcoords) / multiplier / 2; //velocity/2; @@ -1776,9 +1776,8 @@ void doDevKeys() bodyprop = Person::players[closest]->proportionbody.x / 1.1; armprop = Person::players[closest]->proportionarms.x / 1.1; legprop = Person::players[closest]->proportionlegs.x / 1.1; - } - - if (Person::players[closest]->creature == rabbittype) { + } else { + // rabbittype headprop = Person::players[closest]->proportionhead.x / 1.2; bodyprop = Person::players[closest]->proportionbody.x / 1.05; armprop = Person::players[closest]->proportionarms.x / 1.00; @@ -1853,7 +1852,7 @@ void doDevKeys() XYZ headspurtdirection; //int i = Person::players[closest]->skeleton.jointlabels[head]; Joint& headjoint = Person::players[closest]->joint(head); - for (int k = 0; k < Person::players[closest]->skeleton.joints.size(); k++) { + for (unsigned k = 0; k < Person::players[closest]->skeleton.joints.size(); k++) { if (!Person::players[closest]->skeleton.free) flatvelocity2 = Person::players[closest]->velocity; if (Person::players[closest]->skeleton.free) @@ -1897,7 +1896,7 @@ void doDevKeys() emit_sound_at(splattersound, blah); emit_sound_at(breaksound2, blah); - for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { if (!Person::players[closest]->skeleton.free) flatvelocity2 = Person::players[closest]->velocity; if (Person::players[closest]->skeleton.free) @@ -1914,7 +1913,7 @@ void doDevKeys() Sprite::MakeSprite(cloudsprite, flatfacing2, flatvelocity2 * 0, .6, 0, 0, 1, .5); } - for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { if (!Person::players[closest]->skeleton.free) flatvelocity2 = Person::players[closest]->velocity; if (Person::players[closest]->skeleton.free) @@ -1930,7 +1929,7 @@ void doDevKeys() Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2, 1, 1, 1, .4, 1); } - for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { if (!Person::players[closest]->skeleton.free) flatvelocity2 = Person::players[closest]->velocity; if (Person::players[closest]->skeleton.free) @@ -1946,7 +1945,7 @@ void doDevKeys() Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, .4, 1); } - for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) { if (!Person::players[closest]->skeleton.free) flatvelocity2 = Person::players[closest]->velocity; if (Person::players[closest]->skeleton.free) @@ -1971,7 +1970,7 @@ void doDevKeys() Person::players[j]->skeleton.free = 1; Person::players[j]->skeleton.longdead = 0; Person::players[j]->RagDoll(0); - for (int i = 0; i < Person::players[j]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[j]->skeleton.joints.size(); i++) { temppos = Person::players[j]->skeleton.joints[i].position + Person::players[j]->coords; if (distsq(&temppos, &Person::players[closest]->coords) < 25) { flatvelocity2 = temppos - Person::players[closest]->coords; @@ -2093,9 +2092,8 @@ void doDevKeys() bodyprop = Person::players[0]->proportionbody.x / 1.1; armprop = Person::players[0]->proportionarms.x / 1.1; legprop = Person::players[0]->proportionlegs.x / 1.1; - } - - if (Person::players[0]->creature == rabbittype) { + } else { + // rabbittype headprop = Person::players[0]->proportionhead.x / 1.2; bodyprop = Person::players[0]->proportionbody.x / 1.05; armprop = Person::players[0]->proportionarms.x / 1.00; @@ -3428,10 +3426,10 @@ void doPlayerCollisions() } Person::players[k]->DoDamage(findLengthfast(&rotatetarget) / 4); - for (int j = 0; j < Person::players[i]->skeleton.joints.size(); j++) { + for (unsigned j = 0; j < Person::players[i]->skeleton.joints.size(); j++) { Person::players[i]->skeleton.joints[j].velocity = Person::players[i]->skeleton.joints[j].velocity / 5 + Person::players[k]->velocity; } - for (int j = 0; j < Person::players[k]->skeleton.joints.size(); j++) { + for (unsigned j = 0; j < Person::players[k]->skeleton.joints.size(); j++) { Person::players[k]->skeleton.joints[j].velocity = Person::players[k]->skeleton.joints[j].velocity / 5 + Person::players[i]->velocity; } @@ -3536,16 +3534,17 @@ void doAI(unsigned i) XYZ colpoint; closest = -1; closestdistance = -1; - for (int j = 0; j < numpathpoints; j++) + for (int j = 0; j < numpathpoints; j++) { if (closest == -1 || distsq(&Person::players[i]->finalfinaltarget, &pathpoint[j]) < closestdistance) { closestdistance = distsq(&Person::players[i]->finalfinaltarget, &pathpoint[j]); closest = j; Person::players[i]->finaltarget = pathpoint[j]; } + } Person::players[i]->finalpathfindpoint = closest; - for (int j = 0; j < numpathpoints; j++) + for (int j = 0; j < numpathpoints; j++) { for (int k = 0; k < numpathpointconnect[j]; k++) { - DistancePointLine(&Person::players[i]->finalfinaltarget, &pathpoint[j], &pathpoint[pathpointconnect[j][k]], &tempdist, &colpoint ); + DistancePointLine(&Person::players[i]->finalfinaltarget, &pathpoint[j], &pathpoint[pathpointconnect[j][k]], &tempdist, &colpoint); if (sq(tempdist) < closestdistance) if (findDistance(&colpoint, &pathpoint[j]) + findDistance(&colpoint, &pathpoint[pathpointconnect[j][k]]) < findDistance(&pathpoint[j], &pathpoint[pathpointconnect[j][k]]) + .1) { @@ -3554,6 +3553,7 @@ void doAI(unsigned i) Person::players[i]->finaltarget = colpoint; } } + } Person::players[i]->finalpathfindpoint = closest; } @@ -4679,7 +4679,7 @@ void Game::Tick() talkdelay -= multiplier; if (talkdelay <= 0 && !Dialog::inDialog() && Animation::animations[Person::players[0]->animTarget].height != highheight) { - for (int i = 0; i < Dialog::dialogs.size(); i++) { + for (unsigned i = 0; i < Dialog::dialogs.size(); i++) { Dialog::dialogs[i].tick(i); } } @@ -4692,11 +4692,13 @@ void Game::Tick() static float hotspotvisual[40]; if (Hotspot::hotspots.size()) { XYZ hotspotsprite; - if (editorenabled) - for (int i = 0; i < Hotspot::hotspots.size(); i++) + if (editorenabled) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { hotspotvisual[i] -= multiplier / 320; + } + } - for (int i = 0; i < Hotspot::hotspots.size(); i++) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { while (hotspotvisual[i] < 0) { hotspotsprite = 0; hotspotsprite.x = float(abs(Random() % 100000)) / 100000 * Hotspot::hotspots[i].size; @@ -4708,7 +4710,7 @@ void Game::Tick() } } - for (int i = 0; i < Hotspot::hotspots.size(); i++) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { if (Hotspot::hotspots[i].type <= 10 && Hotspot::hotspots[i].type > 0) { Hotspot::hotspots[i].position = Person::players[Hotspot::hotspots[i].type]->coords; } @@ -4866,7 +4868,7 @@ void Game::Tick() Dialog::currentScene().camerayaw = yaw; Dialog::currentScene().camerapitch = pitch; Dialog::indialogue++; - if (Dialog::indialogue < Dialog::currentDialog().scenes.size()) { + if (Dialog::indialogue < int(Dialog::currentDialog().scenes.size())) { if (Dialog::currentScene().sound != 0) { playdialoguescenesound(); } @@ -4900,7 +4902,7 @@ void Game::Tick() if (Input::isKeyDown(SDL_SCANCODE_KP_0)) whichend = 0; Dialog::currentScene().participantfacing[whichend] = facing; } - if (Dialog::indialogue >= Dialog::currentDialog().scenes.size()) { + if (Dialog::indialogue >= int(Dialog::currentDialog().scenes.size())) { Dialog::indialogue = -1; Dialog::directing = false; cameramode = 0; @@ -4915,7 +4917,7 @@ void Game::Tick() if (Dialog::dialoguetime > 0.5) { if (Input::isKeyPressed(attackkey)) { Dialog::indialogue++; - if (Dialog::indialogue < Dialog::currentDialog().scenes.size()) { + if (Dialog::indialogue < int(Dialog::currentDialog().scenes.size())) { if (Dialog::currentScene().sound != 0) { playdialoguescenesound(); if (Dialog::currentScene().sound == -5) { @@ -4934,7 +4936,7 @@ void Game::Tick() } } } - if (Dialog::indialogue >= Dialog::currentDialog().scenes.size()) { + if (Dialog::indialogue >= int(Dialog::currentDialog().scenes.size())) { Dialog::indialogue = -1; Dialog::directing = false; cameramode = 0; @@ -5310,7 +5312,7 @@ void Game::Tick() Person::players[i]->victim->skeleton.free = 1; Person::players[i]->victim->skeleton.broken = 0; - for (int l = 0; l < Person::players[i]->victim->skeleton.joints.size(); l++) { + for (unsigned l = 0; l < Person::players[i]->victim->skeleton.joints.size(); l++) { Person::players[i]->victim->skeleton.joints[l].velchange = 0; Person::players[i]->victim->skeleton.joints[l].locked = 0; } @@ -5937,7 +5939,7 @@ void Game::Tick() if (distsq(&temp, &Person::players[1]->coords) >= distsq(&temp, &temp2) - 1 || distsq(&temp3, &Person::players[1]->coords) < 4) { emit_sound_at(fireendsound, Person::players[1]->coords); - for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { if (Random() % 2 == 0) { if (!Person::players[1]->skeleton.free) temp2 = (Person::players[1]->coords - Person::players[1]->oldcoords) / multiplier / 2; //velocity/2; @@ -5952,7 +5954,7 @@ void Game::Tick() } Person::players[1]->coords = (oldtemp + oldtemp2) / 2; - for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) { Person::players[1]->skeleton.joints[i].velocity = 0; if (Random() % 2 == 0) { if (!Person::players[1]->skeleton.free) @@ -6155,7 +6157,7 @@ void Game::TickOnceAfter() } Hotspot::killhotspot = 2; - for (int i = 0; i < Hotspot::hotspots.size(); i++) { + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { if (Hotspot::hotspots[i].type > 10 && Hotspot::hotspots[i].type < 20) { if (Person::players[Hotspot::hotspots[i].type - 10]->dead == 0) Hotspot::killhotspot = 0; @@ -6168,17 +6170,23 @@ void Game::TickOnceAfter() winhotspot = false; - for (int i = 0; i < Hotspot::hotspots.size(); i++) - if (Hotspot::hotspots[i].type == -1) - if (distsq(&Person::players[0]->coords, &Hotspot::hotspots[i].position) < Hotspot::hotspots[i].size) + for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) { + if (Hotspot::hotspots[i].type == -1) { + if (distsq(&Person::players[0]->coords, &Hotspot::hotspots[i].position) < Hotspot::hotspots[i].size) { winhotspot = true; + } + } + } int numalarmed = 0; - for (unsigned i = 1; i < Person::players.size(); i++) - if (!Person::players[i]->dead && Person::players[i]->aitype == attacktypecutoff && Person::players[i]->surprised <= 0) + for (unsigned i = 1; i < Person::players.size(); i++) { + if (!Person::players[i]->dead && Person::players[i]->aitype == attacktypecutoff && Person::players[i]->surprised <= 0) { numalarmed++; - if (numalarmed > maxalarmed) + } + } + if (numalarmed > maxalarmed) { maxalarmed = numalarmed; + } if (changedelay <= 0 && !loading && !editorenabled && gameon && !tutoriallevel && changedelay != -999 && !won) { if (Person::players[0]->dead && changedelay <= 0) { @@ -6356,7 +6364,7 @@ void Game::TickOnceAfter() target = Person::players[0]->oldcoords + Person::players[0]->currentoffset * (1 - Person::players[0]->target) * Person::players[0]->scale + Person::players[0]->targetoffset * Person::players[0]->target * Person::players[0]->scale - Person::players[0]->facing * .05; target.y += .1; if (Person::players[0]->skeleton.free) { - for (int i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) { if (Person::players[0]->skeleton.joints[i].position.y * Person::players[0]->scale + Person::players[0]->coords.y > target.y) target.y = Person::players[0]->skeleton.joints[i].position.y * Person::players[0]->scale + Person::players[0]->coords.y; } diff --git a/Source/Graphic/Models.cpp b/Source/Graphic/Models.cpp index 649bcde..4f1d91c 100644 --- a/Source/Graphic/Models.cpp +++ b/Source/Graphic/Models.cpp @@ -1447,7 +1447,7 @@ void Model::deallocate() free(decalposition); decalposition = 0; -}; +} Model::Model() { diff --git a/Source/Level/Dialog.cpp b/Source/Level/Dialog.cpp index a60b115..680e584 100644 --- a/Source/Level/Dialog.cpp +++ b/Source/Level/Dialog.cpp @@ -80,10 +80,11 @@ std::string funpackf_string(FILE* tfile, int maxlength) void fpackf_string(FILE* tfile, std::string text) { fpackf(tfile, "Bi", text.size()); - for (int m = 0; m < text.size(); m++) { - fpackf(tfile, "Bb", text[m]); - if (text[m] == '\0') + for (unsigned i = 0; i < text.size(); i++) { + fpackf(tfile, "Bb", text[i]); + if (text[i] == '\0') { break; + } } } @@ -170,7 +171,7 @@ void Dialog::tick(int id) void Dialog::play() { - for (int i = 0; i < scenes.size(); i++) { + for (unsigned i = 0; i < scenes.size(); i++) { int playerId = scenes[i].participantfocus; Person::players[playerId]->coords = participantlocation[playerId]; Person::players[playerId]->yaw = participantyaw[playerId]; @@ -192,8 +193,8 @@ void Dialog::saveDialogs(FILE* tfile) { fpackf(tfile, "Bi", dialogs.size()); - for (int k = 0; k < dialogs.size(); k++) { - dialogs[k].save(tfile); + for (unsigned i = 0; i < dialogs.size(); i++) { + dialogs[i].save(tfile); } } @@ -205,7 +206,7 @@ void Dialog::save(FILE* tfile) fpackf(tfile, "Bf Bf Bf", participantlocation[l].x, participantlocation[l].y, participantlocation[l].z); fpackf(tfile, "Bf", participantyaw[l]); } - for (int l = 0; l < scenes.size(); l++) { + for (unsigned l = 0; l < scenes.size(); l++) { scenes[l].save(tfile); } } diff --git a/Source/Objects/Objects.cpp b/Source/Objects/Objects.cpp index 9064ff8..4b97666 100644 --- a/Source/Objects/Objects.cpp +++ b/Source/Objects/Objects.cpp @@ -838,5 +838,4 @@ Objects::~Objects() treetextureptr.destroy(); bushtextureptr.destroy(); rocktextureptr.destroy(); -}; - +} diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index 8181e81..6af3c02 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -483,7 +483,7 @@ void Person::CheckKick() if (tutoriallevel != 1) emit_sound_at(heavyimpactsound, victim->coords); victim->RagDoll(0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * 120 * damagemult; } victim->Puff(neck); @@ -1532,7 +1532,7 @@ void Person::DoDamage(float howmuch) if (howmuch > damagetolerance * 50 && skeleton.free != 2) { XYZ flatvelocity2; XYZ flatfacing2; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { if (skeleton.free) { flatvelocity2 = skeleton.joints[i].velocity; flatfacing2 = skeleton.joints[i].position * scale + coords; @@ -1675,7 +1675,7 @@ void Person::DoHead() skeleton.specialforward[0] = facing; //skeleton.specialforward[0]=DoRotation(facing,0,yaw,0); - for (int i = 0; i < skeleton.muscles.size(); i++) { + for (unsigned i = 0; i < skeleton.muscles.size(); i++) { if (skeleton.muscles[i].visible && (skeleton.muscles[i].parent1->label == head || skeleton.muscles[i].parent2->label == head)) { skeleton.FindRotationMuscle(i, animTarget); } @@ -1689,7 +1689,7 @@ void Person::DoHead() void Person::RagDoll(bool checkcollision) { static XYZ change; - static int l, i, j; + static int l, i; static float speed; if (!skeleton.free) { if (id == 0) @@ -1721,7 +1721,7 @@ void Person::RagDoll(bool checkcollision) if (!isnormal(tilt)) tilt = 0; if (!isnormal(tilt2)) tilt2 = 0; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { skeleton.joints[i].delay = 0; skeleton.joints[i].locked = 0; skeleton.joints[i].position = DoRotation(DoRotation(DoRotation(skeleton.joints[i].position, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0); @@ -1732,7 +1732,7 @@ void Person::RagDoll(bool checkcollision) skeleton.joints[i].realoldposition = skeleton.joints[i].position * scale + coords; } - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { skeleton.joints[i].velocity = 0; skeleton.joints[i].velchange = 0; } @@ -1753,7 +1753,7 @@ void Person::RagDoll(bool checkcollision) speed *= speedmult; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { if ((Animation::animations[animCurrent].attack != reversed || animCurrent == swordslashreversedanim) && animCurrent != rabbitkickanim && !isLanding() && !wasLanding() && Animation::animations[animCurrent].height == Animation::animations[animTarget].height) skeleton.joints[i].velocity = velocity / scale + facing * 5 + DoRotation(DoRotation(DoRotation((targetFrame().joints[i].position - currentFrame().joints[i].position) * speed, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0); else @@ -1778,13 +1778,13 @@ void Person::RagDoll(bool checkcollision) int howmany; average = 0; howmany = 0; - for (j = 0; j < skeleton.joints.size(); j++) { + for (unsigned j = 0; j < skeleton.joints.size(); j++) { average += skeleton.joints[j].position; howmany++; } average /= howmany; coords += average * scale; - for (j = 0; j < skeleton.joints.size(); j++) { + for (unsigned j = 0; j < skeleton.joints.size(); j++) { skeleton.joints[j].position -= average; } @@ -1806,7 +1806,7 @@ void Person::RagDoll(bool checkcollision) updatedelay = 0; velocity = 0; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { velocity += skeleton.joints[i].velocity * scale; } velocity /= skeleton.joints.size(); @@ -2035,7 +2035,7 @@ void Person::DoAnimations() //Footstep sounds if (tutoriallevel != 1 || id == 0) if ((targetFrame().label && (targetFrame().label < 5 || targetFrame().label == 8))) { - int whichsound; + int whichsound = -1; if (onterrain) { if (terrain.getOpacity(coords.x, coords.z) < .2) { if (targetFrame().label == 1) @@ -2075,27 +2075,33 @@ void Person::DoAnimations() if (r == 2) whichsound = highwhooshsound; } - if (Animation::animations[animTarget].attack == neutral) + if (Animation::animations[animTarget].attack == neutral) { whichsound = movewhooshsound; - } else if (targetFrame().label == 4) + } + } else if (targetFrame().label == 4) { whichsound = knifeswishsound; - if (targetFrame().label == 8 && tutoriallevel != 1) + } + if (targetFrame().label == 8 && tutoriallevel != 1) { whichsound = landsound2; + } - emit_sound_at(whichsound, coords, 256.); + if (whichsound != -1) { + emit_sound_at(whichsound, coords, 256.); - if (id == 0) - if (whichsound == footstepsound || whichsound == footstepsound2 || whichsound == footstepsound3 || whichsound == footstepsound4) { - if (animTarget == wolfrunninganim || animTarget == rabbitrunninganim) { - addEnvSound(coords, 15); - } else { - addEnvSound(coords, 6); + if (id == 0) { + if (whichsound == footstepsound || whichsound == footstepsound2 || whichsound == footstepsound3 || whichsound == footstepsound4) { + if (animTarget == wolfrunninganim || animTarget == rabbitrunninganim) { + addEnvSound(coords, 15); + } else { + addEnvSound(coords, 6); + } } } - if (targetFrame().label == 3) { - whichsound--; - emit_sound_at(whichsound, coords, 128.); + if (targetFrame().label == 3) { + whichsound--; + emit_sound_at(whichsound, coords, 128.); + } } } @@ -2194,7 +2200,7 @@ void Person::DoAnimations() victim->skeleton.free = 1; victim->skeleton.broken = 0; - for (int j = 0; j < victim->skeleton.joints.size(); j++) { + for (unsigned j = 0; j < victim->skeleton.joints.size(); j++) { victim->skeleton.joints[j].velchange = 0; victim->skeleton.joints[j].locked = 0; } @@ -2356,7 +2362,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative = DoRotation(relative, 0, -90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(head) += relative * damagemult * 200; @@ -2391,7 +2397,7 @@ void Person::DoAnimations() relative.y -= 1; Normalise(&relative); relative = DoRotation(relative, 0, 90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 20; } victim->jointVel(head) += relative * damagemult * 100; @@ -2421,7 +2427,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative = DoRotation(relative, 0, -90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(head) += relative * damagemult * 200; @@ -2456,7 +2462,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative = DoRotation(relative, 0, 90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(head) += relative * damagemult * 200; @@ -2485,7 +2491,7 @@ void Person::DoAnimations() relative = victim->coords - coords; relative.y = 0; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 30; } victim->jointVel(head) += relative * damagemult * 100; @@ -2506,7 +2512,7 @@ void Person::DoAnimations() victim->skeleton.broken = 0; victim->skeleton.spinny = 1; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velchange = 0; victim->skeleton.joints[i].delay = 0; victim->skeleton.joints[i].locked = 0; @@ -2517,7 +2523,7 @@ void Person::DoAnimations() relative = 0; relative.y = 1; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity.y = relative.y * 10; victim->skeleton.joints[i].position.y += relative.y * .3; victim->skeleton.joints[i].oldposition.y += relative.y * .3; @@ -2540,7 +2546,7 @@ void Person::DoAnimations() relative = victim->coords - coords; relative.y = 0; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 90; } victim->Puff(abdomen); @@ -2567,7 +2573,7 @@ void Person::DoAnimations() victim->skeleton.broken = 0; victim->skeleton.spinny = 1; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velchange = 0; //victim->skeleton.joints[i].delay=0; victim->skeleton.joints[i].locked = 0; @@ -2577,7 +2583,7 @@ void Person::DoAnimations() Normalise(&relative); relative.y += .3; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 20; } if (!victim->dead) @@ -2663,7 +2669,7 @@ void Person::DoAnimations() victim->skeleton.free = 1; victim->skeleton.broken = 0; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velchange = 0; victim->skeleton.joints[i].locked = 0; //victim->skeleton.joints[i].velocity=0; @@ -2753,7 +2759,7 @@ void Person::DoAnimations() victim->skeleton.free = 1; victim->skeleton.broken = 0; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velchange = 0; victim->skeleton.joints[i].locked = 0; //victim->skeleton.joints[i].velocity=0; @@ -2800,7 +2806,7 @@ void Person::DoAnimations() relative = victim->coords - coords; relative.y = 0; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = relative * 30; } victim->jointVel(head) += relative * damagemult * 150; @@ -2847,7 +2853,7 @@ void Person::DoAnimations() Normalise(&relative); relative.y = .3; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = relative * 5; } victim->jointVel(abdomen) += relative * damagemult * 400; @@ -3074,7 +3080,7 @@ void Person::DoAnimations() relative = DoRotation(relative, 0, 90, 0); relative.y -= 1; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 60; } victim->jointVel(head) += relative * damagemult * 230; @@ -3106,7 +3112,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative = DoRotation(relative, 0, -90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(head) += relative * damagemult * 220; @@ -3137,7 +3143,7 @@ void Person::DoAnimations() victim->skeleton.free = 1; victim->skeleton.broken = 0; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velchange = 0; victim->skeleton.joints[i].locked = 0; //victim->skeleton.joints[i].velocity=0; @@ -3149,13 +3155,13 @@ void Person::DoAnimations() relative.y = -1; Normalise(&relative); if (!victim->dead) { - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = relative * damagemult * 40; } victim->jointVel(abdomen) += relative * damagemult * 40; } if (victim->dead) { - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = relative * damagemult * abs(Random() % 20); } } @@ -3188,7 +3194,7 @@ void Person::DoAnimations() DoBlood(.2, 250); } victim->RagDoll(0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(head) += relative * damagemult * 200; @@ -3207,7 +3213,7 @@ void Person::DoAnimations() } else { if (victim->damage >= victim->damagetolerance) victim->RagDoll(0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 10; } victim->jointVel(abdomen) += relative * damagemult * 200; @@ -3248,12 +3254,12 @@ void Person::DoAnimations() if (Animation::animations[victim->animTarget].height == middleheight || Animation::animations[victim->animCurrent].height == middleheight || victim->damage >= victim->damagetolerance - 40) { victim->RagDoll(0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 15; } relative = DoRotation(relative, 0, -90, 0); relative.y += .1; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { if (victim->skeleton.joints[i].label == leftfoot || victim->skeleton.joints[i].label == rightfoot || victim->skeleton.joints[i].label == leftankle || victim->skeleton.joints[i].label == rightankle) victim->skeleton.joints[i].velocity = relative * 80; } @@ -3263,11 +3269,11 @@ void Person::DoAnimations() } else { if (victim->damage >= victim->damagetolerance) victim->RagDoll(0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 10; } relative = DoRotation(relative, 0, -90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { if (victim->skeleton.joints[i].label == leftfoot || victim->skeleton.joints[i].label == rightfoot || victim->skeleton.joints[i].label == leftankle || victim->skeleton.joints[i].label == rightankle) victim->skeleton.joints[i].velocity += relative * damagemult * 80; } @@ -3310,7 +3316,7 @@ void Person::DoAnimations() relative = victim->coords - oldcoords; relative.y = 0; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(abdomen) += relative * damagemult * 200; @@ -3347,7 +3353,7 @@ void Person::DoAnimations() relative = victim->coords - oldcoords; relative.y = 0; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 30; } victim->jointVel(abdomen) += relative * damagemult * 200; @@ -3376,7 +3382,7 @@ void Person::DoAnimations() relative = victim->coords - oldcoords; relative.y = 0; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 30; } victim->jointVel(abdomen) += relative * damagemult * 200; @@ -3392,7 +3398,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative.y -= .1; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 70; } victim->jointVel(lefthand) *= .1; @@ -3442,7 +3448,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative.y -= .1; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 70; } victim->jointVel(lefthand) *= .1 - 1; @@ -3474,7 +3480,7 @@ void Person::DoAnimations() relative.y = 0; Normalise(&relative); relative = DoRotation(relative, 0, -90, 0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->jointVel(abdomen) += relative * damagemult * 200; @@ -3494,7 +3500,7 @@ void Person::DoAnimations() Normalise(&relative); if (victim->id == 0) relative /= 30; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 40; } victim->damage = victim->damagetolerance; @@ -3569,12 +3575,12 @@ void Person::DoAnimations() if (hasvictim && (animTarget == knifefollowanim || animTarget == knifesneakattackanim) && Animation::animations[animTarget].frames[frameCurrent].label == 6) { escapednum = 0; victim->velocity = 0; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = 0; } if (animTarget == knifefollowanim) { victim->RagDoll(0); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = 0; } } @@ -3627,7 +3633,7 @@ void Person::DoAnimations() if (hasvictim && animTarget == swordsneakattackanim && Animation::animations[animTarget].frames[frameCurrent].label == 6) { escapednum = 0; victim->velocity = 0; - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity = 0; } if (weaponactive != -1) { @@ -3695,7 +3701,7 @@ void Person::DoAnimations() relative = DoRotation(relative, 0, 90, 0); relative.y = .5; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 20; } victim->jointVel(head) += relative * damagemult * 200; @@ -3715,7 +3721,7 @@ void Person::DoAnimations() relative = DoRotation(relative, 0, 90, 0); relative.y = .5; Normalise(&relative); - for (int i = 0; i < victim->skeleton.joints.size(); i++) { + for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) { victim->skeleton.joints[i].velocity += relative * damagemult * 20; } victim->jointVel(head) += relative * damagemult * 200; @@ -3729,7 +3735,7 @@ void Person::DoAnimations() //Animation end - if (frameTarget > Animation::animations[animCurrent].frames.size() - 1) { + if (frameTarget > int(Animation::animations[animCurrent].frames.size()) - 1) { frameTarget = 0; if (wasStop()) { animTarget = getIdle(); @@ -4182,23 +4188,23 @@ void Person::DoAnimations() oldrot = 0; targetrot = 0; } - if (frameCurrent >= Animation::animations[animCurrent].frames.size()) { + if (frameCurrent >= int(Animation::animations[animCurrent].frames.size())) { frameCurrent = Animation::animations[animCurrent].frames.size() - 1; } if (animCurrent != oldanimCurrent || animTarget != oldanimTarget || ((frameCurrent != oldframeCurrent || frameTarget != oldframeTarget) && !calcrot)) { //Old rotates - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { skeleton.joints[i].position = currentFrame().joints[i].position; } skeleton.FindForwards(); - for (int i = 0; i < skeleton.muscles.size(); i++) { + for (unsigned i = 0; i < skeleton.muscles.size(); i++) { if (skeleton.muscles[i].visible) { skeleton.FindRotationMuscle(i, animTarget); } } - for (int i = 0; i < skeleton.muscles.size(); i++) { + for (unsigned i = 0; i < skeleton.muscles.size(); i++) { if (skeleton.muscles[i].visible) { if (isnormal((float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100)) skeleton.muscles[i].oldrotate1 = (float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100; @@ -4210,18 +4216,18 @@ void Person::DoAnimations() } //New rotates - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { skeleton.joints[i].position = targetFrame().joints[i].position; } skeleton.FindForwards(); - for (int i = 0; i < skeleton.muscles.size(); i++) { + for (unsigned i = 0; i < skeleton.muscles.size(); i++) { if (skeleton.muscles[i].visible) { skeleton.FindRotationMuscle(i, animTarget); } } - for (int i = 0; i < skeleton.muscles.size(); i++) { + for (unsigned i = 0; i < skeleton.muscles.size(); i++) { if (skeleton.muscles[i].visible) { if (isnormal((float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100)) skeleton.muscles[i].newrotate1 = (float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100; @@ -4244,12 +4250,12 @@ void Person::DoAnimations() oldframeTarget = frameTarget; oldframeCurrent = frameCurrent; - for (int i = 0; i < skeleton.joints.size(); i++) { + 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); } offset = currentoffset * (1 - target) + targetoffset * target; - for (int i = 0; i < skeleton.muscles.size(); i++) { + 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); @@ -4280,7 +4286,7 @@ void Person::DoStuff() static XYZ flatfacing; static XYZ flatvelocity; static float flatvelspeed; - static int i, j, l; + static int i, l; static XYZ average; static int howmany; static int bloodsize; @@ -4486,7 +4492,7 @@ void Person::DoStuff() } dead = 2; if (animTarget == knifefollowedanim && !skeleton.free) { - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { skeleton.joints[i].velocity = 0; skeleton.joints[i].velocity.y = -2; } @@ -4533,7 +4539,7 @@ void Person::DoStuff() endy = starty; for (i = startx; i < endx; i++) { - for (j = starty; j < endy; j++) { + for (int j = starty; j < endy; j++) { if (Random() % 2 == 0) { color = Random() % 85 + 170; if (skeleton.skinText[i * skeleton.skinsize * 3 + j * 3 + 0] > color / 2) @@ -4829,7 +4835,7 @@ void Person::DoStuff() } if (bloodtoggle && !bled) for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) { - j = terrain.patchobjects[whichpatchx][whichpatchz][l]; + int j = terrain.patchobjects[whichpatchx][whichpatchz][l]; XYZ point = DoRotation(headpoint - objects.position[j], 0, -objects.yaw[j], 0); float size = .8; float opacity = .6; @@ -4924,7 +4930,7 @@ void Person::DoStuff() dead = 0; skeleton.free = 1; damage -= 20; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { skeleton.joints[i].velocity = 0; } } @@ -4998,19 +5004,19 @@ void Person::DoStuff() average = 0; howmany = 0; - for (j = 0; j < skeleton.joints.size(); j++) { + for (unsigned j = 0; j < skeleton.joints.size(); j++) { average += skeleton.joints[j].position; howmany++; } average /= howmany; coords += average * scale; - for (j = 0; j < skeleton.joints.size(); j++) { + for (unsigned j = 0; j < skeleton.joints.size(); j++) { skeleton.joints[j].position -= average; } average /= multiplier; velocity = 0; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { velocity += skeleton.joints[i].velocity * scale; } velocity /= skeleton.joints.size(); @@ -5038,7 +5044,7 @@ void Person::DoStuff() } if (bloodtoggle && !bled) for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) { - j = terrain.patchobjects[whichpatchx][whichpatchz][l]; + int j = terrain.patchobjects[whichpatchx][whichpatchz][l]; XYZ point = DoRotation(headpoint - objects.position[j], 0, -objects.yaw[j], 0); float size = .2 * 1.2; float opacity = .6; @@ -5057,7 +5063,7 @@ void Person::DoStuff() } if (bloodtoggle && !bled) for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) { - j = terrain.patchobjects[whichpatchx][whichpatchz][l]; + int j = terrain.patchobjects[whichpatchx][whichpatchz][l]; XYZ point = DoRotation(headpoint - objects.position[j], 0, -objects.yaw[j], 0); float size = .8; float opacity = .6; @@ -5124,7 +5130,7 @@ void Person::DoStuff() frameCurrent = 0; target = 0; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { tempanimation.frames[0].joints[i].position = skeleton.joints[i].position; tempanimation.frames[0].joints[i].position = DoRotation(tempanimation.frames[0].joints[i].position, 0, -yaw, 0); } @@ -5215,7 +5221,7 @@ void Person::DoStuff() if (middle.y > 0 && animTarget != rollanim) targetoffset.y = middle.y + 1; - for (int i = 0; i < skeleton.joints.size(); i++) { + for (unsigned i = 0; i < skeleton.joints.size(); i++) { tempanimation.frames[0].joints[i].position = skeleton.joints[i].position; tempanimation.frames[0].joints[i].position = DoRotation(tempanimation.frames[0].joints[i].position, 0, -yaw, 0); } @@ -5317,7 +5323,7 @@ void Person::DoStuff() howmany = findLength(&velocity) * 2; if (detail == 2) if (environment != desertenvironment) - for (j = 0; j < howmany; j++) { + for (int j = 0; j < howmany; j++) { tempvel.x = float(abs(Random() % 100) - 50) / 20; tempvel.y = float(abs(Random() % 100) - 50) / 20; tempvel.z = float(abs(Random() % 100) - 50) / 20; @@ -5332,7 +5338,7 @@ void Person::DoStuff() howmany = findLength(&velocity) * 4; if (detail == 2) if (environment == snowyenvironment) - for (j = 0; j < howmany; j++) { + for (int j = 0; j < howmany; j++) { tempvel.x = float(abs(Random() % 100) - 50) / 20; tempvel.y = float(abs(Random() % 100) - 50) / 20; tempvel.z = float(abs(Random() % 100) - 50) / 20; @@ -5377,7 +5383,7 @@ void Person::DoStuff() howmany = findLength(&velocity) * 2; if (detail == 2) if (environment != desertenvironment) - for (j = 0; j < howmany; j++) { + for (int j = 0; j < howmany; j++) { tempvel.x = float(abs(Random() % 100) - 50) / 20; tempvel.y = float(abs(Random() % 100) - 50) / 20; tempvel.z = float(abs(Random() % 100) - 50) / 20; @@ -5393,7 +5399,7 @@ void Person::DoStuff() howmany = findLength(&velocity) * 4; if (detail == 2) if (environment == snowyenvironment) - for (j = 0; j < howmany; j++) { + for (int j = 0; j < howmany; j++) { tempvel.x = float(abs(Random() % 100) - 50) / 20; tempvel.y = float(abs(Random() % 100) - 50) / 20; tempvel.z = float(abs(Random() % 100) - 50) / 20; @@ -6050,7 +6056,7 @@ int Person::DrawSkeleton() } static XYZ mid; static float M[16]; - static int i, j, k; + static int i, k; static int weaponattachmuscle; static int weaponrotatemuscle; static XYZ weaponpoint; @@ -6102,7 +6108,7 @@ int Person::DrawSkeleton() skeleton.drawmodelclothes.vertex[i] = 0; skeleton.drawmodelclothes.vertex[i].y = 999; } - for (int i = 0; i < skeleton.muscles.size(); i++) { + for (unsigned i = 0; i < skeleton.muscles.size(); i++) { // convenience renames const int p1 = skeleton.muscles[i].parent1->label; const int p2 = skeleton.muscles[i].parent2->label; @@ -6161,7 +6167,7 @@ int Person::DrawSkeleton() glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0); if (playerdetail || skeleton.free == 3) { - for (j = 0; j < skeleton.muscles[i].vertices.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles[i].vertices.size(); j++) { XYZ &v0 = skeleton.model[start].vertex[skeleton.muscles[i].vertices[j]]; XYZ &v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]]; glMatrixMode(GL_MODELVIEW); @@ -6190,7 +6196,7 @@ int Person::DrawSkeleton() } } if (!playerdetail || skeleton.free == 3) { - for (j = 0; j < skeleton.muscles[i].verticeslow.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles[i].verticeslow.size(); j++) { XYZ &v0 = skeleton.modellow.vertex[skeleton.muscles[i].verticeslow[j]]; glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -6240,7 +6246,7 @@ int Person::DrawSkeleton() skeleton.muscles[i].lastrotate3 = skeleton.muscles[i].rotate3; glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0); - for (j = 0; j < skeleton.muscles[i].verticesclothes.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles[i].verticesclothes.size(); j++) { XYZ &v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]]; glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -6447,12 +6453,12 @@ int Person::DrawSkeleton() i = weaponids[k]; if (weaponactive == k) { if (weapons[i].getType() != staff) { - for (j = 0; j < skeleton.muscles.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles.size(); j++) { if ((skeleton.muscles[j].parent1->label == righthand || skeleton.muscles[j].parent2->label == righthand) && skeleton.muscles[j].vertices.size() > 0) { weaponattachmuscle = j; } } - for (j = 0; j < skeleton.muscles.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles.size(); j++) { if ((skeleton.muscles[j].parent1->label == rightwrist || skeleton.muscles[j].parent2->label == rightwrist) && (skeleton.muscles[j].parent1->label != righthand && skeleton.muscles[j].parent2->label != righthand) && skeleton.muscles[j].vertices.size() > 0) { weaponrotatemuscle = j; } @@ -6462,12 +6468,12 @@ int Person::DrawSkeleton() weaponpoint = (jointPos(rightwrist) * .7 + jointPos(righthand) * .3); } if (weapons[i].getType() == staff) { - for (j = 0; j < skeleton.muscles.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles.size(); j++) { if ((skeleton.muscles[j].parent1->label == righthand || skeleton.muscles[j].parent2->label == righthand) && skeleton.muscles[j].vertices.size() > 0) { weaponattachmuscle = j; } } - for (j = 0; j < skeleton.muscles.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles.size(); j++) { if ((skeleton.muscles[j].parent1->label == rightelbow || skeleton.muscles[j].parent2->label == rightelbow) && (skeleton.muscles[j].parent1->label != rightshoulder && skeleton.muscles[j].parent2->label != rightshoulder) && skeleton.muscles[j].vertices.size() > 0) { weaponrotatemuscle = j; } @@ -6491,7 +6497,7 @@ int Person::DrawSkeleton() weaponpoint = jointPos(abdomen) + (jointPos(lefthip) - jointPos(righthip)) * .09 + (jointPos(leftshoulder) - jointPos(rightshoulder)) * .33; if (weapons[i].getType() == staff) weaponpoint = jointPos(abdomen) + (jointPos(lefthip) - jointPos(righthip)) * .09 + (jointPos(leftshoulder) - jointPos(rightshoulder)) * .33; - for (j = 0; j < skeleton.muscles.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles.size(); j++) { if ((skeleton.muscles[j].parent1->label == abdomen || skeleton.muscles[j].parent2->label == abdomen) && (skeleton.muscles[j].parent1->label == neck || skeleton.muscles[j].parent2->label == neck) && skeleton.muscles[j].vertices.size() > 0) { weaponrotatemuscle = j; } @@ -6502,7 +6508,7 @@ int Person::DrawSkeleton() weaponpoint = jointPos(abdomen) * .5 + jointPos(neck) * .5 - skeleton.forward * .8; else weaponpoint = jointPos(abdomen) * .5 + jointPos(neck) * .5 + skeleton.forward * .8; - for (j = 0; j < skeleton.muscles.size(); j++) { + for (unsigned j = 0; j < skeleton.muscles.size(); j++) { if ((skeleton.muscles[j].parent1->label == abdomen || skeleton.muscles[j].parent2->label == abdomen) && (skeleton.muscles[j].parent1->label == neck || skeleton.muscles[j].parent2->label == neck) && skeleton.muscles[j].vertices.size() > 0) { weaponrotatemuscle = j; }