- eliminated wallsofsector.

This commit is contained in:
Christoph Oelckers 2022-11-15 15:24:17 +01:00
parent 84b17a8a53
commit 7d9a4ea70d
38 changed files with 119 additions and 129 deletions

View file

@ -250,7 +250,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
auto const sec = &sector[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)
{

View file

@ -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;

View file

@ -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)? &sectortype::ceilingz : &sectortype::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)
{

View file

@ -463,16 +463,6 @@ inline int I_GetBuildTime()
return I_GetTime(120);
}
inline TArrayView<walltype> wallsofsector(const sectortype* sec)
{
return TArrayView<walltype>(sec->firstWall(), sec->walls.Size());
}
inline TArrayView<walltype> wallsofsector(int sec)
{
return wallsofsector(&sector[sec]);
}
// these are mainly meant as refactoring aids to mark function calls to work on.
inline int wallindex(const walltype* wal)
{

View file

@ -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);

View file

@ -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(&sect))
for (auto& wal : sect.walls)
{
if (wal.sector == -1)
wal.sector = i;

View file

@ -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();

View file

@ -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);

View file

@ -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();

View file

@ -181,7 +181,7 @@ TArray<DBloodActor*> getSpritesNearWalls(sectortype* pSrcSect, double nDist)
{
TArray<DBloodActor*> out;
for(auto& wal : wallsofsector(pSrcSect))
for(auto& wal : pSrcSect->walls)
{
if (!wal.twoSided())
continue;

View file

@ -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(&sect))
for (auto& wal : sect.walls)
{
wal.shade -= v4;
if (pXSector->color)

View file

@ -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;
}

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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;
}
}

View file

@ -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)
{

View file

@ -469,7 +469,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& 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;

View file

@ -753,7 +753,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& 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;

View file

@ -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.);

View file

@ -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;

View file

@ -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)

View file

@ -668,7 +668,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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<DDukeActor*>* 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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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(&sect))
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(&sect))
for (auto& wal : sect.walls)
{
if (wal.pal == 1) {
wal.pal = 0;
@ -2623,7 +2623,7 @@ void PostProcess()
sect.pSoundSect = &sect;
sect.Sound = StaticSound[kSound62];
for(auto& wal : wallsofsector(&sect))
for(auto& wal : sect.walls)
{
if (wal.picnum == kTile3603)
{

View file

@ -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++;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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)
{

View file

@ -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();

View file

@ -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));

View file

@ -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())
{

View file

@ -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++;

View file

@ -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);
}

View file

@ -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)

View file

@ -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)