- sector wall access cleanup.

lastWall was only used twice and firstWall() + index can be done better now.
This commit is contained in:
Christoph Oelckers 2022-11-15 15:31:52 +01:00
parent 7d9a4ea70d
commit af60408e63
6 changed files with 11 additions and 12 deletions

View file

@ -428,7 +428,6 @@ struct sectortype
int getfloorslope() const { return floorstat & CSTAT_SECTOR_SLOPE ? floorheinum : 0; }
int getceilingslope() const { return ceilingstat & CSTAT_SECTOR_SLOPE ? ceilingheinum : 0; }
walltype* firstWall() const { return walls.Data(); }
walltype* lastWall() const { return &walls.Last(); }
Blood::XSECTOR& xs() const { return *_xs; }

View file

@ -410,7 +410,7 @@ void HWDrawInfo::CreateScene(bool portal)
auto sect = eff.geosectorwarp[i];
for (unsigned w = 0; w < sect->walls.Size(); w++)
{
auto wal = sect->firstWall() + w;
auto wal = &sect->walls[w];
wal->pos.X += eff.geox[i];
wal->pos.Y += eff.geoy[i];
}
@ -429,7 +429,7 @@ void HWDrawInfo::CreateScene(bool portal)
auto sect = eff.geosectorwarp[i];
for (unsigned w = 0; w < sect->walls.Size(); w++)
{
auto wal = sect->firstWall() + w;
auto wal = &sect->walls[w];
wal->pos.X -= eff.geox[i];
wal->pos.Y -= eff.geoy[i];
}
@ -442,7 +442,7 @@ void HWDrawInfo::CreateScene(bool portal)
auto sect = eff.geosectorwarp2[i];
for (unsigned w = 0; w < sect->walls.Size(); w++)
{
auto wal = sect->firstWall() + w;
auto wal = &sect->walls[w];
wal->pos.X += eff.geox2[i];
wal->pos.Y += eff.geoy2[i];
}
@ -460,7 +460,7 @@ void HWDrawInfo::CreateScene(bool portal)
auto sect = eff.geosectorwarp2[i];
for (unsigned w = 0; w < sect->walls.Size(); w++)
{
auto wal = sect->firstWall() + w;
auto wal = &sect->walls[w];
wal->pos.X -= eff.geox2[i];
wal->pos.Y -= eff.geoy2[i];
}

View file

@ -2168,7 +2168,7 @@ void AlignSlopes(void)
{
if (sect.slopewallofs)
{
walltype* pWall = sect.firstWall() + sect.slopewallofs;
walltype* pWall = &sect.walls[sect.slopewallofs];
if (pWall->twoSided())
{
auto pNextSector = pWall->nextSector();

View file

@ -3386,7 +3386,7 @@ void moveeffectors_r(void) //STATNUM 3
if (act->spr.lotag != SE_29_WAVES) continue;
auto sc = act->sector();
if (sc->walls.Size() != 4) continue;
auto wal = sc->firstWall() + 2;
auto wal = &sc->walls[2];
if (wal->nextSector()) alignflorslope(act->sector(), DVector3(wal->pos, wal->nextSector()->floorz));
}
}

View file

@ -2609,7 +2609,7 @@ void DoSineWaveFloor(void)
if (sect->walls.Size() == 4)
{
//Set wal to the wall on the opposite side of the sector
wal = sect->firstWall() + 2;
wal = &sect->walls[2];
//Pass (Sector, x, y, z)
alignflorslope(sect,DVector3(wal->pos, wal->nextSector()->floorz));

View file

@ -248,8 +248,8 @@ void DoSlidorInterp(DSWActor* actor, INTERP_FUNC interp_func)
auto sect = actor->sector();
// this code is just weird.
auto startWall = sect->firstWall();
auto endWall = sect->lastWall();
auto startWall = &sect->walls[0];
auto endWall = &sect->walls.Last();
auto wal = startWall;
do
{
@ -306,8 +306,8 @@ int DoSlidorMoveWalls(DSWActor* actor, double amt)
auto sect = actor->sector();
// this code is just weird.
auto startWall = sect->firstWall();
auto endWall = sect->lastWall();
auto startWall = &sect->walls[0];
auto endWall = &sect->walls.Last();
auto wal = startWall;
walltype* pwal;