From 36d66f14b5aaac2e50bfcdb09721a01081d99bdb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Nov 2021 01:11:49 +0100 Subject: [PATCH] - smaller stuff --- source/games/blood/src/gameutil.cpp | 16 ++++++++-------- source/games/blood/src/mirrors.cpp | 4 ++-- source/games/blood/src/nnexts.cpp | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index c9a650afd..ba63d857d 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -588,15 +588,15 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, floorColl->setFromEngine(floorHit); if (floorColl->type == kHitSector) { - int nSector = floorColl->index; - if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (sector[nSector].floorstat & 1)) + auto pSector = floorColl->sector(); + if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (pSector->floorstat & 1)) *floorZ = 0x7fffffff; - if (sector[nSector].hasX()) + if (pSector->hasX()) { - XSECTOR *pXSector = §or[nSector].xs(); + XSECTOR *pXSector = &pSector->xs(); *floorZ += pXSector->Depth << 10; } - auto actor = getUpperLink(nSector); + auto actor = pSector->upperLink; if (actor) { auto link = actor->GetOwner(); @@ -608,10 +608,10 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, } if (ceilColl->type == kHitSector) { - int nSector = ceilColl->index; - if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (sector[nSector].ceilingstat & 1)) + auto pSector = ceilColl->sector(); + if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & 1)) *ceilZ = 0x80000000; - auto actor = getLowerLink(nSector); + auto actor = pSector->lowerLink; if (actor) { auto link = actor->GetOwner(); diff --git a/source/games/blood/src/mirrors.cpp b/source/games/blood/src/mirrors.cpp index 05b16cc43..ea8a9e01e 100644 --- a/source/games/blood/src/mirrors.cpp +++ b/source/games/blood/src/mirrors.cpp @@ -110,7 +110,8 @@ void InitMirrors(void) if (mirrorcnt >= 15) break; - if (sector[i].floorpicnum == 504) + auto secti = §or[i]; + if (secti->floorpicnum == 504) { auto link = getUpperLink(i); if (link == nullptr) @@ -119,7 +120,6 @@ void InitMirrors(void) if (link2 == nullptr) continue; - auto secti = §or[i]; int j = link2->s().sectnum; auto sectj = link2->s().sector(); if (sectj->ceilingpicnum != 504) diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 180d9f8d1..f8ece7dbc 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1318,7 +1318,7 @@ void nnExtProcessSuperSprites() continue; } - XSECTOR* pXSector = (sector[pDebris->sectnum].hasX()) ? §or[pDebris->sectnum].xs() : nullptr; + XSECTOR* pXSector = (pDebris->sector()->hasX()) ? &pDebris->sector()->xs() : nullptr; viewBackupSpriteLoc(debrisactor); bool uwater = false; @@ -1340,8 +1340,8 @@ void nnExtProcessSuperSprites() if (!pXSector->panAlways && pXSector->busy) speed = MulScale(speed, pXSector->busy, 16); } - if (sector[pDebris->sectnum].floorstat & 64) - angle = (angle + GetWallAngle(sector[pDebris->sectnum].firstWall()) + 512) & 2047; + if (pDebris->sector()->floorstat & 64) + angle = (angle + GetWallAngle(pDebris->sector()->firstWall()) + 512) & 2047; int dx = MulScale(speed, Cos(angle), 30); int dy = MulScale(speed, Sin(angle), 30); debrisactor->xvel += dx; @@ -1395,13 +1395,13 @@ void nnExtProcessSuperSprites() if (ang < pXDebris->goalAng) pDebris->ang = ClipHigh(ang + angStep, pXDebris->goalAng); else if (ang > pXDebris->goalAng) pDebris->ang = ClipLow(ang - angStep, pXDebris->goalAng); - int nSector = pDebris->sectnum; - int cz = getceilzofslope(nSector, pDebris->x, pDebris->y); - int fz = getflorzofslope(nSector, pDebris->x, pDebris->y); + auto pSector = pDebris->sector(); + int cz = getceilzofslopeptr(pSector, pDebris->x, pDebris->y); + int fz = getflorzofslopeptr(pSector, pDebris->x, pDebris->y); GetActorExtents(debrisactor, &top, &bottom); - if (fz >= bottom && getLowerLink(nSector) == nullptr && !(sector[nSector].ceilingstat & 0x1)) pDebris->z += ClipLow(cz - top, 0); - if (cz <= top && getUpperLink(nSector) == nullptr && !(sector[nSector].floorstat & 0x1)) pDebris->z += ClipHigh(fz - bottom, 0); + if (fz >= bottom && pSector->lowerLink == nullptr && !(pSector->ceilingstat & 0x1)) pDebris->z += ClipLow(cz - top, 0); + if (cz <= top && pSector->upperLink == nullptr && !(pSector->floorstat & 0x1)) pDebris->z += ClipHigh(fz - bottom, 0); } } }