X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2FObjects%2FObject.cpp;h=081f23de9686df7fea95b21a5c034f41948c0b2c;hp=f0dd169b3b05dd02e01eaa96d6057b329e463187;hb=b9a46d8e2b7e7e22c706e7dd3734f31015db4408;hpb=8b6e8f3ad7390309795eb35c0959264cb7924402 diff --git a/Source/Objects/Object.cpp b/Source/Objects/Object.cpp index f0dd169..081f23d 100644 --- a/Source/Objects/Object.cpp +++ b/Source/Objects/Object.cpp @@ -251,42 +251,58 @@ void Object::handleRot(int divide) { messedwith -= multiplier; if (rotxvel || rotx) { - if (rotx > 0) + if (rotx > 0) { rotxvel -= multiplier * 8 * fabs(rotx); - if (rotx < 0) + } + if (rotx < 0) { rotxvel += multiplier * 8 * fabs(rotx); - if (rotx > 0) + } + if (rotx > 0) { rotxvel -= multiplier * 4; - if (rotx < 0) + } + if (rotx < 0) { rotxvel += multiplier * 4; - if (rotxvel > 0) + } + if (rotxvel > 0) { rotxvel -= multiplier * 4; - if (rotxvel < 0) + } + if (rotxvel < 0) { rotxvel += multiplier * 4; - if (fabs(rotx) < multiplier * 4) + } + if (fabs(rotx) < multiplier * 4) { rotx = 0; - if (fabs(rotxvel) < multiplier * 4) + } + if (fabs(rotxvel) < multiplier * 4) { rotxvel = 0; + } rotx += rotxvel * multiplier * 4; } if (rotyvel || roty) { - if (roty > 0) + if (roty > 0) { rotyvel -= multiplier * 8 * fabs(roty); - if (roty < 0) + } + if (roty < 0) { rotyvel += multiplier * 8 * fabs(roty); - if (roty > 0) + } + if (roty > 0) { rotyvel -= multiplier * 4; - if (roty < 0) + } + if (roty < 0) { rotyvel += multiplier * 4; - if (rotyvel > 0) + } + if (rotyvel > 0) { rotyvel -= multiplier * 4; - if (rotyvel < 0) + } + if (rotyvel < 0) { rotyvel += multiplier * 4; - if (fabs(roty) < multiplier * 4) + } + if (fabs(roty) < multiplier * 4) { roty = 0; - if (fabs(rotyvel) < multiplier * 4) + } + if (fabs(rotyvel) < multiplier * 4) { rotyvel = 0; + } roty += rotyvel * multiplier * 4; } @@ -296,14 +312,18 @@ void Object::handleRot(int divide) if (rotx) { glRotatef(-rotx / divide, 0, 0, 1); } - if (rotx > 10) + if (rotx > 10) { rotx = 10; - if (rotx < -10) + } + if (rotx < -10) { rotx = -10; - if (roty > 10) + } + if (roty > 10) { roty = 10; - if (roty < -10) + } + if (roty < -10) { roty = -10; + } } void Object::draw() @@ -321,22 +341,25 @@ void Object::draw() hidden = !(distsqflat(&viewer, &position) > playerdist + 3 || (type != bushtype && type != treeleavestype)); if (!hidden) { - if (detail == 2 && distance > viewdistance * viewdistance / 4 && environment == desertenvironment) + if (detail == 2 && distance > viewdistance * viewdistance / 4 && environment == desertenvironment) { glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness); - else + } else { glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0); + } distance = (viewdistance * viewdistance - (distance - (viewdistance * viewdistance * fadestart)) * (1 / (1 - fadestart))) / viewdistance / viewdistance; - if (distance > 1) + if (distance > 1) { distance = 1; + } if (distance > 0) { if (occluded < 6) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); - if (!model.color) + if (!model.color) { glEnable(GL_LIGHTING); - else + } else { glDisable(GL_LIGHTING); + } glDepthMask(1); glTranslatef(position.x, position.y, position.z); if (type == bushtype) { @@ -634,8 +657,9 @@ void Object::DoShadows() { XYZ lightloc; lightloc = light.location; - if (!skyboxtexture) + if (!skyboxtexture) { lightloc = 0; + } lightloc.y += 10; Normalise(&lightloc);