- converted FuncBullets into a class.

This commit is contained in:
Christoph Oelckers 2021-10-15 21:10:16 +02:00
parent 832b394561
commit 8f9e9de4b4
2 changed files with 59 additions and 59 deletions

View file

@ -452,6 +452,12 @@ struct AIBubble : ExhumedAI
void Draw(RunListEvent* ev) override;
};
class AIBullet : public 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

@ -811,19 +811,15 @@ int BuildBullet(short nSprite, int nType, int, int, int val1, int nAngle, int va
return nBulletSprite | (nBullet << 16);
}
void FuncBullet(int nObject, int nMessage, int, int nRun)
void AIBullet::Tick(RunListEvent* ev)
{
short nBullet = RunData[nRun].nVal;
short nBullet = RunData[ev->nRun].nVal;
assert(nBullet >= 0 && nBullet < kMaxBullets);
short nSeq = SeqOffsets[BulletList[nBullet].nSeq];
short nSprite = BulletList[nBullet].nSprite;
auto pSprite = &sprite[nSprite];
switch (nMessage)
{
case 0x20000:
{
short nFlag = FrameFlag[SeqBase[nSeq] + BulletList[nBullet].nFrame];
seq_MoveSequence(nSprite, nSeq, BulletList[nBullet].nFrame);
@ -853,12 +849,16 @@ void FuncBullet(int nObject, int nMessage, int, int nRun)
{
MoveBullet(nBullet);
}
break;
}
case 0x90000:
void AIBullet::Draw(RunListEvent* ev)
{
short nSprite2 = nObject;
short nBullet = RunData[ev->nRun].nVal;
assert(nBullet >= 0 && nBullet < kMaxBullets);
short nSeq = SeqOffsets[BulletList[nBullet].nSeq];
short nSprite2 = ev->nIndex;
mytsprite[nSprite2].statnum = 1000;
if (BulletList[nBullet].nType == 15)
@ -868,19 +868,13 @@ void FuncBullet(int nObject, int nMessage, int, int nRun)
else
{
seq_PlotSequence(nSprite2, nSeq, BulletList[nBullet].nFrame, 0);
mytsprite[nSprite2].owner = -1;
ev->pTSprite->owner = -1;
}
break;
}
case 0xA0000:
break;
default:
void FuncBullet(int nObject, int nMessage, int nDamage, int nRun)
{
Printf("unknown msg %d for bullet\n", nMessage);
return;
}
}
AIBullet ai;
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
}
END_PS_NS