From 659f80b53bcc1ed45b2cd30832ca4423cd2391ee Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 07:05:50 +0400 Subject: fix(audio): play warbot rocket launch sounds The two stock rack projectiles start gun_mis.wav through an Op2 row in their initial effect group. Accept the authored 0x6 effect flags after checking the phase and playback callback in the GOG Effect.dll. The licensed regression checks the launch event for the two racks and the hero missile. The stock Two Fortresses window also reaches rocket fire with clean Vulkan validation. --- apps/fparkan-game/src/shot_sound.rs | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'apps/fparkan-game/src') diff --git a/apps/fparkan-game/src/shot_sound.rs b/apps/fparkan-game/src/shot_sound.rs index a477e415..e1e493a5 100644 --- a/apps/fparkan-game/src/shot_sound.rs +++ b/apps/fparkan-game/src/shot_sound.rs @@ -21,7 +21,8 @@ pub(super) fn projectile_launch<'a>( effects .filter(|effect| { let header = effect.header(); - header.time_mode == 1 && header.flags == 0 && header.phase_jitter == 0.0 + // The rocket launch flags leave the Op2 clock unchanged. + header.time_mode == 1 && matches!(header.flags, 0 | 0x6) && header.phase_jitter == 0.0 }) .flat_map(FxDocument::commands) .filter_map(Op2SoundCommand::from_command) @@ -104,19 +105,25 @@ mod tests { #[test] #[ignore = "requires licensed projectile and effect resources"] - fn licensed_hero_missile_prepares_launch_without_the_engine_loop() { + fn licensed_missiles_prepare_launch_without_the_engine_loop() { let root = PathBuf::from(std::env::var_os("FPARKAN_CORPUS_PART1_ROOT").unwrap()); let engine = create(EngineServices::new(Arc::new(DirectoryVfs::new(&root)))).unwrap(); - let missile = load_player_projectile(&engine, "objects.rlb", "bm_h_01").unwrap(); - let effects = crate::projectile_render::initial_effects(&root, &missile, "bm_h_01"); - let sounds = projectile_launch(effects.iter().map(|effect| &effect.document)); - let [sound] = sounds.as_slice() else { - panic!("expected the single launch sound, got {sounds:?}"); - }; - let position = [10.0, 20.0, 30.0]; - let event = sound.one_shot_at(position).unwrap(); - assert_eq!(event.position, position); - assert_eq!(event.archive, "sounds.lib"); - assert_eq!(event.name, "H_fire_missile.wav"); + for (projectile, expected) in [ + ("bm_h_01", "H_fire_missile.wav"), + ("br_l_01", "gun_mis.wav"), + ("br_b_01", "gun_mis.wav"), + ] { + let missile = load_player_projectile(&engine, "objects.rlb", projectile).unwrap(); + let effects = crate::projectile_render::initial_effects(&root, &missile, projectile); + let sounds = projectile_launch(effects.iter().map(|effect| &effect.document)); + let [sound] = sounds.as_slice() else { + panic!("expected one launch sound for {projectile}, got {sounds:?}"); + }; + let position = [10.0, 20.0, 30.0]; + let event = sound.one_shot_at(position).unwrap(); + assert_eq!(event.position, position); + assert_eq!(event.archive, "sounds.lib"); + assert_eq!(event.name, expected); + } } } -- cgit v1.2.3