Fix movement desync: strafe animation and missing SET_FACING

Two bugs caused the client to look like a bot to server GMs:

1. Strafe animation played during forward+strafe (W+A) instead of the
   walk/run animation. Added pureStrafe guard so strafe animations only
   play when exclusively strafing (no forward key or auto-run active).

2. CMSG_MOVE_SET_FACING was never sent on mouse-look turns. The server
   predicts movement from the last known facing; without SET_FACING the
   heartbeat position appeared to teleport each time the player changed
   direction. Now sent at up to 10 Hz whenever facing changes >3°,
   skipped while keyboard-turning (handled server-side by TURN flags).
This commit is contained in:
Kelsi 2026-02-19 16:40:17 -08:00
parent 4e5d424b34
commit 2bbd0fdc5f
5 changed files with 31 additions and 2 deletions

View file

@ -954,11 +954,16 @@ void Renderer::updateCharacterAnimation() {
CharAnimState newState = charAnimState;
bool moving = cameraController->isMoving();
bool movingForward = cameraController->isMovingForward();
bool movingBackward = cameraController->isMovingBackward();
bool autoRunning = cameraController->isAutoRunning();
bool strafeLeft = cameraController->isStrafingLeft();
bool strafeRight = cameraController->isStrafingRight();
bool anyStrafeLeft = strafeLeft && !strafeRight;
bool anyStrafeRight = strafeRight && !strafeLeft;
// Strafe animation only plays during *pure* strafing (no forward/backward/autorun).
// When forward+strafe are both held, the walk/run animation plays — same as the real client.
bool pureStrafe = !movingForward && !movingBackward && !autoRunning;
bool anyStrafeLeft = strafeLeft && !strafeRight && pureStrafe;
bool anyStrafeRight = strafeRight && !strafeLeft && pureStrafe;
bool grounded = cameraController->isGrounded();
bool jumping = cameraController->isJumping();
bool sprinting = cameraController->isSprinting();