- added new cmake build option (and fixed bugs from people who added code but did not respect NON streflop define)

This commit is contained in:
Mark Vejvoda 2011-07-13 19:57:29 +00:00
parent 5ffc0937f1
commit bc4f33bc9a
3 changed files with 33 additions and 9 deletions

View File

@ -153,11 +153,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
ENDIF() ENDIF()
OPTION(WANT_STREFLOP "use the library streflop" ON)
# Win32 specific Compiler Flags # Win32 specific Compiler Flags
IF(WIN32) 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() 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()
ENDIF() ENDIF()

View File

@ -483,14 +483,22 @@ void Unit::calculateXZRotation(){
SurfaceCell* sc= map->getSurfaceCell(Map::toSurfCoords(pos)); SurfaceCell* sc= map->getSurfaceCell(Map::toSurfCoords(pos));
const Vec3f normal= sc->getNormal(); const Vec3f normal= sc->getNormal();
#ifdef USE_STREFLOP
float targetRotationZ= radToDeg(streflop::atan2(abs(normal.x), abs(normal.y))); 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)){ if((normal.y < 0 || normal.x < 0) && !(normal.y < 0 && normal.x < 0)){
targetRotationZ= targetRotationZ * -1; targetRotationZ= targetRotationZ * -1;
} }
targetRotationZ= targetRotationZ * -1; targetRotationZ= targetRotationZ * -1;
#ifdef USE_STREFLOP
targetRotationX= radToDeg(streflop::atan2(abs(normal.z), abs(normal.y))); 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)){ if((normal.y < 0 || normal.z < 0) && !(normal.y < 0 && normal.z < 0)){
targetRotationX= targetRotationX * -1; targetRotationX= targetRotationX * -1;
@ -1475,12 +1483,20 @@ bool Unit::update() {
progress += (speed * diagonalFactor * heightFactor) / speedDenominator; progress += (speed * diagonalFactor * heightFactor) / speedDenominator;
if(isAnimProgressBound() == true) { if(isAnimProgressBound() == true) {
if(currSkill->getClass() == scBeBuilt) animProgress = this->getHpRatio(); if(currSkill->getClass() == scBeBuilt) {
if(currSkill->getClass() == scProduce) animProgress = this->getProgressRatio(); animProgress = this->getHpRatio();
if(currSkill->getClass() == scUpgrade) animProgress = this->getProgressRatio(); }
if(currSkill->getClass() == scMorph) animProgress = this->getProgressRatio(); 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; animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
} }
//update target //update target

View File

@ -163,8 +163,8 @@ public:
c = streflop::cosf(rad), c = streflop::cosf(rad),
s = streflop::sinf(rad); s = streflop::sinf(rad);
#else #else
c = scosf(rad), c = cosf(rad),
s = ssinf(rad); s = sinf(rad);
#endif #endif
return Vec2<T>(x*c-y*s,x*s+y*c); return Vec2<T>(x*c-y*s,x*s+y*c);
} }