Use floating point trigonometry

This commit is contained in:
Jaime Ita Passos 2021-05-16 21:43:52 -03:00
parent 7500d12eeb
commit 5b86b8991c

View file

@ -368,11 +368,11 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
if (plangle != 0) if (plangle != 0)
{ {
// Add the view offset, rotated by the plane angle. // Add the view offset, rotated by the plane angle.
fixed_t cosinecomponent = FINECOSINE(plangle>>ANGLETOFINESHIFT); float ang = ANG2RAD(plangle);
fixed_t sinecomponent = FINESINE(plangle>>ANGLETOFINESHIFT); float x = FixedToFloat(xoff);
fixed_t oldxoff = xoff; float y = FixedToFloat(yoff);
xoff = FixedMul(xoff,cosinecomponent)+FixedMul(yoff,sinecomponent); xoff = FloatToFixed(x * cos(ang) + y * sin(ang));
yoff = -FixedMul(oldxoff,sinecomponent)+FixedMul(yoff,cosinecomponent); yoff = FloatToFixed(-x * sin(ang) + y * cos(ang));
} }
} }