fix(audio): order bank completion cues before awards

The original bank handlers play WAVE 2017 before adding either the 50,000
maximum bumper-bank bonus or a 10,000 through 24,464 TDK award. Rust added the
award first. When that operation crossed a media marker, its WAVE 2007 cue was
therefore replaced by the late completion sound.

Queue both completion cues before their score operations. Exact regressions put
each bank one award below the first threshold and prove the monophonic resource
sequence 2012, 2017, 2007.

Test Plan:
- `cargo test --workspace --all-targets --all-features` -- 121 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:13:33 +02:00
parent f53cd5ab2b
commit 9b56247c32
3 changed files with 41 additions and 3 deletions
+38 -2
View File
@@ -1325,10 +1325,10 @@ impl Game {
player.bumper_value += 1_000;
0
};
events.push(Event::Sound(2017));
if completion_bonus != 0 {
self.add_score(completion_bonus, events);
}
events.push(Event::Sound(2017));
for active in &mut self.object_active[90..=104] {
*active = true;
}
@@ -1348,6 +1348,7 @@ impl Game {
} else {
u32::from(segments + 1) * 10_000
};
events.push(Event::Sound(2017));
self.add_score(award, events);
if segments == 8 {
self.ball_double = BallDoubleState::Active;
@@ -1355,7 +1356,6 @@ impl Game {
self.object_active[object_id] = true;
}
}
events.push(Event::Sound(2017));
} else {
if self.ball_double == BallDoubleState::Active {
let player = &mut self.players[self.current_player];
@@ -2810,6 +2810,42 @@ mod tests {
);
}
#[test]
fn bank_completion_sounds_precede_crossed_media_markers() {
let mut bumper_bank = Game::new(1);
bumper_bank.players[0].score = 90_000;
bumper_bank.players[0].bumper_value = 6_000;
for object_id in [90, 93, 96, 99] {
bumper_bank.object_active[object_id] = false;
}
let mut bumper_events = Vec::new();
bumper_bank.apply_wall_rule(102, &mut bumper_events);
assert_eq!(bumper_bank.player().score, 141_500);
assert_eq!(
bumper_events
.iter()
.filter_map(|event| event.sound_resource())
.collect::<Vec<_>>(),
[2012, 2017, 2007]
);
let mut diamond_bank = Game::new(1);
diamond_bank.players[0].score = 130_000;
for object_id in [109, 112, 115] {
diamond_bank.object_active[object_id] = false;
}
let mut diamond_events = Vec::new();
diamond_bank.apply_wall_rule(118, &mut diamond_events);
assert_eq!(diamond_bank.player().score, 141_500);
assert_eq!(
diamond_events
.iter()
.filter_map(|event| event.sound_resource())
.collect::<Vec<_>>(),
[2012, 2017, 2007]
);
}
#[test]
fn special_hole_arms_effect_seven_multiball() {
let mut game = Game::new_with_seed(1, 7);