Skip to content

Commit

Permalink
- validate 'nextsector' fields on walls.
Browse files Browse the repository at this point in the history
Build utterly relied on the map having these right and put the entire responsibility on the mapper.
There's maps, however which have bad values here causing either render glitches or crashes so these bad indices need to be fixed.
Two good examples where this causes problems are RR's E3L1 and the second map of SW's Last Warrior mod where this even glitches in Polymost.
  • Loading branch information
coelckers committed Jul 27, 2021
1 parent 9a8ee00 commit bd23ea1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/core/maploader.cpp
Expand Up @@ -493,4 +493,18 @@ void setWallSectors()
wall[sector[i].wallptr + w].sector = i;
}
}

// validate 'nextsector' fields. Some maps have these wrong which can cause render glitches and occasionally even crashes.
for (int i = 0; i < numwalls; i++)
{
if (wall[i].nextwall != -1)
{
if (wall[i].nextsector != wall[wall[i].nextwall].sector)
{
DPrintf(DMSG_ERROR, "Bad 'nextsector' reference %d on wall %d\n", wall[i].nextsector, i);
wall[i].nextsector = wall[wall[i].nextwall].sector;
}
}
}

}

0 comments on commit bd23ea1

Please sign in to comment.