Removed all "-1"s from R_PointToAngle and R_PointToAngle2, in order to allow ALL basic compass directions at the least to be given the right angle by these functions.

Note: Before this change, North and West directions would be returned as ANGLE_90-1 and ANGLE_180-1. This caused the pusher polyobjects in THZ2 to slowly move sideways as a side-effect (and probably caused similar bugs in the past too, these functions have barely been touched in a decade it turns out.)
This commit is contained in:
Monster Iestyn 2015-06-21 16:58:34 +01:00
parent ac5c8f10e9
commit 6138845930
1 changed files with 8 additions and 8 deletions

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
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4
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
(x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4
ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5
0;
}