mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- converted FuncLavaDude(Limb) into classes
This commit is contained in:
parent
e73725a40e
commit
45e7b7c4d5
2 changed files with 333 additions and 321 deletions
|
@ -479,6 +479,19 @@ struct AIGrenade : public ExhumedAI
|
|||
void RadialDamage(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AILavaDude : public ExhumedAI
|
||||
{
|
||||
void Tick(RunListEvent* ev) override;
|
||||
void Damage(RunListEvent* ev) override;
|
||||
void Draw(RunListEvent* ev) override;
|
||||
};
|
||||
|
||||
struct AILavaDudeLimb : 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);
|
||||
|
||||
|
|
|
@ -113,16 +113,12 @@ int BuildLavaLimb(int nSprite, int edx, int ebx)
|
|||
return nLimbSprite;
|
||||
}
|
||||
|
||||
void FuncLavaLimb(int nObject, int nMessage, int, int nRun)
|
||||
void AILavaDudeLimb::Tick(RunListEvent* ev)
|
||||
{
|
||||
short nSprite = RunData[nRun].nVal;
|
||||
short nSprite = RunData[ev->nRun].nVal;
|
||||
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
case 0x20000:
|
||||
{
|
||||
pSprite->shade += 3;
|
||||
|
||||
int nRet = movesprite(nSprite, pSprite->xvel << 12, pSprite->yvel << 12, pSprite->zvel, 2560, -2560, CLIPMASK1);
|
||||
|
@ -139,18 +135,20 @@ void FuncLavaLimb(int nObject, int nMessage, int, int nRun)
|
|||
|
||||
mydeletesprite(nSprite);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x90000:
|
||||
void AILavaDudeLimb::Draw(RunListEvent* ev)
|
||||
{
|
||||
seq_PlotSequence(nObject, (SeqOffsets[kSeqLavag] + 30) + pSprite->picnum, 0, 1);
|
||||
break;
|
||||
short nSprite = RunData[ev->nRun].nVal;
|
||||
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
||||
auto pSprite = &sprite[nSprite];
|
||||
seq_PlotSequence(ev->nIndex, (SeqOffsets[kSeqLavag] + 30) + pSprite->picnum, 0, 1);
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
void FuncLavaLimb(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AILavaDudeLimb ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
|
||||
void BuildLava(short nSprite, int x, int y, int, short nSector, short nAngle, int nChannel)
|
||||
|
@ -211,43 +209,34 @@ void BuildLava(short nSprite, int x, int y, int, short nSector, short nAngle, in
|
|||
nCreaturesTotal++;
|
||||
}
|
||||
|
||||
void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
||||
void AILavaDude::Draw(RunListEvent* ev)
|
||||
{
|
||||
unsigned nLava = RunData[nRun].nVal;
|
||||
unsigned nLava = RunData[ev->nRun].nVal;
|
||||
assert(nLava < LavaList.Size());
|
||||
|
||||
short nAction = LavaList[nLava].nAction;
|
||||
short nSeq = LavadudeSeq[nAction].a + SeqOffsets[kSeqLavag];
|
||||
|
||||
seq_PlotSequence(ev->nIndex, nSeq, LavaList[nLava].nFrame, LavadudeSeq[nAction].b);
|
||||
ev->pTSprite->owner = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
void AILavaDude::Damage(RunListEvent* ev)
|
||||
{
|
||||
unsigned nLava = RunData[ev->nRun].nVal;
|
||||
assert(nLava < LavaList.Size());
|
||||
|
||||
short nAction = LavaList[nLava].nAction;
|
||||
short nSprite = LavaList[nLava].nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
switch (nMessage)
|
||||
{
|
||||
default:
|
||||
{
|
||||
Printf("unknown msg %d for Lava\n", nMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x90000:
|
||||
{
|
||||
seq_PlotSequence(nObject, nSeq, LavaList[nLava].nFrame, LavadudeSeq[nAction].b);
|
||||
mytsprite[nObject].owner = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
case 0xA0000:
|
||||
if (!ev->nDamage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x80000:
|
||||
{
|
||||
if (!nDamage) {
|
||||
return;
|
||||
}
|
||||
|
||||
LavaList[nLava].nHealth -= dmgAdjust(nDamage, 3);
|
||||
LavaList[nLava].nHealth -= dmgAdjust(ev->nDamage, 3);
|
||||
|
||||
if (LavaList[nLava].nHealth <= 0)
|
||||
{
|
||||
|
@ -261,7 +250,7 @@ void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
|||
}
|
||||
else
|
||||
{
|
||||
short nTarget = nObject;
|
||||
short nTarget = ev->nIndex;
|
||||
|
||||
if (nTarget >= 0)
|
||||
{
|
||||
|
@ -283,12 +272,19 @@ void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
|||
|
||||
BuildLavaLimb(nSprite, totalmoves, 64000);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x20000:
|
||||
void AILavaDude::Tick(RunListEvent* ev)
|
||||
{
|
||||
unsigned nLava = RunData[ev->nRun].nVal;
|
||||
assert(nLava < LavaList.Size());
|
||||
|
||||
short nAction = LavaList[nLava].nAction;
|
||||
short nSeq = LavadudeSeq[nAction].a + SeqOffsets[kSeqLavag];
|
||||
|
||||
short nSprite = LavaList[nLava].nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
|
||||
pSprite->picnum = seq_GetSeqPicnum2(nSeq, LavaList[nLava].nFrame);
|
||||
int var_38 = LavaList[nLava].nFrame;
|
||||
|
||||
|
@ -466,8 +462,7 @@ void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
|||
{
|
||||
BuildLavaLimb(nSprite, ecx, 64000);
|
||||
ecx++;
|
||||
}
|
||||
while (ecx < 20);
|
||||
} while (ecx < 20);
|
||||
runlist_ChangeChannel(LavaList[nLava].nIndex, 1);
|
||||
}
|
||||
}
|
||||
|
@ -479,8 +474,7 @@ void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
|||
{
|
||||
BuildLavaLimb(nSprite, ecx, 256);
|
||||
ecx++;
|
||||
}
|
||||
while (ecx < 30);
|
||||
} while (ecx < 30);
|
||||
|
||||
runlist_DoSubRunRec(pSprite->owner);
|
||||
runlist_FreeRun(pSprite->lotag - 1);
|
||||
|
@ -516,6 +510,11 @@ void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
|||
// loc_31521:
|
||||
pSprite->pal = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FuncLava(int nObject, int nMessage, int nDamage, int nRun)
|
||||
{
|
||||
AILavaDude ai;
|
||||
runlist_DispatchEvent(&ai, nObject, nMessage, nDamage, nRun);
|
||||
}
|
||||
END_PS_NS
|
||||
|
|
Loading…
Reference in a new issue