diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-01 06:57:23 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-01 06:57:23 +0300 |
| commit | 31dd73cbf59f5c8fe58b77b373a75033dc5a037a (patch) | |
| tree | 7a20ada1d75679b61a6c6716ffe91a10faba4592 /apps/fparkan-game/src/main.rs | |
| parent | 364f8a0984e5cd3b65e81f24e95fcf8cd92aec2d (diff) | |
| download | fparkan-31dd73cbf59f5c8fe58b77b373a75033dc5a037a.tar.xz fparkan-31dd73cbf59f5c8fe58b77b373a75033dc5a037a.zip | |
fix(fx): switch warbot smoke with the damage alarm
Resolve the matching enable and disable selectors from authored CTL alarm groups. Render node-attached smoke and light only while the live Control alarm is active. Verify the native selector against both DLLs and inspect two Vulkan frames around an ordinary AutoDemo alarm. Independent mode-14 triggers and the damage stage cascade remain open.
Diffstat (limited to 'apps/fparkan-game/src/main.rs')
| -rw-r--r-- | apps/fparkan-game/src/main.rs | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 6f050780..8075ef2c 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -5706,6 +5706,7 @@ fn append_initial_control_effect_slots( let group_index = row.table_index; let archive = fixed_effect_field(&row.resource.archive); let name = fixed_effect_field(&row.resource.name); + let alarm_controlled = control.alarm_effect_rows.contains(&row.row_index); let windup = row.opcode == 3 && control.typed_records.iter().any(|record| { control @@ -5723,8 +5724,7 @@ fn append_initial_control_effect_slots( ) })?) } else { - // Chassis engine loops use the root. Weapon sounds use their authored node. - if !windup && row.point_offsets[0] != 0 { + if !windup && !alarm_controlled && row.point_offsets[0] != 0 { continue; } None @@ -5754,7 +5754,8 @@ fn append_initial_control_effect_slots( .get(&key) .ok_or_else(|| format!("Control FX {key} was not cached"))?; let header = document.header(); - if row.opcode == 3 && !windup && !matches!(header.time_mode, 5 | 15) { + 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) { continue; } let sound_commands = document @@ -5850,7 +5851,7 @@ fn append_initial_control_effect_slots( ); for (command_index, command) in document.commands().iter().enumerate() { - if row.opcode == 3 && command.opcode != FxOpcode::Op2 { + if row.opcode == 3 && !alarm_effect && command.opcode != FxOpcode::Op2 { continue; } if ambient_effect_op1_supported(command) || command.opcode == FxOpcode::Op2 { @@ -5893,7 +5894,6 @@ fn append_initial_control_effect_slots( } continue; } - let Some(points) = points else { continue }; let Some(kind) = ambient_effect_command_kind(command) else { record_skip("opcode_or_body", 1, false, Some(command_index)); continue; @@ -6071,7 +6071,10 @@ fn append_initial_control_effect_slots( control_table_index: row.table_index, control_row_index: row.row_index, control_point_indices: row.point_offsets, - control_point_owners: points.map(|point| point.raw_signed_field_04), + control_point_owners: match points { + Some(points) => points.map(|point| point.raw_signed_field_04), + None => [owner_node_index as i32, -1, -1], + }, command: command.clone(), command_index, duration_seconds, @@ -14437,6 +14440,7 @@ mod tests { node_data: None, effect_section: PreparedControlEffectSection::Absent, initial_effect_group: None, + alarm_effect_rows: Vec::new(), node_effect_links: Vec::new(), effect_modes: Vec::new(), point_list: None, @@ -19272,6 +19276,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); assert!(update_control_point_lights( &mut [inactive], @@ -19294,6 +19299,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); let lights = update_control_point_lights( std::slice::from_mut(&mut slot), @@ -19341,6 +19347,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); assert_eq!(first.len(), 1); let key = slot.random_instance_key; @@ -19370,6 +19377,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, )[&key], first_sample, "a repeated read of the same captured update reuses the shared sample" @@ -19385,6 +19393,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); let expected = expected_state.advance(SceneSampleId::Replay(8), 500, 1.0); assert_eq!(second[&key].phase_jitter, expected.phase_jitter); @@ -19412,6 +19421,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); assert_eq!(later[&key].phase, Some(1.0)); assert_eq!(later[&key].elapsed_seconds, 0.5); @@ -19426,6 +19436,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); assert_eq!(restarted[&key].phase, Some(0.0)); assert_eq!(restarted[&key].elapsed_seconds, 0.0); @@ -19466,6 +19477,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); assert_eq!(samples[&key].phase, Some(expected)); } @@ -19484,6 +19496,7 @@ mod tests { |_| None, |_| None, |_| None, + |_| None, ); assert_eq!( samples[&key].phase, @@ -19509,12 +19522,34 @@ mod tests { |_| Some((remaining, 100.0)), |_| None, |_| None, + |_| None, ); assert_eq!(samples[&key].phase, expected); if expected.is_none() { assert_eq!(samples[&key].phase_jitter, 0.0); } } + + slot.header_flags = 0x49; + let mut alarm_states = HashMap::new(); + for (frame, active, expected) in + [(15, false, None), (16, true, Some(0.25)), (17, false, None)] + { + let samples = advance_control_effect_instances( + &mut alarm_states, + &[], + std::slice::from_ref(&slot), + &[], + SceneSampleId::Replay(frame), + 5_000 + frame as u32 * 100, + false, + |_| Some((75.0, 100.0)), + |_| None, + |_| None, + |_| Some(active), + ); + assert_eq!(samples[&key].phase, expected); + } } #[test] |
