- got rid of most nextsector references.

This commit is contained in:
Christoph Oelckers 2021-11-24 21:20:22 +01:00
parent 612a9e258e
commit d0eece244b
6 changed files with 27 additions and 38 deletions

View file

@ -43,7 +43,7 @@ typedef struct
DSWActor* cameraActor; // Contains number of ST1 sprite used as a camera
DSWActor* camspriteActor; // sprite pointing to campic
walltype* mirrorWall; // Wall number containing the mirror tile
sectortype* mirrorSector; // nextsector used internally to draw mirror rooms
sectortype* mirrorSector; // used internally to draw mirror rooms
short campic; // Editart tile number to draw a screen to
short numspawnspots; // Number of spawnspots used
short spawnspots[MAXMIRRORMONSTERS]; // One spot for each possible skill level for a max of up to 4 coolie ghosts to spawn.

View file

@ -3410,7 +3410,7 @@ void DoPlayerClimb(PLAYERp pp)
ny = MOVEy(100, lsp->ang);
// set ladder sector
pp->LadderSector = wp->nextsector >= 0? wp->nextsector : wp->sector;
pp->LadderSector = wp->twoSided()? wp->nextsector : wp->sector;
// set players "view" distance from the ladder - needs to be farther than
// the sprite
@ -3804,15 +3804,7 @@ bool PlayerOnLadder(PLAYERp pp)
nx = MOVEx(100, lsp->ang);
ny = MOVEy(100, lsp->ang);
#if DEBUG
if (wall[wal].nextsector < 0)
{
I_Error("Take out white wall ladder x = %d, y = %d",wall[wal].x, wall[wal].y);
}
#endif
pp->LadderSector = wall[wal].nextsector >= 0 ? wall[wal].nextsector : wall[wal].sector;
//DSPRINTF(ds, "Ladder Sector %d", pp->LadderSector);
pp->LadderSector = wall[wal].twoSided() ? wall[wal].nextsector : wall[wal].sector;
MONO_PRINT(ds);
// set players "view" distance from the ladder - needs to be farther than

View file

@ -2539,8 +2539,7 @@ void DoSineWaveFloor(void)
wal = &wall[sector[swf->sector].wallptr+2];
//Pass (Sector, x, y, z)
alignflorslope(swf->sector,wal->x,wal->y,
sector[wal->nextsector].floorz);
alignflorslope(swf->sector,wal->x,wal->y, wal->nextSector()->floorz);
}
}
}

View file

@ -1476,7 +1476,6 @@ void PreMapCombineFloors(void)
int i, j, k;
int base_offset;
int dx, dy;
int startwall, endwall, nextsector;
short pnum;
typedef struct
@ -1520,8 +1519,8 @@ void PreMapCombineFloors(void)
dx = BoundList[base_offset].offset->x - BoundList[i].offset->x;
dy = BoundList[base_offset].offset->y - BoundList[i].offset->y;
BFSSearch search(numsectors, BoundList[i].offset->sectnum);
for (unsigned dasect; (dasect = search.GetNext()) != BFSSearch::EOL;)
BFSSectorSearch search(&sector[BoundList[i].offset->sectnum]);
while (auto dasect = search.GetNext())
{
SWSectIterator it(dasect);
while (auto jActor = it.Next())
@ -1535,18 +1534,17 @@ void PreMapCombineFloors(void)
wal.x += dx;
wal.y += dy;
nextsector = wal.nextsector;
if (nextsector >= 0)
search.Add(nextsector);
if (wal.twoSided())
search.Add(wal.nextSector());
}
}
TRAVERSE_CONNECT(pnum)
{
PLAYERp pp = &Player[pnum];
unsigned dasect = pp->cursectnum;
auto dasect = pp->cursector();
search.Rewind();
for (unsigned itsect; (itsect = search.GetNext()) != BFSSearch::EOL;)
while (auto itsect = search.GetNext())
{
if (itsect == dasect)
{
@ -1575,7 +1573,7 @@ void TraverseSectors(short start_sect)
{
int i, j, k;
short sectlist[M AXSECTORS];
short sectlistplc, sectlistend, sect, startwall, endwall, nextsector;
short sectlistplc, sectlistend, sect, startwall, endwall, nextSector;
sectlist[0] = start_sect;
sectlistplc = 0; sectlistend = 1;
@ -1588,21 +1586,21 @@ void TraverseSectors(short start_sect)
for (j=startwall; j<endwall; j++)
{
nextsector = wall[j].nextsector;
nextSector = wall[j].nextSector;
if (nextsector < 0)
if (nextSector < 0)
continue;
// make sure its not on the list
for (k = sectlistend-1; k >= 0; k--)
{
if (sectlist[k] == nextsector)
if (sectlist[k] == nextSector)
break;
}
// if its not on the list add it to the end
if (k < 0)
sectlist[sectlistend++] = nextsector;
sectlist[sectlistend++] = nextSector;
}
}

View file

@ -3509,16 +3509,20 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
ActorLeaveTrack(actor);
return false;
}
auto wal = &wall[hit_wall];
#if DEBUG
if (wall[hit_wall].nextsector < 0)
if (wal->nextsector < 0)
{
I_Error("Take out white wall ladder x = %d, y = %d",wall[hit_wall].x, wall[hit_wall].y);
I_Error("Take out white wall ladder x = %d, y = %d",wal->x, wal->y);
}
#endif
// destination z for climbing
u->sz = sector[wall[hit_wall].nextsector].floorz;
if (wal->twoSided())
u->sz = wal->nextSector()->floorz;
else
u->sz = wal->sectorp()->ceilingz; // don't crash on bad setups.
DoActorZrange(actor);

View file

@ -7298,10 +7298,9 @@ short StatBreakList[] =
void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, int radius)
{
int k;
int sect, startwall, endwall, nextsector;
int xmid,ymid;
int dist;
short break_count;
int break_count;
int sectnum;
int wall_ang;
@ -7314,9 +7313,8 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
break_count = 0;
BFSSearch search(numsectors, start_sect);
for (unsigned sect; (sect = search.GetNext()) != BFSSearch::EOL;)
BFSSectorSearch search(&sector[start_sect]);
while (auto sect = search.GetNext())
{
for(auto& wal : wallsofsector(sect))
{
@ -7348,10 +7346,8 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
}
}
nextsector = wal.nextsector;
if (nextsector >= 0)
search.Add(nextsector);
if (wal.twoSided())
search.Add(wal.nextSector());
}
}