From c8b161704b4666529423481e3c840624e591552e Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 19 Mar 2019 17:07:57 +0000 Subject: [PATCH] Patch from Nuke.YKT to work around a Polymost glitch with slopes git-svn-id: https://svn.eduke32.com/eduke32@7401 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/polymost.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 00caf9ae2..39a8b6f12 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -4590,7 +4590,14 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0, if (globalorientation&2) //slopes { //Pick some point guaranteed to be not collinear to the 1st two points - vec2f_t const oxy = { n0.x + (n1.y - n0.y), n0.y + (n0.x - n1.x) }; + vec2f_t dxy = { n1.y - n0.y, n0.x - n1.x }; + + float const dxyr = polymost_invsqrt_approximation(dxy.x * dxy.x + dxy.y * dxy.y); + + dxy.x *= dxyr * 4096.f; + dxy.y *= dxyr * 4096.f; + + vec2f_t const oxy = { n0.x + dxy.x, n0.y + dxy.y }; float const ox2 = (oxy.y - fglobalposy) * gcosang - (oxy.x - fglobalposx) * gsinang; float oy2 = 1.f / ((oxy.x - fglobalposx) * gcosang2 + (oxy.y - fglobalposy) * gsinang2);