From 085bd3a165d81d491ebd4793c0d13b0a36725f94 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 Sep 2021 01:46:42 +0200 Subject: [PATCH] - replaced all fxSpawn calls with fxSpawnActor. --- source/games/blood/src/actor.cpp | 12 +-- source/games/blood/src/aiunicult.cpp | 5 +- source/games/blood/src/callback.cpp | 120 +++++++++++++-------------- source/games/blood/src/fx.cpp | 38 ++++----- source/games/blood/src/gib.cpp | 40 ++++----- source/games/blood/src/nnexts.cpp | 53 ++++++------ source/games/blood/src/triggers.cpp | 2 +- 7 files changed, 135 insertions(+), 135 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 93879915a..c9ffe8e22 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -7153,24 +7153,24 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, if (pVectorData->surfHit[nSurf].fx2 >= 0) { - spritetype* pFX2 = gFX.fxSpawn(pVectorData->surfHit[nSurf].fx2, nSector, x, y, z, 0); + auto pFX2 = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx2, nSector, x, y, z, 0); if (pFX2 && gModernMap) - pFX2->owner = pShooter->index; + pFX2->s().owner = pShooter->index; } if (pVectorData->surfHit[nSurf].fx3 >= 0) { - spritetype* pFX3 = gFX.fxSpawn(pVectorData->surfHit[nSurf].fx3, nSector, x, y, z, 0); + auto pFX3 = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx3, nSector, x, y, z, 0); if (pFX3 && gModernMap) - pFX3->owner = pShooter->index; + pFX3->s().owner = pShooter->index; } #else if (pVectorData->surfHit[nSurf].fx2 >= 0) - gFX.fxSpawn(pVectorData->surfHit[nSurf].fx2, nSector, x, y, z, 0); + gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx2, nSector, x, y, z, 0); if (pVectorData->surfHit[nSurf].fx3 >= 0) - gFX.fxSpawn(pVectorData->surfHit[nSurf].fx3, nSector, x, y, z, 0); + gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx3, nSector, x, y, z, 0); #endif if (pVectorData->surfHit[nSurf].fxSnd >= 0) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index da6ce8190..1a0c6f565 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1462,9 +1462,10 @@ void removeLeech(DBloodActor* actLeech, bool delSprite) if (actLeech != NULL) { auto const pLeech = &actLeech->s(); - spritetype* pEffect = gFX.fxSpawn((FX_ID)52, pLeech->sectnum, pLeech->x, pLeech->y, pLeech->z, pLeech->ang); - if (pEffect != NULL) + auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sectnum, pLeech->x, pLeech->y, pLeech->z, pLeech->ang); + if (effectactor != NULL) { + spritetype* pEffect = &effectactor->s(); pEffect->cstat = CSTAT_SPRITE_ALIGNMENT_FACING; pEffect->pal = 6; int repeat = 64 + Random(50); diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 33169857c..ebea59417 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -46,12 +46,12 @@ void fxFlameLick(DBloodActor* actor, int) // 0 int x = pSprite->x + dx; int y = pSprite->y + dy; int z = bottom-Random(bottom-top); - spritetype *pFX = gFX.fxSpawn(FX_32, pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(-dx); - yvel[pFX->index] = actor->yvel() + Random2(-dy); - zvel[pFX->index] = actor->zvel() - Random(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(-dx); + pFX->yvel() = actor->yvel() + Random2(-dy); + pFX->zvel() = actor->zvel() - Random(0x1aaaa); } } if (pXSprite->burnTime > 0) @@ -95,9 +95,9 @@ void FlareBurst(DBloodActor* actor, int) // 2 dz >>= 1; } RotateVector(&dx, &dy, nAngle); - xvel[pSpawn->index] += dx; - yvel[pSpawn->index] += dy; - zvel[pSpawn->index] += dz; + spawnedactor->xvel() += dx; + spawnedactor->yvel() += dy; + spawnedactor->zvel() += dz; evPost(spawnedactor, 960, kCallbackRemove); } evPost(actor, 0, kCallbackRemove); @@ -107,12 +107,12 @@ void fxFlareSpark(DBloodActor* actor, int) // 3 { if (!actor) return; spritetype *pSprite = &actor->s(); - spritetype *pFX = gFX.fxSpawn(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x1aaaa); - yvel[pFX->index] = actor->yvel() + Random2(0x1aaaa); - zvel[pFX->index] = actor->zvel() - Random(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(0x1aaaa); + pFX->yvel() = actor->yvel() + Random2(0x1aaaa); + pFX->zvel() = actor->zvel() - Random(0x1aaaa); } evPost(actor, 4, kCallbackFXFlareSpark); } @@ -121,12 +121,12 @@ void fxFlareSparkLite(DBloodActor* actor, int) // 4 { if (!actor) return; spritetype *pSprite = &actor->s(); - spritetype *pFX = gFX.fxSpawn(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x1aaaa); - yvel[pFX->index] = actor->yvel() + Random2(0x1aaaa); - zvel[pFX->index] = actor->zvel() - Random(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(0x1aaaa); + pFX->yvel() = actor->yvel() + Random2(0x1aaaa); + pFX->zvel() = actor->zvel() - Random(0x1aaaa); } evPost(actor, 12, kCallbackFXFlareSparkLite); } @@ -140,12 +140,12 @@ void fxZombieBloodSpurt(DBloodActor* actor, int) // 5 XSPRITE *pXSprite = &actor->x(); int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); + auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x11111); - yvel[pFX->index] = actor->yvel() + Random2(0x11111); - zvel[pFX->index] = actor->zvel() - 0x6aaaa; + pFX->xvel() = actor->xvel() + Random2(0x11111); + pFX->yvel() = actor->yvel() + Random2(0x11111); + pFX->zvel() = actor->zvel() - 0x6aaaa; } if (pXSprite->data1 > 0) { @@ -164,13 +164,13 @@ void fxBloodSpurt(DBloodActor* actor, int) // 6 { if (!actor) return; spritetype *pSprite = &actor->s(); - spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { - pFX->ang = 0; - xvel[pFX->index] = actor->xvel()>>8; - yvel[pFX->index] = actor->yvel()>>8; - zvel[pFX->index] = actor->zvel()>>8; + pFX->s().ang = 0; + pFX->xvel() = actor->xvel()>>8; + pFX->yvel() = actor->yvel()>>8; + pFX->zvel() = actor->zvel()>>8; } evPost(actor, 6, kCallbackFXBloodSpurt); } @@ -180,12 +180,12 @@ void fxArcSpark(DBloodActor* actor, int) // 7 { if (!actor) return; spritetype* pSprite = &actor->s(); - spritetype* pFX = gFX.fxSpawn(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x10000); - yvel[pFX->index] = actor->yvel() + Random2(0x10000); - zvel[pFX->index] = actor->zvel() - Random(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(0x10000); + pFX->yvel() = actor->yvel() + Random2(0x10000); + pFX->zvel() = actor->zvel() - Random(0x1aaaa); } evPost(actor, 3, kCallbackFXArcSpark); } @@ -201,12 +201,12 @@ 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; - spritetype *pFX = gFX.fxSpawn(FX_7, pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sectnum, x, y, z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel(); - yvel[pFX->index] = actor->yvel(); - zvel[pFX->index] = actor->zvel(); + pFX->xvel() = actor->xvel(); + pFX->yvel() = actor->yvel(); + pFX->zvel() = actor->zvel(); } } evPost(actor, 12, kCallbackFXDynPuff); @@ -290,7 +290,7 @@ void Respawn(DBloodActor* actor, int) // 9 pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE; } - gFX.fxSpawn(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + gFX.fxSpawnActor(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); sfxPlay3DSound(pSprite, 350, -1, 0); break; } @@ -316,12 +316,12 @@ 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); - spritetype *pFX = gFX.fxSpawn((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x1aaaa); - yvel[pFX->index] = actor->yvel() + Random2(0x1aaaa); - zvel[pFX->index] = actor->zvel() + Random2(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(0x1aaaa); + pFX->yvel() = actor->yvel() + Random2(0x1aaaa); + pFX->zvel() = actor->zvel() + Random2(0x1aaaa); } } evPost(actor, 4, kCallbackPlayerBubble); @@ -341,12 +341,12 @@ 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); - spritetype *pFX = gFX.fxSpawn((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x1aaaa); - yvel[pFX->index] = actor->yvel() + Random2(0x1aaaa); - zvel[pFX->index] = actor->zvel() + Random2(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(0x1aaaa); + pFX->yvel() = actor->yvel() + Random2(0x1aaaa); + pFX->zvel() = actor->zvel() + Random2(0x1aaaa); } } evPost(actor, 4, kCallbackEnemeyBubble); @@ -403,7 +403,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.fxSpawn(FX_48, pSprite->sectnum, x, y, pSprite->z, 0); + gFX.fxSpawnActor(FX_48, pSprite->sectnum, x, y, pSprite->z, 0); if (pSprite->ang == 1024) { int nChannel = 28+(pSprite->index&2); @@ -412,9 +412,9 @@ void fxBloodBits(DBloodActor* actor, int) // 14 } if (Chance(0x5000)) { - spritetype *pFX = gFX.fxSpawn(FX_36, pSprite->sectnum, x, y, floorZ-64, 0); + auto pFX = gFX.fxSpawnActor(FX_36, pSprite->sectnum, x, y, floorZ-64, 0); if (pFX) - pFX->ang = nAngle; + pFX->s().ang = nAngle; } gFX.remove(actor->s().index); } @@ -424,12 +424,12 @@ void fxTeslaAlt(DBloodActor* actor, int) // 15 { if (!actor) return; spritetype* pSprite = &actor->s(); - spritetype* pFX = gFX.fxSpawn(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { - xvel[pFX->index] = actor->xvel() + Random2(0x1aaaa); - yvel[pFX->index] = actor->yvel() + Random2(0x1aaaa); - zvel[pFX->index] = actor->zvel() - Random(0x1aaaa); + pFX->xvel() = actor->xvel() + Random2(0x1aaaa); + pFX->yvel() = actor->yvel() + Random2(0x1aaaa); + pFX->zvel() = actor->zvel() - Random(0x1aaaa); } evPost(actor, 3, kCallbackFXTeslaAlt); } @@ -527,17 +527,17 @@ void fxPodBloodSpray(DBloodActor* actor, int) // 18 { if (!actor) return; spritetype* pSprite = &actor->s(); - spritetype* pFX; + DBloodActor* pFX; if (pSprite->type == 53) - pFX = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + pFX = gFX.fxSpawnActor(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); else - pFX = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + pFX = gFX.fxSpawnActor(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); if (pFX) { - pFX->ang = 0; - xvel[pFX->index] = actor->xvel() >> 8; - yvel[pFX->index] = actor->yvel() >> 8; - zvel[pFX->index] = actor->zvel() >> 8; + pFX->s().ang = 0; + pFX->xvel() = actor->xvel() >> 8; + pFX->yvel() = actor->yvel() >> 8; + pFX->zvel() = actor->zvel() >> 8; } evPost(actor, 6, kCallbackFXPodBloodSpray); } @@ -561,19 +561,19 @@ void fxPodBloodSplat(DBloodActor* actor, int) // 19 assert(nChannel < 32); sfxPlay3DSound(pSprite, 385, nChannel, 1); } - spritetype *pFX = NULL; + DBloodActor *pFX = NULL; if (pSprite->type == 53 || pSprite->type == kThingPodGreenBall) { if (Chance(0x500) || pSprite->type == kThingPodGreenBall) - pFX = gFX.fxSpawn(FX_55, pSprite->sectnum, x, y, floorZ-64, 0); + pFX = gFX.fxSpawnActor(FX_55, pSprite->sectnum, x, y, floorZ-64, 0); if (pFX) - pFX->ang = nAngle; + pFX->s().ang = nAngle; } else { - pFX = gFX.fxSpawn(FX_32, pSprite->sectnum, x, y, floorZ-64, 0); + pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, floorZ-64, 0); if (pFX) - pFX->ang = nAngle; + pFX->s().ang = nAngle; } gFX.remove(actor->s().index); } diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index f03ad6f03..984ce99b8 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -272,11 +272,10 @@ void fxSpawnBlood(spritetype *pSprite, int ) return; if (adult_lockout && gGameOptions.nGameType <= 0) return; - spritetype *pBlood = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); - if (pBlood) + auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + if (bloodactor) { - auto bloodactor = &bloodActors[pBlood->index]; - pBlood->ang = 1024; + bloodactor->s().ang = 1024; bloodactor->xvel() = Random2(0x6aaaa); bloodactor->yvel() = Random2(0x6aaaa); bloodactor->zvel() = -(int)Random(0x10aaaa)-100; @@ -293,15 +292,14 @@ void sub_746D4(spritetype *pSprite, int ) return; if (adult_lockout && gGameOptions.nGameType <= 0) return; - spritetype *pSpawn; + DBloodActor *spawnactor; if (pSprite->type == kDudePodGreen) - pSpawn = gFX.fxSpawn(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); else - pSpawn = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); - if (pSpawn) + spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); + if (spawnactor) { - auto spawnactor = &bloodActors[pSpawn->index]; - pSpawn->ang = 1024; + spawnactor->s().ang = 1024; spawnactor->xvel() = Random2(0x6aaaa); spawnactor->yvel() = Random2(0x6aaaa); spawnactor->zvel() = -(int)Random(0x10aaaa)-100; @@ -315,16 +313,16 @@ void fxSpawnEjectingBrass(spritetype *pSprite, 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); - spritetype *pBrass = gFX.fxSpawn((FX_ID)(FX_37+Random(3)), pSprite->sectnum, x, y, z, 0); + auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37+Random(3)), pSprite->sectnum, x, y, z, 0); if (pBrass) { if (!VanillaMode()) - pBrass->ang = Random(2047); + pBrass->s().ang = Random(2047); int nDist = (a4<<18)/120+Random2(((a4/4)<<18)/120); int nAngle = pSprite->ang+Random2(56)+512; - xvel[pBrass->index] = MulScale(nDist, Cos(nAngle), 30); - yvel[pBrass->index] = MulScale(nDist, Sin(nAngle), 30); - zvel[pBrass->index] = zvel[pSprite->index]-(0x20000+(Random2(40)<<18)/120); + pBrass->xvel() = MulScale(nDist, Cos(nAngle), 30); + pBrass->yvel() = MulScale(nDist, Sin(nAngle), 30); + pBrass->zvel() = zvel[pSprite->index]-(0x20000+(Random2(40)<<18)/120); } } @@ -334,16 +332,16 @@ void fxSpawnEjectingShell(spritetype *pSprite, 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); - spritetype *pShell = gFX.fxSpawn((FX_ID)(FX_40+Random(3)), pSprite->sectnum, x, y, z, 0); + auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40+Random(3)), pSprite->sectnum, x, y, z, 0); if (pShell) { if (!VanillaMode()) - pShell->ang = Random(2047); + pShell->s().ang = Random(2047); int nDist = (a4<<18)/120+Random2(((a4/4)<<18)/120); int nAngle = pSprite->ang+Random2(56)+512; - xvel[pShell->index] = MulScale(nDist, Cos(nAngle), 30); - yvel[pShell->index] = MulScale(nDist, Sin(nAngle), 30); - zvel[pShell->index] = zvel[pSprite->index]-(0x20000+(Random2(20)<<18)/120); + pShell->xvel() = MulScale(nDist, Cos(nAngle), 30); + pShell->yvel() = MulScale(nDist, Sin(nAngle), 30); + pShell->zvel() = zvel[pSprite->index]-(0x20000+(Random2(20)<<18)/120); } } diff --git a/source/games/blood/src/gib.cpp b/source/games/blood/src/gib.cpp index 764d370e7..5c670b345 100644 --- a/source/games/blood/src/gib.cpp +++ b/source/games/blood/src/gib.cpp @@ -307,41 +307,41 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p gPos.y = pSprite->y+MulScale(pSprite->clipdist<<2, Sin(nAngle), 30); gPos.z = bottom-Random(bottom-top); } - spritetype *pFX = gFX.fxSpawn(pGFX->fxId, nSector, gPos.x, gPos.y, gPos.z, 0); + auto pFX = gFX.fxSpawnActor(pGFX->fxId, nSector, gPos.x, gPos.y, gPos.z, 0); if (pFX) { if (pGFX->at1 < 0) - pFX->pal = pSprite->pal; + pFX->s().pal = pSprite->pal; if (pVel) { - xvel[pFX->index] = pVel->vx+Random2(pGFX->atd); - yvel[pFX->index] = pVel->vy+Random2(pGFX->atd); - zvel[pFX->index] = pVel->vz-Random(pGFX->at11); + pFX->xvel() = pVel->vx+Random2(pGFX->atd); + pFX->yvel() = pVel->vy+Random2(pGFX->atd); + pFX->zvel() = pVel->vz-Random(pGFX->at11); } else { - xvel[pFX->index] = Random2((pGFX->atd<<18)/120); - yvel[pFX->index] = Random2((pGFX->atd<<18)/120); + pFX->xvel() = Random2((pGFX->atd<<18)/120); + pFX->yvel() = Random2((pGFX->atd<<18)/120); switch(pSprite->cstat&48) { case 16: - zvel[pFX->index] = Random2((pGFX->at11<<18)/120); + pFX->zvel() = Random2((pGFX->at11<<18)/120); break; default: if (dz2 < dz1 && dz2 < 0x4000) { - zvel[pFX->index] = 0; + pFX->zvel() = 0; } else if (dz2 > dz1 && dz1 < 0x4000) { - zvel[pFX->index] = -(int)Random((abs(pGFX->at11)<<18)/120); + pFX->zvel() = -(int)Random((abs(pGFX->at11)<<18)/120); } else { if ((pGFX->at11<<18)/120 < 0) - zvel[pFX->index] = -(int)Random((abs(pGFX->at11)<<18)/120); + pFX->zvel() = -(int)Random((abs(pGFX->at11)<<18)/120); else - zvel[pFX->index] = Random2((pGFX->at11<<18)/120); + pFX->zvel() = Random2((pGFX->at11<<18)/120); } break; } @@ -452,22 +452,22 @@ void GibFX(int nWall, GIBFX * pGFX, int a3, int a4, int a5, int a6, CGibVelocity int r1 = Random(a6); int r2 = Random(a5); int r3 = Random(a4); - spritetype *pGib = gFX.fxSpawn(pGFX->fxId, nSector, pWall->x+r3, pWall->y+r2, a3+r1, 0); + auto pGib = gFX.fxSpawnActor(pGFX->fxId, nSector, pWall->x+r3, pWall->y+r2, a3+r1, 0); if (pGib) { if (pGFX->at1 < 0) - pGib->pal = pWall->pal; + pGib->s().pal = pWall->pal; if (!pVel) { - xvel[pGib->index] = Random2((pGFX->atd<<18)/120); - yvel[pGib->index] = Random2((pGFX->atd<<18)/120); - zvel[pGib->index] = -(int)Random((pGFX->at11<<18)/120); + pGib->xvel() = Random2((pGFX->atd<<18)/120); + pGib->yvel() = Random2((pGFX->atd<<18)/120); + pGib->zvel() = -(int)Random((pGFX->at11<<18)/120); } else { - xvel[pGib->index] = Random2((pVel->vx<<18)/120); - yvel[pGib->index] = Random2((pVel->vy<<18)/120); - zvel[pGib->index] = -(int)Random((pVel->vz<<18)/120); + pGib->xvel() = Random2((pVel->vx << 18) / 120); + pGib->yvel() = Random2((pVel->vy << 18) / 120); + pGib->zvel() = -(int)Random((pVel->vz<<18)/120); } } } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 7b6b21436..b3e6e6910 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1534,11 +1534,11 @@ void debrisBubble(int nSprite) int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int z = bottom - Random(bottom - top); - spritetype* pFX = gFX.fxSpawn((FX_ID)(FX_23 + Random(3)), pSprite->sectnum, x, y, z, 0); + auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), pSprite->sectnum, x, y, z, 0); if (pFX) { - xvel[pFX->index] = xvel[nSprite] + Random2(0x1aaaa); - yvel[pFX->index] = yvel[nSprite] + Random2(0x1aaaa); - zvel[pFX->index] = zvel[nSprite] + Random2(0x1aaaa); + pFX->xvel() = xvel[nSprite] + Random2(0x1aaaa); + pFX->yvel() = yvel[nSprite] + Random2(0x1aaaa); + pFX->zvel() = zvel[nSprite] + Random2(0x1aaaa); } } @@ -1696,19 +1696,19 @@ void debrisMove(int listIndex) } moveHit = floorHit; - spritetype* pFX = NULL; spritetype* pFX2 = NULL; + DBloodActor* pFX = NULL, *pFX2 = NULL; switch (tileGetSurfType(floorHit)) { case kSurfLava: - if ((pFX = gFX.fxSpawn(FX_10, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0)) == NULL) break; + if ((pFX = gFX.fxSpawnActor(FX_10, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0)) == NULL) break; for (i = 0; i < 7; i++) { - if ((pFX2 = gFX.fxSpawn(FX_14, pFX->sectnum, pFX->x, pFX->y, pFX->z, 0)) == NULL) continue; - xvel[pFX2->index] = Random2(0x6aaaa); - yvel[pFX2->index] = Random2(0x6aaaa); - zvel[pFX2->index] = -(int)Random(0xd5555); + if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->s().sectnum, pFX->s().x, pFX->s().y, pFX->s().z, 0)) == NULL) continue; + pFX2->xvel() = Random2(0x6aaaa); + pFX2->yvel() = Random2(0x6aaaa); + pFX2->zvel() = -(int)Random(0xd5555); } break; case kSurfWater: - gFX.fxSpawn(FX_9, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); + gFX.fxSpawnActor(FX_9, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); break; } @@ -2813,7 +2813,7 @@ void useEffectGen(XSPRITE* pXSource, spritetype* pSprite) { } else if (valueIsBetween(fxId, 0, kFXMax)) { int pos, top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - spritetype* pEffect = NULL; + DBloodActor* pEffect = nullptr; // select where exactly effect should be spawned switch (pXSource->data4) { @@ -2833,27 +2833,28 @@ void useEffectGen(XSPRITE* pXSource, spritetype* pSprite) { break; } - if ((pEffect = gFX.fxSpawn((FX_ID)fxId, pSprite->sectnum, pSprite->x, pSprite->y, pos, 0)) != NULL) { + if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, pSprite->sectnum, pSprite->x, pSprite->y, pos, 0)) != NULL) { - pEffect->owner = pSource->index; + auto pEffectSpr = &pEffect->s(); + pEffectSpr->owner = pSource->index; if (pSource->flags & kModernTypeFlag1) { - pEffect->pal = pSource->pal; - pEffect->xoffset = pSource->xoffset; - pEffect->yoffset = pSource->yoffset; - pEffect->xrepeat = pSource->xrepeat; - pEffect->yrepeat = pSource->yrepeat; - pEffect->shade = pSource->shade; + pEffectSpr->pal = pSource->pal; + pEffectSpr->xoffset = pSource->xoffset; + pEffectSpr->yoffset = pSource->yoffset; + pEffectSpr->xrepeat = pSource->xrepeat; + pEffectSpr->yrepeat = pSource->yrepeat; + pEffectSpr->shade = pSource->shade; } if (pSource->flags & kModernTypeFlag2) { - pEffect->cstat = pSource->cstat; - if (pEffect->cstat & CSTAT_SPRITE_INVISIBLE) - pEffect->cstat &= ~CSTAT_SPRITE_INVISIBLE; + pEffectSpr->cstat = pSource->cstat; + if (pEffectSpr->cstat & CSTAT_SPRITE_INVISIBLE) + pEffectSpr->cstat &= ~CSTAT_SPRITE_INVISIBLE; } - if (pEffect->cstat & CSTAT_SPRITE_ONE_SIDED) - pEffect->cstat &= ~CSTAT_SPRITE_ONE_SIDED; + if (pEffectSpr->cstat & CSTAT_SPRITE_ONE_SIDED) + pEffectSpr->cstat &= ~CSTAT_SPRITE_ONE_SIDED; } } @@ -5465,7 +5466,7 @@ void useRandomItemGen(spritetype* pSource, XSPRITE* pXSource) { { spritetype* pItem = &sprite[nItem]; if ((unsigned int)pItem->type == pXSource->dropMsg && pItem->x == pSource->x && pItem->y == pSource->y && pItem->z == pSource->z) { - gFX.fxSpawn((FX_ID)29, pSource->sectnum, pSource->x, pSource->y, pSource->z, 0); + gFX.fxSpawnActor((FX_ID)29, pSource->sectnum, pSource->x, pSource->y, pSource->z, 0); pItem->type = kSpriteDecoration; actPostSprite(nItem, kStatFree); break; diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index b20738fa8..172077f22 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -2247,7 +2247,7 @@ void ActivateGenerator(int nSprite) case kGenBubbleMulti: { int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - gFX.fxSpawn((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->sectnum, pSprite->x, pSprite->y, top, 0); break; } }