From f9a776e71c51181fa9c5cbbb9503856c41715579 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 12 Nov 2020 19:12:30 +0100 Subject: [PATCH] - iterate linearly over sector effectors. Apparently they aren't all properly linked into the required statnums. Fixes #179 --- source/games/duke/src/player_r.cpp | 4 ++-- source/games/duke/src/sectors_r.cpp | 2 +- source/games/duke/src/spawn.cpp | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index ba97ad276..ab470bbae 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -119,7 +119,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, if (isRRRA() && ((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0)) && hitsprt == nullptr && hitwall == -1) { - DukeSpriteIterator its; + DukeLinearSpriteIterator its; while (auto effector = its.Next()) { // shouldn't this only check STAT_EFFECTOR? @@ -276,7 +276,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa if (isRRRA() && (((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0)) && hitsprt == nullptr && hitwall == -1)) { - DukeSpriteIterator its; + DukeLinearSpriteIterator its; while (auto effector = its.Next()) { // shouldn't this only check STAT_EFFECTOR? diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 6c7303777..a7f4ccd2c 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -786,7 +786,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) DDukeActor* switches[3]; int switchcount = 0, j; S_PlaySound3D(SWITCH_ON, act, &v); - DukeSpriteIterator it; + DukeLinearSpriteIterator it; while (auto actt = it.Next()) { int jpn = actt->s.picnum; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index c68f061e8..8137982fd 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -640,12 +640,13 @@ void spawneffector(DDukeActor* actor) break; case SE_7_TELEPORT: // Transporters!!!! case SE_23_ONE_WAY_TELEPORT:// XPTR END - if (sp->lotag != 23) + if (sp->lotag != SE_23_ONE_WAY_TELEPORT) { - DukeSpriteIterator it; + DukeLinearSpriteIterator it; while (auto act2 = it.Next()) { - if (act2->s.statnum < MAXSTATUS && act2->s.picnum == SECTOREFFECTOR && (act2->s.lotag == 7 || act2->s.lotag == 23) && actor != act2 && act2->s.hitag == sp->hitag) + if (act2->s.statnum < MAXSTATUS && act2->s.picnum == SECTOREFFECTOR && (act2->s.lotag == SE_7_TELEPORT || act2->s.lotag == SE_23_ONE_WAY_TELEPORT) && + actor != act2 && act2->s.hitag == sp->hitag) { actor->SetOwner(act2); break; @@ -964,7 +965,7 @@ void spawneffector(DDukeActor* actor) sector[sect].hitag = ActorToScriptIndex(actor); } - DukeSpriteIterator it; + DukeLinearSpriteIterator it; bool found = false; while (auto act2 = it.Next()) {