Skip to content

Fix setPedAnimation not initializing animation cache on success#5083

Open
QueryOfficial wants to merge 1 commit into
multitheftauto:masterfrom
QueryOfficial:fix/setpedanimation-starttime-early-return
Open

Fix setPedAnimation not initializing animation cache on success#5083
QueryOfficial wants to merge 1 commit into
multitheftauto:masterfrom
QueryOfficial:fix/setpedanimation-starttime-early-return

Conversation

@QueryOfficial

Copy link
Copy Markdown
Contributor

Summary

On successful local setPedAnimation paths, early return true skipped the trailing m_AnimationCache.startTime = GetTimestamp() assignment. Initialize startTime, speed, and progress before those returns (normal + IFP gateway paths), and remove the unreachable assignment after the branch.

Motivation

Client-local setPedAnimation never primed the animation cache on success (unlike RPC-driven setup). That breaks stream-in progress restore and time-based checks that depend on startTime. Split out from the getPedAnimation partial-anim PR so each change stays focused.

Test plan

  1. Client: call setPedAnimation(ped, block, anim, ...) on a streamed-in ped, then stream the ped out and back in — timing/progress should resume from a sensible start, not look unset/stuck.
  2. Client: exercise the custom IFP / gateway setPedAnimation path — same cache init, no regression.
  3. Client: setPedAnimation(ped, false) / clear animation still works.
  4. Compare with a server-synced animation (RPC path) — startTime/speed/progress priming should align.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

This update initializes the animation cache parameters (startTime, speed, and progress) for the Ped entity within the SetPedAnimation method, ensuring proper handling of animation states during gameplay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant