diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 291e5fbb9..677241768 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -2105,13 +2105,16 @@ void Game::update() { float angle=rotation+180; -#ifdef USE_STREFLOP - c.z=c.z+4*streflop::cosf(static_cast(degToRad(angle))); - c.x=c.x+4*streflop::sinf(static_cast(degToRad(angle))); -#else - c.z=c.z+4*cosf(degToRad(angle)); - c.x=c.x+4*sinf(degToRad(angle)); -#endif +//#ifdef USE_STREFLOP +// c.z=c.z+4*streflop::cosf(static_cast(degToRad(angle))); +// c.x=c.x+4*streflop::sinf(static_cast(degToRad(angle))); +//#else +// c.z=c.z+4*cosf(degToRad(angle)); +// c.x=c.x+4*sinf(degToRad(angle)); +//#endif + c.z=c.z+4*std::cos(degToRad(angle)); + c.x=c.x+4*std::sin(degToRad(angle)); + c.y=c.y+currentCameraFollowUnit->getType()->getHeight()/2.f+2.0f; getGameCameraPtr()->setPos(c); diff --git a/source/glest_game/game/game_camera.cpp b/source/glest_game/game/game_camera.cpp index 13cb6efc4..fe6481161 100644 --- a/source/glest_game/game/game_camera.cpp +++ b/source/glest_game/game/game_camera.cpp @@ -145,11 +145,12 @@ void GameCamera::update(){ //free state if(state==sFree ){ -#ifdef USE_STREFLOP - if(streflop::fabs(static_cast(rotate)) == 1){ -#else - if(fabs(rotate) == 1){ -#endif +//#ifdef USE_STREFLOP +// if(streflop::fabs(static_cast(rotate)) == 1){ +//#else +// if(fabs(rotate) == 1){ +//#endif + if(std::fabs(rotate) == 1){ rotateHV(speed*5*rotate, 0); } if(move.y>0){ @@ -226,15 +227,18 @@ Quad2i GameCamera::computeVisibleQuad() { float farDist = 90.f * (pos.y > nearDist ? pos.y / 15.f : 1.f); const float viewDegree = 180.f; -#ifdef USE_STREFLOP - Vec2f v(streflop::sinf(static_cast(degToRad(viewDegree - hAng))), streflop::cosf(static_cast(degToRad(viewDegree - hAng)))); - Vec2f v1(streflop::sinf(static_cast(degToRad(viewDegree - hAng - fov))), streflop::cosf(static_cast(degToRad(viewDegree - hAng - fov)))); - Vec2f v2(streflop::sinf(static_cast(degToRad(viewDegree - hAng + fov))), streflop::cosf(static_cast(degToRad(viewDegree - hAng + fov)))); -#else - Vec2f v(sinf(degToRad(viewDegree - hAng)), cosf(degToRad(viewDegree - hAng))); - Vec2f v1(sinf(degToRad(viewDegree - hAng - fov)), cosf(degToRad(viewDegree - hAng - fov))); - Vec2f v2(sinf(degToRad(viewDegree - hAng + fov)), cosf(degToRad(viewDegree - hAng + fov))); -#endif +//#ifdef USE_STREFLOP +// Vec2f v(streflop::sinf(static_cast(degToRad(viewDegree - hAng))), streflop::cosf(static_cast(degToRad(viewDegree - hAng)))); +// Vec2f v1(streflop::sinf(static_cast(degToRad(viewDegree - hAng - fov))), streflop::cosf(static_cast(degToRad(viewDegree - hAng - fov)))); +// Vec2f v2(streflop::sinf(static_cast(degToRad(viewDegree - hAng + fov))), streflop::cosf(static_cast(degToRad(viewDegree - hAng + fov)))); +//#else +// Vec2f v(sinf(degToRad(viewDegree - hAng)), cosf(degToRad(viewDegree - hAng))); +// Vec2f v1(sinf(degToRad(viewDegree - hAng - fov)), cosf(degToRad(viewDegree - hAng - fov))); +// Vec2f v2(sinf(degToRad(viewDegree - hAng + fov)), cosf(degToRad(viewDegree - hAng + fov))); +//#endif + Vec2f v(std::sin(degToRad(viewDegree - hAng)), std::cos(degToRad(viewDegree - hAng))); + Vec2f v1(std::sin(degToRad(viewDegree - hAng - fov)), std::cos(degToRad(viewDegree - hAng - fov))); + Vec2f v2(std::sin(degToRad(viewDegree - hAng + fov)), std::cos(degToRad(viewDegree - hAng + fov))); v.normalize(false); v1.normalize(false); @@ -341,13 +345,15 @@ void GameCamera::rotateToVH(float v, float h) { } void GameCamera::zoom(float dist) { -#ifdef USE_STREFLOP - float flatDist = dist * streflop::cosf(static_cast(degToRad(vAng))); - Vec3f offset(flatDist * streflop::sinf(static_cast(degToRad(hAng))), dist * streflop::sinf(static_cast(degToRad(vAng))), flatDist * -streflop::cosf(static_cast(degToRad(hAng)))); -#else - float flatDist = dist * cosf(degToRad(vAng)); - Vec3f offset(flatDist * sinf(degToRad(hAng)), dist * sinf(degToRad(vAng)), flatDist * -cosf(degToRad(hAng))); -#endif +//#ifdef USE_STREFLOP +// float flatDist = dist * streflop::cosf(static_cast(degToRad(vAng))); +// Vec3f offset(flatDist * streflop::sinf(static_cast(degToRad(hAng))), dist * streflop::sinf(static_cast(degToRad(vAng))), flatDist * -streflop::cosf(static_cast(degToRad(hAng)))); +//#else +// float flatDist = dist * cosf(degToRad(vAng)); +// Vec3f offset(flatDist * sinf(degToRad(hAng)), dist * sinf(degToRad(vAng)), flatDist * -cosf(degToRad(hAng))); +//#endif + float flatDist = dist * std::cos(degToRad(vAng)); + Vec3f offset(flatDist * std::sin(degToRad(hAng)), dist * std::sin(degToRad(vAng)), flatDist * -std::cos(degToRad(hAng))); destPos += offset; } @@ -421,11 +427,12 @@ void GameCamera::clampAng() { //move camera forwad but never change heightFactor void GameCamera::moveForwardH(float d, float response) { -#ifdef USE_STREFLOP - Vec3f offset(streflop::sinf(static_cast(degToRad(hAng))) * d, 0.f, -streflop::cosf(static_cast(degToRad(hAng))) * d); -#else - Vec3f offset(sinf(degToRad(hAng)) * d, 0.f, -cosf(degToRad(hAng)) * d); -#endif +//#ifdef USE_STREFLOP +// Vec3f offset(streflop::sinf(static_cast(degToRad(hAng))) * d, 0.f, -streflop::cosf(static_cast(degToRad(hAng))) * d); +//#else +// Vec3f offset(sinf(degToRad(hAng)) * d, 0.f, -cosf(degToRad(hAng)) * d); +//#endif + Vec3f offset(std::sin(degToRad(hAng)) * d, 0.f, -std::cos(degToRad(hAng)) * d); destPos += offset; pos.x += offset.x * response; pos.z += offset.z * response; @@ -433,11 +440,12 @@ void GameCamera::moveForwardH(float d, float response) { //move camera to a side but never change heightFactor void GameCamera::moveSideH(float d, float response){ -#ifdef USE_STREFLOP - Vec3f offset(streflop::sinf(static_cast(degToRad(hAng+90))) * d, 0.f, -streflop::cosf(static_cast(degToRad(hAng+90))) * d); -#else - Vec3f offset(sinf(degToRad(hAng+90)) * d, 0.f, -cosf(degToRad(hAng+90)) * d); -#endif +//#ifdef USE_STREFLOP +// Vec3f offset(streflop::sinf(static_cast(degToRad(hAng+90))) * d, 0.f, -streflop::cosf(static_cast(degToRad(hAng+90))) * d); +//#else +// Vec3f offset(sinf(degToRad(hAng+90)) * d, 0.f, -cosf(degToRad(hAng+90)) * d); +//#endif + Vec3f offset(std::sin(degToRad(hAng+90)) * d, 0.f, -std::cos(degToRad(hAng+90)) * d); destPos += offset; pos.x += (destPos.x - pos.x) * response; pos.z += (destPos.z - pos.z) * response; diff --git a/source/glest_game/sound/sound_renderer.cpp b/source/glest_game/sound/sound_renderer.cpp index 1602aeb4e..e753898eb 100644 --- a/source/glest_game/sound/sound_renderer.cpp +++ b/source/glest_game/sound/sound_renderer.cpp @@ -183,11 +183,12 @@ void SoundRenderer::playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPo if(d < audibleDist){ float vol= (1.f-d/audibleDist)*fxVolume; -#ifdef USE_STREFLOP - float correctedVol= streflop::log10(streflop::log10(static_cast(vol*9+1))*9+1); -#else - float correctedVol= log10(log10(vol*9+1)*9+1); -#endif +//#ifdef USE_STREFLOP +// float correctedVol= streflop::log10(streflop::log10(static_cast(vol*9+1))*9+1); +//#else +// float correctedVol= log10(log10(vol*9+1)*9+1); +//#endif + float correctedVol= std::log10(std::log10(vol*9+1)*9+1); staticSound->setVolume(correctedVol); diff --git a/source/shared_lib/sources/graphics/gl/particle_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/particle_renderer_gl.cpp index 179199295..dca3a4c3a 100644 --- a/source/shared_lib/sources/graphics/gl/particle_renderer_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/particle_renderer_gl.cpp @@ -253,12 +253,13 @@ void ParticleRendererGl::renderModel(GameParticleSystem *ps, ModelRenderer *mr){ float angleV= radToDeg(std::atan2(flatDirection.length(false), direction.y)) - 90.f; glRotatef(angleV, rotVector.x, rotVector.y, rotVector.z); -#ifdef USE_STREFLOP - float angleH= radToDeg(streflop::atan2(static_cast(direction.x), static_cast(direction.z))); -#else - float angleH= radToDeg(atan2(direction.x, direction.z)); -#endif +//#ifdef USE_STREFLOP +// float angleH= radToDeg(streflop::atan2(static_cast(direction.x), static_cast(direction.z))); +//#else +// float angleH= radToDeg(atan2(direction.x, direction.z)); +//#endif + float angleH= radToDeg(std::atan2(direction.x, direction.z)); glRotatef(angleH, 0.f, 1.f, 0.f); //render