aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--apps/fparkan-game/src/shot_sound.rs33
-rw-r--r--docs/tomes/06-behavior.md4
2 files changed, 24 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);
+ }
}
}
diff --git a/docs/tomes/06-behavior.md b/docs/tomes/06-behavior.md
index e93f4441..2219cce8 100644
--- a/docs/tomes/06-behavior.md
+++ b/docs/tomes/06-behavior.md
@@ -2771,6 +2771,10 @@ Simulation читает подготовленный input snapshot. Renderer н
начальной фазой 0 указывает на `H_fire_missile.wav`. Вызов GOG
`Effect.dll` по RVA `0x5c60` подтвердил, что режим 1 отсчитывает фазу
от начала эффекта. FParkan ставит этот звук в очередь в точке пуска.
+Ракеты кассет `br_l_01` и `br_b_01` используют `gun_mis.wav` из своих
+эффектов `gunf_missile_l` и `gunf_missile_b`. Вызовы `Effect.dll` по RVA
+`0x5c60` и `0x12eb0` подтвердили, что флаги `0x6` сохраняют ту же фазу
+и открывают звуковой интервал после нуля.
Двигатель ракеты задан отдельной зацикленной командой Op2. Time mode 5
берёт длину текущей скорости и делит на длину предельной скорости из
профиля (`Effect.dll` RVA `0x5c60`). При скорости 70 у ракеты героя фаза