Fix a potential sector[-1] access when drawing a masked wall in Polymost.

git-svn-id: https://svn.eduke32.com/eduke32@2280 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-01-26 21:57:51 +00:00
parent f96cc343a2
commit c657588658

View file

@ -4550,6 +4550,10 @@ void polymost_drawrooms()
numscans = numbunches = 0;
// MASKWALL_BAD_ACCESS
// Fixes access of stale maskwall[maskwallcnt] (a "scan" index, in BUILD lingo):
maskwallcnt = 0;
if (globalcursectnum >= MAXSECTORS)
globalcursectnum -= MAXSECTORS;
else
@ -4624,6 +4628,11 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
z = maskwall[damaskwallcnt];
wal = &wall[thewall[z]]; wal2 = &wall[wal->point2];
sectnum = thesector[z]; sec = &sector[sectnum];
// if (wal->nextsector < 0) return;
// Without MASKWALL_BAD_ACCESS fix:
// wal->nextsector is -1, WGR2 SVN Lochwood Hollow (Til' Death L1) (or trueror1.map)
nsec = &sector[wal->nextsector];
z1 = max(nsec->ceilingz,sec->ceilingz);
z2 = min(nsec->floorz,sec->floorz);