aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-assets/src
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 14:12:24 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 14:12:24 +0300
commit06df070ba0d7bd2435b8b1313019278090889d09 (patch)
treee1e282bccf51fa7a24b42cb4bbab2d8971060820 /crates/fparkan-assets/src
parent85082a1c829050f375ad688d9ed563d753b3727b (diff)
downloadfparkan-06df070ba0d7bd2435b8b1313019278090889d09.tar.xz
fparkan-06df070ba0d7bd2435b8b1313019278090889d09.zip
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.
Diffstat (limited to 'crates/fparkan-assets/src')
-rw-r--r--crates/fparkan-assets/src/control_weapon_sound.rs31
-rw-r--r--crates/fparkan-assets/src/lib.rs1
2 files changed, 32 insertions, 0 deletions
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<Item = &PreparedControlEffectRow> {
+ 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::{