Fix TROR clipping issue

git-svn-id: https://svn.eduke32.com/eduke32@7617 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-20 21:57:02 +00:00 committed by Christoph Oelckers
parent 2228af8658
commit 968ebdef84

View file

@ -11134,19 +11134,16 @@ void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t *
{ {
bool nofirstzcheck = false; bool nofirstzcheck = false;
if (*sectnum >= MAXSECTORS && (unsigned)*sectnum < (unsigned)numsectors + MAXSECTORS) if (*sectnum >= MAXSECTORS && *sectnum - MAXSECTORS < numsectors)
{ {
*sectnum -= MAXSECTORS; *sectnum -= MAXSECTORS;
nofirstzcheck = true; 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; int32_t cz, fz;
getzsofslope(correctedsectnum, x, y, &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); SET_AND_RETURN(*sectnum, next);
} }
#endif #endif
if (z >= cz && z <= fz && inside_p(x, y, correctedsectnum)) if ((nofirstzcheck || (z >= cz && z <= fz)) && inside_p(x, y, *sectnum))
return; return;
static int16_t sectlist[MAXSECTORS]; static int16_t sectlist[MAXSECTORS];