A standing jump keeps its air nudge for a key pressed mid-arc (#2420)
#2311 added a second `let moving` in `control` for the pitch keys' integration, true through any arc. It shadowed the direction-key `moving` that the mover step, the mounted Space flourish and the body heading read. So a jump taken standing counted as moving with a zero direction: its first airborne frame spent the one air nudge with a zero vector. A direction key pressed later in the arc then steered nothing, where in 1.12.1 the first direction key pressed mid-arc gets the nudge (`0x7c6afc`). The pitch integration's binding is now `pitch_integrating`, and the other three readers get the direction-key `moving` again. Test: `a_standing_jump_keeps_its_air_nudge_for_a_key_pressed_mid_arc` jumps standing, waits five frames, then presses forward and sees the nudge. It fails without the fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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}"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user