aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/control_effects.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 07:14:18 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 07:14:18 +0300
commit00e8ddb1ca169e0bf38bde14eaa73969b9177d1a (patch)
tree0b36f51ce6a56c588135d1170eaa10be9210904c /apps/fparkan-game/src/control_effects.rs
parent161c3fad038c5fae15d49ba614bee37cbcdde6f6 (diff)
downloadfparkan-00e8ddb1ca169e0bf38bde14eaa73969b9177d1a.tar.xz
fparkan-00e8ddb1ca169e0bf38bde14eaa73969b9177d1a.zip
feat(audio): drive chassis engine loops from actual movement
Prepare the authored root-node CTL attachments and feed Control speed limits plus observed motion into FX modes 5 and 15. The stock AutoDemo window queues ground and flight engine loops from the starting scene.
Diffstat (limited to 'apps/fparkan-game/src/control_effects.rs')
-rw-r--r--apps/fparkan-game/src/control_effects.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/fparkan-game/src/control_effects.rs b/apps/fparkan-game/src/control_effects.rs
index a21606d4..8007ea9f 100644
--- a/apps/fparkan-game/src/control_effects.rs
+++ b/apps/fparkan-game/src/control_effects.rs
@@ -31,6 +31,7 @@ pub(super) fn advance_control_effect_instances(
control_clock_ms: u32,
manager_flag: bool,
owner_capacity: impl Fn(usize) -> Option<(f32, f32)>,
+ owner_motion: impl Fn(usize) -> Option<FxPhaseProvider>,
) -> HashMap<ControlEffectInstanceKey, ControlEffectFrameSample> {
let mut specifications = HashMap::new();
for slot in ambient_slots {
@@ -69,6 +70,7 @@ pub(super) fn advance_control_effect_instances(
}
let idle = FxPhaseProvider::idle();
let mut provider = idle;
+ let mut resolved = false;
if mode == 14 {
let capacity = owner_capacity(key.object_index)
.and_then(|(remaining, capacity)| idle.with_control_capacity(remaining, capacity));
@@ -79,7 +81,13 @@ pub(super) fn advance_control_effect_instances(
eprintln!("render_coverage control_fx_owner_state_stub=1 (missing Control capacity; instance={key:?} mode={mode})");
}
}
- } else if state.clock.is_none() && fparkan_fx::fx_time_mode_requires_owner_state(mode) {
+ } else if matches!(mode, 5 | 15) {
+ if let Some(motion) = owner_motion(key.object_index) {
+ provider = motion;
+ resolved = true;
+ }
+ }
+ if mode != 14 && !resolved && state.clock.is_none() && fparkan_fx::fx_time_mode_requires_owner_state(mode) {
eprintln!("render_coverage control_fx_owner_state_stub=1 (idle provider; instance={key:?} mode={mode})");
}
let clock = state.clock.get_or_insert_with(|| {