diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index f49be0cc9..4b46208d6 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -250,7 +250,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, auto const sec = §or[dasect]; - for (auto& wal : wallsofsector(sec)) + for (auto& wal : sec->walls) { auto const wal2 = wal.point2Wall(); vec2_t p1 = wal.wall_int_pos(); @@ -293,7 +293,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, && inside(pos->X * inttoworld, pos->Y * inttoworld, sec) == 1) { bool found = false; - for (auto& wwal : wallsofsector(sec)) + for (auto& wwal : sec->walls) { if (wwal.nextsector == initialsectnum) { diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 31ec6e8f2..986a0fd58 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -272,7 +272,7 @@ void MarkSectorSeen(sectortype* sec) if (sec) { show2dsector.Set(sectindex(sec)); - for (auto& wal : wallsofsector(sec)) + for (auto& wal : sec->walls) { if (!wal.twoSided()) continue; const auto bits = (CSTAT_WALL_BLOCK | CSTAT_WALL_MASKED | CSTAT_WALL_1WAY | CSTAT_WALL_BLOCK_HITSCAN); @@ -395,7 +395,7 @@ static void drawredlines(const DVector2& cpos, const DVector2& cangvect, const D double z1 = sector[i].ceilingz; double z2 = sector[i].floorz; - for (auto& wal : wallsofsector(i)) + for (auto& wal : sector[i].walls) { if (!wal.twoSided()) continue; @@ -426,7 +426,7 @@ static void drawwhitelines(const DVector2& cpos, const DVector2& cangvect, const { if (!gFullMap && !show2dsector[i] && !isSWALL()) continue; - for (auto& wal : wallsofsector(i)) + for (auto& wal : sector[i].walls) { if (wal.nextwall >= 0) continue; if (!gFullMap && !tileGetTexture(wal.picnum)->isValid()) continue; diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 844bab19d..125ef9562 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -180,7 +180,7 @@ double SquareDistToSector(double px, double py, const sectortype* sect, DVector2 double bestdist = DBL_MAX; DVector2 bestpt = { px, py }; - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { DVector2 pt; auto dist = SquareDistToWall(px, py, &wal, &pt); @@ -383,7 +383,7 @@ void checkRotatedWalls() bool sectorsConnected(int sect1, int sect2) { - for (auto& wal : wallsofsector(sect1)) + for (auto& wal : sector[sect1].walls) { if (wal.nextsector == sect2) return true; } @@ -428,7 +428,7 @@ int inside(double x, double y, const sectortype* sect) if (sect) { int64_t acc = 1; - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { acc ^= checkforinside(x, y, wal.pos, wal.point2Wall()->pos); } @@ -469,7 +469,7 @@ sectortype* nextsectorneighborzptr(sectortype* sectp, double startz, int flags) const auto planez = (flags & Find_Ceiling)? §ortype::ceilingz : §ortype::floorz; startz *= factor; - for(auto& wal : wallsofsector(sectp)) + for(auto& wal : sectp->walls) { if (wal.twoSided()) { @@ -506,7 +506,7 @@ bool cansee(const DVector3& start, sectortype* sect1, const DVector3& end, secto while (auto sec = search.GetNext()) { - for (auto& wal : wallsofsector(sec)) + for (auto& wal : sec->walls) { double factor = InterceptLineSegments(start.X, start.Y, delta.X, delta.Y, wal.pos.X, wal.pos.Y, wal.delta().X, wal.delta().Y, nullptr, true); if (factor < 0 || factor >= 1) continue; @@ -802,7 +802,7 @@ int hitscan(const DVector3& start, const sectortype* startsect, const DVector3& } // check all walls in this sector - for (auto& w : wallsofsector(sec)) + for (auto& w : sec->walls) { hit = checkWallHit(&w, EWallFlags::FromInt(wallflags), start, vect, v, hitfactor); if (hit > 0) @@ -997,7 +997,7 @@ void getzrange(const DVector3& pos, sectortype* sect, double* ceilz, CollisionBa BFSSectorSearch search(sect); while (auto sec = search.GetNext()) { - for (auto& wal : wallsofsector(sec)) + for (auto& wal : sec->walls) { if (checkRangeOfWall(&wal, EWallFlags::FromInt(dawalclipmask), pos, maxdist + 1 / 16., theZs)) { @@ -1098,7 +1098,7 @@ void neartag(const DVector3& pos, sectortype* startsect, DAngle angle, HitInfoBa while (auto sect = search.GetNext()) { - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { const auto nextsect = wal.nextSector(); @@ -1217,10 +1217,10 @@ int pushmove(DVector3& pos, sectortype** pSect, double walldist, double ceildist while (auto sec = search.GetNext()) { - // this must go both forward and backward so we cannot use wallsofsector. Pity + // this must go both forward and backward so we cannot use iterators. Pity for (unsigned i = 0; i < sec->walls.Size(); i++) { - auto wal = direction > 0 ? sec->firstWall() + i : sec->lastWall() - i; + auto wal = direction > 0 ? &sec->walls[i] : &sec->walls[sec->walls.Size() - i]; if (IsCloseToWall(pos.XY(), wal, walldist - 0.25) == EClose::InFront) { diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 3ac3db6d1..d7de29dcd 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -463,16 +463,6 @@ inline int I_GetBuildTime() return I_GetTime(120); } -inline TArrayView wallsofsector(const sectortype* sec) -{ - return TArrayView(sec->firstWall(), sec->walls.Size()); -} - -inline TArrayView wallsofsector(int sec) -{ - return wallsofsector(§or[sec]); -} - // these are mainly meant as refactoring aids to mark function calls to work on. inline int wallindex(const walltype* wal) { diff --git a/source/core/interpolate.cpp b/source/core/interpolate.cpp index a72b3beb6..d7acccabe 100644 --- a/source/core/interpolate.cpp +++ b/source/core/interpolate.cpp @@ -212,7 +212,7 @@ void ClearMovementInterpolations() void setsectinterpolate(sectortype* sect) { - for (auto&wal : wallsofsector(sect)) + for (auto&wal : sect->walls) { StartInterpolation(&wal, Interp_Wall_X); StartInterpolation(&wal, Interp_Wall_Y); @@ -230,7 +230,7 @@ void setsectinterpolate(sectortype* sect) void clearsectinterpolate(sectortype* sect) { - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { StopInterpolation(&wal, Interp_Wall_X); StopInterpolation(&wal, Interp_Wall_Y); diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 2ba28f887..76cde78fb 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -251,11 +251,11 @@ static void ReadWallV5(FileReader& fr, walltype& wall) static void SetWallPalV5() { - for (unsigned i = 0; i < sector.Size(); i++) + for (auto& sect : sector) { - for(auto& wal : wallsofsector(i)) + for(auto& wal : sect.walls) { - wal.pal = sector[i].floorpal; + wal.pal = sect.floorpal; } } } @@ -806,7 +806,7 @@ void setWallSectors() for(auto& sect: sector) { sect.dirty = EDirty::AllDirty; - for (auto& wal : wallsofsector(§)) + for (auto& wal : sect.walls) { if (wal.sector == -1) wal.sector = i; diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 28ee78c30..d24d18688 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -58,7 +58,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos) double tx = tspr->pos.X; double ty = tspr->pos.Y; - for(auto& wal : wallsofsector(sect)) + for(auto& wal : sect->walls) { // Intentionally include two sided walls. Even on them the sprite should be projected onto the wall for better results. auto d = wal.delta(); diff --git a/source/core/updatesector.h b/source/core/updatesector.h index 23f3b15e5..c407898dc 100644 --- a/source/core/updatesector.h +++ b/source/core/updatesector.h @@ -59,7 +59,7 @@ void DoUpdateSector(double x, double y, double z, int* sectnum, double maxDistan return; } - for (auto& wal : wallsofsector(lsect)) + for (auto& wal : lsect->walls) { if (wal.twoSided() && !search.Check(wal.nextsector) && (iter == 0 || SquareDistToWall(x, y, &wal) <= maxDistSq)) search.Add(wal.nextsector); diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index ce0ed268b..108c03456 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -554,7 +554,7 @@ BitArray GetClosestSpriteSectors(sectortype* pSector, const DVector2& pos, int n while (auto pCurSector = search.GetNext()) { - for (auto& wal : wallsofsector(pCurSector)) + for (auto& wal : pCurSector->walls) { if (!wal.twoSided()) continue; const auto pNextSector = wal.nextSector(); diff --git a/source/games/blood/src/nnsprinsect.cpp b/source/games/blood/src/nnsprinsect.cpp index 72da90462..5e49b8427 100644 --- a/source/games/blood/src/nnsprinsect.cpp +++ b/source/games/blood/src/nnsprinsect.cpp @@ -181,7 +181,7 @@ TArray getSpritesNearWalls(sectortype* pSrcSect, double nDist) { TArray out; - for(auto& wal : wallsofsector(pSrcSect)) + for(auto& wal : pSrcSect->walls) { if (!wal.twoSided()) continue; diff --git a/source/games/blood/src/sectorfx.cpp b/source/games/blood/src/sectorfx.cpp index 666ea39f8..3bba9f272 100644 --- a/source/games/blood/src/sectorfx.cpp +++ b/source/games/blood/src/sectorfx.cpp @@ -155,7 +155,7 @@ void DoSectorLighting(void) } if (pXSector->shadeWalls) { - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { wal.shade -= v4; if (pXSector->color) @@ -197,7 +197,7 @@ void DoSectorLighting(void) } if (pXSector->shadeWalls) { - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { wal.shade = ClipRange(wal.shade + v4, -128, 127); if (pXSector->color && v4 != 0) @@ -249,7 +249,7 @@ void UndoSectorLighting(void) } if (pXSector->shadeWalls) { - for (auto& wal : wallsofsector(§)) + for (auto& wal : sect.walls) { wal.shade -= v4; if (pXSector->color) diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 7dbfb34db..10b2a94cd 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -856,14 +856,14 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec if (bAllWalls) { - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { rotatewall(&wal, ptang_w2, offset); } } else { - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { auto p2Wall = wal.point2Wall(); if (wal.cstat & CSTAT_WALL_MOVE_FORWARD) @@ -2256,7 +2256,7 @@ static void UpdateBasePoints(sectortype* pSector) } #endif - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { wal.baseWall = wal.pos; } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index fa9dc0800..410ef4053 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -291,7 +291,7 @@ void movesector(DDukeActor* const actor, int msindex, DAngle rotation) //T1,T2 and T3 are used for all the sector moving stuff!!! actor->spr.pos.XY() += actor->spr.angle.ToVector() * actor->vel.X; - for(auto& wal : wallsofsector(actor->sector())) + for(auto& wal : actor->sector()->walls) { dragpoint(&wal, actor->spr.pos.XY() + mspos[msindex].Rotated(rotation)); msindex++; @@ -321,7 +321,7 @@ void movecyclers(void) c->lotag += sect->extra; if (c->state) { - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { if (wal.hitag != 1) { @@ -2865,7 +2865,7 @@ void handle_se03(DDukeActor *actor) sc->ceilingshade = actor->temp_data[0]; sc->floorshade = actor->temp_data[0]; - for(auto& wal : wallsofsector(sc)) + for(auto& wal : sc->walls) { if (wal.hitag != 1) { @@ -2914,7 +2914,7 @@ void handle_se04(DDukeActor *actor) sc->floorshade = actor->temp_data[1]; sc->ceilingshade = actor->temp_data[1]; - for (auto& wal : wallsofsector(sc)) + for (auto& wal : sc->walls) { if (j) wal.pal = (palvals & 0xff); else wal.pal = actor->spr.pal; @@ -3079,7 +3079,7 @@ void handle_se08(DDukeActor *actor, bool checkhitag1) auto sect = ac->sector(); int minshade = ac->spr.shade; - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { if (wal.hitag != 1) { @@ -3175,7 +3175,7 @@ void handle_se11(DDukeActor *actor) if (actor->temp_data[4]) { - for(auto& wal : wallsofsector(sc)) + for(auto& wal : sc->walls) { DukeStatIterator it(STAT_ACTOR); while (auto ac = it.Next()) @@ -3191,7 +3191,7 @@ void handle_se11(DDukeActor *actor) movesector(actor, actor->temp_data[1], actor->temp_angle); //SetActor(actor, actor->spr.pos); - for(auto& wal : wallsofsector(sc)) + for(auto& wal : sc->walls) { DukeStatIterator it(STAT_PLAYER); while (auto ac = it.Next()) @@ -3232,7 +3232,7 @@ void handle_se12(DDukeActor *actor, int planeonly) sc->floorpal = 0; sc->ceilingpal = 0; - for (auto& wal : wallsofsector(sc)) + for (auto& wal : sc->walls) { if (wal.hitag != 1) { @@ -3273,7 +3273,7 @@ void handle_se12(DDukeActor *actor, int planeonly) if (planeonly != 2) sc->floorshade -= 2; if (planeonly != 1) sc->ceilingshade -= 2; - for (auto& wal : wallsofsector(sc)) + for (auto& wal : sc->walls) { if (wal.hitag != 1) { @@ -3345,7 +3345,7 @@ void handle_se13(DDukeActor* actor) if (actor->spr.intangle == 512) { - for (auto& wal : wallsofsector(sc)) + for (auto& wal : sc->walls) wal.shade = actor->spr.shade; sc->floorshade = actor->spr.shade; @@ -3697,7 +3697,7 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) if (actor->temp_data[0] == 1) { actor->temp_data[0]++; - for (auto& wal : wallsofsector(sc)) + for (auto& wal : sc->walls) { if (wal.overpicnum == BIGFORCE) { diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index f82046c89..029fd08b7 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -284,7 +284,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h } } - for (auto& wal : wallsofsector(dasectp)) + for (auto& wal : dasectp->walls) { if ((wal.pos - actor->spr.pos.XY()).Sum() < radius) { diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index c0230e095..c5c68778f 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -238,7 +238,7 @@ void dotorch(void) sect->floorshade = shade; break; } - for (auto& wal : wallsofsector(sect)) + for (auto& wal : sect->walls) { if (wal.lotag != 1) { @@ -301,7 +301,7 @@ void dojaildoor(void) } else { - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { DVector2 vec = wal.pos; switch (jd.direction) @@ -388,7 +388,7 @@ void moveminecart(void) } else { - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { auto pos = wal.pos; switch (mc.direction) @@ -415,7 +415,7 @@ void moveminecart(void) auto csect = mc.childsect; double max_x = INT32_MIN, max_y = INT32_MIN, min_x = INT32_MAX, min_y = INT32_MAX; - for (auto& wal : wallsofsector(csect)) + for (auto& wal : csect->walls) { double x = wal.pos.X; double y = wal.pos.Y; @@ -498,7 +498,7 @@ void thunder(void) auto sectp = lightninsector[i]; sectp->floorshade = (int8_t)lightninsectorshade[i]; sectp->ceilingshade = (int8_t)lightninsectorshade[i]; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) wal.shade = (int8_t)lightninsectorshade[i]; } } @@ -520,7 +520,7 @@ void thunder(void) auto sectp = lightninsector[i]; sectp->floorshade = lightninsectorshade[i] - shade; sectp->ceilingshade = lightninsectorshade[i] - shade; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) wal.shade = lightninsectorshade[i] - shade; } } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 89d4348ef..78d69976a 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -243,7 +243,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h } } - for (auto& wal : wallsofsector(dasectp)) + for (auto& wal : dasectp->walls) { if ((wal.pos - actor->spr.pos.XY()).Sum() < radius) { diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index fd2b58f26..945fcbdc1 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -469,7 +469,7 @@ void prelevel_d(int g, TArray& actors) //Invalidate textures in sector behind mirror for (i = 0; i < mirrorcnt; i++) { - for (auto& wal : wallsofsector(mirrorsector[i])) + for (auto& wal : mirrorsector[i]->walls) { wal.picnum = MIRROR; wal.overpicnum = MIRROR; diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 5a2590a55..9a984076d 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -753,7 +753,7 @@ void prelevel_r(int g, TArray& actors) //Invalidate textures in sector behind mirror for (i = 0; i < mirrorcnt; i++) { - for (auto& mwal : wallsofsector(mirrorsector[i])) + for (auto& mwal : mirrorsector[i]->walls) { mwal.picnum = MIRROR; mwal.overpicnum = MIRROR; diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index f8baad3d0..374ee1f86 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -532,7 +532,7 @@ static void handle_st09(sectortype* sptr, DDukeActor* actor) //first find center point by averaging all points dax = 0, day = 0; - for (auto& wal : wallsofsector(sptr)) + for (auto& wal : sptr->walls) { dax += wal.pos.X; day += wal.pos.Y; @@ -544,7 +544,7 @@ static void handle_st09(sectortype* sptr, DDukeActor* actor) // as center (dax, day) - should be 2 points found. wallfind[0] = nullptr; wallfind[1] = nullptr; - for (auto& wal : wallsofsector(sptr)) + for (auto& wal : sptr->walls) // more precise checks won't work here. if (abs(wal.pos.X - dax) <= (1 / 32.) || abs(wal.pos.Y - day) <= (1 / 32.)) { @@ -997,7 +997,7 @@ void operatesectors(sectortype* sptr, DDukeActor *actor) case 7: if (!isRR()) break; - for (auto& wal : wallsofsector(sptr)) + for (auto& wal : sptr->walls) { setanimation(sptr, anim_vertexx, &wal, wal.pos.X + 64, 1 / 4.); if (wal.twoSided()) setanimation(sptr, anim_vertexx, wal.nextWall(), wal.nextWall()->pos.X + 64, 1 / 4.); diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index fde94be5b..17d840fdd 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -856,7 +856,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw if (!wal->twoSided()) return; darkestwall = 0; - for (auto& wl : wallsofsector(wal->nextSector())) + for (auto& wl : wal->nextSector()->walls) if (wl.shade > darkestwall) darkestwall = wl.shade; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 74f68cae1..87fbc769d 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -1082,7 +1082,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw act->spriteextra++; if (act->spriteextra == 25) { - for(auto& wl : wallsofsector(act->sector())) + for(auto& wl : act->sector()->walls) { if (wl.twoSided()) wl.nextSector()->lotag = 0; } @@ -1338,7 +1338,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw if (!wal->twoSided()) return; darkestwall = 0; - for (auto& wl : wallsofsector(wal->nextSector())) + for (auto& wl : wal->nextSector()->walls) if (wl.shade > darkestwall) darkestwall = wl.shade; @@ -2718,7 +2718,7 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) if (movestep == 0) movestep = 4 * maptoworld; double max_x = INT32_MIN, max_y = INT32_MIN, min_x = INT32_MAX, min_y = INT32_MAX; - for (auto& wal : wallsofsector(nextsect)) + for (auto& wal : nextsect->walls) { double x = wal.pos.X; double y = wal.pos.Y; @@ -2744,7 +2744,7 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) !inside(min_x, max_y, sectp)) pos_ok = 0; - for (auto& wal : wallsofsector(nextsect)) + for (auto& wal : nextsect->walls) { switch (wlwal->lotag) { @@ -2764,7 +2764,7 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) { if (S_CheckActorSoundPlaying(ps[snum].GetActor(), 389) == 0) S_PlayActorSound(389, ps[snum].GetActor()); - for(auto& wal : wallsofsector(nextsect)) + for(auto& wal : nextsect->walls) { auto vec = wal.pos; switch (wlwal->lotag) @@ -2791,7 +2791,7 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) else { movestep -= 2 * maptoworld; - for(auto& wal : wallsofsector(nextsect)) + for(auto& wal : nextsect->walls) { auto vec = wal.pos; switch (wlwal->lotag) diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index bc4ea1fc3..aa810d002 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -668,7 +668,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) if (actor->spr.intangle == 512) { - for (auto& wl : wallsofsector(sectp)) + for (auto& wl : sectp->walls) { if (wl.twoSided()) { @@ -721,7 +721,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) walltype* closewall = nullptr; double maxdist = 0x7fffffff; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { double dist = (actor->spr.pos.XY() - wal.pos).LengthSquared(); if (dist < maxdist && &wal != actor->temp_walls[0]) @@ -754,7 +754,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) //fix all the walls; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { if (!(wal.hitag & 1)) wal.shade = actor->spr.shade; @@ -769,7 +769,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) // actor->temp_data[2] = actor->spr.hitag; if (actor->spr.intangle != 1536) sectp->setfloorz(actor->spr.pos.Z); - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) if (wal.hitag == 0) wal.hitag = 9999; StartInterpolation(sectp, Interp_Sect_Floorz); @@ -780,7 +780,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) actor->temp_data[2] = actor->spr.hitag; if (actor->spr.intangle != 1536) sectp->setceilingz(actor->spr.pos.Z); - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) if (wal.hitag == 0) wal.hitag = 9999; StartInterpolation(sectp, Interp_Sect_Ceilingz); @@ -793,7 +793,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) actor->palvals = (sectp->ceilingpal << 8) | sectp->floorpal; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) if (wal.shade > actor->temp_data[3]) actor->temp_data[3] = wal.shade; @@ -810,7 +810,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) actor->temp_data[0] = sectp->floorshade; actor->temp_data[1] = sectp->ceilingshade; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) if (wal.shade > actor->temp_data[2]) actor->temp_data[2] = wal.shade; @@ -825,7 +825,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) actor->temp_data[0] = sectp->floorshade; actor->temp_data[1] = sectp->ceilingshade; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) if (wal.shade > actor->temp_data[2]) actor->temp_data[2] = wal.shade; @@ -886,7 +886,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) } actor->temp_data[1] = mspos.Size(); - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { mspos.Push(wal.pos - actor->spr.pos); } @@ -900,7 +900,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) sectp->hitagactor = actor; sectortype* s = nullptr; - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { if (wal.twoSided() && wal.nextSector()->hitag == 0 && @@ -1078,7 +1078,7 @@ void spriteglass(DDukeActor* actor, int n) void ceilingglass(DDukeActor* actor, sectortype* sectp, int n) { - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { auto pos = wal.pos; auto delta = wal.delta() / (n + 1); diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 2e94526df..f861ebff0 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -227,14 +227,14 @@ void InitNewGame() void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b) { - for(auto& wal1 : wallsofsector(pSectorA)) + for(auto& wal1 : pSectorA->walls) { DVector2 bestxy = { 0x7FFFFFF, 0x7FFFFFF }; DVector2 w1pos = wal1.pos; walltype* bestwall = nullptr; - for(auto& wal2 : wallsofsector(pSectorB)) + for(auto& wal2 : pSectorB->walls) { DVector2 thisxy = w1pos - wal2.pos; diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index 7bc26852a..43e3d916e 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -271,7 +271,7 @@ void AddFlash(sectortype* pSector, const DVector3& pos, int val) int var_14 = 0; - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { sectortype *pNextSector = NULL; if (wal.twoSided()) @@ -618,7 +618,7 @@ void DoGlows() pSector->ceilingshade += nShade; pSector->floorshade += nShade; - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { wal.shade += nShade; } @@ -667,7 +667,7 @@ void DoFlickers() pSector->ceilingshade += shade; pSector->floorshade += shade; - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { wal.shade += shade; } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index e4708eaa1..e426231ae 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -169,7 +169,7 @@ int BelowNear(DExhumedActor* pActor, double walldist) sectortype* pTempSect = nullptr; while (auto pCurSector = search.GetNext()) { - for (auto& wal : wallsofsector(pCurSector)) + for (auto& wal : pCurSector->walls) { if (wal.twoSided()) { @@ -718,7 +718,7 @@ void CreatePushBlock(sectortype* pSector) int nBlock = GrabPushBlock(); DVector2 sum(0, 0); - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { sum += wal.pos; } @@ -736,7 +736,7 @@ void CreatePushBlock(sectortype* pSector) double mindist = 0; - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { double length = (avg - wal.pos).Length(); @@ -904,7 +904,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel) } } - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { dragpoint(&wal, vect + wal.pos); } diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index c22015765..65d90ea38 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -405,7 +405,7 @@ DExhumedActor* FindWallSprites(sectortype* pSector) double max_x = -DBL_MAX; double max_y = -DBL_MAX; - for (auto& wal : wallsofsector(pSector)) + for (auto& wal : pSector->walls) { if (wal.pos.X < min_x) { min_x = wal.pos.X; @@ -1010,7 +1010,7 @@ int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p PointList[nPoint].nNext = -1; PointList[nPoint].pSector = pSector; - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { int ax = SlideData[nSlide].nStart; @@ -1249,7 +1249,7 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx) auto pSector = pActor->sector(); - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { if (var_18 == wal.hitag) { @@ -1526,7 +1526,7 @@ void DimLights() if (sect.floorshade < 100) sect.floorshade++; - for (auto& wal : wallsofsector(§)) + for (auto& wal : sect.walls) { if (wal.shade < 100) wal.shade++; @@ -1616,7 +1616,7 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector) { DVector2 apos(0, 0); - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { apos += wal.pos; @@ -1698,7 +1698,7 @@ void ExplodeEnergyBlock(DExhumedActor* pActor) { auto pSector = pActor->sector(); - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { if (!wal.twoSided()) continue; auto nextwal = wal.nextWall(); @@ -1775,7 +1775,7 @@ void ExplodeEnergyBlock(DExhumedActor* pActor) sect.floorpal = 0; } - for (auto& wal : wallsofsector(§)) + for (auto& wal : sect.walls) { if (wal.pal == 1) { wal.pal = 0; @@ -2623,7 +2623,7 @@ void PostProcess() sect.pSoundSect = § sect.Sound = StaticSound[kSound62]; - for(auto& wal : wallsofsector(§)) + for(auto& wal : sect.walls) { if (wal.picnum == kTile3603) { diff --git a/source/games/exhumed/src/ramses.cpp b/source/games/exhumed/src/ramses.cpp index 200d984a3..4e1aa35b5 100644 --- a/source/games/exhumed/src/ramses.cpp +++ b/source/games/exhumed/src/ramses.cpp @@ -158,7 +158,7 @@ void InitSpiritHead() void DimSector(sectortype* pSector) { - for(auto& wal : wallsofsector(pSector)) + for(auto& wal : pSector->walls) { if (wal.shade < 40) { wal.shade++; diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index 538235921..f81959fd4 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -279,7 +279,7 @@ void so_addinterpolation(SECTOR_OBJECT* sop) for (sectp = sop->sectp; *sectp; sectp++) { - for (auto& wal : wallsofsector(*sectp)) + for (auto& wal : (*sectp)->walls) { so_setpointinterpolation(interp, wallindex(&wal) | soi_wallx); so_setpointinterpolation(interp, wallindex(&wal) | soi_wally); diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index bf2aa3898..2a38cd93e 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -389,7 +389,7 @@ void JS_InitMirrors(void) // Invalidate textures in sector behind mirror for (i = 0; i < mirrorcnt; i++) { - for (auto& wal : wallsofsector(mirror[i].mirrorSector)) + for (auto& wal : mirror[i].mirrorSector->walls) { wal.picnum = MIRROR; wal.overpicnum = MIRROR; diff --git a/source/games/sw/src/light.cpp b/source/games/sw/src/light.cpp index 32941181e..3ed64a58b 100644 --- a/source/games/sw/src/light.cpp +++ b/source/games/sw/src/light.cpp @@ -69,7 +69,7 @@ void SectorLightShade(DSWActor* actor, short intensity) wall_shade = actor->user.WallShade.Data(); int wallcount = 0; - for(auto &wal : wallsofsector(actor->sector())) + for(auto &wal : actor->sector()->walls) { base_shade = wall_shade[wallcount]; wal.shade = base_shade + intensity; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 68e9c62f0..0be2aa489 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -2695,7 +2695,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) { for (sectp = sop->sectp, wallcount = 0, j = 0; *sectp; sectp++, j++) { - for(auto& wal : wallsofsector(*sectp)) + for(auto& wal : (*sectp)->walls) { if (wal.extra && (wal.extra & (WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY)) == WALLFX_LOOP_OUTER) { diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index d488ab9b5..2c96d7518 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -915,7 +915,7 @@ void CollectPortals() floordone.Set(i); for (unsigned ii = 0; ii < fp.sectors.Size(); ii++) { - for (auto& wal : wallsofsector(fp.sectors[ii])) + for (auto& wal : sector[fp.sectors[ii]].walls) { if (!wal.twoSided()) continue; auto nsec = wal.nextSector(); @@ -933,7 +933,7 @@ void CollectPortals() ceilingdone.Set(i); for (unsigned ii = 0; ii < fp.sectors.Size(); ii++) { - for (auto& wal : wallsofsector(fp.sectors[ii])) + for (auto& wal : sector[fp.sectors[ii]].walls) { if (!wal.twoSided()) continue; auto nsec = wal.nextSector(); diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 2d7129a6d..eadcb8c86 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -253,7 +253,7 @@ bool TestRotatorMatchActive(short match) void DoRotatorSetInterp(DSWActor* actor) { - for(auto& wal : wallsofsector(actor->sector())) + for(auto& wal : actor->sector()->walls) { StartInterpolation(&wal, Interp_Wall_X); StartInterpolation(&wal, Interp_Wall_Y); @@ -275,7 +275,7 @@ void DoRotatorSetInterp(DSWActor* actor) void DoRotatorStopInterp(DSWActor* actor) { - for (auto& wal : wallsofsector(actor->sector())) + for (auto& wal : actor->sector()->walls) { StopInterpolation(&wal, Interp_Wall_X); StopInterpolation(&wal, Interp_Wall_Y); @@ -394,7 +394,7 @@ int DoRotator(DSWActor* actor) // move points ndx = 0; - for(auto& wal : wallsofsector(actor->sector())) + for(auto& wal : actor->sector()->walls) { auto nxy = rotatepoint(pivot->spr.pos, r->orig[ndx], DAngle::fromBuild(r->pos)); diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index a0f4b915f..cfe241877 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -639,7 +639,7 @@ DVector3 SectorMidPoint(sectortype* sectp) { DVector3 sum(0,0,0); - for (auto& wal : wallsofsector(sectp)) + for (auto& wal : sectp->walls) { sum += wal.pos; } @@ -704,7 +704,7 @@ void DoSpringBoardDown(void) sectortype* FindNextSectorByTag(sectortype* sect, int tag) { - for(auto& wal : wallsofsector(sect)) + for(auto& wal : sect->walls) { if (wal.twoSided()) { diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 9f279ac78..4298e2fa6 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1525,7 +1525,7 @@ void PreMapCombineFloors(void) jActor->spr.pos += dv; } - for (auto& wal : wallsofsector(dasect)) + for (auto& wal : dasect->walls) { wal.move(wal.pos + dv); @@ -2198,7 +2198,7 @@ void SpriteSetup(void) actor->user.rotator->orig_speed = actor->user.rotator->speed; wallcount = 0; - for(auto& wal : wallsofsector(actor->sector())) + for(auto& wal : actor->sector()->walls) { actor->user.rotator->orig[wallcount] = wal.pos; wallcount++; @@ -2378,7 +2378,7 @@ void SpriteSetup(void) LIGHT_CeilingShade(actor) = actor->sector()->ceilingshade; // count walls of sector - for(auto& wal : wallsofsector(actor->sector())) + for(auto& wal : actor->sector()->walls) { wallcount++; if (TEST_BOOL5(actor)) @@ -2394,7 +2394,7 @@ void SpriteSetup(void) wall_shade = actor->user.WallShade.Data(); // save off original wall shades - for(auto& wal : wallsofsector(actor->sector())) + for(auto& wal : actor->sector()->walls) { wall_shade[wallcount] = wal.shade; wallcount++; @@ -2427,7 +2427,7 @@ void SpriteSetup(void) LIGHT_CeilingShade(actor) = actor->sector()->ceilingshade; // count walls of sector - for (auto& wal : wallsofsector(actor->sector())) + for (auto& wal : actor->sector()->walls) { wallcount++; if (TEST_BOOL5(actor)) @@ -2445,7 +2445,7 @@ void SpriteSetup(void) wall_shade = actor->user.WallShade.Data(); // save off original wall shades - for (auto& wal : wallsofsector(actor->sector())) + for (auto& wal : actor->sector()->walls) { wall_shade[wallcount] = wal.shade; wallcount++; diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index c5e6d1d03..98376c478 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -718,7 +718,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) SectorInBounds = true; - for(auto& wal : wallsofsector(sect)) + for(auto& wal : sect->walls) { // all walls have to be in bounds to be in sector object if (!(wal.pos.X > vlow.X && wal.pos.X < vhigh.X && wal.pos.Y > vlow.Y && wal.pos.Y < vhigh.Y)) @@ -764,7 +764,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { // move all walls in sectors - for(auto& wal : wallsofsector(*sectp)) + for(auto& wal : (*sectp)->walls) { // for morph point - tornado style if (wal.lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT) @@ -1357,7 +1357,7 @@ void PlaceSectorObjectsOnTracks(void) { // move all walls in sectors - for (auto& wal : wallsofsector(sop->sectp[j])) + for (auto& wal : sop->sectp[j]->walls) { sop->orig[sop->num_walls] = sop->pmid - wal.pos; sop->num_walls++; @@ -1567,7 +1567,7 @@ void MovePoints(SECTOR_OBJECT* sop, DAngle deltaangle, const DVector2& move) goto PlayerPart; // move all walls in sectors - for(auto& wal : wallsofsector(*sectp)) + for(auto& wal : (*sectp)->walls) { if ((wal.extra & (WALLFX_LOOP_DONT_SPIN | WALLFX_DONT_MOVE))) continue; @@ -1782,7 +1782,7 @@ void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic) if (!(sop->flags & SOBJ_SPRITE_OBJ)) { // move all walls in sectors back to the original position - for (auto& wal : wallsofsector(*sectp)) + for (auto& wal : (*sectp)->walls) { if (!(wal.extra && (wal.extra & WALLFX_DONT_MOVE))) { @@ -1924,7 +1924,7 @@ SECTOR_OBJECT* DetectSectorObjectByWall(walltype* wph) int j; for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { - for (auto& wal : wallsofsector(*sectp)) + for (auto& wal : (*sectp)->walls) { // if outer wall check the NEXTWALL also if ((wal.extra & WALLFX_LOOP_OUTER)) @@ -1955,7 +1955,7 @@ void CollapseSectorObject(SECTOR_OBJECT* sop, const DVector2& pos) if (!(sop->flags & SOBJ_SPRITE_OBJ)) { // move all walls in sectors back to the original position - for (auto& wal : wallsofsector(*sectp)) + for (auto& wal : (*sectp)->walls) { if ((wal.extra & WALLFX_DONT_MOVE)) continue; @@ -2095,7 +2095,7 @@ void CallbackSOsink(ANIM* ap, void *data) // Take out any blocking walls - for(auto& wal : wallsofsector(destsect)) + for(auto& wal : destsect->walls) { wal.cstat &= ~(CSTAT_WALL_BLOCK); } diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index f132f49cb..08bed420d 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -59,7 +59,7 @@ void SOwallmove(SECTOR_OBJECT* sop, DSWActor* actor, walltype* find_wallp, doubl { // move all walls in sectors back to the original position - for (auto& wal : wallsofsector(*sectp)) + for (auto& wal : (*sectp)->walls) { // find the one wall we want to adjust if (&wal == find_wallp) diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 8aac72508..ec78dc36e 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -7296,7 +7296,7 @@ int DoFlamesDamageTest(DSWActor* actor) walltype* PrevWall(walltype* wall_num) { - for(auto&wal : wallsofsector(wall_num->sectorp())) + for(auto&wal : wall_num->sectorp()->walls) { if (wal.point2Wall() == wall_num) return &wal; } @@ -7333,7 +7333,7 @@ void TraverseBreakableWalls(sectortype* start_sect, const DVector3& pos, DAngle BFSSectorSearch search(start_sect); while (auto sect = search.GetNext()) { - for(auto& wal : wallsofsector(sect)) + for(auto& wal : sect->walls) { // see if this wall should be broken if (wal.lotag == TAG_WALL_BREAK)