From 06df070ba0d7bd2435b8b1313019278090889d09 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 1 Dec 2026 15:12:24 +0400 Subject: fix(audio): play flamer sound from the firing node Feed initial node-attached Op2 rows from the same Control blends as their firing nodes. Keep them separate from projectile one-shots and opcode 10 wind-up sounds. The original Effect.dll confirmed the strict 0.01 threshold. The Constructor replay ordered and boarded the stock warbot, played the heavy flamer before projectile release, and captured the hangar. --- crates/fparkan-assets/src/control_weapon_sound.rs | 31 +++++++++++++++++++++++ crates/fparkan-assets/src/lib.rs | 1 + 2 files changed, 32 insertions(+) create mode 100644 crates/fparkan-assets/src/control_weapon_sound.rs (limited to 'crates/fparkan-assets/src') diff --git a/crates/fparkan-assets/src/control_weapon_sound.rs b/crates/fparkan-assets/src/control_weapon_sound.rs new file mode 100644 index 00000000..1d8a6bd1 --- /dev/null +++ b/crates/fparkan-assets/src/control_weapon_sound.rs @@ -0,0 +1,31 @@ +use crate::{PreparedComponentControl, PreparedControlEffectRow, PreparedControlEffectSection}; + +impl PreparedComponentControl { + /// Initial node-attached sound rows driven by a weapon's timeline. + pub fn weapon_node_sound_rows(&self) -> impl Iterator { + let rows = match &self.effect_section { + PreparedControlEffectSection::Parsed(rows) => rows.as_slice(), + _ => &[], + }; + rows.iter().filter(|row| { + row.opcode == 3 + && self.initial_effect_group == Some(row.table_index) + && row.raw_condition[0] & 0xf000_0000 == 0 + && !self.typed_records.iter().any(|record| { + self.weapon_windup_sound_rows(record) + .any(|windup| windup.row_index == row.row_index) + }) + && self.typed_records.iter().any(|record| { + record.tag == 2 + && record.values.iter().any(|&index| { + self.timeline_rows + .get(index as usize) + .is_some_and(|timeline| { + timeline.flags & 0x44 == 0 + && timeline.node_index == row.point_offsets[0] as usize + }) + }) + }) + }) + } +} diff --git a/crates/fparkan-assets/src/lib.rs b/crates/fparkan-assets/src/lib.rs index 88c3b193..4d2f7366 100644 --- a/crates/fparkan-assets/src/lib.rs +++ b/crates/fparkan-assets/src/lib.rs @@ -32,6 +32,7 @@ pub use fparkan_texm::{PageRect, RgbaImage}; use fparkan_vfs::DirectoryVfs; mod behavior_profile_values; mod chassis_profile; +mod control_weapon_sound; mod explosion_profile; mod turret_elevation; pub use behavior_profile_values::{ -- cgit v1.2.3