fix(audio): suppress tilted drain cue before reset

normal_ball_end asks the sound helper for WAVE 2008 before reset_ball_state
clears Tilt. The helper therefore suppresses the drain cue for a tilted ball.
Rust queued WAVE 2008 unconditionally and only cleared Tilt afterward.

Emit the drain cue only when the pre-reset state is not tilted. Keep later timer
epilogue sounds unchanged, so clearing Tilt can still allow a latched flipper's
normal WAVE 2021 release edge.

Test Plan:
- `cargo test --workspace --all-targets --all-features` -- 119 passed
- `cargo clippy --workspace --all-targets --all-features -- -D warnings` -- passed
- `rumdl check --flavor commonmark RECONSTRUCTION.md CHANGELOG.md` -- passed
- `git diff --cached --check` -- passed
This commit is contained in:
2026-08-23 20:04:34 +02:00
parent 3859498172
commit d8cb7591b5
3 changed files with 8 additions and 4 deletions
+5 -2
View File
@@ -2088,7 +2088,9 @@ impl Game {
(player.balls == 0 && player.extra_balls == 0).then_some(player.score);
self.save_current_rule_state();
events.push(Event::Drain);
events.push(Event::Sound(2008));
if !self.tilted {
events.push(Event::Sound(2008));
}
if let Some(score) = high_score_candidate {
events.push(Event::HighScoreCandidate(score));
self.flipper_release_latch[0] |= self.flipper_inputs.left_raised;
@@ -4198,10 +4200,11 @@ mod tests {
left_flipper: true,
..Controls::default()
};
game.update(0.030, 3, held);
let events = game.update(0.030, 3, held);
assert!(!game.tilted);
assert!(game.ball.in_launcher);
assert!(!events.contains(&Event::Sound(2008)));
assert!(game.flipper_release_latch[0]);
game.update(0.0, 3, held);
assert!(!game.flipper_inputs.left_raised);