From 3dd13b710e1e559ef3f5cf15f3c6b50e8377d161 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 06:52:25 +0400 Subject: feat(combat): activate mounted flash effects on autonomous shots Carry the prepared effect row with each shot. Use the existing mode 4 visual effect for that component at release, with its authored geometry, lights and CPT placement. Keep the one-shot sound on its existing event path. Verified stock AutoDemo shot frames submit the authored muzzle light with Vulkan validation clean. A matched on-screen comparison and the full flash curve remain open. --- apps/fparkan-game/src/control_effects.rs | 45 ++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'apps/fparkan-game/src/control_effects.rs') diff --git a/apps/fparkan-game/src/control_effects.rs b/apps/fparkan-game/src/control_effects.rs index e70b33e5..a21606d4 100644 --- a/apps/fparkan-game/src/control_effects.rs +++ b/apps/fparkan-game/src/control_effects.rs @@ -4,8 +4,8 @@ use super::{ MissionRenderRoot, SceneSampleId, }; use fparkan_fx::clock::{FxInstanceClock, FxPhaseProvider}; -use fparkan_runtime::{loaded_mission_control_device_tables, Engine}; -use std::collections::HashMap; +use fparkan_runtime::{loaded_mission_control_device_tables, AutoDemoCombatEvent, Engine}; +use std::collections::{HashMap, HashSet}; pub(super) fn owner_control_capacity( engine: &Engine, @@ -108,3 +108,44 @@ pub(super) fn advance_control_effect_instances( ) .collect() } + +pub(super) fn activate_firing_flashes( + samples: &mut HashMap, + ambient_slots: &[AmbientEffectGpuSlot], + point_light_slots: &[ControlEffectSlot], + events: &[AutoDemoCombatEvent], +) -> HashSet { + events + .iter() + .filter_map(|event| { + let AutoDemoCombatEvent::Shot { + effect_instance: Some(effect), + .. + } = *event + else { + return None; + }; + let key = ControlEffectInstanceKey { + object_index: effect.object_index, + component_index: effect.component_index, + table_index: effect.table_index, + row_index: effect.row_index, + }; + let has_external_flash = ambient_slots + .iter() + .any(|slot| slot.random_instance_key == key && slot.time_mode == 4) + || point_light_slots + .iter() + .any(|slot| slot.random_instance_key == key && slot.time_mode == 4); + if !has_external_flash { + return None; + } + let sample = samples.get_mut(&key)?; + // shortcut: the release occurs at the midpoint of the weapon cycle. + // Keep the flash to this snapshot until the full effect phase is wired. + sample.phase = Some(0.5); + sample.elapsed_seconds = 0.0; + Some(key) + }) + .collect() +} -- cgit v1.2.3