From b12a11f00cbd04c053bb6979c0534708d206c46a Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 19:43:04 +0400 Subject: fix(audio): play projectile launch sounds Read phase-zero one-shot sounds from the projectile's initial Control effect group. Reuse the decoded effects for trails and play the launch sounds when the weapon creates a projectile. The native mode-1 phase probe and the licensed hero missile fixture both pass. A replayed trigger at the stock Firing Line start queued H_fire_missile.wav once and Vulkan validation was clean. --- apps/fparkan-game/src/player_fire.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'apps/fparkan-game/src/player_fire.rs') diff --git a/apps/fparkan-game/src/player_fire.rs b/apps/fparkan-game/src/player_fire.rs index dfb0f8d6..870dfe2f 100644 --- a/apps/fparkan-game/src/player_fire.rs +++ b/apps/fparkan-game/src/player_fire.rs @@ -105,6 +105,7 @@ impl StaticVulkanApp { weapon.rounds_remaining(), ); let (pool, sound) = &layout.slots[slot]; + let mut launch_sounds = &[][..]; if let Some(draw) = self.projectile_draws[*pool].as_mut() { if let Some(instance) = draw .instances @@ -120,6 +121,7 @@ impl StaticVulkanApp { ); instance.shooter = Some(cockpit.handle); if let Some(flight) = &instance.flight { + launch_sounds = &draw.launch_sounds; eprintln!("player_projectile_spawn slot={} queue_time_ms={clock_ms} speed={} lifetime_ms={} position={muzzle:?} direction={:?}", slot + 1, draw.speed, draw.lifetime_ms, flight.direction); } } else { @@ -129,8 +131,12 @@ impl StaticVulkanApp { ); } } - if let (Some(sound), Some(audio)) = (sound, self.audio.as_mut()) { - if let Some(event) = sound.one_shot_at(muzzle) { + if let Some(audio) = self.audio.as_mut() { + for event in sound + .iter() + .chain(launch_sounds) + .filter_map(|sound| sound.one_shot_at(muzzle)) + { match audio.handle_sound_event(&event) { Ok(()) => eprintln!( "player_shot_sound slot={} resource={}:{} queue_time_ms={clock_ms}", -- cgit v1.2.3