From befc4572e9e14a30c914aaf515a7246892b0f52a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 27 Nov 2021 21:08:49 +0100 Subject: [PATCH] - minimal backend array removal. --- source/build/src/polymost.cpp | 9 ++++----- source/games/blood/src/db.cpp | 11 ++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 713aa15af..ff221cedf 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -27,6 +27,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken #include "gamestruct.h" #include "gamestruct.h" #include "hw_voxels.h" +#include "coreactor.h" #ifdef _MSC_VER // just make it shut up. Most of this file will go down the drain anyway soon. @@ -1910,12 +1911,10 @@ void polymost_scansector(int32_t sectnum) { sectnum = sectorborder[--sectorbordercnt]; - int z; - SectIterator it(sectnum); - while ((z = it.NextIndex()) >= 0) + TSectIterator it(sectnum); + while (auto act = it.Next()) { - auto const spr = (uspriteptr_t)&sprite[z]; - + auto spr = &act->s(); if ((spr->cstat & 0x8000) || spr->xrepeat == 0 || spr->yrepeat == 0) continue; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 9d3aead48..a8aa88f5b 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -191,12 +191,13 @@ DBloodActor* InsertSprite(sectortype* pSector, int nStat) int DeleteSprite(int nSprite) { - FVector3 pos = GetSoundPos(&sprite[nSprite].pos); + auto sp = &sprite[nSprite]; + FVector3 pos = GetSoundPos(&sp->pos); soundEngine->RelinkSound(SOURCE_Actor, &sprite[nSprite], nullptr, &pos); - assert(sprite[nSprite].statnum >= 0 && sprite[nSprite].statnum < kMaxStatus); + assert(sp->statnum >= 0 && sp->statnum < kMaxStatus); RemoveSpriteStat(nSprite); - assert(validSectorIndex(sprite[nSprite].sectnum)); + assert(sp->insector()); RemoveSpriteSect(nSprite); InsertSpriteStat(nSprite, kMaxStatus); #ifdef NOONE_EXTENSIONS @@ -211,7 +212,7 @@ int ChangeSpriteSect(int nSprite, int nSector) { assert(nSprite >= 0 && nSprite < kMaxSprites); assert(validSectorIndex(nSector)); - assert(validSectorIndex(sprite[nSprite].sectnum)); + assert(sprite[nSprite].insector()); RemoveSpriteSect(nSprite); InsertSpriteSect(nSprite, nSector); return 0; @@ -227,7 +228,7 @@ int ChangeSpriteStat(int nSprite, int nStatus) assert(nSprite >= 0 && nSprite < kMaxSprites); assert(nStatus >= 0 && nStatus < kMaxStatus); assert(sprite[nSprite].statnum >= 0 && sprite[nSprite].statnum < kMaxStatus); - assert(validSectorIndex(sprite[nSprite].sectnum)); + assert(sprite[nSprite].insector()); RemoveSpriteStat(nSprite); InsertSpriteStat(nSprite, nStatus); return 0;