From 4b223ab26df06a61c56d251fb3d6c74896adc16a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 21 Apr 2023 21:13:11 +1000 Subject: [PATCH] - Exhumed: Tidy up `DExhumedActor` variables for clarity. --- source/games/exhumed/src/anims.cpp | 14 +++++++------- source/games/exhumed/src/bubbles.cpp | 6 +++--- source/games/exhumed/src/exhumed.cpp | 2 +- source/games/exhumed/src/exhumedactor.h | 15 +++++++++------ source/games/exhumed/src/player.cpp | 2 +- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/source/games/exhumed/src/anims.cpp b/source/games/exhumed/src/anims.cpp index 33e367d5f..76d57a707 100644 --- a/source/games/exhumed/src/anims.cpp +++ b/source/games/exhumed/src/anims.cpp @@ -115,7 +115,7 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, const FName seqFile, int seqInde pActor->nFlags = nFlag; pActor->nFrame = 0; pActor->nSeqFile = seqFile; - pActor->nSeq = seqIndex; + pActor->nSeqIndex = seqIndex; pActor->pTarget = nullptr; pActor->nPhase = ITEM_MAGIC; pActor->backuppos(); @@ -134,7 +134,7 @@ void AIAnim::Tick(RunListEvent* ev) const auto pActor = ev->pObjActor; if (!pActor || pActor->nSeqFile == NAME_None) return; - const auto& animSeq = getSequence(pActor->nSeqFile, pActor->nSeq); + const auto& animSeq = getSequence(pActor->nSeqFile, pActor->nSeqIndex); const int nFrame = pActor->nFrame; if (!(pActor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) @@ -208,18 +208,18 @@ void AIAnim::Tick(RunListEvent* ev) { pActor->nFrame = 0; } - else if (pActor->nSeqFile == FName("magic2") && pActor->nSeq == 0) + else if (pActor->nSeqFile == FName("magic2") && pActor->nSeqIndex == 0) { pActor->nFrame = 0; pActor->nSeqFile = "items"; - pActor->nSeq = 21; + pActor->nSeqIndex = 21; pActor->nFlags |= kAnimLoop; pActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT; } - else if (pActor->nSeqFile == FName("items") && pActor->nSeq == 12) + else if (pActor->nSeqFile == FName("items") && pActor->nSeqIndex == 12) { pActor->nFrame = 0; - pActor->nSeq++; + pActor->nSeqIndex++; pActor->nFlags |= kAnimLoop; } else @@ -240,7 +240,7 @@ void AIAnim::Draw(RunListEvent* ev) const auto pActor = ev->pObjActor; if (!pActor || pActor->nSeqFile == NAME_None) return; - seq_PlotSequence(ev->nParam, pActor->nSeqFile, pActor->nSeq, pActor->nFrame, 0x101); + seq_PlotSequence(ev->nParam, pActor->nSeqFile, pActor->nSeqIndex, pActor->nFrame, 0x101); ev->pTSprite->ownerActor = nullptr; } diff --git a/source/games/exhumed/src/bubbles.cpp b/source/games/exhumed/src/bubbles.cpp index 5d01ba682..d88b561dc 100644 --- a/source/games/exhumed/src/bubbles.cpp +++ b/source/games/exhumed/src/bubbles.cpp @@ -78,7 +78,7 @@ static DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector, cons pActor->nFrame = 0; pActor->nSeqFile = "bubble"; - pActor->nSeq = nSize; + pActor->nSeqIndex = nSize; pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x140000); pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x140000); @@ -96,7 +96,7 @@ void AIBubble::Tick(RunListEvent* ev) const auto pActor = ev->pObjActor; if (!pActor) return; - const auto& bubbSeq = getSequence(pActor->nSeqFile, pActor->nSeq); + const auto& bubbSeq = getSequence(pActor->nSeqFile, pActor->nSeqIndex); playFrameSound(pActor, bubbSeq[pActor->nFrame]); @@ -130,7 +130,7 @@ void AIBubble::Draw(RunListEvent* ev) { if (const auto pActor = ev->pObjActor) { - seq_PlotSequence(ev->nParam, pActor->nSeqFile, pActor->nSeq, pActor->nFrame, 1); + seq_PlotSequence(ev->nParam, pActor->nSeqFile, pActor->nSeqIndex, pActor->nFrame, 1); ev->pTSprite->ownerActor = nullptr; } } diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 0ec3e1627..72ab35768 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -579,7 +579,7 @@ void DExhumedActor::Serialize(FSerializer& arc) ("index2", nIndex2) ("channel", nChannel) ("damage", nDamage) - ("seq", nSeq) + ("seqidx", nSeqIndex) ("seqfile", nSeqFile) ("flags", nFlags) ("angle2", pitch) diff --git a/source/games/exhumed/src/exhumedactor.h b/source/games/exhumed/src/exhumedactor.h index 38c4cf343..b8e3810ae 100644 --- a/source/games/exhumed/src/exhumedactor.h +++ b/source/games/exhumed/src/exhumedactor.h @@ -22,13 +22,7 @@ public: TObjPtr pTarget; int16_t nPhase; - int16_t nHealth; - int16_t nSeq; - FName nSeqFile; - uint16_t nFrame; - int16_t nFlags; - int16_t nAction; int16_t nCount; int16_t nRun; union { int16_t nIndex; int16_t nAngle; }; // angle is for wasp. @@ -41,6 +35,15 @@ public: int nTurn; DVector2 vec; + // for sequences. + FName nSeqFile; + uint16_t nFrame; + int16_t nAction; + + // for anims. + int16_t nSeqIndex; + int16_t nFlags; + DExhumedActor() = default; diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index c501c2840..9abe927d8 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1016,7 +1016,7 @@ void doPlayerItemPickups(Player* const pPlayer) case 59: // Scarab (Checkpoint) if (nLocalPlayer == pPlayer->nPlayer) { - pPickupActor->nSeq++; + pPickupActor->nSeqIndex++; pPickupActor->nFlags &= 0xEF; pPickupActor->nFrame = 0; ChangeActorStat(pPickupActor, 899);