- Duke/RR: Some quick wall[] replacements.

This commit is contained in:
Christoph Oelckers 2021-11-06 13:20:51 +01:00
parent b548d9eca2
commit 9e4afd543c
3 changed files with 66 additions and 62 deletions

View file

@ -341,23 +341,24 @@ void dojaildoor(void)
endwall = startwall + sector[jaildoorsect[i]].wallnum; endwall = startwall + sector[jaildoorsect[i]].wallnum;
for (j = startwall; j < endwall; j++) for (j = startwall; j < endwall; j++)
{ {
auto wal = &wall[j];
switch (jaildoordir[i]) switch (jaildoordir[i])
{ {
case 10: case 10:
x = wall[j].x; x = wal->x;
y = wall[j].y + speed; y = wal->y + speed;
break; break;
case 20: case 20:
x = wall[j].x - speed; x = wal->x - speed;
y = wall[j].y; y = wal->y;
break; break;
case 30: case 30:
x = wall[j].x; x = wal->x;
y = wall[j].y - speed; y = wal->y - speed;
break; break;
case 40: case 40:
x = wall[j].x + speed; x = wal->x + speed;
y = wall[j].y; y = wal->y;
break; break;
} }
dragpoint(j,x,y); dragpoint(j,x,y);
@ -476,23 +477,24 @@ void moveminecart(void)
endwall = startwall + sector[minecartsect[i]].wallnum; endwall = startwall + sector[minecartsect[i]].wallnum;
for (j = startwall; j < endwall; j++) for (j = startwall; j < endwall; j++)
{ {
auto wal = &wall[j];
switch (minecartdir[i]) switch (minecartdir[i])
{ {
case 10: case 10:
x = wall[j].x; x = wal->x;
y = wall[j].y + speed; y = wal->y + speed;
break; break;
case 20: case 20:
x = wall[j].x - speed; x = wal->x - speed;
y = wall[j].y; y = wal->y;
break; break;
case 30: case 30:
x = wall[j].x; x = wal->x;
y = wall[j].y - speed; y = wal->y - speed;
break; break;
case 40: case 40:
x = wall[j].x + speed; x = wal->x + speed;
y = wall[j].y; y = wal->y;
break; break;
} }
dragpoint(j,x,y); dragpoint(j,x,y);

View file

@ -469,35 +469,36 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
else if (hitwall >= 0) else if (hitwall >= 0)
{ {
spawn(spark, SMALLSMOKE); spawn(spark, SMALLSMOKE);
auto wal = &wall[hitwall];
if (fi.isadoorwall(wall[hitwall].picnum) == 1) if (fi.isadoorwall(wal->picnum) == 1)
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
if (p >= 0 && ( if (p >= 0 && (
wall[hitwall].picnum == DIPSWITCH || wal->picnum == DIPSWITCH ||
wall[hitwall].picnum == DIPSWITCH + 1 || wal->picnum == DIPSWITCH + 1 ||
wall[hitwall].picnum == DIPSWITCH2 || wal->picnum == DIPSWITCH2 ||
wall[hitwall].picnum == DIPSWITCH2 + 1 || wal->picnum == DIPSWITCH2 + 1 ||
wall[hitwall].picnum == DIPSWITCH3 || wal->picnum == DIPSWITCH3 ||
wall[hitwall].picnum == DIPSWITCH3 + 1 || wal->picnum == DIPSWITCH3 + 1 ||
wall[hitwall].picnum == HANDSWITCH || wal->picnum == HANDSWITCH ||
wall[hitwall].picnum == HANDSWITCH + 1)) wal->picnum == HANDSWITCH + 1))
{ {
fi.checkhitswitch(p, hitwall, nullptr); fi.checkhitswitch(p, hitwall, nullptr);
return; return;
} }
if (wall[hitwall].hitag != 0 || (wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0)) if (wal->hitag != 0 || (wal->nextwall >= 0 && wall[wal->nextwall].hitag != 0))
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
if (hitsect >= 0 && sector[hitsect].lotag == 0) if (hitsect >= 0 && sector[hitsect].lotag == 0)
if (wall[hitwall].overpicnum != BIGFORCE) if (wal->overpicnum != BIGFORCE)
if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) || if ((wal->nextsector >= 0 && sector[wal->nextsector].lotag == 0) ||
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) (wal->nextsector == -1 && sector[hitsect].lotag == 0))
if ((wall[hitwall].cstat & 16) == 0) if ((wal->cstat & 16) == 0)
{ {
if (wall[hitwall].nextsector >= 0) if (wal->nextsector >= 0)
{ {
DukeSectIterator it(wall[hitwall].nextsector); DukeSectIterator it(wal->nextsector);
while (auto l = it.Next()) while (auto l = it.Next())
{ {
if (l->s->statnum == 3 && l->s->lotag == 13) if (l->s->statnum == 3 && l->s->lotag == 13)
@ -514,17 +515,17 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
} }
auto hole = spawn(spark, BULLETHOLE); auto hole = spawn(spark, BULLETHOLE);
hole->s->xvel = -1; hole->s->xvel = -1;
hole->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, hole->s->ang = getangle(wal->x - wall[wal->point2].x,
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; wal->y - wall[wal->point2].y) + 512;
ssp(hole, CLIPMASK0); ssp(hole, CLIPMASK0);
} }
SKIPBULLETHOLE: SKIPBULLETHOLE:
if (wall[hitwall].cstat & 2) if (wal->cstat & 2)
if (wall[hitwall].nextsector >= 0) if (wal->nextsector >= 0)
if (hitz >= (sector[wall[hitwall].nextsector].floorz)) if (hitz >= (sector[wal->nextsector].floorz))
hitwall = wall[hitwall].nextwall; hitwall = wal->nextwall;
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1); fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
} }

View file

@ -366,38 +366,39 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
else if (hitwall >= 0) else if (hitwall >= 0)
{ {
spawn(spark, SMALLSMOKE); spawn(spark, SMALLSMOKE);
auto wal = &wall[hitwall];
if (fi.isadoorwall(wall[hitwall].picnum) == 1) if (fi.isadoorwall(wal->picnum) == 1)
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
if (isablockdoor(wall[hitwall].picnum) == 1) if (isablockdoor(wal->picnum) == 1)
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
if (p >= 0 && ( if (p >= 0 && (
wall[hitwall].picnum == DIPSWITCH || wal->picnum == DIPSWITCH ||
wall[hitwall].picnum == DIPSWITCH + 1 || wal->picnum == DIPSWITCH + 1 ||
wall[hitwall].picnum == DIPSWITCH2 || wal->picnum == DIPSWITCH2 ||
wall[hitwall].picnum == DIPSWITCH2 + 1 || wal->picnum == DIPSWITCH2 + 1 ||
wall[hitwall].picnum == DIPSWITCH3 || wal->picnum == DIPSWITCH3 ||
wall[hitwall].picnum == DIPSWITCH3 + 1 || wal->picnum == DIPSWITCH3 + 1 ||
(isRRRA() && wall[hitwall].picnum == RRTILE8660) || (isRRRA() && wal->picnum == RRTILE8660) ||
wall[hitwall].picnum == HANDSWITCH || wal->picnum == HANDSWITCH ||
wall[hitwall].picnum == HANDSWITCH + 1)) wal->picnum == HANDSWITCH + 1))
{ {
fi.checkhitswitch(p, hitwall, nullptr); fi.checkhitswitch(p, hitwall, nullptr);
return; return;
} }
if (wall[hitwall].hitag != 0 || (wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0)) if (wal->hitag != 0 || (wal->nextwall >= 0 && wall[wal->nextwall].hitag != 0))
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
if (hitsect >= 0 && sector[hitsect].lotag == 0) if (hitsect >= 0 && sector[hitsect].lotag == 0)
if (wall[hitwall].overpicnum != BIGFORCE) if (wal->overpicnum != BIGFORCE)
if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) || if ((wal->nextsector >= 0 && sector[wal->nextsector].lotag == 0) ||
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) (wal->nextsector == -1 && sector[hitsect].lotag == 0))
if ((wall[hitwall].cstat & 16) == 0) if ((wal->cstat & 16) == 0)
{ {
if (wall[hitwall].nextsector >= 0) if (wal->nextsector >= 0)
{ {
DukeSectIterator it(wall[hitwall].nextsector); DukeSectIterator it(wal->nextsector);
while (auto l = it.Next()) while (auto l = it.Next())
{ {
if (l->s->statnum == 3 && l->s->lotag == 13) if (l->s->statnum == 3 && l->s->lotag == 13)
@ -414,17 +415,17 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
} }
auto l = spawn(spark, BULLETHOLE); auto l = spawn(spark, BULLETHOLE);
l->s->xvel = -1; l->s->xvel = -1;
l->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, l->s->ang = getangle(wal->x - wall[wal->point2].x,
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; wal->y - wall[wal->point2].y) + 512;
ssp(l, CLIPMASK0); ssp(l, CLIPMASK0);
} }
SKIPBULLETHOLE: SKIPBULLETHOLE:
if (wall[hitwall].cstat & 2) if (wal->cstat & 2)
if (wall[hitwall].nextsector >= 0) if (wal->nextsector >= 0)
if (hitz >= (sector[wall[hitwall].nextsector].floorz)) if (hitz >= (sector[wal->nextsector].floorz))
hitwall = wall[hitwall].nextwall; hitwall = wal->nextwall;
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1); fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
} }