From 66e61d799d65cc7cc5c95a954862d62b4d39b0c6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Nov 2021 09:31:19 +0100 Subject: [PATCH] - handle the remaining SectIterators. --- source/games/sw/src/slidor.cpp | 9 ++++----- source/games/sw/src/sprite.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index f1b521953..f85c79a56 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -592,16 +592,15 @@ int DoSlidor(DSWActor* actor) // if heading for the OFF (original) position and should NOT CRUSH if (TEST_BOOL3(sp) && r->tgt == 0) { - int i; SPRITEp bsp; USERp bu; bool found = false; - SectIterator it(sp->sectnum); - while ((i = it.NextIndex()) >= 0) + SWSectIterator it(sp->sectnum); + while (auto itActor = it.Next()) { - bsp = &sprite[i]; - bu = User[i].Data(); + bsp = &itActor->s(); + bu = itActor->u(); if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY)) { diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 1f88234e1..ed98702df 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -4685,10 +4685,10 @@ getzrangepoint(int x, int y, int z, short sectnum, *florhit = sectnum + 16384; // Go through sprites of only the current sector - SectIterator it(sectnum); - while ((j = it.NextIndex()) >= 0) + SWSectIterator it(sectnum); + while (auto itActor = it.Next()) { - spr = &sprite[j]; + spr = &itActor->s(); cstat = spr->cstat; if ((cstat & 49) != 33) continue; // Only check blocking floor sprites @@ -4771,7 +4771,7 @@ getzrangepoint(int x, int y, int z, short sectnum, if (daz > *ceilz) { *ceilz = daz; - *ceilhit = j + 49152; + *ceilhit = itActor->GetSpriteIndex() + HIT_SPRITE; } } else @@ -4779,7 +4779,7 @@ getzrangepoint(int x, int y, int z, short sectnum, if (daz < *florz) { *florz = daz; - *florhit = j + 49152; + *florhit = itActor->GetSpriteIndex() + HIT_SPRITE; } } }