mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- removed all uses of single precision floats from FraggleScript code.
This commit is contained in:
parent
267030c759
commit
ba2a07fb26
3 changed files with 9 additions and 9 deletions
|
@ -73,7 +73,6 @@ static FRandom pr_script("FScript");
|
|||
|
||||
#define AngleToFixed(x) ((((double) x) / ((double) ANG45/45)) * FRACUNIT)
|
||||
#define FixedToAngle(x) ((((double) x) / FRACUNIT) * ANG45/45)
|
||||
#define FIXED_TO_FLOAT(f) ((f)/(float)FRACUNIT)
|
||||
|
||||
// functions. FParser::SF_ means Script Function not, well.. heh, me
|
||||
|
||||
|
@ -1417,11 +1416,11 @@ void FParser::SF_PointToDist(void)
|
|||
if (CheckArgs(4))
|
||||
{
|
||||
// Doing this in floating point is actually faster with modern computers!
|
||||
float x = floatvalue(t_argv[2]) - floatvalue(t_argv[0]);
|
||||
float y = floatvalue(t_argv[3]) - floatvalue(t_argv[1]);
|
||||
double x = floatvalue(t_argv[2]) - floatvalue(t_argv[0]);
|
||||
double y = floatvalue(t_argv[3]) - floatvalue(t_argv[1]);
|
||||
|
||||
t_return.type = svt_fixed;
|
||||
t_return.value.f = (fixed_t)(sqrtf(x*x+y*y)*65536.f);
|
||||
t_return.value.f = FLOAT2FIXED(sqrt(x*x+y*y)*65536.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ struct svalue_t
|
|||
|
||||
int intvalue(const svalue_t & v);
|
||||
fixed_t fixedvalue(const svalue_t & v);
|
||||
float floatvalue(const svalue_t & v);
|
||||
double floatvalue(const svalue_t & v);
|
||||
const char *stringvalue(const svalue_t & v);
|
||||
AActor *actorvalue(const svalue_t &svalue);
|
||||
|
||||
|
|
|
@ -89,11 +89,12 @@ fixed_t fixedvalue(const svalue_t &v)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
float floatvalue(const svalue_t &v)
|
||||
double floatvalue(const svalue_t &v)
|
||||
{
|
||||
return (float)( (v.type == svt_string ? atof(v.string) :
|
||||
v.type == svt_fixed ? (float)(v.value.f / (float)FRACUNIT) :
|
||||
v.type == svt_mobj ? -1.f : (float)v.value.i ));
|
||||
return
|
||||
v.type == svt_string ? atof(v.string) :
|
||||
v.type == svt_fixed ? FIXED2DBL(v.value.f) :
|
||||
v.type == svt_mobj ? -1. : (double)v.value.i;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue