anim: also trigger animation update on walk/run transitions for creatures

Extend the locomotion state-change detection to include the WALKING
movement flag. Previously a creature that switched from walking to
running (or vice versa) while staying in the moving state would keep
playing the wrong animation because only the moving/idle transition
was tracked.

Add creatureWasWalking_ alongside creatureWasSwimming_ and
creatureWasFlying_; guard the walking check with isMovingNow to avoid
spurious triggers when the flag flips while the creature is idle.
Clear and erase the new map at world reset and creature/player despawn.
This commit is contained in:
Kelsi 2026-03-10 12:04:59 -07:00
parent 2717018631
commit acbfe99401
2 changed files with 12 additions and 3 deletions

View file

@ -190,6 +190,7 @@ private:
std::unordered_map<uint64_t, bool> creatureWasMoving_; // guid -> previous-frame movement state
std::unordered_map<uint64_t, bool> creatureWasSwimming_; // guid -> previous-frame swim state (for anim transition detection)
std::unordered_map<uint64_t, bool> creatureWasFlying_; // guid -> previous-frame flying state (for anim transition detection)
std::unordered_map<uint64_t, bool> creatureWasWalking_; // guid -> previous-frame walking state (walk vs run transition detection)
std::unordered_map<uint64_t, bool> creatureSwimmingState_; // guid -> currently in swim mode (SWIMMING flag)
std::unordered_map<uint64_t, bool> creatureWalkingState_; // guid -> walking (WALKING flag, selects Walk(4) vs Run(5))
std::unordered_map<uint64_t, bool> creatureFlyingState_; // guid -> currently flying (FLYING flag)