From 5a29afc412a129d9b8d3bd8e6840cc3250921952 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 27 Nov 2026 02:41:33 +0400 Subject: fix(render): drive manual firing flashes from linked barrel nodes Use the current authored barrel blend as Effect mode 4 input when Control links the effect to that node. Leave projectile release and direct shot audio on their existing clocks. Verified the bound node and phase flags against GOG AniMesh and Effect, covered the stock Constructor cannon, and compared the flash at two phases in a validation-clean mission window. --- apps/fparkan-game/src/main.rs | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 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 b479d3c3..8d5c0c68 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -9,16 +9,15 @@ mod chassis_animation; mod cockpit_geometry; #[cfg(windows)] mod control_effects; +#[cfg(test)] +use control_effects::advance_control_effect_instances; mod damage_visibility; mod debris; mod destruction_effects; -mod motion_effects; -use control_effects::{ - activate_firing_flashes, advance_control_effect_instances, owner_control_capacity, -}; mod mission_hints; mod mission_notices; mod mission_pause; +mod motion_effects; mod player_collision; mod player_fire; mod player_footsteps; @@ -11446,32 +11445,12 @@ impl StaticVulkanApp { None }; self.start_windup_sounds(control_clock_ms, weapon_windup_sounds); - let mut control_effect_random_samples = advance_control_effect_instances( - &mut self.control_effect_instance_states, - &self.ambient_effect_slots, - &self.control_point_light_slots, - &self.control_sound_slots, + let (control_effect_random_samples, direct_shot_sounds) = self.sample_control_effects( clock.id, control_clock_ms, environment .as_ref() .is_some_and(|frame| frame.control_effect_manager_flag), - |index| { - owner_control_capacity( - self.mission_engine.as_ref()?, - &self.mission_render_roots, - index, - ) - }, - |index| self.motion_effects.provider(index), - ); - let firing_flashes = activate_firing_flashes( - &mut control_effect_random_samples, - &self.ambient_effect_slots, - &self.control_point_light_slots, - self.mission_frame - .as_ref() - .map_or(&[][..], |frame| &frame.autodemo_combat_events), player_firing_effects, ); let control_point_lights = update_control_point_lights( @@ -11715,7 +11694,7 @@ impl StaticVulkanApp { continue; } // The same firing event starts its one-shot directly. - if firing_flashes.contains(&slot.random_instance_key) { + if direct_shot_sounds.contains(&slot.random_instance_key) { continue; } if slot.owner_component_is_mounted { @@ -19290,6 +19269,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); assert!(update_control_point_lights( &mut [inactive], @@ -19311,6 +19291,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); let lights = update_control_point_lights( std::slice::from_mut(&mut slot), @@ -19357,6 +19338,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); assert_eq!(first.len(), 1); let key = slot.random_instance_key; @@ -19385,6 +19367,7 @@ mod tests { false, |_| None, |_| None, + |_| None, )[&key], first_sample, "a repeated read of the same captured update reuses the shared sample" @@ -19399,6 +19382,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); let expected = expected_state.advance(SceneSampleId::Replay(8), 500, 1.0); assert_eq!(second[&key].phase_jitter, expected.phase_jitter); @@ -19425,6 +19409,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); assert_eq!(later[&key].phase, Some(1.0)); assert_eq!(later[&key].elapsed_seconds, 0.5); @@ -19438,6 +19423,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); assert_eq!(restarted[&key].phase, Some(0.0)); assert_eq!(restarted[&key].elapsed_seconds, 0.0); @@ -19477,6 +19463,7 @@ mod tests { daylight, |_| None, |_| None, + |_| None, ); assert_eq!(samples[&key].phase, Some(expected)); } @@ -19494,6 +19481,7 @@ mod tests { false, |_| None, |_| None, + |_| None, ); assert_eq!( samples[&key].phase, @@ -19518,6 +19506,7 @@ mod tests { false, |_| Some((remaining, 100.0)), |_| None, + |_| None, ); assert_eq!(samples[&key].phase, expected); if expected.is_none() { -- cgit v1.2.3