mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Merge branch 'fix-plane-offsets' into 'master'
R_FindPlane: fix offsets rotation overflow for non-sloped planes Closes #676 See merge request KartKrew/Kart!1495
This commit is contained in:
commit
e351f07e4e
1 changed files with 17 additions and 6 deletions
|
|
@ -365,16 +365,27 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||||
|
|
||||||
if (!slope) // Don't mess with this right now if a slope is involved
|
if (!slope) // Don't mess with this right now if a slope is involved
|
||||||
{
|
{
|
||||||
xoff += viewx;
|
|
||||||
yoff -= viewy;
|
|
||||||
if (plangle != 0)
|
if (plangle != 0)
|
||||||
{
|
{
|
||||||
|
// Must use 64-bit math to avoid an overflow!
|
||||||
|
INT64 vx = xoff + viewx;
|
||||||
|
INT64 vy = yoff - viewy;
|
||||||
|
|
||||||
// Add the view offset, rotated by the plane angle.
|
// Add the view offset, rotated by the plane angle.
|
||||||
float ang = ANG2RAD(plangle);
|
float ang = ANG2RAD(plangle);
|
||||||
float x = FixedToFloat(xoff);
|
float x = vx / (float)FRACUNIT;
|
||||||
float y = FixedToFloat(yoff);
|
float y = vy / (float)FRACUNIT;
|
||||||
xoff = FloatToFixed(x * cos(ang) + y * sin(ang));
|
|
||||||
yoff = FloatToFixed(-x * sin(ang) + y * cos(ang));
|
vx = (x * cos(ang) + y * sin(ang)) * FRACUNIT;
|
||||||
|
vy = (-x * sin(ang) + y * cos(ang)) * FRACUNIT;
|
||||||
|
|
||||||
|
xoff = vx;
|
||||||
|
yoff = vy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xoff += viewx;
|
||||||
|
yoff -= viewy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue