Merge branch 'pointtoangle-fix' into 'next'

Tweaks to R_PointToAngle and R_PointToAngle2

Exactly what it says in the title! See commit description for more information on what I did, since I'm too lazy to write it all up a second time. =P

Could someone check that these changes don't cause anything else in particular to go wrong in the game or source code? I haven't checked myself that much yet, mostly because I totally forgot about this thing until now, lol.

See merge request !19
This commit is contained in:
Alam Ed Arias 2015-08-14 18:10:33 -04:00
commit 79ecbc407e

View file

@ -316,13 +316,13 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y)
x >= 0 ?
y >= 0 ?
(x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0
ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1
ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1
x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8
ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7
y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3
y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3
ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4
ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5
ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5
0;
}
@ -332,13 +332,13 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
x >= 0 ?
y >= 0 ?
(x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0
ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1
ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1
x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8
ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7
y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3
y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3
ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4
ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5
ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5
0;
}