diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index f63efb4b0..59faf414f 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2960,7 +2960,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) else { seqKill(actor); - DBloodActor* pEffect = gFX.fxSpawnActor((FX_ID)52, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang()); + DBloodActor* pEffect = gFX.fxSpawnActor((FX_ID)52, actor->sector(), actor->spr.pos, actor->int_ang()); if (pEffect != nullptr) { pEffect->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FACING; @@ -3872,7 +3872,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) case 4: if (pWallHit) { - auto pFX = gFX.fxSpawnActor(FX_52, missileActor->sector(), missileActor->int_pos().X, missileActor->int_pos().Y, missileActor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_52, missileActor->sector(), missileActor->spr.pos, 0); if (pFX) pFX->set_int_ang((GetWallAngle(pWallHit) + 512) & 2047); } break; @@ -4580,7 +4580,7 @@ static Collision MoveThing(DBloodActor* actor) actor->vel.Z += 58254; if (actor->spr.type == kThingZombieHead) { - auto* fxActor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto* fxActor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos, 0); if (fxActor) { int v34 = (PlayClock * 3) & 2047; @@ -5120,19 +5120,20 @@ void MoveDude(DBloodActor* actor) else actor->spr.flags |= 4; + double ffloorZ = floorZ * zinttoworld; switch (tileGetSurfType(floorColl)) { case kSurfWater: - gFX.fxSpawnActor(FX_9, actor->sector(), actor->int_pos().X, actor->int_pos().Y, floorZ, 0); + gFX.fxSpawnActor(FX_9, actor->sector(), DVector3(actor->spr.pos, ffloorZ), 0); break; case kSurfLava: { - auto pFX = gFX.fxSpawnActor(FX_10, actor->sector(), actor->int_pos().X, actor->int_pos().Y, floorZ, 0); + auto pFX = gFX.fxSpawnActor(FX_10, actor->sector(), DVector3(actor->spr.pos, ffloorZ), 0); if (pFX) { for (int i = 0; i < 7; i++) { - auto pFX2 = gFX.fxSpawnActor(FX_14, pFX->sector(), pFX->int_pos().X, pFX->int_pos().Y, pFX->int_pos().Z, 0); + auto pFX2 = gFX.fxSpawnActor(FX_14, pFX->sector(), pFX->spr.pos, 0); if (pFX2) { pFX2->vel.X = Random2(0x6aaaa); @@ -6930,45 +6931,37 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, void FireballSeqCallback(int, DBloodActor* actor) { - auto pFX = gFX.fxSpawnActor(FX_11, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_11, actor->sector(), actor->spr.pos, 0); if (pFX) { - pFX->vel.X = actor->vel.X; - pFX->vel.Y = actor->vel.Y; - pFX->vel.Z = actor->vel.Z; + pFX->vel = actor->vel; } } void NapalmSeqCallback(int, DBloodActor* actor) { - auto pFX = gFX.fxSpawnActor(FX_12, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_12, actor->sector(), actor->spr.pos, 0); if (pFX) { - pFX->vel.X = actor->vel.X; - pFX->vel.Y = actor->vel.Y; - pFX->vel.Z = actor->vel.Z; + pFX->vel = actor->vel; } } void Fx32Callback(int, DBloodActor* actor) { - auto pFX = gFX.fxSpawnActor(FX_32, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_32, actor->sector(), actor->spr.pos, 0); if (pFX) { - pFX->vel.X = actor->vel.X; - pFX->vel.Y = actor->vel.Y; - pFX->vel.Z = actor->vel.Z; + pFX->vel = actor->vel; } } void Fx33Callback(int, DBloodActor* actor) { - auto pFX = gFX.fxSpawnActor(FX_33, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_33, actor->sector(), actor->spr.pos, 0); if (pFX) { - pFX->vel.X = actor->vel.X; - pFX->vel.Y = actor->vel.Y; - pFX->vel.Z = actor->vel.Z; + pFX->vel = actor->vel; } } diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 515b9d56e..b6ff845bc 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1404,7 +1404,7 @@ void removeLeech(DBloodActor* actLeech, bool delSprite) { if (actLeech != nullptr) { - auto effectactor = gFX.fxSpawnActor((FX_ID)52, actLeech->sector(), actLeech->int_pos().X, actLeech->int_pos().Y, actLeech->int_pos().Z, actLeech->int_ang()); + auto effectactor = gFX.fxSpawnActor((FX_ID)52, actLeech->sector(), actLeech->spr.pos, actLeech->int_ang()); if (effectactor != nullptr) { effectactor->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FACING; diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 829571dd1..a2778d0ca 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -125,7 +125,7 @@ void FlareBurst(DBloodActor* actor, sectortype*) // 2 void fxFlareSpark(DBloodActor* actor, sectortype*) // 3 { if (!actor) return; - auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->spr.pos, 0); if (pFX) { pFX->vel.X = actor->vel.X + Random2(0x1aaaa); @@ -144,7 +144,7 @@ void fxFlareSpark(DBloodActor* actor, sectortype*) // 3 void fxFlareSparkLite(DBloodActor* actor, sectortype*) // 4 { if (!actor) return; - auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->spr.pos, 0); if (pFX) { pFX->vel.X = actor->vel.X + Random2(0x1aaaa); @@ -164,9 +164,9 @@ void fxZombieBloodSpurt(DBloodActor* actor, sectortype*) // 5 { if (!actor) return; assert(actor->hasX()); - int top, bottom; + double top, bottom; GetActorExtents(actor, &top, &bottom); - auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, top, 0); + auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), DVector3(actor->spr.pos.XY(), top), 0); if (pFX) { pFX->vel.X = actor->vel.X + Random2(0x11111); @@ -195,7 +195,7 @@ void fxZombieBloodSpurt(DBloodActor* actor, sectortype*) // 5 void fxBloodSpurt(DBloodActor* actor, sectortype*) // 6 { if (!actor) return; - auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos, 0); if (pFX) { pFX->set_int_ang(0); @@ -215,7 +215,7 @@ void fxBloodSpurt(DBloodActor* actor, sectortype*) // 6 void fxArcSpark(DBloodActor* actor, sectortype*) // 7 { if (!actor) return; - auto pFX = gFX.fxSpawnActor(FX_15, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_15, actor->sector(), actor->spr.pos, 0); if (pFX) { pFX->vel.X = actor->vel.X + Random2(0x10000); @@ -334,7 +334,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9 actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE; } - gFX.fxSpawnActor(FX_29, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + gFX.fxSpawnActor(FX_29, actor->sector(), actor->spr.pos, 0); sfxPlay3DSound(actor, 350, -1, 0); break; } @@ -491,7 +491,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14 void fxTeslaAlt(DBloodActor* actor, sectortype*) // 15 { if (!actor) return; - auto pFX = gFX.fxSpawnActor(FX_49, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto pFX = gFX.fxSpawnActor(FX_49, actor->sector(), actor->spr.pos, 0); if (pFX) { pFX->vel.X = actor->vel.X + Random2(0x1aaaa); @@ -620,9 +620,9 @@ void fxPodBloodSpray(DBloodActor* actor, sectortype*) // 18 if (!actor) return; DBloodActor* pFX; if (actor->spr.type == 53) - pFX = gFX.fxSpawnActor(FX_53, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + pFX = gFX.fxSpawnActor(FX_53, actor->sector(), actor->spr.pos, 0); else - pFX = gFX.fxSpawnActor(FX_54, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + pFX = gFX.fxSpawnActor(FX_54, actor->sector(), actor->spr.pos, 0); if (pFX) { pFX->set_int_ang(0); diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index e54136886..34f3dea34 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -138,7 +138,11 @@ void CFX::remove(DBloodActor* actor) DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, int x, int y, int z, unsigned int a6) { DVector3 pos(x * inttoworld, y * inttoworld, z * zinttoworld); + return fxSpawnActor(nFx, pSector, pos, a6); +} +DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, const DVector3& pos, unsigned int a6) +{ if (pSector == nullptr) return nullptr; auto pSector2 = pSector; @@ -275,7 +279,7 @@ void fxSpawnBlood(DBloodActor* actor, int) return; if (adult_lockout && gGameOptions.nGameType <= 0) return; - auto bloodactor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + auto bloodactor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos, 0); if (bloodactor) { bloodactor->set_int_ang(1024); @@ -303,9 +307,9 @@ void fxSpawnPodStuff(DBloodActor* actor, int) return; DBloodActor* spawnactor; if (actor->spr.type == kDudePodGreen) - spawnactor = gFX.fxSpawnActor(FX_53, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + spawnactor = gFX.fxSpawnActor(FX_53, actor->sector(), actor->spr.pos, 0); else - spawnactor = gFX.fxSpawnActor(FX_54, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + spawnactor = gFX.fxSpawnActor(FX_54, actor->sector(), actor->spr.pos, 0); if (spawnactor) { spawnactor->set_int_ang(1024); diff --git a/source/games/blood/src/fx.h b/source/games/blood/src/fx.h index 8c70eb9e9..2d828c812 100644 --- a/source/games/blood/src/fx.h +++ b/source/games/blood/src/fx.h @@ -94,6 +94,7 @@ public: void destroy(DBloodActor*); void remove(DBloodActor*); DBloodActor* fxSpawnActor(FX_ID a, sectortype* b, int c, int d, int e, unsigned int f); + DBloodActor* fxSpawnActor(FX_ID a, sectortype* b, const DVector3& pos, unsigned int f); void fxProcess(void); }; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index efc6b443c..5f1ba341a 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1801,20 +1801,21 @@ void debrisMove(int listIndex) moveHit = floorColl; DBloodActor* pFX = NULL, * pFX2 = NULL; + double ffloorZ = floorZ * zinttoworld; switch (tileGetSurfType(floorColl)) { case kSurfLava: - if ((pFX = gFX.fxSpawnActor(FX_10, actor->sector(), actor->int_pos().X, actor->int_pos().Y, floorZ, 0)) == NULL) break; + if ((pFX = gFX.fxSpawnActor(FX_10, actor->sector(), DVector3(actor->spr.pos.XY(), ffloorZ), 0)) == NULL) break; for (i = 0; i < 7; i++) { - if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->sector(), pFX->int_pos().X, pFX->int_pos().Y, pFX->int_pos().Z, 0)) == NULL) continue; + if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->sector(), pFX->spr.pos, 0)) == NULL) continue; pFX2->vel.X = Random2(0x6aaaa); pFX2->vel.Y = Random2(0x6aaaa); pFX2->vel.Z = -(int)Random(0xd5555); } break; case kSurfWater: - gFX.fxSpawnActor(FX_9, actor->sector(), actor->int_pos().X, actor->int_pos().Y, floorZ, 0); + gFX.fxSpawnActor(FX_9, actor->sector(), DVector3(actor->spr.pos.XY(), ffloorZ), 0); break; } @@ -3345,7 +3346,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor) } else if (valueIsBetween(fxId, 0, kFXMax)) { - int pos, top, bottom; + double pos, top, bottom; GetActorExtents(actor, &top, &bottom); DBloodActor* pEffect = nullptr; @@ -3356,17 +3357,16 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor) pos = bottom; break; case 2: // middle - pos = actor->int_pos().Z + (tileHeight(actor->spr.picnum) / 2 + tileTopOffset(actor->spr.picnum)); + pos = actor->spr.pos.Z + (tileHeight(actor->spr.picnum) / 2 + tileTopOffset(actor->spr.picnum)); break; case 3: case 4: if (actor->insector()) { if (sourceactor->xspr.data4 == 3) - pos = getflorzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y); + pos = getflorzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); else - pos = getceilzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y); - + pos = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); break; } [[fallthrough]]; @@ -3375,7 +3375,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor) break; } - if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, actor->sector(), actor->int_pos().X, actor->int_pos().Y, pos, 0)) != NULL) + if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, actor->sector(), DVector3(actor->spr.pos.XY(), pos), 0)) != nullptr) { pEffect->SetOwner(sourceactor); @@ -6477,9 +6477,9 @@ void useRandomItemGen(DBloodActor* actor) BloodStatIterator it(kStatItem); while (auto iactor = it.Next()) { - if ((unsigned int)iactor->spr.type == actor->xspr.dropMsg && iactor->int_pos().X == actor->int_pos().X && iactor->int_pos().Y == actor->int_pos().Y && iactor->int_pos().Z == actor->int_pos().Z) + if ((unsigned int)iactor->spr.type == actor->xspr.dropMsg && iactor->spr.pos == actor->spr.pos) { - gFX.fxSpawnActor((FX_ID)29, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0); + gFX.fxSpawnActor((FX_ID)29, actor->sector(), actor->spr.pos, 0); iactor->spr.type = kSpriteDecoration; actPostSprite(iactor, kStatFree); break; diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index c16bf06ea..a37326152 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -2524,9 +2524,9 @@ void ActivateGenerator(DBloodActor* actor) break; case kGenBubble: case kGenBubbleMulti: { - int top, bottom; + double top, bottom; GetActorExtents(actor, &top, &bottom); - gFX.fxSpawnActor((actor->spr.type == kGenBubble) ? FX_23 : FX_26, actor->sector(), actor->int_pos().X, actor->int_pos().Y, top, 0); + gFX.fxSpawnActor((actor->spr.type == kGenBubble) ? FX_23 : FX_26, actor->sector(), DVector3(actor->spr.pos.XY(), top), 0); break; } }