revert this

This commit is contained in:
Alug committed 2024-02-12 14:38:47 +01:00
1 parent 0098c3bbc0
commit a934c76263
1 file changed
+17 -4
+17 -4
View File
@@ -437,19 +437,32 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
0;
}
//
// R_PointToPseudoAngle
// ! Returns the pseudoangle between the line p1 to (infinity, p1.y) and the
// line from p1 to p2. The pseudoangle has the property that the ordering of
// points by true angle anround p1 and ordering of points by pseudoangle are the
// same.
//
// For clipping exact angles are not needed. Only the ordering matters.
// This is about as fast as the fixed point R_PointToAngle2 but without
// the precision issues associated with that function.
//
FUNCINLINE ATTRINLINE angle_t R_PointToPseudoAngle (fixed_t x, fixed_t y)
{
// Note: float won't work here as it's less precise than the BAM values being passed as parameters
INT64 vecx = x - viewx;
INT64 vecy = y - viewy;
double vecx = (double)x - viewx;
double vecy = (double)y - viewy;
double epsilon = 1e-9;
if (vecx == 0 && vecy == 0)
if (fabs(vecx) < epsilon && fabs(vecy) < epsilon)
{
return 0;
}
else
{
double result = vecy / (vecx + vecy);
double result = vecy / (fabs(vecx) + fabs(vecy));
if (vecx < 0)
{
result = 2.0 - result;