From 471a25f8199244c4add6371e675720fc45c60b6f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Oct 2020 20:49:52 +0200 Subject: [PATCH] - operaterespawns. # Conflicts: # source/games/duke/src/sectors_d.cpp # source/games/duke/src/sectors_r.cpp --- source/games/duke/src/sectors_d.cpp | 16 +++++++--------- source/games/duke/src/sectors_r.cpp | 18 ++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 44863529a..a3dbd0893 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -187,20 +187,18 @@ void animatewalls_d(void) void operaterespawns_d(int low) { - int i; - - StatIterator it(STAT_FX); - while ((i = it.NextIndex()) >= 0) + DukeStatIterator it(STAT_FX); + while (auto act = it.Next()) { - if (sprite[i].lotag == low) switch (sprite[i].picnum) + if (act->s.lotag == low) switch (act->s.picnum) { case RESPAWN: - if (badguypic(sprite[i].hitag) && ud.monsters_off) break; + if (badguypic(act->s.hitag) && ud.monsters_off) break; - auto j = spawn(&hittype[i], TRANSPORTERSTAR); - j->s.z -= (32 << 8); + auto star = spawn(act, TRANSPORTERSTAR); + star->s.z -= (32 << 8); - sprite[i].extra = 66 - 12; // Just a way to killit + act->s.extra = 66 - 12; // Just a way to killit break; } } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index c8797371c..59efe0cf9 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -302,26 +302,24 @@ void animatewalls_r(void) void operaterespawns_r(int low) { - int i; - - StatIterator it(STAT_FX); - while ((i = it.NextIndex()) >= 0) + DukeStatIterator it(STAT_FX); + while (auto act = it.Next()) { - if (sprite[i].lotag == low) switch (sprite[i].picnum) + if (act->s.lotag == low) switch (act->s.picnum) { case RESPAWN: { - if (badguypic(sprite[i].hitag) && ud.monsters_off) break; + if (badguypic(act->s.hitag) && ud.monsters_off) break; - auto j = spawn(&hittype[i], TRANSPORTERSTAR); - j->s.z -= (32 << 8); + auto star = spawn(act, TRANSPORTERSTAR); + star->s.z -= (32 << 8); - sprite[i].extra = 66 - 12; // Just a way to killit + act->s.extra = 66 - 12; // Just a way to killit break; } case RRTILE7424: if (isRRRA() && !ud.monsters_off) - changespritestat(i, 119); + changespritestat(act, 119); break; }