diff options
-rw-r--r-- | engines/wintermute/base/scriptables/script_ext_math.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp index 4d770d4c51..fd45594245 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.cpp +++ b/engines/wintermute/base/scriptables/script_ext_math.cpp @@ -120,7 +120,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Cos") == 0) { stack->correctParams(1); - stack->pushFloat(cos(degreeToRadian(stack->pop()->getFloat()))); + stack->pushFloat(cos(Common::deg2rad<double>(stack->pop()->getFloat()))); return STATUS_OK; } @@ -129,7 +129,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Cosh") == 0) { stack->correctParams(1); - stack->pushFloat(cosh(degreeToRadian(stack->pop()->getFloat()))); + stack->pushFloat(cosh(Common::deg2rad<double>(stack->pop()->getFloat()))); return STATUS_OK; } @@ -186,7 +186,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Sin") == 0) { stack->correctParams(1); - stack->pushFloat(sin(degreeToRadian(stack->pop()->getFloat()))); + stack->pushFloat(sin(Common::deg2rad<double>(stack->pop()->getFloat()))); return STATUS_OK; } @@ -195,7 +195,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Sinh") == 0) { stack->correctParams(1); - stack->pushFloat(sinh(degreeToRadian(stack->pop()->getFloat()))); + stack->pushFloat(sinh(Common::deg2rad<double>(stack->pop()->getFloat()))); return STATUS_OK; } @@ -204,7 +204,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Tan") == 0) { stack->correctParams(1); - stack->pushFloat(tan(degreeToRadian(stack->pop()->getFloat()))); + stack->pushFloat(tan(Common::deg2rad<double>(stack->pop()->getFloat()))); return STATUS_OK; } @@ -213,7 +213,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Tanh") == 0) { stack->correctParams(1); - stack->pushFloat(tanh(degreeToRadian(stack->pop()->getFloat()))); + stack->pushFloat(tanh(Common::deg2rad<double>(stack->pop()->getFloat()))); return STATUS_OK; } @@ -231,7 +231,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "DegToRad") == 0) { stack->correctParams(1); - stack->pushFloat(degreeToRadian(stack->pop()->getFloat())); + stack->pushFloat(Common::deg2rad<double>(stack->pop()->getFloat())); return STATUS_OK; } @@ -240,7 +240,7 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "RadToDeg") == 0) { stack->correctParams(1); - stack->pushFloat(radianToDegree(stack->pop()->getFloat())); + stack->pushFloat(Common::rad2deg<double>(stack->pop()->getFloat())); return STATUS_OK; } else { return STATUS_FAILED; @@ -273,18 +273,6 @@ ScValue *SXMath::scGetProperty(const Common::String &name) { ////////////////////////////////////////////////////////////////////////// -double SXMath::degreeToRadian(double value) { - return value * (M_PI / 180.0f); -} - - -////////////////////////////////////////////////////////////////////////// -double SXMath::radianToDegree(double value) { - return value * (180.0f / M_PI); -} - - -////////////////////////////////////////////////////////////////////////// bool SXMath::persist(BasePersistenceManager *persistMgr) { BaseScriptable::persist(persistMgr); |