diff --git a/source/games/exhumed/src/enginesubs.cpp b/source/games/exhumed/src/enginesubs.cpp index 69c6c194f..6a7015b0e 100644 --- a/source/games/exhumed/src/enginesubs.cpp +++ b/source/games/exhumed/src/enginesubs.cpp @@ -61,15 +61,14 @@ void precache() for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, wall[i].pal); } - for (i = 0; i < kMaxSprites; i++) + ExhumedSpriteIterator it; + while (auto ac = it.Next()) { - if (sprite[i].statnum < kMaxStatus) - { - int j = sprite[i].picnum; - markTileForPrecache(j, sprite[i].pal); - if (picanm[j].sf & PICANM_ANIMTYPE_MASK) - for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sprite[i].pal); - } + auto sp = &ac->s(); + int j = sp->picnum; + markTileForPrecache(j, sp->pal); + if (picanm[j].sf & PICANM_ANIMTYPE_MASK) + for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sp->pal); } precacheMarkedTiles(); } diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index ba968d57d..3c8991b64 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -189,13 +189,12 @@ void DoRedAlert(int nVal) nRedTicks = 30; } - int i; - StatIterator it(405); - while ((i = it.NextIndex()) >= 0) + ExhumedStatIterator it(405); + while (auto ac = it.Next()) { if (nVal) { - auto spri = &sprite[i]; + auto spri = &ac->s(); PlayFXAtXYZ(StaticSound[kSoundAlarm], spri->x, spri->y, spri->z, spri->sectnum); AddFlash(spri->sectnum, spri->x, spri->y, spri->z, 192); } @@ -254,9 +253,10 @@ void GameMove(void) { FixPalette(); - for (int i = 0; i < MAXSPRITES; i++) + ExhumedSpriteIterator it; + while (auto ac = it.Next()) { - sprite[i].backuploc(); + ac->s().backuploc(); } if (currentLevel->gameflags & LEVEL_EX_COUNTDOWN) diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 0ed605c40..f33a86f55 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -805,9 +805,10 @@ void ExamineSprites() nNetStartSprites = 0; nCurStartSprite = 0; - for (int nSprite = 0; nSprite < kMaxSprites; nSprite++) + ExhumedLinearSpriteIterator it; + while (auto ac = it.Next()) { - auto pSprite = &sprite[nSprite]; + auto pSprite = &ac->s(); int nStatus = pSprite->statnum; if (!nStatus) @@ -820,11 +821,11 @@ void ExamineSprites() pSprite->lotag = 0; pSprite->hitag = 0; - ProcessSpriteTag(nSprite, lotag, hitag); + ProcessSpriteTag(ac->GetSpriteIndex(), lotag, hitag); } else { - changespritestat(nSprite, 0); + ChangeActorStat(ac, 0); } } } diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index ba85c0746..bde79b458 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -49,8 +49,8 @@ void DrawMap(double const smoothratio) { if (!nFreeze && automapMode != am_off) { - int nPlayerSprite = PlayerList[nLocalPlayer].nSprite; - auto psp = &sprite[nPlayerSprite]; + auto pPlayerActor = PlayerList[nLocalPlayer].Actor(); + auto psp = &pPlayerActor->s(); int x = psp->interpolatedx(smoothratio); int y = psp->interpolatedy(smoothratio); @@ -79,8 +79,8 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - int nPSprite = PlayerList[i].nSprite; - spritetype* pSprite = &sprite[nPSprite]; + auto pPlayerActor = PlayerList[i].Actor(); + spritetype* pSprite = &pPlayerActor->s(); int x1 = pSprite->x - x; int y1 = pSprite->y - y; int pa = (pSprite->ang - a) & 2047; diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 469843e22..b1dabe234 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -37,7 +37,7 @@ BEGIN_PS_NS void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { Player *nPlayer = &PlayerList[nLocalPlayer]; - spritetype *pSprite = &sprite[nPlayer->nSprite]; + spritetype *pSprite = &nPlayer->Actor()->s(); pSprite->ox = pSprite->x = x; pSprite->oy = pSprite->y = y;