- Exhumed: Separate out seq variables within DExhumedActor.

This commit is contained in:
Mitchell Richters 2023-04-21 21:10:45 +10:00
parent 57ffb0e251
commit 80125e11f3
6 changed files with 36 additions and 33 deletions

View file

@ -133,11 +133,10 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, int nSeq, int nOffset, const DVe
pActor->spr.intowner = -1;
pActor->spr.extra = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x100000);
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x100000);
pActor->nAction = nFlag;
pActor->nIndex = 0;
pActor->nIndex2 = getSeqFromId(nSeq, nOffset);
pActor->nFlags = nFlag;
pActor->nFrame = 0;
pActor->nSeq = getSeqFromId(nSeq, nOffset);
pActor->pTarget = nullptr;
pActor->nDamage = pActor->nRun;
pActor->nPhase = ITEM_MAGIC;
pActor->backuppos();
@ -155,8 +154,8 @@ void AIAnim::Tick(RunListEvent* ev)
const auto pActor = ev->pObjActor;
if (!pActor) return;
const int nSeq = pActor->nIndex2;
const int nFrame = pActor->nIndex;
const int nSeq = pActor->nSeq;
const int nFrame = pActor->nFrame;
if (!(pActor->spr.cstat & CSTAT_SPRITE_INVISIBLE))
{
@ -222,25 +221,25 @@ void AIAnim::Tick(RunListEvent* ev)
}
}
pActor->nIndex++;
if (pActor->nIndex >= getSeqFrameCount(nSeq))
pActor->nFrame++;
if (pActor->nFrame >= getSeqFrameCount(nSeq))
{
if (pActor->nAction & 0x10)
if (pActor->nFlags & kAnimLoop)
{
pActor->nIndex = 0;
pActor->nFrame = 0;
}
else if (nSeq == nPreMagicSeq)
{
pActor->nIndex = 0;
pActor->nIndex2 = nMagicSeq;
pActor->nAction |= 0x10;
pActor->nFrame = 0;
pActor->nSeq = nMagicSeq;
pActor->nFlags |= kAnimLoop;
pActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT;
}
else if (nSeq == nSavePointSeq)
{
pActor->nIndex = 0;
pActor->nIndex2++;
pActor->nAction |= 0x10;
pActor->nFrame = 0;
pActor->nSeq++;
pActor->nFlags |= kAnimLoop;
}
else
{
@ -260,7 +259,7 @@ void AIAnim::Draw(RunListEvent* ev)
const auto pActor = ev->pObjActor;
if (!pActor) return;
seq_PlotSequence(ev->nParam, pActor->nIndex2, pActor->nIndex, 0x101);
seq_PlotSequence(ev->nParam, pActor->nSeq, pActor->nFrame, 0x101);
ev->pTSprite->ownerActor = nullptr;
}

View file

@ -77,7 +77,7 @@ static DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector, cons
// GrabTimeSlot(3);
pActor->nFrame = 0;
pActor->nIndex = getSeqFromId(kSeqBubble, nSize);
pActor->nSeq = getSeqFromId(kSeqBubble, nSize);
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x140000);
pActor->nRun = runlist_AddRunRec(NewRun, pActor, 0x140000);
@ -95,7 +95,7 @@ void AIBubble::Tick(RunListEvent* ev)
const auto pActor = ev->pObjActor;
if (!pActor) return;
const int nSeq = pActor->nIndex;
const int nSeq = pActor->nSeq;
seq_MoveSequence(pActor, nSeq, pActor->nFrame);
@ -130,7 +130,7 @@ void AIBubble::Draw(RunListEvent* ev)
const auto pActor = ev->pObjActor;
if (!pActor) return;
seq_PlotSequence(ev->nParam, pActor->nIndex, pActor->nFrame, 1);
seq_PlotSequence(ev->nParam, pActor->nSeq, pActor->nFrame, 1);
ev->pTSprite->ownerActor = nullptr;
}

View file

@ -579,6 +579,8 @@ void DExhumedActor::Serialize(FSerializer& arc)
("index2", nIndex2)
("channel", nChannel)
("damage", nDamage)
("seq", nSeq)
("flags", nFlags)
("angle2", pitch)
("turn", nTurn)

View file

@ -24,7 +24,9 @@ public:
int16_t nPhase;
int16_t nHealth;
int16_t nSeq;
int16_t nFrame;
int16_t nFlags;
int16_t nAction;
int16_t nCount;
int16_t nRun;

View file

@ -1889,11 +1889,11 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
if (nSeq > -1)
{
pActor->nIndex = getSeqFromId(nSeq);
pActor->nSeq = getSeqFromId(nSeq);
if (!nOjectType) // if not Explosion Trigger (e.g. Exploding Fire Cauldron)
{
pActor->nFrame = RandomSize(4) % (getSeqFrameCount(pActor->nIndex) - 1);
pActor->nFrame = RandomSize(4) % (getSeqFrameCount(pActor->nSeq) - 1);
}
auto pActor2 = insertActor(pActor->sector(), 0);
@ -1906,7 +1906,7 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
else
{
pActor->nFrame = 0;
pActor->nIndex = -1;
pActor->nSeq = -1;
if (pActor->spr.statnum == kStatDestructibleSprite) {
pActor->nIndex2 = -1;
@ -1949,7 +1949,7 @@ void AIObject::Tick(RunListEvent* ev)
auto pActor = ev->pObjActor;
if (!pActor) return;
int nStat = pActor->spr.statnum;
int bx = pActor->nIndex;
int nSeq = pActor->nSeq;
if (nStat == 97 || (!(pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))) {
return;
@ -1960,14 +1960,14 @@ void AIObject::Tick(RunListEvent* ev)
}
// do animation
if (bx != -1)
if (nSeq != -1)
{
pActor->nFrame++;
if (pActor->nFrame >= getSeqFrameCount(bx)) {
if (pActor->nFrame >= getSeqFrameCount(nSeq)) {
pActor->nFrame = 0;
}
pActor->spr.picnum = seq_GetSeqPicnum2(bx, pActor->nFrame);
pActor->spr.picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
}
if (pActor->nHealth >= 0) {
@ -2102,11 +2102,11 @@ void AIObject::Draw(RunListEvent* ev)
{
auto pActor = ev->pObjActor;
if (!pActor) return;
int bx = pActor->nIndex;
int nSeq = pActor->nSeq;
if (bx > -1)
if (nSeq > -1)
{
seq_PlotSequence(ev->nParam, bx, pActor->nFrame, 1);
seq_PlotSequence(ev->nParam, nSeq, pActor->nFrame, 1);
}
return;
}

View file

@ -1015,9 +1015,9 @@ void doPlayerItemPickups(Player* const pPlayer)
case 59: // Scarab (Checkpoint)
if (nLocalPlayer == pPlayer->nPlayer)
{
pPickupActor->nIndex2++;
pPickupActor->nAction &= 0xEF;
pPickupActor->nIndex = 0;
pPickupActor->nSeq++;
pPickupActor->nFlags &= 0xEF;
pPickupActor->nFrame = 0;
ChangeActorStat(pPickupActor, 899);
}
SetSavePoint(pPlayer->nPlayer, pPlayerActor->spr.pos, pPlayerSect, pPlayerActor->spr.Angles.Yaw);