From b063e19980e4ee618eb71ac0b0c1d9addbaeabca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Nov 2021 00:41:19 +0100 Subject: [PATCH] - gFX.fxSpawnActor and a few other simple replacements. --- source/games/blood/src/actor.cpp | 24 ++++++++++---------- source/games/blood/src/aiunicult.cpp | 2 +- source/games/blood/src/callback.cpp | 34 ++++++++++++++-------------- source/games/blood/src/fx.cpp | 10 ++++---- source/games/blood/src/gameutil.cpp | 2 +- source/games/blood/src/nnexts.cpp | 16 ++++++------- source/games/blood/src/triggers.cpp | 4 ++-- source/games/blood/src/warp.cpp | 4 ++-- source/games/blood/src/weapon.cpp | 8 +++---- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 8a23da534..03894e47c 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2917,7 +2917,7 @@ bool actHealDude(DBloodActor* actor, int add, int threshold) if (pXDude->health < (unsigned)threshold) { spritetype* pSprite = &actor->s(); - if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 780, pSprite->sectnum); + if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 780, pSprite->sector()); pXDude->health = min(pXDude->health + add, threshold); return true; } @@ -2992,7 +2992,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) else { seqKill(actor); - DBloodActor* pEffectA = gFX.fxSpawnActor((FX_ID)52, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, pSprite->ang); + DBloodActor* pEffectA = gFX.fxSpawnActor((FX_ID)52, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, pSprite->ang); if (pEffectA != nullptr) { auto pEffect = &pEffectA->s(); @@ -3932,7 +3932,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) case 4: if (pWallHit) { - auto pFX = gFX.fxSpawnActor(FX_52, pMissile->sectnum, pMissile->x, pMissile->y, pMissile->z, 0); + auto pFX = gFX.fxSpawnActor(FX_52, pMissile->sector(), pMissile->x, pMissile->y, pMissile->z, 0); if (pFX) pFX->s().ang = (GetWallAngle(pWallHit) + 512) & 2047; } break; @@ -4662,7 +4662,7 @@ static Collision MoveThing(DBloodActor* actor) actor->zvel += 58254; if (pSprite->type == kThingZombieHead) { - auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (fxActor) { int v34 = (PlayClock * 3) & 2047; @@ -5211,17 +5211,17 @@ void MoveDude(DBloodActor* actor) switch (tileGetSurfType(floorColl)) { case kSurfWater: - gFX.fxSpawnActor(FX_9, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); + gFX.fxSpawnActor(FX_9, pSprite->sector(), pSprite->x, pSprite->y, floorZ, 0); break; case kSurfLava: { - auto pFX = gFX.fxSpawnActor(FX_10, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); + auto pFX = gFX.fxSpawnActor(FX_10, pSprite->sector(), pSprite->x, pSprite->y, floorZ, 0); if (pFX) { auto pFXs = &pFX->s(); for (int i = 0; i < 7; i++) { - auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sectnum, pFXs->x, pFXs->y, pFXs->z, 0); + auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sector(), pFXs->x, pFXs->y, pFXs->z, 0); if (pFX2) { pFX2->xvel = Random2(0x6aaaa); @@ -6068,7 +6068,7 @@ static void actCheckTraps() int dy = MulScale(t, Sin(pSprite->ang), 30); for (int i = 0; i < 2; i++) { - auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), x, y, z, 0); if (pFX) { pFX->xvel = dx + Random2(0x8888); @@ -7092,7 +7092,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, void FireballSeqCallback(int, DBloodActor* actor) { auto pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel; @@ -7104,7 +7104,7 @@ void FireballSeqCallback(int, DBloodActor* actor) void NapalmSeqCallback(int, DBloodActor* actor) { auto pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel; @@ -7116,7 +7116,7 @@ void NapalmSeqCallback(int, DBloodActor* actor) void Fx32Callback(int, DBloodActor* actor) { auto pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel; @@ -7128,7 +7128,7 @@ void Fx32Callback(int, DBloodActor* actor) void Fx33Callback(int, DBloodActor* actor) { auto pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel; diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index f5634a174..530cae9ac 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1442,7 +1442,7 @@ void removeLeech(DBloodActor* actLeech, bool delSprite) if (actLeech != NULL) { auto const pLeech = &actLeech->s(); - auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sectnum, pLeech->x, pLeech->y, pLeech->z, pLeech->ang); + auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sector(), pLeech->x, pLeech->y, pLeech->z, pLeech->ang); if (effectactor != NULL) { spritetype* pEffect = &effectactor->s(); diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index dd35a3f78..073e6090d 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -46,7 +46,7 @@ void fxFlameLick(DBloodActor* actor, int) // 0 int x = pSprite->x + dx; int y = pSprite->y + dy; int z = bottom-Random(bottom-top); - auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), x, y, z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(-dx); @@ -105,7 +105,7 @@ void fxFlareSpark(DBloodActor* actor, int) // 3 { if (!actor) return; spritetype *pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x1aaaa); @@ -119,7 +119,7 @@ void fxFlareSparkLite(DBloodActor* actor, int) // 4 { if (!actor) return; spritetype *pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x1aaaa); @@ -137,7 +137,7 @@ void fxZombieBloodSpurt(DBloodActor* actor, int) // 5 XSPRITE *pXSprite = &actor->x(); int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); + auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, top, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x11111); @@ -161,7 +161,7 @@ void fxBloodSpurt(DBloodActor* actor, int) // 6 { if (!actor) return; spritetype *pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->s().ang = 0; @@ -177,7 +177,7 @@ void fxArcSpark(DBloodActor* actor, int) // 7 { if (!actor) return; spritetype* pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x10000); @@ -198,7 +198,7 @@ void fxDynPuff(DBloodActor* actor, int) // 8 int x = pSprite->x + MulScale(nDist, Cos(pSprite->ang-512), 30); int y = pSprite->y + MulScale(nDist, Sin(pSprite->ang-512), 30); int z = pSprite->z; - auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sector(), x, y, z, 0); if (pFX) { pFX->xvel = actor->xvel; @@ -286,7 +286,7 @@ void Respawn(DBloodActor* actor, int) // 9 pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE; } - gFX.fxSpawnActor(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + gFX.fxSpawnActor(FX_29, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); sfxPlay3DSound(pSprite, 350, -1, 0); break; } @@ -312,7 +312,7 @@ void PlayerBubble(DBloodActor* actor, int) // 10 int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int z = bottom-Random(bottom-top); - auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sector(), x, y, z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x1aaaa); @@ -337,7 +337,7 @@ void EnemyBubble(DBloodActor* actor, int) // 11 int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int z = bottom-Random(bottom-top); - auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sector(), x, y, z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x1aaaa); @@ -400,7 +400,7 @@ void fxBloodBits(DBloodActor* actor, int) // 14 int nDist = Random(16)<<4; int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28); int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28); - gFX.fxSpawnActor(FX_48, pSprite->sectnum, x, y, pSprite->z, 0); + gFX.fxSpawnActor(FX_48, pSprite->sector(), x, y, pSprite->z, 0); if (pSprite->ang == 1024) { int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid... @@ -408,7 +408,7 @@ void fxBloodBits(DBloodActor* actor, int) // 14 } if (Chance(0x5000)) { - auto pFX = gFX.fxSpawnActor(FX_36, pSprite->sectnum, x, y, floorZ-64, 0); + auto pFX = gFX.fxSpawnActor(FX_36, pSprite->sector(), x, y, floorZ-64, 0); if (pFX) pFX->s().ang = nAngle; } @@ -420,7 +420,7 @@ void fxTeslaAlt(DBloodActor* actor, int) // 15 { if (!actor) return; spritetype* pSprite = &actor->s(); - auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x1aaaa); @@ -529,9 +529,9 @@ void fxPodBloodSpray(DBloodActor* actor, int) // 18 spritetype* pSprite = &actor->s(); DBloodActor* pFX; if (pSprite->type == 53) - pFX = gFX.fxSpawnActor(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + pFX = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); else - pFX = gFX.fxSpawnActor(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + pFX = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { pFX->s().ang = 0; @@ -567,13 +567,13 @@ void fxPodBloodSplat(DBloodActor* actor, int) // 19 if (pSprite->type == 53 || pSprite->type == kThingPodGreenBall) { if (Chance(0x500) || pSprite->type == kThingPodGreenBall) - pFX = gFX.fxSpawnActor(FX_55, pSprite->sectnum, x, y, floorZ-64, 0); + pFX = gFX.fxSpawnActor(FX_55, pSprite->sector(), x, y, floorZ-64, 0); if (pFX) pFX->s().ang = nAngle; } else { - pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, floorZ-64, 0); + pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), x, y, floorZ-64, 0); if (pFX) pFX->s().ang = nAngle; } diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index feef15ad0..4682ce5ae 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -265,7 +265,7 @@ void fxSpawnBlood(DBloodActor *actor, int ) return; if (adult_lockout && gGameOptions.nGameType <= 0) return; - auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (bloodactor) { bloodactor->s().ang = 1024; @@ -288,9 +288,9 @@ void fxSpawnPodStuff(DBloodActor* actor, int ) return; DBloodActor *spawnactor; if (pSprite->type == kDudePodGreen) - spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); else - spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0); if (spawnactor) { spawnactor->s().ang = 1024; @@ -308,7 +308,7 @@ void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4) int y = pSprite->y + MulScale(pSprite->clipdist - 4, Sin(pSprite->ang), 28); x += MulScale(a3, Cos(pSprite->ang + 512), 30); y += MulScale(a3, Sin(pSprite->ang + 512), 30); - auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37 + Random(3)), pSprite->sectnum, x, y, z, 0); + auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37 + Random(3)), pSprite->sector(), x, y, z, 0); if (pBrass) { if (!VanillaMode()) @@ -328,7 +328,7 @@ void fxSpawnEjectingShell(DBloodActor* actor, int z, int a3, int a4) int y = pSprite->y + MulScale(pSprite->clipdist - 4, Sin(pSprite->ang), 28); x += MulScale(a3, Cos(pSprite->ang + 512), 30); y += MulScale(a3, Sin(pSprite->ang + 512), 30); - auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40 + Random(3)), pSprite->sectnum, x, y, z, 0); + auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40 + Random(3)), pSprite->sector(), x, y, z, 0); if (pShell) { if (!VanillaMode()) diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index 52a68ba79..758152a06 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -583,7 +583,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, int bakCstat = pSprite->cstat; int32_t nTemp1, nTemp2; pSprite->cstat &= ~257; - getzrange(&pSprite->pos, pSprite->sectnum, (int32_t*)ceilZ, &ceilHit, (int32_t*)floorZ, &floorHit, nDist, nMask); + getzrange(&pSprite->pos, pSprite->sector(), (int32_t*)ceilZ, &ceilHit, (int32_t*)floorZ, &floorHit, nDist, nMask); ceilColl->setFromEngine(ceilHit); floorColl->setFromEngine(floorHit); if (floorColl->type == kHitSector) diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 5d1ce2103..9d1348338 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1648,7 +1648,7 @@ void debrisBubble(DBloodActor* actor) int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int z = bottom - Random(bottom - top); - auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), pSprite->sector(), x, y, z, 0); if (pFX) { pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); @@ -1843,7 +1843,7 @@ void debrisMove(int listIndex) } break; case kSurfWater: - gFX.fxSpawnActor(FX_9, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); + gFX.fxSpawnActor(FX_9, pSprite->sector(), pSprite->x, pSprite->y, floorZ, 0); break; } @@ -3008,8 +3008,8 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) XSECTOR* pXSector = (pSource->sector()->hasX()) ? &pSource->sector()->xs() : nullptr; bool isDude = (!pPlayer && actor->IsDudeActor()); - if (pSprite->sectnum != pSource->sectnum) - ChangeActorSect(actor, pSource->sectnum); + if (pSprite->sector() != pSource->sector()) + ChangeActorSect(actor, pSource->sector()); pSprite->x = pSource->x; pSprite->y = pSource->y; int zTop, zBot; @@ -3175,7 +3175,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor) break; } - if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, pSprite->sectnum, pSprite->x, pSprite->y, pos, 0)) != NULL) + if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, pSprite->sector(), pSprite->x, pSprite->y, pos, 0)) != NULL) { auto pEffectSpr = &pEffect->s(); pEffect->SetOwner(sourceactor); @@ -4996,7 +4996,7 @@ bool aiFightDudeCanSeeTarget(DBloodActor* dudeactor, DUDEINFO* pDudeInfo, DBlood int eyeAboveZ = pDudeInfo->eyeHeight * pDude->yrepeat << 2; // is there a line of sight to the target? - if (cansee(pDude->x, pDude->y, pDude->z, pDude->sectnum, pTarget->x, pTarget->y, pTarget->z - eyeAboveZ, pTarget->sectnum)) + if (cansee(pDude->x, pDude->y, pDude->z, pDude->sector(), pTarget->x, pTarget->y, pTarget->z - eyeAboveZ, pTarget->sector())) { /*int nAngle = getangle(dx, dy); int losAngle = ((1024 + nAngle - pDude->ang) & 2047) - 1024; @@ -7843,7 +7843,7 @@ void aiPatrolSetMarker(DBloodActor* actor) continue; GetActorExtents(nextactor, &zt1, &zb1); - if (cansee(pNext->x, pNext->y, zt1, pNext->sectnum, pSprite->x, pSprite->y, zt2, pSprite->sectnum)) + if (cansee(pNext->x, pNext->y, zt1, pNext->sector(), pSprite->x, pSprite->y, zt2, pSprite->sector())) { closest = dist; selected = nextactor; @@ -8314,7 +8314,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor) { eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor, &z, &j); //use ztop of the target sprite - if (!cansee(x, y, z, pSpr->sectnum, pSprite->x, pSprite->y, pSprite->z - eyeAboveZ, pSprite->sectnum)) + if (!cansee(x, y, z, pSpr->sector(), pSprite->x, pSprite->y, pSprite->z - eyeAboveZ, pSprite->sector())) continue; } else diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 28f2e77b9..9aabc9e57 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -1445,7 +1445,7 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector) pSprite->y = pDest->y; pSprite->z += sector[pDest->sectnum].floorz-sector[nSector].floorz; pSprite->ang = pDest->ang; - ChangeActorSect(actor, pDest->sectnum); + ChangeActorSect(actor, pDest->sector()); sfxPlay3DSound(pDest, 201, -1, 0); actor->xvel = actor->yvel = actor->zvel = 0; actor->interpolated = false; @@ -2224,7 +2224,7 @@ void ActivateGenerator(DBloodActor* actor) case kGenBubbleMulti: { int top, bottom; GetActorExtents(actor, &top, &bottom); - gFX.fxSpawnActor((pSprite->type == kGenBubble) ? FX_23 : FX_26, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); + gFX.fxSpawnActor((pSprite->type == kGenBubble) ? FX_23 : FX_26, pSprite->sector(), pSprite->x, pSprite->y, top, 0); break; } } diff --git a/source/games/blood/src/warp.cpp b/source/games/blood/src/warp.cpp index 7eb010e99..c10529649 100644 --- a/source/games/blood/src/warp.cpp +++ b/source/games/blood/src/warp.cpp @@ -205,7 +205,7 @@ int CheckLink(DBloodActor *actor) assert(aLower); spritetype *pLower = &aLower->s(); assert(validSectorIndex(pLower->sectnum)); - ChangeActorSect(actor, pLower->sectnum); + ChangeActorSect(actor, pLower->sector()); pSprite->x += pLower->x-pUpper->x; pSprite->y += pLower->y-pUpper->y; int z2; @@ -232,7 +232,7 @@ int CheckLink(DBloodActor *actor) assert(aUpper); spritetype *pUpper = &aUpper->s(); assert(validSectorIndex(pUpper->sectnum)); - ChangeActorSect(actor, pUpper->sectnum); + ChangeActorSect(actor, pUpper->sector()); pSprite->x += pUpper->x-pLower->x; pSprite->y += pUpper->y-pLower->y; int z2; diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 30499f8f3..c544d8538 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -396,7 +396,7 @@ void UpdateAimVector(PLAYER * pPlayer) int angle = getangle(x2-x,y2-y); if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->angleRange) continue; - if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,x2,y2,z2,pSprite->sectnum)) + if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sector(),x2,y2,z2,pSprite->sector())) pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor; // Inlined? int dz = (lz-z2)>>8; @@ -408,7 +408,7 @@ void UpdateAimVector(PLAYER * pPlayer) DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); int center = (pSprite->yrepeat*pDudeInfo->aimHeight)<<2; int dzCenter = (z2-center)-z; - if (cansee(x, y, z, pPSprite->sectnum, x2, y2, z2, pSprite->sectnum)) + if (cansee(x, y, z, pPSprite->sector(), x2, y2, z2, pSprite->sector())) { nClosest = nDist2; aim.dx = bcos(angle); @@ -447,7 +447,7 @@ void UpdateAimVector(PLAYER * pPlayer) int angle = getangle(dx,dy); if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->thingAngle) continue; - if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,pSprite->x,pSprite->y,pSprite->z,pSprite->sectnum)) + if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sector(),pSprite->x,pSprite->y,pSprite->z,pSprite->sector())) pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor; // Inlined? int dz2 = (lz-z2)>>8; @@ -456,7 +456,7 @@ void UpdateAimVector(PLAYER * pPlayer) int nDist2 = ksqrt(dx2*dx2+dy2*dy2+dz2*dz2); if (nDist2 >= nClosest) continue; - if (cansee(x, y, z, pPSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum)) + if (cansee(x, y, z, pPSprite->sector(), pSprite->x, pSprite->y, pSprite->z, pSprite->sector())) { nClosest = nDist2; aim.dx = bcos(angle);