aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/player_fire.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 18:43:04 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 18:43:04 +0300
commitb12a11f00cbd04c053bb6979c0534708d206c46a (patch)
tree0a61d49c1bef3c4cb52c3370cc1c0119df422043 /apps/fparkan-game/src/player_fire.rs
parentf3f5054641a3542e3154461f39a7a204cfd095ff (diff)
downloadfparkan-b12a11f00cbd04c053bb6979c0534708d206c46a.tar.xz
fparkan-b12a11f00cbd04c053bb6979c0534708d206c46a.zip
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.
Diffstat (limited to 'apps/fparkan-game/src/player_fire.rs')
-rw-r--r--apps/fparkan-game/src/player_fire.rs10
1 files changed, 8 insertions, 2 deletions
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}",