mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
movement: fix jumpXYSpeed to be 0 when jumping in place
jumpXYSpeed should reflect actual horizontal movement at jump time: - non-zero (run/walk speed) only when movement flags indicate forward/ backward/strafe movement - zero when jumping straight up without horizontal movement This prevents the server from thinking the player launched with full run speed when they jumped in place, which could affect position prediction.
This commit is contained in:
parent
4cf73a6def
commit
9291637977
1 changed files with 13 additions and 3 deletions
|
|
@ -7248,9 +7248,19 @@ void GameHandler::sendMovement(Opcode opcode) {
|
|||
const float facingRad = movementInfo.orientation;
|
||||
movementInfo.jumpCosAngle = std::cos(facingRad);
|
||||
movementInfo.jumpSinAngle = std::sin(facingRad);
|
||||
// Use server run speed as the horizontal speed at jump time.
|
||||
// Horizontal speed: only non-zero when actually moving at jump time.
|
||||
const uint32_t horizFlags =
|
||||
static_cast<uint32_t>(MovementFlags::FORWARD) |
|
||||
static_cast<uint32_t>(MovementFlags::BACKWARD) |
|
||||
static_cast<uint32_t>(MovementFlags::STRAFE_LEFT) |
|
||||
static_cast<uint32_t>(MovementFlags::STRAFE_RIGHT);
|
||||
const bool movingHoriz = (movementInfo.flags & horizFlags) != 0;
|
||||
if (movingHoriz) {
|
||||
const bool isWalking = (movementInfo.flags & static_cast<uint32_t>(MovementFlags::WALKING)) != 0;
|
||||
movementInfo.jumpXYSpeed = isWalking ? 2.5f : (serverRunSpeed_ > 0.0f ? serverRunSpeed_ : 7.0f);
|
||||
} else {
|
||||
movementInfo.jumpXYSpeed = 0.0f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Opcode::MSG_MOVE_START_TURN_LEFT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue