From 0e6dd28573e4668e41642c335d740aed46b4da14 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 4 Mar 2019 23:49:03 +0000 Subject: [PATCH] Patch from Nuke.YKT to clip Polymost spans to screen borders git-svn-id: https://svn.eduke32.com/eduke32@7390 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/polymost.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 673df626d..21702797a 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -3572,11 +3572,23 @@ static void polymost_domost(float x0, float y0, float x1, float y1) return; } - vec2f_t const dm0 = { x0, y0 }; - vec2f_t const dm1 = { x1, y1 }; + vec2f_t dm0 = { x0, y0 }; + vec2f_t dm1 = { x1, y1 }; float const slop = (dm1.y - dm0.y) / (dm1.x - dm0.x); + if (dm0.x < xbl) + { + dm0.y += slop*(xbl-dm0.x); + dm0.x = xbl; + } + + if (dm1.x > xbr) + { + dm1.y += slop*(xbr-dm1.x); + dm1.x = xbr; + } + drawpoly_alpha = 0.f; drawpoly_blend = 0;