- reworked non-functional anim detection when picking up an item.

This would not unregister the item's run list entries because the logic was insufficient.
This commit is contained in:
Christoph Oelckers 2021-11-08 01:13:54 +01:00
parent 43fdc1bb56
commit afec39aded
4 changed files with 10 additions and 3 deletions

View file

@ -111,6 +111,8 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, int val, int val2, int x, int y,
pActor->nIndex = 0;
pActor->nIndex2 = SeqOffsets[val] + val2;
pActor->pTarget = nullptr;
pActor->nDamage = pActor->nRun;
pActor->nPhase = ITEM_MAGIC;
if (nFlag & 0x80) {
pSprite->cstat |= 0x2; // set transluscence

View file

@ -39,6 +39,8 @@ BEGIN_PS_NS
enum { kTimerTicks = 120 };
const int ITEM_MAGIC = 0x4711;
enum basepal_t {
BASEPAL = 0,
ANIMPAL,

View file

@ -146,7 +146,7 @@ void BuildItemAnim(DExhumedActor* pActor)
void DestroyItemAnim(DExhumedActor* actor)
{
if (actor && actor->s().owner == 0)
if (actor && actor->s().owner >= 0)
DestroyAnim(actor);
}

View file

@ -1349,8 +1349,11 @@ sectdone:
// CHECKME - is order of evaluation correct?
if (!mplevel || (var_70 >= 25 && (var_70 <= 25 || var_70 == 50)))
{
DestroyItemAnim(pActorB);
DeleteActor(pActorB);
// If this is an anim we need to properly destroy it so we need to do some proper detection and not wild guesses.
if (pActorB->nRun == pActorB->nDamage && pActorB->nRun != 0 && pActorB->nPhase == ITEM_MAGIC)
DestroyAnim(pActorB);
else
DeleteActor(pActorB);
}
else
{