Merge branch 'master' of c:\programming\doom-dev\zdoom

This commit is contained in:
Christoph Oelckers 2016-04-23 13:56:05 +02:00
commit c246d1c1ad
2 changed files with 0 additions and 146 deletions

View file

@ -157,114 +157,6 @@ DAngle viewpitch;
// CODE --------------------------------------------------------------------
static void R_Shutdown ();
//==========================================================================
//
// SlopeDiv
//
// Utility function, called by R_PointToAngle.
//
//==========================================================================
angle_t SlopeDiv (unsigned int num, unsigned den)
{
unsigned int ans;
if (den < 512)
return (ANG45 - 1); //tantoangle[SLOPERANGE]
ans = (num << 3) / (den >> 8);
return ans <= SLOPERANGE ? tantoangle[ans] : (ANG45 - 1);
}
//==========================================================================
//
// R_PointToAngle
//
// To get a global angle from cartesian coordinates, the coordinates are
// flipped until they are in the first octant of the coordinate system,
// then the y (<=x) is scaled and divided by x to get a tangent (slope)
// value which is looked up in the tantoangle[] table.
//
//==========================================================================
angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x, fixed_t y)
{
x -= x1;
y -= y1;
if ((x | y) == 0)
{
return 0;
}
// We need to be aware of overflows here. If the values get larger than INT_MAX/4
// this code won't work anymore.
if (x < INT_MAX/4 && x > -INT_MAX/4 && y < INT_MAX/4 && y > -INT_MAX/4)
{
if (x >= 0)
{
if (y >= 0)
{
if (x > y)
{ // octant 0
return SlopeDiv(y, x);
}
else
{ // octant 1
return ANG90 - 1 - SlopeDiv(x, y);
}
}
else // y < 0
{
y = -y;
if (x > y)
{ // octant 8
return 0 - SlopeDiv(y, x);
}
else
{ // octant 7
return ANG270 + SlopeDiv(x, y);
}
}
}
else // x < 0
{
x = -x;
if (y >= 0)
{
if (x > y)
{ // octant 3
return ANG180 - 1 - SlopeDiv(y, x);
}
else
{ // octant 2
return ANG90 + SlopeDiv(x, y);
}
}
else // y < 0
{
y = -y;
if (x > y)
{ // octant 4
return ANG180 + SlopeDiv(y, x);
}
else
{ // octant 5
return ANG270 - 1 - SlopeDiv(x, y);
}
}
}
}
else
{
// we have to use the slower but more precise floating point atan2 function here.
return xs_RoundToUInt(g_atan2(double(y), double(x)) * (ANGLE_180/M_PI));
}
}
//==========================================================================
//
// R_InitPointToAngle
@ -285,37 +177,6 @@ void R_InitPointToAngle (void)
}
}
//==========================================================================
//
// R_PointToDist2
//
// Returns the distance from (0,0) to some other point. In a
// floating point environment, we'd probably be better off using the
// Pythagorean Theorem to determine the result.
//
// killough 5/2/98: simplified
// [RH] Simplified further [sin (t + 90 deg) == cos (t)]
// Not used. Should it go away?
//
//==========================================================================
fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy)
{
dx = abs (dx);
dy = abs (dy);
if ((dx | dy) == 0)
{
return 0;
}
if (dy > dx)
{
swapvalues (dx, dy);
}
return FixedDiv (dx, finecosine[tantoangle[FixedDiv (dy, dx) >> DBITS] >> ANGLETOFINESHIFT]);
}
//==========================================================================
//

View file

@ -65,12 +65,6 @@ inline int R_PointOnSide(const DVector2 &pos, const node_t *node)
return DMulScale32(FLOAT2FIXED(pos.Y) - node->y, node->dx, node->x - FLOAT2FIXED(pos.X), node->dy) > 0;
}
angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
inline angle_t R_PointToAnglePrecise (fixed_t viewx, fixed_t viewy, fixed_t x, fixed_t y)
{
return xs_RoundToUInt(g_atan2(double(y-viewy), double(x-viewx)) * (ANGLE_180/M_PI));
}
// Used for interpolation waypoints.
struct DVector3a
{
@ -84,7 +78,6 @@ inline subsector_t *R_PointInSubsector(const DVector2 &pos)
{
return R_PointInSubsector(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y));
}
fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy);
void R_ResetViewInterpolation ();
void R_RebuildViewInterpolation(player_t *player);
bool R_GetViewInterpolationStatus();