From 879407538edad817329968a925348166f27f9d3d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Nov 2021 01:59:55 +0100 Subject: [PATCH] - several 'sectnum's. --- source/games/blood/src/actor.cpp | 2 +- source/games/blood/src/callback.cpp | 2 +- source/games/blood/src/fx.cpp | 4 ++-- source/games/blood/src/gameutil.cpp | 4 ++-- source/games/blood/src/player.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 145aded80..f7c6f6a47 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -5992,7 +5992,7 @@ static void actCheckExplosion() if (gPhysSpritesList[i] == nullptr) continue; auto physactor = gPhysSpritesList[i]; spritetype* pDebris = &physactor->s(); - if (pDebris->sectnum < 0 || (pDebris->flags & kHitagFree) != 0) continue; + if (!pDebris->insector() || (pDebris->flags & kHitagFree) != 0) continue; if (!CheckSector(sectorMap, pDebris) || !CheckProximity(physactor, x, y, z, pSector, radius)) continue; else debrisConcuss(Owner, i, x, y, z, pExplodeInfo->dmgType); diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index ee0059af9..3c3935de3 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -605,7 +605,7 @@ void sub_76A08(DBloodActor *actor, spritetype *pSprite2, PLAYER *pPlayer) // ??? pSprite->y = pSprite2->y; pSprite->z = pSprite2->sector()->floorz-(bottom-pSprite->z); pSprite->ang = pSprite2->ang; - ChangeActorSect(actor, pSprite2->sectnum); + ChangeActorSect(actor, pSprite2->sector()); sfxPlay3DSound(pSprite2, 201, -1, 0); actor->xvel = actor->yvel = actor->zvel = 0; viewBackupSpriteLoc(actor); diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index 66cbc326f..050dd9747 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -256,7 +256,7 @@ void CFX::fxProcess(void) void fxSpawnBlood(DBloodActor *actor, int ) { spritetype* pSprite = &actor->s(); - if (pSprite->sectnum < 0 || pSprite->sectnum >= numsectors) + if (!pSprite->insector()) return; auto pSector = pSprite->sector(); if (!FindSector(pSprite->x, pSprite->y, pSprite->z, &pSector)) @@ -277,7 +277,7 @@ void fxSpawnBlood(DBloodActor *actor, int ) void fxSpawnPodStuff(DBloodActor* actor, int ) { auto pSprite = &actor->s(); - if (pSprite->sectnum < 0 || pSprite->sectnum >= numsectors) + if (!pSprite->insector()) return; auto pSector = pSprite->sector(); if (!FindSector(pSprite->x, pSprite->y, pSprite->z, &pSector)) diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index 7123b3aa9..e1417eb6a 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -343,7 +343,6 @@ int HitScan(DBloodActor *actor, int z, int dx, int dy, int dz, unsigned int nMas gHitInfo.clearObj(); int x = pSprite->x; int y = pSprite->y; - int nSector = pSprite->sectnum; int bakCstat = pSprite->cstat; pSprite->cstat &= ~256; if (nRange) @@ -358,6 +357,7 @@ int HitScan(DBloodActor *actor, int z, int dx, int dy, int dz, unsigned int nMas vec3_t pos = { x, y, z }; hitdata_t hitData; hitData.pos.z = gHitInfo.hitz; + int nSector = pSprite->sectnum; hitscan(&pos, nSector, dx, dy, dz << 4, &hitData, nMask); gHitInfo.set(&hitData); hitscangoal.x = hitscangoal.y = 0x1ffffff; @@ -394,7 +394,6 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in int z1 = pSprite->z+nZOffset; int bakCstat = pSprite->cstat; pSprite->cstat &= ~256; - int nSector = pSprite->sectnum; if (nRange) { hitscangoal.x = x1+MulScale(nRange<<4, Cos(pSprite->ang), 30); @@ -407,6 +406,7 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in vec3_t pos = { x1, y1, z1 }; hitdata_t hitData; hitData.pos.z = gHitInfo.hitz; + int nSector = pSprite->sectnum; hitscan(&pos, nSector, dx, dy, dz << 4, &hitData, CLIPMASK1); gHitInfo.set(&hitData); hitscangoal.x = hitscangoal.y = 0x1ffffff; diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index a67dc66d3..a2a59185c 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1204,7 +1204,7 @@ void CheckPickUp(PLAYER *pPlayer) int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; - int nSector = pSprite->sectnum; + auto pSector = pSprite->sector(); BloodStatIterator it(kStatItem); while (auto itemactor = it.Next()) { @@ -1229,9 +1229,9 @@ void CheckPickUp(PLAYER *pPlayer) if (approxDist(dx,dy) > 48) continue; GetSpriteExtents(pItem, &top, &bottom); - if (cansee(x, y, z, nSector, pItem->x, pItem->y, pItem->z, pItem->sectnum) - || cansee(x, y, z, nSector, pItem->x, pItem->y, top, pItem->sectnum) - || cansee(x, y, z, nSector, pItem->x, pItem->y, bottom, pItem->sectnum)) + if (cansee(x, y, z, pSector, pItem->x, pItem->y, pItem->z, pItem->sector()) + || cansee(x, y, z, pSector, pItem->x, pItem->y, top, pItem->sector()) + || cansee(x, y, z, pSector, pItem->x, pItem->y, bottom, pItem->sector())) PickUp(pPlayer, itemactor); } }