diff --git a/crates/benilla-app/src/player/controller.rs b/crates/benilla-app/src/player/controller.rs index 3cae8a916..c0fe68c78 100644 --- a/crates/benilla-app/src/player/controller.rs +++ b/crates/benilla-app/src/player/controller.rs @@ -774,12 +774,12 @@ pub(super) fn control( ); // The integration runs in any mode the bits survive into (`0x7c53b9`), at three quarters // under a direction bit or FALLING (`0x200f`, `0x7c5cb3`). - let moving = if swimming { + let pitch_integrating = if swimming { swim_fwd != 0.0 || swim_side != 0.0 } else { (may_translate && (fwd_axis != 0 || side_axis != 0)) || player.airborne_since.is_some() }; - swim::integrate_pitch_keys(&mut player, turn_rate, moving, dt); + swim::integrate_pitch_keys(&mut player, turn_rate, pitch_integrating, dt); // The mounted Space flourish, the jump-key handler `0x60dea0`: mounted, still and grounded // plays MountSpecial (94) locally, then sends `CMSG_MOUNTSPECIAL_ANIM`; moving jumps; diff --git a/crates/benilla-app/src/player/controller/tests.rs b/crates/benilla-app/src/player/controller/tests.rs index d55e44700..2592516f6 100644 --- a/crates/benilla-app/src/player/controller/tests.rs +++ b/crates/benilla-app/src/player/controller/tests.rs @@ -854,3 +854,24 @@ fn a_pitch_press_while_swimming_starts_before_the_frames_packets() { ); assert!(client.player().pitch_latch, "the latch outlives the root"); } + +/// A jump taken standing keeps its one air nudge until a direction key opens it: the opener runs +/// only while the direction nibble (`+0x40 & 0xf`) is clear (`0x7c6afc`), and an arc with no key +/// down leaves the nibble clear, so a forward press mid-arc steers the jump. +#[test] +fn a_standing_jump_keeps_its_air_nudge_for_a_key_pressed_mid_arc() { + let mut client = Client::standing(Body::Own); + client.traced(vec![], vec![Fire(FiredInput::Jump)], |_| {}); + for _ in 0..5 { + client.traced(vec![], vec![], |_| {}); + } + let player = client.player(); + assert!(player.airborne_since.is_some(), "the body is mid-arc"); + assert!(!player.arc_dirs_set, "no key opened the nudge"); + client.traced(vec![], forward(), |_| {}); + let speed = client.player().horiz_vel.length(); + assert!( + (speed - crate::player::AIR_NUDGE_SPEED).abs() < 1e-4, + "the forward press nudges the arc: {speed}" + ); +}