- converted FuncCreatureChunk into a class.

This commit is contained in:
Christoph Oelckers 2021-10-15 21:58:07 +02:00
parent b772200dd4
commit 008825fe32
2 changed files with 15 additions and 6 deletions

View file

@ -500,6 +500,11 @@ struct AILion : public ExhumedAI
void RadialDamage(RunListEvent* ev) override;
};
struct AICreatureChunk : public ExhumedAI
{
virtual void Tick(RunListEvent* ev) override;
};
void runlist_DispatchEvent(ExhumedAI* ai, int nObject, int nMessage, int nDamage, int nRun);

View file

@ -1491,14 +1491,11 @@ int BuildCreatureChunk(int nVal, int nPic)
return nSprite | 0xD0000;
}
void FuncCreatureChunk(int nObject, int nMessage, int, int nRun)
void AICreatureChunk::Tick(RunListEvent* ev)
{
int nSprite = RunData[nRun].nVal;
int nSprite = RunData[ev->nRun].nVal;
assert(nSprite >= 0 && nSprite < kMaxSprites);
auto pSprite = &sprite[nSprite];
if (nMessage != 0x20000)
return;
auto pSprite = &sprite[nSprite];
Gravity(nSprite);
@ -1569,6 +1566,13 @@ void FuncCreatureChunk(int nObject, int nMessage, int, int nRun)
pSprite->lotag = 0;
}
void FuncCreatureChunk(int nObject, int nMessage, int nDamage, int nRun)
{
AICreatureChunk ai;
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
}
short UpdateEnemy(short *nEnemy)
{
if (*nEnemy >= 0)