diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 6c5d7d4d5..421fed82d 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2616,16 +2616,17 @@ int actWallBounceVector(int* x, int* y, int nWall, int a4) int actFloorBounceVector(int* x, int* y, int* z, int nSector, int a5) { int t = 0x10000 - a5; - if (sector[nSector].floorheinum == 0) + auto pSector = §or[nSector]; + if (pSector->floorheinum == 0) { int t2 = MulScale(*z, t, 16); *z = -(*z - t2); return t2; } - walltype* pWall = &wall[sector[nSector].wallptr]; - walltype* pWall2 = &wall[pWall->point2]; + walltype* pWall = pSector->firstWall(); + walltype* pWall2 = pWall->point2Wall(); int angle = getangle(pWall2->x - pWall->x, pWall2->y - pWall->y) + 512; - int t2 = sector[nSector].floorheinum << 4; + int t2 = pSector->floorheinum << 4; int t3 = approxDist(-0x10000, t2); int t4 = DivScale(-0x10000, t3, 16); int t5 = DivScale(t2, t3, 16); @@ -5019,11 +5020,11 @@ void MoveDude(DBloodActor* actor) { case kMarkerLowStack: if (pPlayer == gView) - setgotpic(sector[pSprite->sectnum].floorpicnum); + setgotpic(pSprite->sector()->floorpicnum); break; case kMarkerUpStack: if (pPlayer == gView) - setgotpic(sector[pSprite->sectnum].ceilingpicnum); + setgotpic(pSprite->sector()->ceilingpicnum); break; case kMarkerLowWater: case kMarkerLowGoo: @@ -6895,13 +6896,14 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, { int nWall = gHitInfo.hitwall; assert(nWall >= 0 && nWall < kMaxWalls); - nSurf = surfType[wall[nWall].picnum]; + auto pWall = &wall[nWall]; + nSurf = surfType[pWall->picnum]; if (actCanSplatWall(nWall)) { int x = gHitInfo.hitx - MulScale(a4, 16, 14); int y = gHitInfo.hity - MulScale(a5, 16, 14); int z = gHitInfo.hitz - MulScale(a6, 256, 14); - int nSurf = surfType[wall[nWall].picnum]; + int nSurf = surfType[pWall->picnum]; assert(nSurf < kSurfMax); if (pVectorData->surfHit[nSurf].fx1 >= 0) { diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index cbaa282be..a2b0f989a 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -2557,10 +2557,10 @@ bool genDudePrepare(DBloodActor* actor, int propId) // make sure dudes aren't in the floor or ceiling int zTop, zBot; GetSpriteExtents(pSprite, &zTop, &zBot); - if (!(sector[pSprite->sectnum].ceilingstat & 0x0001)) - pSprite->z += ClipLow(sector[pSprite->sectnum].ceilingz - zTop, 0); - if (!(sector[pSprite->sectnum].floorstat & 0x0001)) - pSprite->z += ClipHigh(sector[pSprite->sectnum].floorz - zBot, 0); + if (!(pSprite->sector()->ceilingstat & 0x0001)) + pSprite->z += ClipLow(pSprite->sector()->ceilingz - zTop, 0); + if (!(pSprite->sector()->floorstat & 0x0001)) + pSprite->z += ClipHigh(pSprite->sector()->floorz - zBot, 0); pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120); if (propId) break; diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index 8ea89985d..d0f1e4633 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -205,7 +205,7 @@ void CFX::fxProcess(void) pSprite->y += actor->yvel>>12; pSprite->z += actor->zvel>>8; // Weird... - if (actor->xvel || (actor->yvel && pSprite->z >= sector[pSprite->sectnum].floorz)) + if (actor->xvel || (actor->yvel && pSprite->z >= pSprite->sector()->floorz)) { updatesector(pSprite->x, pSprite->y, &nSector); if (nSector == -1) diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 562346117..fe0e62231 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -746,8 +746,8 @@ void nnExtInitModernStuff() // very quick fix for floor sprites with Touch trigger flag if their Z is equals sector floorz / ceilgz if (pSprite->sectnum >= 0 && pXSprite->Touch && (pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) { - if (pSprite->z == sector[pSprite->sectnum].floorz) pSprite->z--; - else if (pSprite->z == sector[pSprite->sectnum].ceilingz) pSprite->z++; + if (pSprite->z == pSprite->sector()->floorz) pSprite->z--; + else if (pSprite->z == pSprite->sector()->ceilingz) pSprite->z++; } // make Proximity flag work not just for dudes and things... @@ -3177,7 +3177,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor) case 3: case 4: if (!sectRangeIsFine(pSprite->sectnum)) pos = top; - else pos = (pXSource->data4 == 3) ? sector[pSprite->sectnum].floorz : sector[pSprite->sectnum].ceilingz; + else pos = (pXSource->data4 == 3) ? pSprite->sector()->floorz : pSprite->sector()->ceilingz; break; default: pos = top; diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index d4016e5bf..a63ae58d4 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1339,7 +1339,7 @@ void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1) auto* const pXSprite = pPlayer->pXSprite; int const florhit = pPlayer->actor->hit.florhit.type; bool const va = pXSprite->height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0; - pPlayer->horizon.calcviewpitch(pSprite->pos.vec2, buildang(pSprite->ang), va, sector[pSprite->sectnum].floorstat & 2, pSprite->sectnum, scaleAdjust); + pPlayer->horizon.calcviewpitch(pSprite->pos.vec2, buildang(pSprite->ang), va, pSprite->sector()->floorstat & 2, pSprite->sectnum, scaleAdjust); } void ProcessInput(PLAYER *pPlayer) diff --git a/source/games/blood/src/seq.cpp b/source/games/blood/src/seq.cpp index 8ac3f384c..dce6f65c2 100644 --- a/source/games/blood/src/seq.cpp +++ b/source/games/blood/src/seq.cpp @@ -356,7 +356,7 @@ void SEQINST::Update() if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel == 0 && actor->xvel != 0) { if (getUpperLink(pSprite->sectnum)) break; // don't play surface sound for stacked sectors - int surf = tileGetSurfType(sector[pSprite->sectnum].floorpicnum); + int surf = tileGetSurfType(pSprite->sector()->floorpicnum); if (!surf) break; static int surfSfxMove[15][4] = { /* {snd1, snd2, gameVolume, myVolume} */