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 InitChunks();
|
||||||
void InitPushBlocks();
|
void InitPushBlocks();
|
||||||
void Gravity(DExhumedActor* actor);
|
void Gravity(DExhumedActor* actor);
|
||||||
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy);
|
DExhumedActor* UpdateEnemy(DExhumedActor* ppEnemy);
|
||||||
Collision MoveCreature(DExhumedActor* nSprite);
|
Collision MoveCreature(DExhumedActor* nSprite);
|
||||||
Collision MoveCreatureWithCaution(DExhumedActor* actor);
|
Collision MoveCreatureWithCaution(DExhumedActor* actor);
|
||||||
DVector3 WheresMyMouth(DExhumedPlayer* const pPlayer, sectortype** sectnum);
|
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)) {
|
if (!(ppEnemy->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
|
||||||
*ppEnemy = nullptr;
|
{
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ppEnemy;
|
||||||
return *ppEnemy;
|
|
||||||
}
|
}
|
||||||
END_PS_NS
|
END_PS_NS
|
||||||
|
|
|
@ -133,9 +133,8 @@ void AIMummy::Tick(RunListEvent* ev)
|
||||||
auto pActor = ev->pObjActor;
|
auto pActor = ev->pObjActor;
|
||||||
if (!pActor) return;
|
if (!pActor) return;
|
||||||
|
|
||||||
DExhumedActor* targ = pActor->pTarget;
|
auto pTarget = UpdateEnemy(pActor->pTarget);
|
||||||
auto pTarget = UpdateEnemy(&targ);
|
pActor->pTarget = pTarget;
|
||||||
pActor->pTarget = targ;
|
|
||||||
|
|
||||||
int nAction = pActor->nAction;
|
int nAction = pActor->nAction;
|
||||||
|
|
||||||
|
|
|
@ -563,10 +563,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
|
||||||
bVal = true;
|
bVal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DExhumedActor* enemy = pEgg->pActor;
|
pTarget = UpdateEnemy(pEgg->pTarget);
|
||||||
pTarget = UpdateEnemy(&enemy);
|
|
||||||
pEgg->pActor = enemy;
|
|
||||||
pEgg->pTarget = pTarget;
|
|
||||||
|
|
||||||
if (pTarget && (pTarget->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) == 0)
|
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 nEgg = RunData[ev->nRun].nObjIndex;
|
||||||
const auto pEgg = &QueenEgg[nEgg];
|
const auto pEgg = &QueenEgg[nEgg];
|
||||||
const auto eggSeq = &EggSeq[pEgg->nAction];
|
const auto eggSeq = &EggSeq[pEgg->nAction];
|
||||||
|
if (pEgg->pActor == nullptr) return;
|
||||||
seq_PlotSequence(ev->nParam, pEgg->pActor->nSeqFile, eggSeq->nSeqId, pEgg->nFrame, eggSeq->nFlags);
|
seq_PlotSequence(ev->nParam, pEgg->pActor->nSeqFile, eggSeq->nSeqId, pEgg->nFrame, eggSeq->nFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue