fix(input): restore original nudge and tilt behavior

Replace the float nudge direction, cooldown, and decaying meter with the
scan-code-specific Win16 behavior. Left Shift and keypad 3 now use the original
random directional impulse, while Space uses the reconstructed random horizontal
and vertical formulas with scalar 15 and wrapping millipixel velocities.

Track the original 16-bit tilt counter: each nudge adds 25, compares against
30 + Random(10), and the selected detail timer decrements a nonzero counter once
per callback. Allow the same input while a ball waits in the launcher, retain
bonus state when tilt latches, clear flippers immediately, and keep Right Shift
only as a documented modern alias for keypad 3.

Test Plan:
- `cargo test --all-targets` -- passed, 57 tests
- `cargo clippy --all-targets -- -D warnings` -- passed
- `rumdl check tdkpin-rs/CHANGELOG.md tdkpin-rs/README.md tdkpin-rs/RECONSTRUCTION.md` -- passed
- `git diff --cached --check` -- passed
This commit is contained in:
2026-08-23 16:55:02 +02:00
parent c25287186a
commit aae4671586
5 changed files with 140 additions and 65 deletions
+5 -13
View File
@@ -1,6 +1,6 @@
use crate::{
assets::Assets,
game::{Controls, Event, Game},
game::{Controls, Event, Game, Nudge},
persistence::{HighScore, Language, Persistence, SavedData, insert_high_score},
table::BUMPERS,
};
@@ -174,21 +174,13 @@ impl App {
|| is_key_down(KeyCode::D)
|| is_key_down(KeyCode::Right);
let nudge = if is_key_pressed(KeyCode::LeftShift) {
-1.0
Nudge::Left
} else if is_key_pressed(KeyCode::RightShift) || is_key_pressed(KeyCode::Kp3) {
1.0
Nudge::Right
} else if is_key_pressed(KeyCode::Space) {
if self
.game
.as_ref()
.is_some_and(|game| game.ball.position.x < WIDTH / 4.0)
{
1.0
} else {
-1.0
}
Nudge::Center
} else {
0.0
Nudge::None
};
let controls = Controls {
left_flipper,