- Exhumed: Adjust c66b9795b9 to always return the last sequence instead of a nullptr.

* Returning a nullptr and having the caller return from that potentially results in no animation being drawn at all.
* Change here is akin to fix applied in 1cb15ed878.
This commit is contained in:
Mitchell Richters 2024-01-05 20:59:26 +11:00
parent f800d6937c
commit baa28dc6a8
2 changed files with 3 additions and 4 deletions

View file

@ -1928,7 +1928,6 @@ static void doPlayerActionSequence(DExhumedPlayer* const pPlayer)
const auto pPlayerActor = pPlayer->GetActor();
const auto playerSeq = getSequence(pPlayerActor->nSeqFile, PlayerSeq[pPlayerActor->nAction].nSeqId);
if (playerSeq == nullptr) return;
const auto seqSize = playerSeq->frames.Size();
if (pPlayerActor->nFrame >= seqSize) pPlayerActor->nFrame = seqSize - 1;
const auto& seqFrame = playerSeq->frames[pPlayerActor->nFrame];

View file

@ -88,9 +88,9 @@ TArray<Seq>* getFileSeqs(const FName nSeqFile);
inline Seq* getSequence(const FName nSeqFile, const unsigned nSeqIndex = 0)
{
auto seq = getFileSeqs(nSeqFile);
if (nSeqIndex >= seq->Size()) return nullptr;
return seq->Data(nSeqIndex);
const auto seq = getFileSeqs(nSeqFile);
const auto seqSize = seq->Size();
return seq->Data((nSeqIndex >= seqSize) ? seqSize - 1 : nSeqIndex);
}
END_PS_NS