-more index stuff.

This commit is contained in:
Christoph Oelckers 2021-12-02 00:45:34 +01:00
parent ee1b574830
commit 83cf2f3baf
2 changed files with 15 additions and 16 deletions

View file

@ -2337,10 +2337,6 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex)
int32_t const sectnum = wal->nextWall()->nextsector;
auto const sec = (usectorptr_t)&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)
auto const nsec = (usectorptr_t)wal->nextSector();
polymost_outputGLDebugMessage(3, "polymost_drawmaskwallinternal(wallIndex:%d)", wallIndex);
@ -2388,11 +2384,11 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex)
int32_t m1 = (int32_t)((wal2->y - wal->y) * t0 + wal->y);
int32_t cz[4], fz[4];
getzsofslope(sectnum, m0, m1, &cz[0], &fz[0]);
getzsofslope(wal->nextsector, m0, m1, &cz[1], &fz[1]);
getzsofslopeptr(wal->nextSector(), m0, m1, &cz[1], &fz[1]);
m0 = (int32_t)((wal2->x - wal->x) * t1 + wal->x);
m1 = (int32_t)((wal2->y - wal->y) * t1 + wal->y);
getzsofslope(sectnum, m0, m1, &cz[2], &fz[2]);
getzsofslope(wal->nextsector, m0, m1, &cz[3], &fz[3]);
getzsofslopeptr(wal->nextSector(), m0, m1, &cz[3], &fz[3]);
float ryp0 = 1.f/p0.Y;
float ryp1 = 1.f/p1.Y;
@ -3309,6 +3305,7 @@ EXTERN_CVAR(Int, gl_fogmode)
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, sectortype* dacursect, bool fromoutside)
{
if (dacursect) return renderDrawRoomsQ16(daposx, daposy, daposz, daang, dahoriz, sectnum(dacursect), fromoutside);
return 0;
}
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,

View file

@ -548,25 +548,27 @@ void loadMapBackup(const char* filename)
// Sets the sector reference for each wall. We need this for the triangulation cache.
void setWallSectors()
{
for (int i = 0; i < numsectors; i++)
int i = 0;
for(auto& sect : sectors())
{
sector[i].dirty = 255;
sector[i].exflags = 0;
for (int w = 0; w < sector[i].wallnum; w++)
sect.dirty = 255;
sect.exflags = 0;
for (auto& wal : wallsofsector(&sect))
{
wall[sector[i].wallptr + w].sector = i;
wal.sector = i;
}
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++)
for (auto& wal : walls())
{
if (wall[i].nextwall != -1)
if (wal.nextwall != -1)
{
if (wall[i].nextsector != wall[wall[i].nextwall].sector)
if (wal.nextsector != wal.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;
DPrintf(DMSG_ERROR, "Bad 'nextsector' reference %d on wall %d\n", wal.nextsector, i);
wal.nextsector = wal.nextWall()->sector;
}
}
}