- Replaced toint/quickertoint with the portable routines from xs_Float.h. The
former used fistp, which is not portable across platforms, so cannot be used in the play simulation. They were only suitable for the renderer. xs_Float.h also has a very fast float->fixed conversion, so FLOAT2FIXED uses that now. (And I also learned that the FPU's round to nearest is not the rounding I learned in grade school but actually Banker's Rounding. I had no idea.) (Also, also, the only thing that could have made quickertoint faster than toint was that it stored a 32-bit int. I never timed them, and I doubt in practice there was any real difference between the two.) - Changed atan2f to atan2. Using floats is not a win, because the result is returned as a double on the x87 stack, which the caller then needs to cast down to a float using fst/fld. SVN r1990 (trunk)
This commit is contained in:
parent
eca9b4981b
commit
344dda4a1a
13 changed files with 56 additions and 83 deletions
|
|
@ -326,9 +326,7 @@ angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x, fixed_t y)
|
|||
else
|
||||
{
|
||||
// we have to use the slower but more precise floating point atan2 function here.
|
||||
// (use quickertoint to speed this up because the CRT's conversion is rather slow and
|
||||
// this is used in time critical code.)
|
||||
return quickertoint((float)(atan2f(float(y), float(x)) * (ANGLE_180/M_PI)));
|
||||
return xs_RoundToUInt(atan2(double(y), double(x)) * (ANGLE_180/M_PI));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -534,7 +532,7 @@ void R_SetVisibility (float vis)
|
|||
return;
|
||||
}
|
||||
|
||||
r_BaseVisibility = toint (vis * 65536.f);
|
||||
r_BaseVisibility = xs_RoundToInt(vis * 65536.f);
|
||||
|
||||
// Prevent overflow on walls
|
||||
if (r_BaseVisibility < 0 && r_BaseVisibility < -MaxVisForWall)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue