From 9e4afd543ca4ab1376354be09400761492bb0d4e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Nov 2021 13:20:51 +0100 Subject: [PATCH] - Duke/RR: Some quick wall[] replacements. --- source/games/duke/src/actors_lava.cpp | 34 ++++++++++--------- source/games/duke/src/player_d.cpp | 45 ++++++++++++------------ source/games/duke/src/player_r.cpp | 49 ++++++++++++++------------- 3 files changed, 66 insertions(+), 62 deletions(-) diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index 6aa759d91..db5981df4 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -341,23 +341,24 @@ void dojaildoor(void) endwall = startwall + sector[jaildoorsect[i]].wallnum; for (j = startwall; j < endwall; j++) { + auto wal = &wall[j]; switch (jaildoordir[i]) { case 10: - x = wall[j].x; - y = wall[j].y + speed; + x = wal->x; + y = wal->y + speed; break; case 20: - x = wall[j].x - speed; - y = wall[j].y; + x = wal->x - speed; + y = wal->y; break; case 30: - x = wall[j].x; - y = wall[j].y - speed; + x = wal->x; + y = wal->y - speed; break; case 40: - x = wall[j].x + speed; - y = wall[j].y; + x = wal->x + speed; + y = wal->y; break; } dragpoint(j,x,y); @@ -476,23 +477,24 @@ void moveminecart(void) endwall = startwall + sector[minecartsect[i]].wallnum; for (j = startwall; j < endwall; j++) { + auto wal = &wall[j]; switch (minecartdir[i]) { case 10: - x = wall[j].x; - y = wall[j].y + speed; + x = wal->x; + y = wal->y + speed; break; case 20: - x = wall[j].x - speed; - y = wall[j].y; + x = wal->x - speed; + y = wal->y; break; case 30: - x = wall[j].x; - y = wall[j].y - speed; + x = wal->x; + y = wal->y - speed; break; case 40: - x = wall[j].x + speed; - y = wall[j].y; + x = wal->x + speed; + y = wal->y; break; } dragpoint(j,x,y); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index bd3dbed80..d9ef28f46 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -469,35 +469,36 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa else if (hitwall >= 0) { spawn(spark, SMALLSMOKE); + auto wal = &wall[hitwall]; - if (fi.isadoorwall(wall[hitwall].picnum) == 1) + if (fi.isadoorwall(wal->picnum) == 1) goto SKIPBULLETHOLE; if (p >= 0 && ( - wall[hitwall].picnum == DIPSWITCH || - wall[hitwall].picnum == DIPSWITCH + 1 || - wall[hitwall].picnum == DIPSWITCH2 || - wall[hitwall].picnum == DIPSWITCH2 + 1 || - wall[hitwall].picnum == DIPSWITCH3 || - wall[hitwall].picnum == DIPSWITCH3 + 1 || - wall[hitwall].picnum == HANDSWITCH || - wall[hitwall].picnum == HANDSWITCH + 1)) + wal->picnum == DIPSWITCH || + wal->picnum == DIPSWITCH + 1 || + wal->picnum == DIPSWITCH2 || + wal->picnum == DIPSWITCH2 + 1 || + wal->picnum == DIPSWITCH3 || + wal->picnum == DIPSWITCH3 + 1 || + wal->picnum == HANDSWITCH || + wal->picnum == HANDSWITCH + 1)) { fi.checkhitswitch(p, hitwall, nullptr); 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; if (hitsect >= 0 && sector[hitsect].lotag == 0) - if (wall[hitwall].overpicnum != BIGFORCE) - if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) || - (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) - if ((wall[hitwall].cstat & 16) == 0) + if (wal->overpicnum != BIGFORCE) + if ((wal->nextsector >= 0 && sector[wal->nextsector].lotag == 0) || + (wal->nextsector == -1 && sector[hitsect].lotag == 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()) { 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); hole->s->xvel = -1; - hole->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, - wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + hole->s->ang = getangle(wal->x - wall[wal->point2].x, + wal->y - wall[wal->point2].y) + 512; ssp(hole, CLIPMASK0); } SKIPBULLETHOLE: - if (wall[hitwall].cstat & 2) - if (wall[hitwall].nextsector >= 0) - if (hitz >= (sector[wall[hitwall].nextsector].floorz)) - hitwall = wall[hitwall].nextwall; + if (wal->cstat & 2) + if (wal->nextsector >= 0) + if (hitz >= (sector[wal->nextsector].floorz)) + hitwall = wal->nextwall; fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1); } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 6027be8ab..00a159943 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -366,38 +366,39 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa else if (hitwall >= 0) { spawn(spark, SMALLSMOKE); + auto wal = &wall[hitwall]; - if (fi.isadoorwall(wall[hitwall].picnum) == 1) + if (fi.isadoorwall(wal->picnum) == 1) goto SKIPBULLETHOLE; - if (isablockdoor(wall[hitwall].picnum) == 1) + if (isablockdoor(wal->picnum) == 1) goto SKIPBULLETHOLE; if (p >= 0 && ( - wall[hitwall].picnum == DIPSWITCH || - wall[hitwall].picnum == DIPSWITCH + 1 || - wall[hitwall].picnum == DIPSWITCH2 || - wall[hitwall].picnum == DIPSWITCH2 + 1 || - wall[hitwall].picnum == DIPSWITCH3 || - wall[hitwall].picnum == DIPSWITCH3 + 1 || - (isRRRA() && wall[hitwall].picnum == RRTILE8660) || - wall[hitwall].picnum == HANDSWITCH || - wall[hitwall].picnum == HANDSWITCH + 1)) + wal->picnum == DIPSWITCH || + wal->picnum == DIPSWITCH + 1 || + wal->picnum == DIPSWITCH2 || + wal->picnum == DIPSWITCH2 + 1 || + wal->picnum == DIPSWITCH3 || + wal->picnum == DIPSWITCH3 + 1 || + (isRRRA() && wal->picnum == RRTILE8660) || + wal->picnum == HANDSWITCH || + wal->picnum == HANDSWITCH + 1)) { fi.checkhitswitch(p, hitwall, nullptr); 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; if (hitsect >= 0 && sector[hitsect].lotag == 0) - if (wall[hitwall].overpicnum != BIGFORCE) - if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) || - (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) - if ((wall[hitwall].cstat & 16) == 0) + if (wal->overpicnum != BIGFORCE) + if ((wal->nextsector >= 0 && sector[wal->nextsector].lotag == 0) || + (wal->nextsector == -1 && sector[hitsect].lotag == 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()) { 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); l->s->xvel = -1; - l->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, - wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + l->s->ang = getangle(wal->x - wall[wal->point2].x, + wal->y - wall[wal->point2].y) + 512; ssp(l, CLIPMASK0); } SKIPBULLETHOLE: - if (wall[hitwall].cstat & 2) - if (wall[hitwall].nextsector >= 0) - if (hitz >= (sector[wall[hitwall].nextsector].floorz)) - hitwall = wall[hitwall].nextwall; + if (wal->cstat & 2) + if (wal->nextsector >= 0) + if (hitz >= (sector[wal->nextsector].floorz)) + hitwall = wal->nextwall; fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1); }