aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/shot_sound.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 19:02:16 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 19:02:16 +0300
commit4367287f9e07aca6a173a5eaef641a75918d66e0 (patch)
tree84aaf51a48c743b5a5d9fc85a1f52a166a2fcb02 /apps/fparkan-game/src/shot_sound.rs
parentb12a11f00cbd04c053bb6979c0534708d206c46a (diff)
downloadfparkan-4367287f9e07aca6a173a5eaef641a75918d66e0.tar.xz
fparkan-4367287f9e07aca6a173a5eaef641a75918d66e0.zip
fix(audio): start node-attached laser sounds during wind-up
Use the weapon descriptor's Control group to select the mode-1 sound rows. Update them through the existing FX clock and spatial Op2 playback for both manual and autonomous weapons. The GOG Control/Effect entry points confirm the selector, epoch and phase threshold, including retriggering after a sample at the exact phase peak. The stock Two Fortresses helicopter started the original sound at both weapon nodes in a Vulkan window.
Diffstat (limited to 'apps/fparkan-game/src/shot_sound.rs')
-rw-r--r--apps/fparkan-game/src/shot_sound.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/fparkan-game/src/shot_sound.rs b/apps/fparkan-game/src/shot_sound.rs
index 893b3a14..02c561ee 100644
--- a/apps/fparkan-game/src/shot_sound.rs
+++ b/apps/fparkan-game/src/shot_sound.rs
@@ -32,6 +32,7 @@ pub(super) fn projectile_launch<'a>(
pub(super) fn report_missing_player_sounds(
layouts: &std::collections::HashMap<usize, super::PlayerWeaponLayout>,
projectiles: &[Option<super::ProjectileDraw>],
+ control_sounds: &[super::ControlSoundSlot],
) {
for (&object, layout) in layouts {
for (weapon, (pool, sound)) in layout.weapons.weapons().iter().zip(&layout.slots) {
@@ -39,7 +40,13 @@ pub(super) fn report_missing_player_sounds(
.get(*pool)
.and_then(Option::as_ref)
.is_some_and(|draw| !draw.launch_sounds.is_empty());
- if sound.is_none() && !has_launch_sound {
+ let has_windup_sound = weapon.windup_sounds(object).any(|effect| {
+ let key = super::ControlEffectInstanceKey::from(effect);
+ control_sounds
+ .iter()
+ .any(|slot| slot.effect.random_instance_key == key)
+ });
+ if sound.is_none() && !has_launch_sound && !has_windup_sound {
eprintln!(
"sim_coverage player_weapon_sound_stub=1 object={object} projectile={}",
weapon.projectile