mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
Exhumed: sanitize stupid implementation of UpdateEnemy and fixed bad use of it for the queen's eggs.
This commit is contained in:
parent
91dfeb42bd
commit
5a176fdf3d
4 changed files with 11 additions and 14 deletions
|
@ -210,7 +210,7 @@ void MoveThings();
|
|||
void InitChunks();
|
||||
void InitPushBlocks();
|
||||
void Gravity(DExhumedActor* actor);
|
||||
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy);
|
||||
DExhumedActor* UpdateEnemy(DExhumedActor* ppEnemy);
|
||||
Collision MoveCreature(DExhumedActor* nSprite);
|
||||
Collision MoveCreatureWithCaution(DExhumedActor* actor);
|
||||
DVector3 WheresMyMouth(DExhumedPlayer* const pPlayer, sectortype** sectnum);
|
||||
|
|
|
@ -1286,15 +1286,15 @@ void AICreatureChunk::Tick(RunListEvent* ev)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy)
|
||||
DExhumedActor* UpdateEnemy(DExhumedActor* ppEnemy)
|
||||
{
|
||||
if (*ppEnemy)
|
||||
if (ppEnemy)
|
||||
{
|
||||
if (!((*ppEnemy)->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)) {
|
||||
*ppEnemy = nullptr;
|
||||
if (!(ppEnemy->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return *ppEnemy;
|
||||
return ppEnemy;
|
||||
}
|
||||
END_PS_NS
|
||||
|
|
|
@ -133,9 +133,8 @@ void AIMummy::Tick(RunListEvent* ev)
|
|||
auto pActor = ev->pObjActor;
|
||||
if (!pActor) return;
|
||||
|
||||
DExhumedActor* targ = pActor->pTarget;
|
||||
auto pTarget = UpdateEnemy(&targ);
|
||||
pActor->pTarget = targ;
|
||||
auto pTarget = UpdateEnemy(pActor->pTarget);
|
||||
pActor->pTarget = pTarget;
|
||||
|
||||
int nAction = pActor->nAction;
|
||||
|
||||
|
|
|
@ -563,10 +563,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
|
|||
bVal = true;
|
||||
}
|
||||
|
||||
DExhumedActor* enemy = pEgg->pActor;
|
||||
pTarget = UpdateEnemy(&enemy);
|
||||
pEgg->pActor = enemy;
|
||||
pEgg->pTarget = pTarget;
|
||||
pTarget = UpdateEnemy(pEgg->pTarget);
|
||||
|
||||
if (pTarget && (pTarget->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) == 0)
|
||||
{
|
||||
|
@ -734,6 +731,7 @@ void AIQueenEgg::Draw(RunListEvent* ev)
|
|||
const auto nEgg = RunData[ev->nRun].nObjIndex;
|
||||
const auto pEgg = &QueenEgg[nEgg];
|
||||
const auto eggSeq = &EggSeq[pEgg->nAction];
|
||||
if (pEgg->pActor == nullptr) return;
|
||||
seq_PlotSequence(ev->nParam, pEgg->pActor->nSeqFile, eggSeq->nSeqId, pEgg->nFrame, eggSeq->nFlags);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue