- all nextwall references removed.

This commit is contained in:
Christoph Oelckers 2021-11-24 20:59:19 +01:00
parent ca536ce5bd
commit b7a2687a7b
5 changed files with 35 additions and 51 deletions

View file

@ -66,7 +66,7 @@ void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect)
dwall->lotag = swall->lotag;
dwall->extra = swall->extra;
if (validWallIndex(dwall->nextwall) && validWallIndex(swall->nextwall))
if (dwall->twoSided() && swall->twoSided())
{
auto const dest_nextwall = dwall->nextWall();
auto const src_nextwall = swall->nextWall();

View file

@ -135,7 +135,7 @@ void SetWallWarpHitscan(short sectnum)
// Travel all the way around loop setting wall bits
do
{
if (validWallIndex(wall_num->nextwall))
if (wall_num->twoSided())
SET(wall_num->cstat, CSTAT_WALL_WARP_HITSCAN);
wall_num = wall_num->point2Wall();
}

View file

@ -100,9 +100,8 @@ void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_
if (set_nextwall)
{
uint16_t const nextwall = wall_num->nextwall;
if (validWallIndex(nextwall))
SET(wall[nextwall].extra, bit_mask);
if (wall_num->twoSided())
SET(wall_num->nextWall()->extra, bit_mask);
}
wall_num = wall_num->point2Wall();
@ -144,9 +143,9 @@ static void WallSetupLoop(WALLp wp, int16_t lotag, int16_t extra)
// set first wall
{
SET(wp->extra, extra);
uint16_t const nextwall = wp->nextwall;
if (validWallIndex(nextwall))
SET(wall[nextwall].extra, extra);
if (wp->twoSided())
SET(wp->nextWall()->extra, extra);
}
// Travel all the way around loop setting wall bits
@ -155,9 +154,8 @@ static void WallSetupLoop(WALLp wp, int16_t lotag, int16_t extra)
wall_num = wall_num->point2Wall())
{
SET(wall_num->extra, extra);
uint16_t const nextwall = wall_num->nextwall;
if (validWallIndex(nextwall))
SET(wall[nextwall].extra, extra);
if (wall_num->twoSided())
SET(wall_num->nextWall()->extra, extra);
}
}

View file

@ -2445,8 +2445,7 @@ void SpriteSetup(void)
case LIGHTING:
{
short w, startwall, endwall;
short wallcount;
int wallcount = 0;
int8_t* wall_shade;
USERp u;
@ -2459,35 +2458,32 @@ void SpriteSetup(void)
LIGHT_FloorShade(sp) = sp->sector()->floorshade;
LIGHT_CeilingShade(sp) = sp->sector()->ceilingshade;
startwall = sp->sector()->wallptr;
endwall = startwall + sp->sector()->wallnum - 1;
// count walls of sector
for (w = startwall, wallcount = 0; w <= endwall; w++)
for(auto& wal : wallsofsector(sp->sector()))
{
wallcount++;
if (TEST_BOOL5(sp))
{
if (wall[w].nextwall >= 0)
if (wal.twoSided())
wallcount++;
}
}
u = SpawnUser(actor, 0, nullptr);
u->WallShade.Resize(wallcount);
wallcount = 0;
wall_shade = u->WallShade.Data();
// save off original wall shades
for (w = startwall, wallcount = 0; w <= endwall; w++)
for(auto& wal : wallsofsector(sp->sector()))
{
wall_shade[wallcount] = wall[w].shade;
wall_shade[wallcount] = wal.shade;
wallcount++;
if (TEST_BOOL5(sp))
{
uint16_t const nextwall = wall[w].nextwall;
if (validWallIndex(nextwall))
if (wal.twoSided())
{
wall_shade[wallcount] = wall[wall[w].nextwall].shade;
wall_shade[wallcount] = wal.nextWall()->shade;
wallcount++;
}
}
@ -2502,8 +2498,7 @@ void SpriteSetup(void)
case LIGHTING_DIFFUSE:
{
short w, startwall, endwall;
short wallcount;
int wallcount = 0;
int8_t* wall_shade;
USERp u;
@ -2513,16 +2508,13 @@ void SpriteSetup(void)
LIGHT_FloorShade(sp) = sp->sector()->floorshade;
LIGHT_CeilingShade(sp) = sp->sector()->ceilingshade;
startwall = sp->sector()->wallptr;
endwall = startwall + sp->sector()->wallnum - 1;
// count walls of sector
for (w = startwall, wallcount = 0; w <= endwall; w++)
for (auto& wal : wallsofsector(sp->sector()))
{
wallcount++;
if (TEST_BOOL5(sp))
{
if (wall[w].nextwall >= 0)
if (wal.twoSided())
wallcount++;
}
}
@ -2531,19 +2523,19 @@ void SpriteSetup(void)
// make an wall_shade array and put it in User
u = SpawnUser(actor, 0, nullptr);
u->WallShade.Resize(wallcount);
wallcount = 0;
wall_shade = u->WallShade.Data();
// save off original wall shades
for (w = startwall, wallcount = 0; w <= endwall; w++)
for (auto& wal : wallsofsector(sp->sector()))
{
wall_shade[wallcount] = wall[w].shade;
wall_shade[wallcount] = wal.shade;
wallcount++;
if (TEST_BOOL5(sp))
{
uint16_t const nextwall = wall[w].nextwall;
if (validWallIndex(nextwall))
if (wal.twoSided())
{
wall_shade[wallcount] = wall[wall[w].nextwall].shade;
wall_shade[wallcount] = wal.nextWall()->shade;
wallcount++;
}
}
@ -2816,7 +2808,7 @@ void SpriteSetup(void)
do
{
// DO NOT TAG WHITE WALLS!
if (validWallIndex(wall_num->nextwall))
if (wall_num->twoSided())
{
SET(wall_num->cstat, CSTAT_WALL_WARP_HITSCAN);
}
@ -2929,9 +2921,8 @@ void SpriteSetup(void)
do
{
SET(wall_num->cstat, CSTAT_WALL_BLOCK_ACTOR);
uint16_t const nextwall = wall_num->nextwall;
if (validWallIndex(nextwall))
SET(wall[nextwall].cstat, CSTAT_WALL_BLOCK_ACTOR);
if (wall_num->twoSided())
SET(wall_num->nextWall()->cstat, CSTAT_WALL_BLOCK_ACTOR);
wall_num = wall_num->point2Wall();
}
while (wall_num != start_wall);

View file

@ -841,24 +841,20 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{
startwall = (*sectp)->wallptr;
endwall = startwall + (*sectp)->wallnum - 1;
// move all walls in sectors
for (k = startwall; k <= endwall; k++)
for(auto& wal : wallsofsector(*sectp))
{
// for morph point - tornado style
if (wall[k].lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
if (wal.lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
sop->morph_wall_point = k;
if (wall[k].extra && TEST(wall[k].extra, WALLFX_LOOP_OUTER))
if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER))
FoundOutsideLoop = true;
// each wall has this set - for collision detection
SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
uint16_t const nextwall = wall[k].nextwall;
if (validWallIndex(nextwall))
SET(wall[nextwall].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
SET(wal.extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
if (wal.twoSided())
SET(wal.nextWall()->extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
}
}
@ -2082,8 +2078,7 @@ SECTOR_OBJECTp DetectSectorObjectByWall(WALLp wph)
// if outer wall check the NEXTWALL also
if (TEST(wp->extra, WALLFX_LOOP_OUTER))
{
uint16_t const nextwall = wp->nextwall;
if (validWallIndex(nextwall) && wph == &wall[nextwall])
if (wp->twoSided() && wph == wp->nextWall())
return sop;
}