From 968ebdef842a5b9e8bb6f1b2e3b1a1da49c958aa Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 20 Apr 2019 21:57:02 +0000 Subject: [PATCH] Fix TROR clipping issue git-svn-id: https://svn.eduke32.com/eduke32@7617 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index d07e61ba9..a1c127353 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -11134,19 +11134,16 @@ void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * { bool nofirstzcheck = false; - if (*sectnum >= MAXSECTORS && (unsigned)*sectnum < (unsigned)numsectors + MAXSECTORS) + if (*sectnum >= MAXSECTORS && *sectnum - MAXSECTORS < numsectors) { *sectnum -= MAXSECTORS; nofirstzcheck = true; } - int const correctedsectnum = *sectnum; + uint32_t const correctedsectnum = (unsigned)*sectnum; - if ((unsigned)correctedsectnum < (unsigned)numsectors && getsectordist({x, y}, correctedsectnum) < INITIALUPDATESECTORDIST) + if (correctedsectnum < (unsigned)numsectors && getsectordist({x, y}, correctedsectnum) < INITIALUPDATESECTORDIST) { - if (nofirstzcheck && inside_p(x, y, correctedsectnum)) - return; - int32_t cz, fz; getzsofslope(correctedsectnum, x, y, &cz, &fz); @@ -11165,7 +11162,7 @@ void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * SET_AND_RETURN(*sectnum, next); } #endif - if (z >= cz && z <= fz && inside_p(x, y, correctedsectnum)) + if ((nofirstzcheck || (z >= cz && z <= fz)) && inside_p(x, y, *sectnum)) return; static int16_t sectlist[MAXSECTORS];