- Exhumed: Repair OOB seq access with Anubis.

* Everytime `nAction` changes, `nFrame` must be reset as well.
* One `AnubisSeq[]` index has an `nSeqId` of `-1`, this must be handled.
This commit is contained in:
Mitchell Richters 2023-04-16 18:07:10 +10:00
parent 27b9b0d2f8
commit ba8bdf347e

View file

@ -226,6 +226,7 @@ void AIAnubis::Tick(RunListEvent* ev)
{
// Don't let Anubis get stuck in this state and allow him to acquire a new target.
ap->nAction = 0;
ap->nFrame = 0;
ap->nCount = 50;
}
}
@ -239,6 +240,7 @@ void AIAnubis::Tick(RunListEvent* ev)
if (pTarget == nullptr)
{
ap->nAction = 0;
ap->nFrame = 0;
ap->nCount = 50;
}
else
@ -246,6 +248,7 @@ void AIAnubis::Tick(RunListEvent* ev)
if (PlotCourseToSprite(ap, pTarget) >= 48)
{
ap->nAction = 1;
ap->nFrame = 0;
}
else if (seqFrame.flags & 0x80)
{
@ -342,7 +345,11 @@ void AIAnubis::Draw(RunListEvent* ev)
if (const auto ap = ev->pObjActor)
{
const auto anubisSeq = &AnubisSeq[ap->nAction];
seq_PlotSequence(ev->nParam, ap->nSeqFile, anubisSeq->nSeqId, ap->nFrame, anubisSeq->nFlags);
if (anubisSeq->nSeqId >= 0)
{
seq_PlotSequence(ev->nParam, ap->nSeqFile, anubisSeq->nSeqId, ap->nFrame, anubisSeq->nFlags);
}
}
}