From baa28dc6a8ad4f5a657d8958f718f5cab7e0d871 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 5 Jan 2024 20:59:26 +1100 Subject: [PATCH] - Exhumed: Adjust c66b9795b9db6d7ab4f36eae95298c0a2077b458 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 1cb15ed878da187636cccc4c677bbb1bc5e8e515. --- source/games/exhumed/src/player.cpp | 1 - source/games/exhumed/src/sequence.h | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index bd6f10683..e0671b1c3 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -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]; diff --git a/source/games/exhumed/src/sequence.h b/source/games/exhumed/src/sequence.h index 46530e422..450ad45d2 100644 --- a/source/games/exhumed/src/sequence.h +++ b/source/games/exhumed/src/sequence.h @@ -88,9 +88,9 @@ TArray* 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