- use wallsofsector for all remaining iterations over a sector's walls.

This commit is contained in:
Christoph Oelckers 2021-11-18 23:00:24 +01:00
parent ac5425a545
commit 0d8b380b05
3 changed files with 21 additions and 37 deletions

View file

@ -283,7 +283,6 @@ void ms(DDukeActor* const actor)
{ {
//T1,T2 and T3 are used for all the sector moving stuff!!! //T1,T2 and T3 are used for all the sector moving stuff!!!
int startwall, endwall, x;
int tx, ty; int tx, ty;
auto s = actor->s; auto s = actor->s;
@ -293,17 +292,14 @@ void ms(DDukeActor* const actor)
int j = actor->temp_data[1]; int j = actor->temp_data[1];
int k = actor->temp_data[2]; int k = actor->temp_data[2];
startwall = s->sector()->wallptr; for(auto& wal : wallsofsector(s->sectnum))
endwall = startwall + s->sector()->wallnum;
for (x = startwall; x < endwall; x++)
{ {
rotatepoint( rotatepoint(
0, 0, 0, 0,
msx[j], msy[j], msx[j], msy[j],
k & 2047, &tx, &ty); k & 2047, &tx, &ty);
dragpoint(x, s->x + tx, s->y + ty); dragpoint(&wal, s->x + tx, s->y + ty);
j++; j++;
} }
} }
@ -3629,19 +3625,13 @@ void handle_se11(DDukeActor *actor)
if (t[4]) if (t[4])
{ {
int startwall, endwall; for(auto& wal : wallsofsector(sc))
startwall = sc->wallptr;
endwall = startwall + sc->wallnum;
for (int j = startwall; j < endwall; j++)
{ {
DukeStatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
while (auto ac = it.Next()) while (auto ac = it.Next())
{ {
auto sk = ac->s; auto sk = ac->s;
if (sk->extra > 0 && badguy(ac) && clipinsidebox(sk->x, sk->y, j, 256L) == 1) if (sk->extra > 0 && badguy(ac) && clipinsidebox(sk->x, sk->y, wallnum(&wal), 256) == 1)
return; return;
} }
} }
@ -3652,13 +3642,13 @@ void handle_se11(DDukeActor *actor)
ms(actor); ms(actor);
setsprite(actor, s->pos); setsprite(actor, s->pos);
for (int j = startwall; j < endwall; j++) for(auto& wal : wallsofsector(sc))
{ {
DukeStatIterator it(STAT_PLAYER); DukeStatIterator it(STAT_PLAYER);
while (auto ac = it.Next()) while (auto ac = it.Next())
{ {
auto sk = ac->s; auto sk = ac->s;
if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, j, 144L) == 1) if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, wallnum(&wal), 144) == 1)
{ {
t[5] = 8; // Delay t[5] = 8; // Delay
t[2] -= k; t[2] -= k;
@ -3696,14 +3686,14 @@ void handle_se12(DDukeActor *actor, int planeonly)
sc->floorpal = 0; sc->floorpal = 0;
sc->ceilingpal = 0; sc->ceilingpal = 0;
auto wal = sc->firstWall(); for (auto& wal : wallsofsector(sc))
for (int j = sc->wallnum; j > 0; j--, wal++)
if (wal->hitag != 1)
{ {
wal->shade = t[1]; if (wal.hitag != 1)
wal->pal = 0; {
wal.shade = t[1];
wal.pal = 0;
}
} }
sc->floorshade = t[1]; sc->floorshade = t[1];
sc->ceilingshade = t[2]; sc->ceilingshade = t[2];
t[0] = 0; t[0] = 0;
@ -3737,12 +3727,13 @@ void handle_se12(DDukeActor *actor, int planeonly)
if (planeonly != 2) sc->floorshade -= 2; if (planeonly != 2) sc->floorshade -= 2;
if (planeonly != 1) sc->ceilingshade -= 2; if (planeonly != 1) sc->ceilingshade -= 2;
auto wal = sc->firstWall(); for (auto& wal : wallsofsector(sc))
for (int j = sc->wallnum; j > 0; j--, wal++)
if (wal->hitag != 1)
{ {
wal->pal = s->pal; if (wal.hitag != 1)
wal->shade -= 2; {
wal.pal = s->pal;
wal.shade -= 2;
}
} }
} }
else t[0] = 2; else t[0] = 2;
@ -3809,9 +3800,8 @@ void handle_se13(DDukeActor* actor)
if (s->ang == 512) if (s->ang == 512)
{ {
auto wal = sc->firstWall(); for (auto& wal : wallsofsector(sc))
for (j = sc->wallnum; j > 0; j--, wal++) wal.shade = s->shade;
wal->shade = s->shade;
sc->floorshade = s->shade; sc->floorshade = s->shade;

View file

@ -492,9 +492,6 @@ static void handle_st09(int sn, DDukeActor* actor)
walltype* wallfind[2]; walltype* wallfind[2];
sectortype* sptr = &sector[sn]; sectortype* sptr = &sector[sn];
int startwall = sptr->wallptr;
int endwall = startwall + sptr->wallnum - 1;
sp = sptr->extra >> 4; sp = sptr->extra >> 4;
//first find center point by averaging all points //first find center point by averaging all points

View file

@ -619,7 +619,7 @@ void spawneffector(DDukeActor* actor)
auto sectp = sp->sector(); auto sectp = sp->sector();
int sect = sp->sectnum; int sect = sp->sectnum;
auto t = actor->temp_data; auto t = actor->temp_data;
int startwall, endwall, d, clostest = 0; int d, clostest = 0;
sp->yvel = sectp->extra; sp->yvel = sectp->extra;
sp->cstat |= 32768; sp->cstat |= 32768;
@ -792,9 +792,6 @@ void spawneffector(DDukeActor* actor)
int q; int q;
walltype* closewall = nullptr; walltype* closewall = nullptr;
startwall = sectp->wallptr;
endwall = startwall + sectp->wallnum;
//find the two most clostest wall x's and y's //find the two most clostest wall x's and y's
q = 0x7fffffff; q = 0x7fffffff;