From e81b37b31a6fb3e4d47cb54261e4af3377539493 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 26 Oct 2020 06:59:21 +0100 Subject: [PATCH] - checkhitswitch_r part 2 --- source/games/duke/src/sectors_r.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index bb73f4a3c..a43e54f72 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -611,14 +611,14 @@ bool checkhitswitch_r(int snum, int w, int switchtype) case DIPSWITCH: case TECHSWITCH: case ALIENSWITCH: - if (switchtype == 0 && i == w) wall[x].picnum++; + if (switchtype == SWITCH_WALL && i == w) wall[x].picnum++; else if (wall[x].hitag == 0) correctdips++; numdips++; break; case DIPSWITCH + 1: case TECHSWITCH + 1: case ALIENSWITCH + 1: - if (switchtype == 0 && i == w) wall[x].picnum--; + if (switchtype == SWITCH_WALL && i == w) wall[x].picnum--; else if (wall[x].hitag == 1) correctdips++; numdips++; break; @@ -788,15 +788,16 @@ bool checkhitswitch_r(int snum, int w, int switchtype) { int switches[3], switchcount = 0, j; S_PlaySound3D(SWITCH_ON, act, &v); - for (j = 0; j < MAXSPRITES; j++) + DukeSpriteIterator it; + while (auto actt = it.Next()) { - int jpn = sprite[j].picnum; - int jht = sprite[j].hitag; + int jpn = actt->s.picnum; + int jht = actt->s.hitag; if ((jpn == MULTISWITCH || jpn == MULTISWITCH2) && jht == 10000) { if (switchcount < 3) { - switches[switchcount] = j; + switches[switchcount] = actt->GetIndex(); switchcount++; } }