- added conversion macros to convert floating point angles to angle_t, using xs_Float.h, and replaced all occurences in the code with them (let's hope I found everything.)

Converting a floating point value that is out of range for a signed integer will result in 0x80000000 with SSE math, which is used exclusively for this purpose on modern Visual C++ compilers, so this cannot be used anywhere.
On ARM there's problems with float to unsigned int conversions.

xs_Float does not depend on these
This commit is contained in:
Christoph Oelckers 2016-02-08 12:10:53 +01:00
commit 6d0ef7a9da
18 changed files with 58 additions and 46 deletions

View file

@ -86,7 +86,7 @@ void ASecurityCamera::PostBeginPlay ()
pitch = -ANGLE_90 + ANGLE_1;
else if (pitch >= ANGLE_90)
pitch = ANGLE_90 - ANGLE_1;
Range = (angle_t)((float)args[1] * 536870912.f / 45.f);
Range = FLOAT2ANGLE(args[1]);
}
void ASecurityCamera::Tick ()
@ -136,7 +136,7 @@ void AAimingCamera::PostBeginPlay ()
args[2] = 0;
Super::PostBeginPlay ();
MaxPitchChange = (int)((float)changepitch * 536870912.f / 45.f / (float)TICRATE);
MaxPitchChange = FLOAT2ANGLE(changepitch * TICRATE);
Range /= TICRATE;
TActorIterator<AActor> iterator (args[3]);
@ -181,7 +181,7 @@ void AAimingCamera::Tick ()
double dz = Z() - tracer->Z() - tracer->height/2;
double dist = vect.Length();
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
int desiredpitch = (angle_t)(ang * 2147483648.f / PI);
int desiredpitch = (int)RAD2ANGLE(ang);
if (abs (desiredpitch - pitch) < MaxPitchChange)
{
pitch = desiredpitch;