From dce391583cf3a0379fca1b317abb06cd49eae71b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 27 May 2017 15:41:24 +0200 Subject: [PATCH] Use standard Sin/Cos version (fixing "The Pit" tilting floor issue, and maybe other similar issues too) --- Sources/Engine/Math/Functions.cpp | 3 ++- Sources/Engine/Math/Functions.h | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/Engine/Math/Functions.cpp b/Sources/Engine/Math/Functions.cpp index 6fa0c9e..9618707 100644 --- a/Sources/Engine/Math/Functions.cpp +++ b/Sources/Engine/Math/Functions.cpp @@ -69,7 +69,7 @@ double adCosQuadrants[4][2] = {1.0, -90.0}, {1.0, 0.0}, }; - +/* FLOAT Sin(ANGLE a) { double aWrapped = WrapAngle(a); @@ -92,3 +92,4 @@ FLOAT Tan(ANGLE a) { return Sin(a)/Cos(a); } +*/ diff --git a/Sources/Engine/Math/Functions.h b/Sources/Engine/Math/Functions.h index 1108e71..c3d5338 100755 --- a/Sources/Engine/Math/Functions.h +++ b/Sources/Engine/Math/Functions.h @@ -495,9 +495,15 @@ inline FLOAT RadAngle(ANGLE aAngle) { return FLOAT (WrapAngle(aAngle)*PI/ANGLE_180); } -ENGINE_API FLOAT Sin(ANGLE a); -ENGINE_API FLOAT Cos(ANGLE a); -ENGINE_API FLOAT Tan(ANGLE a); +#ifdef __arm__ +inline ENGINE_API FLOAT Sin(ANGLE a) { return sinf(a*(PI/ANGLE_180)); }; +inline ENGINE_API FLOAT Cos(ANGLE a) { return cosf(a*(PI/ANGLE_180)); }; +inline ENGINE_API FLOAT Tan(ANGLE a) { return tanf(a*(PI/ANGLE_180)); }; +#else +inline ENGINE_API FLOAT Sin(ANGLE a) { return sin(a*(PI/ANGLE_180)); }; +inline ENGINE_API FLOAT Cos(ANGLE a) { return cos(a*(PI/ANGLE_180)); }; +inline ENGINE_API FLOAT Tan(ANGLE a) { return tan(a*(PI/ANGLE_180)); }; +#endif #ifdef __arm__ inline ENGINE_API FLOAT SinFast(ANGLE a) { return sinf(a*(PI/ANGLE_180)); };