rendering/game: track per-entity swim state for correct water animations

- Add creatureSwimmingState_ map to track which units are swimming
- unitAnimHintCallback with animId=42 (Swim): marks entity as swimming
- unitAnimHintCallback with animId=0 (MSG_MOVE_STOP_SWIM): clears swim state
- Per-frame sync: uses Swim(42)/SwimIdle(41) when swimming, Run(5)/Stand(0) otherwise
  — creatures/players now show SwimIdle when standing still in water
- Clear creatureSwimmingState_ on creature/player despawn and world reset
This commit is contained in:
Kelsi 2026-03-10 10:36:45 -07:00
parent 14c2bc97b1
commit 333ada8eb6
3 changed files with 31 additions and 9 deletions

View file

@ -12190,9 +12190,12 @@ void GameHandler::handleOtherPlayerMovement(network::Packet& packet) {
// Signal specific animation transitions that the per-frame sync can't detect reliably.
// WoW M2 animation IDs: 38=JumpMid (loops during airborne), 42=Swim
// animId=0 signals "exit swim mode" (MSG_MOVE_STOP_SWIM) so per-frame sync reverts to Stand.
const bool isStopSwimOpcode = (wireOp == wireOpcode(Opcode::MSG_MOVE_STOP_SWIM));
if (unitAnimHintCallback_) {
if (isJumpOpcode) unitAnimHintCallback_(moverGuid, 38u);
else if (isSwimOpcode) unitAnimHintCallback_(moverGuid, 42u);
if (isJumpOpcode) unitAnimHintCallback_(moverGuid, 38u);
else if (isSwimOpcode) unitAnimHintCallback_(moverGuid, 42u);
else if (isStopSwimOpcode) unitAnimHintCallback_(moverGuid, 0u);
}
}