mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-21 11:01:01 +00:00
- fixed the rat.
- converted FuncRat to a class.
This commit is contained in:
parent
39ca524185
commit
89d98ddf34
2 changed files with 188 additions and 176 deletions
|
@ -593,6 +593,15 @@ struct AIRa : public ExhumedAI
|
|||
void Draw(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AIRat : public ExhumedAI
|
||||
{
|
||||
void Tick(RunListEvent* ev) override;
|
||||
void Damage(RunListEvent* ev) override;
|
||||
void Draw(RunListEvent* ev) override;
|
||||
void RadialDamage(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
|
||||
void runlist_DispatchEvent(ExhumedAI* ai, int nObject, int nMessage, int nDamage, int nRun);
|
||||
|
||||
typedef void(*AiFunc)(int, int, int, int nRun);
|
||||
|
|
|
@ -204,32 +204,21 @@ int FindFood(short nSprite)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void FuncRat(int nObject, int nMessage, int nDamage, int nRun)
|
||||
void AIRat::RadialDamage(RunListEvent* ev)
|
||||
{
|
||||
short nRat = RunData[nRun].nVal;
|
||||
short nRat = RunData[ev->nRun].nVal;
|
||||
short nSprite = RatList[nRat].nSprite;
|
||||
ev->nDamage = runlist_CheckRadialDamage(nSprite);
|
||||
Damage(ev);
|
||||
}
|
||||
|
||||
void AIRat::Damage(RunListEvent* ev)
|
||||
{
|
||||
short nRat = RunData[ev->nRun].nVal;
|
||||
short nSprite = RatList[nRat].nSprite;
|
||||
short nAction = RatList[nRat].nAction;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
bool bVal = false;
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
default:
|
||||
{
|
||||
Printf("unknown msg %d for Rathead\n", nMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
case 0xA0000:
|
||||
{
|
||||
nDamage = runlist_CheckRadialDamage(nSprite);
|
||||
// fall through to 0x80000
|
||||
fallthrough__;
|
||||
}
|
||||
case 0x80000:
|
||||
{
|
||||
if (nDamage)
|
||||
if (ev->nDamage)
|
||||
{
|
||||
pSprite->cstat = 0;
|
||||
pSprite->xvel = 0;
|
||||
|
@ -238,16 +227,26 @@ void FuncRat(int nObject, int nMessage, int nDamage, int nRun)
|
|||
RatList[nRat].nFrame = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
case 0x90000:
|
||||
{
|
||||
seq_PlotSequence(nObject, SeqOffsets[kSeqRat] + RatSeq[nAction].a, RatList[nRat].nFrame, RatSeq[nAction].b);
|
||||
return;
|
||||
}
|
||||
void AIRat::Draw(RunListEvent* ev)
|
||||
{
|
||||
short nRat = RunData[ev->nRun].nVal;
|
||||
short nAction = RatList[nRat].nAction;
|
||||
|
||||
seq_PlotSequence(ev->nIndex, SeqOffsets[kSeqRat] + RatSeq[nAction].a, RatList[nRat].nFrame, RatSeq[nAction].b);
|
||||
}
|
||||
|
||||
|
||||
void AIRat::Tick(RunListEvent* ev)
|
||||
{
|
||||
short nRat = RunData[ev->nRun].nVal;
|
||||
short nSprite = RatList[nRat].nSprite;
|
||||
short nAction = RatList[nRat].nAction;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
bool bVal = false;
|
||||
|
||||
case 0x20000:
|
||||
{
|
||||
int nSeq = SeqOffsets[kSeqRat] + RatSeq[nAction].a;
|
||||
pSprite->picnum = seq_GetSeqPicnum2(nSeq, RatList[nRat].nFrame);
|
||||
|
||||
|
@ -406,9 +405,13 @@ void FuncRat(int nObject, int nMessage, int nDamage, int nRun)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FuncRat(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AIRat ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
Loading…
Reference in a new issue