diff --git a/CMakeLists.txt b/CMakeLists.txt index 085463fe..81b13d6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,11 +153,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) ENDIF() + OPTION(WANT_STREFLOP "use the library streflop" ON) + # Win32 specific Compiler Flags IF(WIN32) - ADD_DEFINITIONS("-D_WINDOWS -D_WIN32 -D_STDCALL_SUPPORTED -D_M_IX86 -DXML_LIBRARY -D_LIB -DUSE_STREFLOP -DSTREFLOP_SSE -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32 -DCURL_STATICLIB") + ADD_DEFINITIONS("-D_WINDOWS -D_WIN32 -D_STDCALL_SUPPORTED -D_M_IX86 -DXML_LIBRARY -D_LIB -DCURL_STATICLIB") ELSE() - ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_SSE -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32 -DCURL_STATICLIB") + ADD_DEFINITIONS("-DCURL_STATICLIB") + ENDIF() + + IF(WANT_STREFLOP) + ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_SSE -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32") + ELSE() + MESSAGE(STATUS "*WARNING: Disabled use of STREFLOP! Out of synchs may occur") ENDIF() ENDIF() diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index b47e9001..fc87f92b 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -483,14 +483,22 @@ void Unit::calculateXZRotation(){ SurfaceCell* sc= map->getSurfaceCell(Map::toSurfCoords(pos)); const Vec3f normal= sc->getNormal(); +#ifdef USE_STREFLOP float targetRotationZ= radToDeg(streflop::atan2(abs(normal.x), abs(normal.y))); +#else + float targetRotationZ= radToDeg(atan2(abs(normal.x), abs(normal.y))); +#endif if((normal.y < 0 || normal.x < 0) && !(normal.y < 0 && normal.x < 0)){ targetRotationZ= targetRotationZ * -1; } targetRotationZ= targetRotationZ * -1; +#ifdef USE_STREFLOP targetRotationX= radToDeg(streflop::atan2(abs(normal.z), abs(normal.y))); +#else + targetRotationX= radToDeg(atan2(abs(normal.z), abs(normal.y))); +#endif if((normal.y < 0 || normal.z < 0) && !(normal.y < 0 && normal.z < 0)){ targetRotationX= targetRotationX * -1; @@ -1475,12 +1483,20 @@ bool Unit::update() { progress += (speed * diagonalFactor * heightFactor) / speedDenominator; if(isAnimProgressBound() == true) { - if(currSkill->getClass() == scBeBuilt) animProgress = this->getHpRatio(); - if(currSkill->getClass() == scProduce) animProgress = this->getProgressRatio(); - if(currSkill->getClass() == scUpgrade) animProgress = this->getProgressRatio(); - if(currSkill->getClass() == scMorph) animProgress = this->getProgressRatio(); + if(currSkill->getClass() == scBeBuilt) { + animProgress = this->getHpRatio(); + } + if(currSkill->getClass() == scProduce) { + animProgress = this->getProgressRatio(); + } + if(currSkill->getClass() == scUpgrade) { + animProgress = this->getProgressRatio(); + } + if(currSkill->getClass() == scMorph) { + animProgress = this->getProgressRatio(); + } } - else{ + else { animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator; } //update target diff --git a/source/shared_lib/include/graphics/vec.h b/source/shared_lib/include/graphics/vec.h index 082af584..49f3209c 100644 --- a/source/shared_lib/include/graphics/vec.h +++ b/source/shared_lib/include/graphics/vec.h @@ -163,8 +163,8 @@ public: c = streflop::cosf(rad), s = streflop::sinf(rad); #else - c = scosf(rad), - s = ssinf(rad); + c = cosf(rad), + s = sinf(rad); #endif return Vec2(x*c-y*s,x*s+y*c); }