From 73cbc59dd9ae3ef6bb154ca72618a32d14240ac2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 11 Feb 2016 22:57:26 +0100 Subject: [PATCH] - replaced double2fixed function with FLOAT2FIXED macro. --- src/fragglescript/t_func.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 444750e03..8be7f798d 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -3825,19 +3825,12 @@ void FParser::SF_ObjType() // //========================================================================== -inline fixed_t double2fixed(double t) -{ - return (fixed_t)(t*65536.0); -} - - - void FParser::SF_Sin() { if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(sin(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(sin(floatvalue(t_argv[0]))); } } @@ -3847,7 +3840,7 @@ void FParser::SF_ASin() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(asin(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(asin(floatvalue(t_argv[0]))); } } @@ -3857,7 +3850,7 @@ void FParser::SF_Cos() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(cos(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(cos(floatvalue(t_argv[0]))); } } @@ -3867,7 +3860,7 @@ void FParser::SF_ACos() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(acos(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(acos(floatvalue(t_argv[0]))); } } @@ -3877,7 +3870,7 @@ void FParser::SF_Tan() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(tan(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(tan(floatvalue(t_argv[0]))); } } @@ -3887,7 +3880,7 @@ void FParser::SF_ATan() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(atan(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(atan(floatvalue(t_argv[0]))); } } @@ -3897,7 +3890,7 @@ void FParser::SF_Exp() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(exp(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(exp(floatvalue(t_argv[0]))); } } @@ -3906,7 +3899,7 @@ void FParser::SF_Log() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(log(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(log(floatvalue(t_argv[0]))); } } @@ -3916,7 +3909,7 @@ void FParser::SF_Sqrt() if (CheckArgs(1)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(sqrt(floatvalue(t_argv[0]))); + t_return.value.f = FLOAT2FIXED(sqrt(floatvalue(t_argv[0]))); } } @@ -3936,7 +3929,7 @@ void FParser::SF_Pow() if (CheckArgs(2)) { t_return.type = svt_fixed; - t_return.value.f = double2fixed(pow(floatvalue(t_argv[0]), floatvalue(t_argv[1]))); + t_return.value.f = FLOAT2FIXED(pow(floatvalue(t_argv[0]), floatvalue(t_argv[1]))); } }