From 3b397183ac20286156b46bc3e1a476e1c6a7339d Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 15 Nov 2016 15:15:01 +0100 Subject: [PATCH] Clamp segment range --- src/r_poly_cull.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/r_poly_cull.cpp b/src/r_poly_cull.cpp index 3df07abf96..2b97d71bba 100644 --- a/src/r_poly_cull.cpp +++ b/src/r_poly_cull.cpp @@ -102,6 +102,9 @@ void PolyCull::ClearSolidSegments() bool PolyCull::IsSegmentCulled(int x1, int x2) const { + x1 = clamp(x1, -0x7ffe, 0x7ffd); + x2 = clamp(x2, -0x7ffd, 0x7ffe); + int next = 0; while (SolidSegments[next].X2 <= x2) next++; @@ -113,6 +116,9 @@ void PolyCull::MarkSegmentCulled(int x1, int x2) if (x1 >= x2) return; + x1 = clamp(x1, -0x7ffe, 0x7ffd); + x2 = clamp(x2, -0x7ffd, 0x7ffe); + int cur = 1; while (true) {