From 51202cba780b17521d04569153886ec5a0e2fd87 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Oct 2021 13:20:00 +0200 Subject: [PATCH] - nFinaleSpr. --- source/games/exhumed/src/aistuff.h | 2 +- source/games/exhumed/src/object.cpp | 12 ++++++------ source/games/exhumed/src/runlist.cpp | 2 +- source/games/exhumed/src/sound.h | 5 +++++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index b9089da33..ad9523d2c 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -309,7 +309,7 @@ enum kStatus extern short nSmokeSparks; extern short nDronePitch; extern int lFinaleStart; -extern short nFinaleSpr; +extern DExhumedActor* pFinaleSpr; void InitObjects(); void InitElev(); diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 8c59542ad..5879d6f8d 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -191,7 +191,7 @@ int lFinaleStart; short nEnergyBlocks; short nFinaleStage; -short nFinaleSpr; +DExhumedActor* pFinaleSpr; short nDronePitch = 0; short nSmokeSparks = 0; @@ -387,7 +387,7 @@ void SerializeObjects(FSerializer& arc) ("finalestart", lFinaleStart) ("energyblocks", nEnergyBlocks) ("finalestage", nFinaleStage) - ("finalespr", nFinaleSpr) + ("finalespr", pFinaleSpr) ("dronepitch", nDronePitch) ("smokesparks", nSmokeSparks) .EndObject(); @@ -1640,13 +1640,13 @@ void DoFinale() if (!(dword_96788 & 2)) { int nAng = RandomSize(11); - sprite[nFinaleSpr].ang = nAng; - BuildSpark(&exhumedActors[nFinaleSpr], 1); + pFinaleSpr->s().ang = nAng; + BuildSpark(pFinaleSpr, 1); } if (!RandomSize(2)) { - PlayFX2(StaticSound[kSound78] | 0x2000, nFinaleSpr); + PlayFX2(StaticSound[kSound78] | 0x2000, pFinaleSpr); for (int i = 0; i < nTotalPlayers; i++) { nQuake[i] = 1280; @@ -1847,7 +1847,7 @@ void ExplodeEnergyBlock(int nSprite) } else { - nFinaleSpr = nSprite; + pFinaleSpr = &exhumedActors[nSprite]; lFinaleStart = PlayClock; if (!lFinaleStart) { diff --git a/source/games/exhumed/src/runlist.cpp b/source/games/exhumed/src/runlist.cpp index 00dc2399e..6e93d1e4b 100644 --- a/source/games/exhumed/src/runlist.cpp +++ b/source/games/exhumed/src/runlist.cpp @@ -1066,7 +1066,7 @@ void runlist_ProcessSectorTag(int nSector, int nLotag, int nHitag) int nEnergyBlock = BuildEnergyBlock(nSector); if (nLotag == 36) { - nFinaleSpr = nEnergyBlock; + pFinaleSpr = &exhumedActors[nEnergyBlock]; } return; diff --git a/source/games/exhumed/src/sound.h b/source/games/exhumed/src/sound.h index 70201ff5d..e1121019d 100644 --- a/source/games/exhumed/src/sound.h +++ b/source/games/exhumed/src/sound.h @@ -132,6 +132,11 @@ void BendAmbientSound(); void CheckAmbience(short nSector); void PlayFX2(unsigned short nSound, short nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0); +inline void PlayFX2(unsigned short nSound, DExhumedActor* actor, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0) +{ + PlayFX2(nSound, actor->GetSpriteIndex(), sectf, chanflags, sprflags); +} + void PlayFXAtXYZ(unsigned short nSound, int x, int y, int z, int nSector, EChanFlags chanflags = CHANF_NONE, int sectf = 0); inline void D3PlayFX(unsigned short nSound, short nSprite, short flags = 0) {