aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/player_fire.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/player_fire.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/player_fire.rs')
-rw-r--r--apps/fparkan-game/src/player_fire.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/apps/fparkan-game/src/player_fire.rs b/apps/fparkan-game/src/player_fire.rs
index 870dfe2f..b1be6551 100644
--- a/apps/fparkan-game/src/player_fire.rs
+++ b/apps/fparkan-game/src/player_fire.rs
@@ -3,25 +3,30 @@ use super::{
LegacyIron3dEulerTransform, PlayerProjectile, PreparedControlPoint, StaticVulkanApp,
};
+use fparkan_runtime::FiringEffectInstance;
+
impl StaticVulkanApp {
pub(super) fn sample_player_fire(
&mut self,
clock_ms: u32,
- ) -> Vec<(usize, PreparedControlPoint)> {
+ ) -> (
+ Vec<(usize, PreparedControlPoint)>,
+ Vec<FiringEffectInstance>,
+ ) {
let trigger = self.player_fire_held || self.player_fire_pressed;
self.player_fire_pressed = false;
let Some(cockpit) = self.cockpit else {
- return Vec::new();
+ return (Vec::new(), Vec::new());
};
if self.mission_frame.is_none()
|| !self
.player_weapon_layouts
.contains_key(&cockpit.object_index)
{
- return Vec::new();
+ return (Vec::new(), Vec::new());
}
let Some(weapons) = self.player_weapon_banks.get_mut(&cockpit.handle) else {
- return Vec::new();
+ return (Vec::new(), Vec::new());
};
if let Some(engine) = &self.mission_engine {
weapons.read_control_energy(engine, cockpit.handle);
@@ -33,7 +38,12 @@ impl StaticVulkanApp {
if let Some(engine) = &mut self.mission_engine {
weapons.publish_control_energy(engine, cockpit.handle);
}
- shots
+ (
+ shots,
+ weapons
+ .started_windup_sounds(cockpit.object_index)
+ .collect(),
+ )
}
pub(super) fn emit_player_shots(