- converted FuncBubble into a class.

This commit is contained in:
Christoph Oelckers 2021-10-15 21:07:58 +02:00
parent 0fc490bf40
commit 832b394561
2 changed files with 43 additions and 45 deletions

View file

@ -446,6 +446,12 @@ struct AIAnubis : public ExhumedAI
void Damage(RunListEvent* ev) override;
};
struct AIBubble : ExhumedAI
{
void Tick(RunListEvent* ev) override;
void Draw(RunListEvent* ev) override;
};
void runlist_DispatchEvent(ExhumedAI* ai, int nObject, int nMessage, int nDamage, int nRun);

View file

@ -162,19 +162,15 @@ int BuildBubble(int x, int y, int z, short nSector)
return nBubble | 0x140000;
}
void FuncBubble(int nObject, int nMessage, int, int nRun)
void AIBubble::Tick(RunListEvent* ev)
{
short nBubble = RunData[nRun].nVal;
short nBubble = RunData[ev->nRun].nVal;
assert(nBubble >= 0 && nBubble < kMaxBubbles);
short nSprite = BubbleList[nBubble].nSprite;
short nSeq = BubbleList[nBubble].nSeq;
auto pSprite = &sprite[nSprite];
switch (nMessage)
{
case 0x20000:
{
seq_MoveSequence(nSprite, nSeq, BubbleList[nBubble].nFrame);
BubbleList[nBubble].nFrame++;
@ -197,25 +193,21 @@ void FuncBubble(int nObject, int nMessage, int, int nRun)
DestroyBubble(nBubble);
}
}
return;
}
void AIBubble::Draw(RunListEvent* ev)
{
short nBubble = RunData[ev->nRun].nVal;
assert(nBubble >= 0 && nBubble < kMaxBubbles);
case 0x90000:
{
seq_PlotSequence(nObject, nSeq, BubbleList[nBubble].nFrame, 1);
mytsprite[nObject].owner = -1;
return;
}
seq_PlotSequence(ev->nIndex, BubbleList[nBubble].nSeq, BubbleList[nBubble].nFrame, 1);
ev->pTSprite->owner = -1;
}
case 0x80000:
case 0xA0000:
return;
default:
Printf("unknown msg %d for Bubble\n", nMessage);
return;
}
void FuncBubble(int nObject, int nMessage, int nDamage, int nRun)
{
AIBubble ai;
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
}
void DoBubbleMachines()