— Duke: use twoSided utility where appropriate.

This commit is contained in:
Christoph Oelckers 2021-11-21 08:42:36 +01:00
parent 323b5441d5
commit b1b0c5d25c
10 changed files with 48 additions and 49 deletions

View file

@ -333,7 +333,7 @@ void movecyclers(void)
{
wal.shade = j;
if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.nextwall >= 0)
if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.twoSided())
wal.nextWall()->shade = j;
}
@ -3318,7 +3318,7 @@ void handle_se03(DDukeActor *actor)
if (wal.hitag != 1)
{
wal.shade = t[0];
if ((wal.cstat & 2) && wal.nextwall >= 0)
if ((wal.cstat & 2) && wal.twoSided())
{
wal.nextWall()->shade = wal.shade;
}
@ -3372,7 +3372,7 @@ void handle_se04(DDukeActor *actor)
if (wal.hitag != 1)
{
wal.shade = t[0];
if ((wal.cstat & 2) && wal.nextwall >= 0)
if ((wal.cstat & 2) && wal.twoSided())
wal.nextWall()->shade = wal.shade;
}
}
@ -3546,7 +3546,7 @@ void handle_se08(DDukeActor *actor, bool checkhitag1)
else if (wal.shade > ac->temp_data[2])
wal.shade = ac->temp_data[2];
if (wal.nextwall >= 0)
if (wal.twoSided())
if (wal.nextWall()->hitag != 1)
wal.nextWall()->shade = wal.shade;
}
@ -4721,7 +4721,7 @@ void handle_se128(DDukeActor *actor)
{
wal->cstat &= (255 - 32);
wal->cstat |= 16;
if (wal->nextwall >= 0)
if (wal->twoSided())
{
wal->nextWall()->cstat &= (255 - 32);
wal->nextWall()->cstat |= 16;

View file

@ -4156,7 +4156,7 @@ void destroyit(DDukeActor *actor)
destwal->yrepeat = srcwal->yrepeat;
destwal->xpan_ = srcwal->xpan_;
destwal->ypan_ = srcwal->ypan_;
if (isRRRA() && destwal->nextwall != -1)
if (isRRRA() && destwal->twoSided())
{
destwal->cstat = 0;
destwal->nextWall()->cstat = 0;

View file

@ -1014,17 +1014,17 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
// oh my...
if (FindDistance2D(sx - hitx, sy - hity) < 1024 &&
(wal != nullptr && wal->overpicnum != BIGFORCE) &&
((wal->nextsector >= 0 && hitsectp != nullptr &&
((wal->twoSided() && hitsectp != nullptr &&
wal->nextSector()->lotag == 0 &&
hitsectp->lotag == 0 &&
(hitsectp->floorz - wal->nextSector()->floorz) > (16 << 8)) ||
(wal->nextsector == -1 && hitsectp->lotag == 0)))
(!wal->twoSided() && hitsectp->lotag == 0)))
{
if ((wal->cstat & 16) == 0)
{
if (wal->nextsector >= 0)
if (wal->twoSided())
{
DukeSectIterator it(wal->nextsector);
DukeSectIterator it(wal->nextSector());
while (auto act2 = it.Next())
{
if (act2->s->statnum == STAT_EFFECTOR && act2->s->lotag == SE_13_EXPLOSIVE)
@ -1032,7 +1032,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
}
}
if (wal->nextwall >= 0 &&
if (wal->twoSided() &&
wal->nextWall()->hitag != 0)
return;

View file

@ -291,7 +291,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
auto wal = hitwallp;
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (wal->twoSided())
if (hitz >= (wal->nextSector()->floorz))
wal =wal->nextWall();
@ -504,18 +504,18 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
return;
}
if (wal->hitag != 0 || (wal->nextwall >= 0 && wal->nextWall()->hitag != 0))
if (wal->hitag != 0 || (wal->twoSided() && wal->nextWall()->hitag != 0))
goto SKIPBULLETHOLE;
if (hitsectp && hitsectp->lotag == 0)
if (wal->overpicnum != BIGFORCE)
if ((wal->nextsector >= 0 && wal->nextSector()->lotag == 0) ||
(wal->nextsector == -1 && hitsectp->lotag == 0))
if ((wal->twoSided() && wal->nextSector()->lotag == 0) ||
(!wal->twoSided() && hitsectp->lotag == 0))
if ((wal->cstat & 16) == 0)
{
if (wal->nextsector >= 0)
if (wal->twoSided())
{
DukeSectIterator it(wal->nextsector);
DukeSectIterator it(wal->nextSector());
while (auto l = it.Next())
{
if (l->s->statnum == 3 && l->s->lotag == 13)
@ -543,7 +543,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
SKIPBULLETHOLE:
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (wal->twoSided())
if (hitz >= (wal->nextSector()->floorz))
wal = wal->nextWall();
@ -889,7 +889,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
if (((hitx - sx) * (hitx - sx) + (hity - sy) * (hity - sy)) < (290 * 290))
{
if (wal->nextsector >= 0)
if (wal->twoSided())
{
if (wal->nextSector()->lotag <= 2 && hitsectp->lotag <= 2)
j = 1;
@ -2080,7 +2080,7 @@ int operateTripbomb(int snum)
}
if (j == nullptr && wal != nullptr && (wal->cstat & 16) == 0)
if ((wal->nextsector >= 0 && wal->nextSector()->lotag <= 2) || (wal->nextsector == -1 && hitsectp->lotag <= 2))
if ((wal->twoSided() && wal->nextSector()->lotag <= 2) || (!wal->twoSided() && hitsectp->lotag <= 2))
if (((sx - p->pos.x) * (sx - p->pos.x) + (sy - p->pos.y) * (sy - p->pos.y)) < (290 * 290))
{
p->pos.z = p->oposz;

View file

@ -177,7 +177,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
else if (wal)
{
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (wal->twoSided())
if (hitz >= (wal->nextSector()->floorz))
wal = wal->nextWall();
@ -395,18 +395,18 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
return;
}
if (wal->hitag != 0 || (wal->nextwall >= 0 && wal->nextWall()->hitag != 0))
if (wal->hitag != 0 || (wal->twoSided() && wal->nextWall()->hitag != 0))
goto SKIPBULLETHOLE;
if (hitsectp != nullptr && hitsectp->lotag == 0)
if (wal->overpicnum != BIGFORCE)
if ((wal->nextsector >= 0 && wal->nextSector()->lotag == 0) ||
(wal->nextsector == -1 && hitsectp->lotag == 0))
if ((wal->twoSided() && wal->nextSector()->lotag == 0) ||
(!wal->twoSided() && hitsectp->lotag == 0))
if ((wal->cstat & 16) == 0)
{
if (wal->nextsector >= 0)
if (wal->twoSided())
{
DukeSectIterator it(wal->nextsector);
DukeSectIterator it(wal->nextSector());
while (auto l = it.Next())
{
if (l->s->statnum == 3 && l->s->lotag == 13)
@ -434,7 +434,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
SKIPBULLETHOLE:
if (wal->cstat & 2)
if (wal->nextsector >= 0)
if (wal->twoSided())
if (hitz >= (wal->nextSector()->floorz))
wal = wal->nextWall();

View file

@ -426,7 +426,7 @@ void prelevel_d(int g)
wal.cstat = 0;
else wal.cstat |= 85 + 256;
if (wal.lotag && wal.nextwall >= 0)
if (wal.lotag && wal.twoSided())
wal.nextWall()->lotag = wal.lotag;
[[fallthrough]];

View file

@ -974,7 +974,7 @@ void operatesectors(sectortype* sptr, DDukeActor *actor)
for (auto& wal : wallsofsector(sptr))
{
setanimation(sptr, anim_vertexx, &wal, wal.x + 1024, 4);
if (wal.nextwall >= 0) setanimation(sptr, anim_vertexx, wal.nextWall(), wal.nextWall()->x + 1024, 4);
if (wal.twoSided()) setanimation(sptr, anim_vertexx, wal.nextWall(), wal.nextWall()->x + 1024, 4);
}
break;

View file

@ -665,7 +665,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
}
}
if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0)
if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->twoSided())
if (wal->nextSector()->floorz > z)
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
switch (wal->overpicnum)
@ -702,7 +702,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case FANSPRITE:
wal->overpicnum = FANSPRITEBROKE;
wal->cstat &= 65535 - 65;
if (wal->nextwall >= 0)
if (wal->twoSided())
{
wal->nextWall()->overpicnum = FANSPRITEBROKE;
wal->nextWall()->cstat &= 65535 - 65;
@ -720,7 +720,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
lotsofglass(spr, wal, 10);
wal->cstat = 0;
if (wal->nextwall >= 0)
if (wal->twoSided())
wal->nextWall()->cstat = 0;
auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
@ -739,7 +739,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (sptr == nullptr) return;
lotsofcolourglass(spr, wal, 80);
wal->cstat = 0;
if (wal->nextwall >= 0)
if (wal->twoSided())
wal->nextWall()->cstat = 0;
S_PlayActorSound(VENT_BUST, spr);
S_PlayActorSound(GLASS_BREAKING, spr);
@ -867,7 +867,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (!wal->lotag) return;
if (wal->nextsector < 0) return;
if (!wal->twoSided()) return;
darkestwall = 0;
for (auto& wl : wallsofsector(wal->nextSector()))

View file

@ -1006,7 +1006,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
}
}
if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0)
if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->twoSided())
if (wal->nextSector()->floorz > z)
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
switch (wal->overpicnum)
@ -1014,7 +1014,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case FANSPRITE:
wal->overpicnum = FANSPRITEBROKE;
wal->cstat &= 65535 - 65;
if (wal->nextwall >= 0)
if (wal->twoSided())
{
wal->nextWall()->overpicnum = FANSPRITEBROKE;
wal->nextWall()->cstat &= 65535 - 65;
@ -1032,7 +1032,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
lotsofpopcorn(spr, wal, 64);
wal->cstat = 0;
if (wal->nextwall >= 0)
if (wal->twoSided())
wal->nextWall()->cstat = 0;
auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
@ -1053,7 +1053,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
lotsofglass(spr, wal, 10);
wal->cstat = 0;
if (wal->nextwall >= 0)
if (wal->twoSided())
wal->nextWall()->cstat = 0;
auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
@ -1070,7 +1070,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
updatesector(x, y, &sn); if (sn < 0) return;
lotsofcolourglass(spr, wal, 80);
wal->cstat = 0;
if (wal->nextwall >= 0)
if (wal->twoSided())
wal->nextWall()->cstat = 0;
S_PlayActorSound(VENT_BUST, spr);
S_PlayActorSound(GLASS_BREAKING, spr);
@ -1087,8 +1087,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case RRTILE3643 + 2:
case RRTILE3643 + 3:
{
int sect;
sect = wal->nextWall()->nextsector;
auto sect = wal->nextWall()->nextSector();
DukeSectIterator it(sect);
while (auto act = it.Next())
{
@ -1100,7 +1099,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
{
for(auto& wl : wallsofsector(act->sector()))
{
if (wl.nextsector >= 0) wl.nextSector()->lotag = 0;
if (wl.twoSided()) wl.nextSector()->lotag = 0;
}
s->sector()->lotag = 0;
S_StopSound(act->s->lotag);
@ -1351,11 +1350,10 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (!wal->lotag) return;
sn = wal->nextsector;
if (sn < 0) return;
if (!wal->twoSided()) return;
darkestwall = 0;
for (auto& wl : wallsofsector(wal->nextsector))
for (auto& wl : wallsofsector(wal->nextSector()))
if (wl.shade > darkestwall)
darkestwall = wl.shade;
@ -2804,7 +2802,8 @@ void checksectors_r(int snum)
void dofurniture(walltype* wlwal, sectortype* sectp, int snum)
{
int nextsect = wlwal->nextsector;
assert(wlwal->twoSided());
auto nextsect = wlwal->nextSector();
int var_C;
int x;
int y;

View file

@ -749,7 +749,7 @@ void spawneffector(DDukeActor* actor)
{
for (auto& wl : wallsofsector(sectp))
{
if (wl.nextsector >= 0)
if (wl.twoSided())
{
auto nsec = wl.nextSector();
if (!(nsec->ceilingstat & 1))
@ -846,7 +846,7 @@ void spawneffector(DDukeActor* actor)
{
if (!(wal.hitag & 1))
wal.shade = sp->shade;
if ((wal.cstat & 2) && wal.nextwall >= 0)
if ((wal.cstat & 2) && wal.twoSided())
wal.nextWall()->shade = sp->shade;
}
break;
@ -997,7 +997,7 @@ void spawneffector(DDukeActor* actor)
sectortype* s = nullptr;
for (auto& wal : wallsofsector(sectp))
{
if (wal.nextsector >= 0 &&
if (wal.twoSided() &&
wal.nextSector()->hitag == 0 &&
(wal.nextSector()->lotag < 3 || (isRRRA() && wal.nextSector()->lotag == 160)))
{