- Exhumed: Tidy up DExhumedActor variables for clarity.

This commit is contained in:
Mitchell Richters 2023-04-21 21:13:11 +10:00
parent 5efc14411a
commit 4b223ab26d
5 changed files with 21 additions and 18 deletions

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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)

View file

@ -22,13 +22,7 @@ public:
TObjPtr<DExhumedActor*> 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;

View file

@ -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);