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. --- apps/fparkan-game/src/main.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'apps/fparkan-game/src/main.rs') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 8ccd06a0..1f128548 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -948,6 +948,7 @@ struct ControlEffectSlot { struct ControlSoundSlot { effect: ControlEffectSlot, waits_for_windup: bool, + follows_weapon_phase: bool, command: Op2SoundCommand, state: Op2SoundState, } @@ -5528,6 +5529,9 @@ fn append_initial_control_effect_slots( .weapon_windup_sound_rows(record) .any(|sound| sound.row_index == row.row_index) }); + let weapon_node_sound = control + .weapon_node_sound_rows() + .any(|sound| sound.row_index == row.row_index); let points = if row.opcode == 4 { let Some(point_list) = point_list else { continue; @@ -5539,7 +5543,7 @@ fn append_initial_control_effect_slots( ) })?) } else { - if !windup && !alarm_controlled && row.point_offsets[0] != 0 { + if !windup && !weapon_node_sound && !alarm_controlled && row.point_offsets[0] != 0 { continue; } None @@ -5570,7 +5574,16 @@ fn append_initial_control_effect_slots( .ok_or_else(|| format!("Control FX {key} was not cached"))?; let header = document.header(); let alarm_effect = alarm_controlled && header.time_mode == 14 && header.flags & 0x40 != 0; - if row.opcode == 3 && !windup && !alarm_effect && !matches!(header.time_mode, 5 | 15) { + let follows_weapon_phase = weapon_node_sound && header.time_mode == 4; + if weapon_node_sound && !follows_weapon_phase && row.point_offsets[0] != 0 { + continue; + } + if row.opcode == 3 + && !windup + && !follows_weapon_phase + && !alarm_effect + && !matches!(header.time_mode, 5 | 15) + { continue; } let sound_commands = document @@ -5696,6 +5709,7 @@ fn append_initial_control_effect_slots( sound_slots.push(ControlSoundSlot { effect: slot, waits_for_windup: windup, + follows_weapon_phase, command: sound, state: Op2SoundState::default(), }); -- cgit v1.2.3