diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index f5c432f01..41e027c29 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -346,8 +346,8 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput) { predict.at72 = 1; int nSector = predict.sectnum; - int nLink = gLowerLink[nSector]; - if (nLink > 0 && (sprite[nLink].type == kMarkerLowGoo || sprite[nLink].type == kMarkerLowWater)) + auto nLink = getLowerLink(nSector); + if (nLink && (nLink->s().type == kMarkerLowGoo || nLink->s().type == kMarkerLowWater)) { if (getceilzofslope(nSector, predict.x, predict.y) > predict.viewz) predict.at72 = 0; @@ -435,11 +435,11 @@ static void fakeMoveDude(spritetype *pSprite) if (pXSector->Depth) bDepth = 1; } - int nUpperLink = gUpperLink[nSector]; - int nLowerLink = gLowerLink[nSector]; - if (nUpperLink >= 0 && (sprite[nUpperLink].type == kMarkerUpWater || sprite[nUpperLink].type == kMarkerUpGoo)) + auto nUpperLink = getUpperLink(nSector); + auto nLowerLink = getLowerLink(nSector); + if (nUpperLink >= 0 && (nUpperLink->s().type == kMarkerUpWater || nUpperLink->s().type == kMarkerUpGoo)) bDepth = 1; - if (nLowerLink >= 0 && (sprite[nLowerLink].type == kMarkerLowWater || sprite[nLowerLink].type == kMarkerLowGoo)) + if (nLowerLink >= 0 && (nLowerLink->s().type == kMarkerLowWater || nLowerLink->s().type == kMarkerLowGoo)) bDepth = 1; if (pPlayer) wd += 16; diff --git a/source/games/blood/src/preload.cpp b/source/games/blood/src/preload.cpp index 06e6703d6..4bf8ac864 100644 --- a/source/games/blood/src/preload.cpp +++ b/source/games/blood/src/preload.cpp @@ -259,23 +259,21 @@ void PreloadCache() if (wall[i].overpicnum >= 0) tilePrecacheTile(wall[i].overpicnum, 0, wall[i].pal); } - for (int i = 0; i < kMaxSprites; i++) + BloodSpriteIterator it; + while (auto actor = it.Next()) { - if (sprite[i].statnum < kMaxStatus) + spritetype *pSprite = &actor->s(); + switch (pSprite->statnum) { - spritetype *pSprite = &sprite[i]; - switch (pSprite->statnum) - { - case kStatDude: - PrecacheDude(pSprite); - break; - case kStatThing: - PrecacheThing(pSprite); - break; - default: - tilePrecacheTile(pSprite->picnum, -1, pSprite->pal); - break; - } + case kStatDude: + PrecacheDude(pSprite); + break; + case kStatThing: + PrecacheThing(pSprite); + break; + default: + tilePrecacheTile(pSprite->picnum, -1, pSprite->pal); + break; } }