From b49722d3f001f01039a6d82f8a043a81a4661f0a Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Thu, 23 Jul 2026 13:07:07 +0300 Subject: [PATCH 1/4] Fix getPedAnimation for short-lived partial anims --- Client/mods/deathmatch/logic/CClientPed.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index bfb2cb271cf..149fb6b437c 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -5784,15 +5784,18 @@ bool CClientPed::GetRunningAnimationName(SString& strBlockName, SString& strAnim bool CClientPed::IsRunningAnimation() { + // Prefer the live named-anim primary task when present. if (m_pPlayerPed) { CTask* pTask = m_pTaskManager->GetTask(TASK_PRIORITY_PRIMARY); if (pTask && pTask->GetTaskType() == TASK_SIMPLE_NAMED_ANIM) - { return true; - } - return false; } + + // Why: partial anims with a short time (e.g. time=1 on crry_prtial) finish the + // TASK_SIMPLE_NAMED_ANIM almost immediately while loop/freezeLastFrame keeps the + // pose. getPedAnimation must still report the cached block/anim in that case — + // same rule already used for streamed-out peds. return (m_AnimationCache.bLoop || m_AnimationCache.bFreezeLastFrame) && m_pAnimationBlock; } @@ -5897,6 +5900,9 @@ void CClientPed::RunNamedAnimation(std::unique_ptr& pBlock, const ch m_AnimationCache.bUpdatePosition = bUpdatePosition; m_AnimationCache.bInterruptible = bInterruptible; m_AnimationCache.bFreezeLastFrame = bFreezeLastFrame; + // Local setPedAnimation previously left startTime unset (only RPCs set it), which + // broke time-based IsAnimationInProgress checks for client-applied anims. + m_AnimationCache.startTime = GetTimestamp(); } void CClientPed::KillAnimation() From 6360de25ad163b8d6a448795d2b551f5802d11ad Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Thu, 23 Jul 2026 13:12:23 +0300 Subject: [PATCH 2/4] Trim verbose comments in getPedAnimation fix --- Client/mods/deathmatch/logic/CClientPed.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 149fb6b437c..a4ef9e82814 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -5784,7 +5784,6 @@ bool CClientPed::GetRunningAnimationName(SString& strBlockName, SString& strAnim bool CClientPed::IsRunningAnimation() { - // Prefer the live named-anim primary task when present. if (m_pPlayerPed) { CTask* pTask = m_pTaskManager->GetTask(TASK_PRIORITY_PRIMARY); @@ -5792,10 +5791,8 @@ bool CClientPed::IsRunningAnimation() return true; } - // Why: partial anims with a short time (e.g. time=1 on crry_prtial) finish the - // TASK_SIMPLE_NAMED_ANIM almost immediately while loop/freezeLastFrame keeps the - // pose. getPedAnimation must still report the cached block/anim in that case — - // same rule already used for streamed-out peds. + // Short-lived partial anims end TASK_SIMPLE_NAMED_ANIM while loop/freezeLastFrame + // keeps the pose; fall back to cache (same as streamed-out peds). return (m_AnimationCache.bLoop || m_AnimationCache.bFreezeLastFrame) && m_pAnimationBlock; } @@ -5900,8 +5897,7 @@ void CClientPed::RunNamedAnimation(std::unique_ptr& pBlock, const ch m_AnimationCache.bUpdatePosition = bUpdatePosition; m_AnimationCache.bInterruptible = bInterruptible; m_AnimationCache.bFreezeLastFrame = bFreezeLastFrame; - // Local setPedAnimation previously left startTime unset (only RPCs set it), which - // broke time-based IsAnimationInProgress checks for client-applied anims. + // Local setPedAnimation did not set this (RPCs did); needed for IsAnimationInProgress. m_AnimationCache.startTime = GetTimestamp(); } From dc2bcf41bf006b1c268664f7470fee1ced9c1ead Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:43:22 +0300 Subject: [PATCH 3/4] Fix stream-in anim progress by moving startTime out of RunNamedAnimation --- Client/mods/deathmatch/logic/CClientPed.cpp | 2 -- .../mods/deathmatch/logic/CStaticFunctionDefinitions.cpp | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index a4ef9e82814..58074ce0930 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -5897,8 +5897,6 @@ void CClientPed::RunNamedAnimation(std::unique_ptr& pBlock, const ch m_AnimationCache.bUpdatePosition = bUpdatePosition; m_AnimationCache.bInterruptible = bInterruptible; m_AnimationCache.bFreezeLastFrame = bFreezeLastFrame; - // Local setPedAnimation did not set this (RPCs did); needed for IsAnimationInProgress. - m_AnimationCache.startTime = GetTimestamp(); } void CClientPed::KillAnimation() diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index dcd11a4e984..d9018d907f8 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -2264,6 +2264,9 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CClientEntity& Entity, const SS Ped.SetCurrentAnimationCustom(false); Ped.SetNextAnimationNormal(); Ped.RunNamedAnimation(pBlock, szAnimName, iTime, iBlend, bLoop, bUpdatePosition, bInterruptible, bFreezeLastFrame); + Ped.m_AnimationCache.startTime = GetTimestamp(); + Ped.m_AnimationCache.speed = 1.0f; + Ped.m_AnimationCache.progress = 0.0f; return true; } else @@ -2283,12 +2286,13 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CClientEntity& Entity, const SS const char* szGateWayAnimationName = g_pGame->GetAnimManager()->GetGateWayAnimationName(); Ped.RunNamedAnimation(pBlock, szGateWayAnimationName, iTime, iBlend, bLoop, bUpdatePosition, bInterruptible, bFreezeLastFrame); + Ped.m_AnimationCache.startTime = GetTimestamp(); + Ped.m_AnimationCache.speed = 1.0f; + Ped.m_AnimationCache.progress = 0.0f; return true; } } } - - Ped.m_AnimationCache.startTime = GetTimestamp(); } else { From bb5ae9430ff06ee714b6373d18345e4c6555924f Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Fri, 24 Jul 2026 20:39:34 +0300 Subject: [PATCH 4/4] Refactor animation cache handling in SetPedAnimation to streamline startTime assignment --- .../mods/deathmatch/logic/CStaticFunctionDefinitions.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index d9018d907f8..dcd11a4e984 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -2264,9 +2264,6 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CClientEntity& Entity, const SS Ped.SetCurrentAnimationCustom(false); Ped.SetNextAnimationNormal(); Ped.RunNamedAnimation(pBlock, szAnimName, iTime, iBlend, bLoop, bUpdatePosition, bInterruptible, bFreezeLastFrame); - Ped.m_AnimationCache.startTime = GetTimestamp(); - Ped.m_AnimationCache.speed = 1.0f; - Ped.m_AnimationCache.progress = 0.0f; return true; } else @@ -2286,13 +2283,12 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CClientEntity& Entity, const SS const char* szGateWayAnimationName = g_pGame->GetAnimManager()->GetGateWayAnimationName(); Ped.RunNamedAnimation(pBlock, szGateWayAnimationName, iTime, iBlend, bLoop, bUpdatePosition, bInterruptible, bFreezeLastFrame); - Ped.m_AnimationCache.startTime = GetTimestamp(); - Ped.m_AnimationCache.speed = 1.0f; - Ped.m_AnimationCache.progress = 0.0f; return true; } } } + + Ped.m_AnimationCache.startTime = GetTimestamp(); } else {