From 39d03f12b1fe9fe1dfdd4289489655a4022bf183 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 8 Apr 2016 15:14:26 +0200 Subject: [PATCH] - fixed float <-> fixed conversion errors in Fragglescript. --- src/fragglescript/t_script.h | 2 +- src/fragglescript/t_variable.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fragglescript/t_script.h b/src/fragglescript/t_script.h index 39b0b93ee..02ea444a2 100644 --- a/src/fragglescript/t_script.h +++ b/src/fragglescript/t_script.h @@ -123,7 +123,7 @@ struct svalue_t void setDouble(double dp) { - value.f = fsfix(dp/65536); + value.f = fsfix(dp * 65536); type = svt_fixed; } }; diff --git a/src/fragglescript/t_variable.cpp b/src/fragglescript/t_variable.cpp index 7fd39aa14..b41b05490 100644 --- a/src/fragglescript/t_variable.cpp +++ b/src/fragglescript/t_variable.cpp @@ -93,7 +93,7 @@ double floatvalue(const svalue_t &v) { return v.type == svt_string ? atof(v.string) : - v.type == svt_fixed ? v.value.f * 65536. : + v.type == svt_fixed ? v.value.f / 65536. : v.type == svt_mobj ? -1. : (double)v.value.i; }