aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/shot_sound.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 06:05:50 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 06:05:50 +0300
commit659f80b53bcc1ed45b2cd30832ca4423cd2391ee (patch)
tree37fc25390af302a7b45e40c408a969c83354fa3b /apps/fparkan-game/src/shot_sound.rs
parent204223a2b3900f3be981942ecde81ec7475f440c (diff)
downloadfparkan-659f80b53bcc1ed45b2cd30832ca4423cd2391ee.tar.xz
fparkan-659f80b53bcc1ed45b2cd30832ca4423cd2391ee.zip
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.
Diffstat (limited to 'apps/fparkan-game/src/shot_sound.rs')
-rw-r--r--apps/fparkan-game/src/shot_sound.rs33
1 files changed, 20 insertions, 13 deletions
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);
+ }
}
}