summaryrefslogtreecommitdiffstats
path: root/src/General.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-05 14:34:41 +0200
committerGitHub <noreply@github.com>2019-07-05 14:34:41 +0200
commit9d13ab28a8a625a60a38729129c8d2c8e02e7b8f (patch)
tree86d117096a709da2f395c3c6145fc1f7791e3140 /src/General.h
parentMore AudioManager (diff)
parentimplemented some CVehicle functions (diff)
downloadre3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.gz
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.bz2
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.lz
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.xz
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.zst
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.zip
Diffstat (limited to 'src/General.h')
-rw-r--r--src/General.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/General.h b/src/General.h
index fd78edaa..cae1caa0 100644
--- a/src/General.h
+++ b/src/General.h
@@ -4,10 +4,6 @@ class CGeneral
{
public:
static float GetATanOfXY(float x, float y){
-// why exactly doesn't this work?
-// if(y >= 0.0f) return atan2(x, y);
-// return atan2(x, y) + 2*M_PI;
-
if(x == 0.0f && y == 0.0f)
return 0.0f;
float xabs = fabs(x);
@@ -42,13 +38,14 @@ public:
static float LimitRadianAngle(float angle)
{
- if (angle < -25.0f)
- angle = -25.0f;
+ float result;
- if (angle > 25.0f)
- angle = 25.0f;
-
- float result = angle;
+ if (angle < -25.0f)
+ result = -25.0f;
+ else if (angle > 25.0f)
+ result = 25.0f;
+ else
+ result = angle;
while (result >= PI) {
result -= 2 * PI;
@@ -71,7 +68,7 @@ public:
if (x > 0.0f) {
if (y > 0.0f)
- return 2 * PI - atan2(x / y, 1.0f);
+ return PI - atan2(x / y, 1.0f);
else
return -atan2(x / y, 1.0f);
} else {
@@ -84,7 +81,7 @@ public:
// not too sure about all these...
static uint16 GetRandomNumber(void)
- { return myrand() & 0xFFFF; }
+ { return myrand() & MYRAND_MAX; }
// Probably don't want to ever reach high
static float GetRandomNumberInRange(float low, float high)
{ return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); }