diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-26 20:10:24 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-26 20:10:24 +0300 |
| commit | 75dcc70912d4e6feb14d9370452914ff826849f7 (patch) | |
| tree | 06c5577b02e92daff7deb4c1cd544ebd210323ed /crates/fparkan-assets/src/lib.rs | |
| parent | 07a90f035ebd935ad9705a5f8a8916638a4a8f4f (diff) | |
| download | fparkan-75dcc70912d4e6feb14d9370452914ff826849f7.tar.xz fparkan-75dcc70912d4e6feb14d9370452914ff826849f7.zip | |
fix(input): use the original hero turret elevation range
Apply the World3D mouse Y filter and reverse setting, update the normalized turret request, and use the authored neutral and span to share pitch with the cockpit and elevation tracks. Original World3D dispatch and Control manual mode confirmed the gain and clamp. Stock Firing Range captures show both endpoints and the licensed Constructor test checks the camera and turret together.
Diffstat (limited to 'crates/fparkan-assets/src/lib.rs')
| -rw-r--r-- | crates/fparkan-assets/src/lib.rs | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/crates/fparkan-assets/src/lib.rs b/crates/fparkan-assets/src/lib.rs index 186285f0..51270eca 100644 --- a/crates/fparkan-assets/src/lib.rs +++ b/crates/fparkan-assets/src/lib.rs @@ -33,11 +33,13 @@ use fparkan_vfs::DirectoryVfs; mod behavior_profile_values; mod chassis_profile; mod explosion_profile; +mod turret_elevation; pub use behavior_profile_values::{ decode_behavior_go_speed_percent, decode_behavior_work_rates, BehaviorWorkRates, }; pub use chassis_profile::{decode_chassis_can_fly, decode_chassis_flags, ChassisFlags}; pub use explosion_profile::decode_explosion_effect; +pub use turret_elevation::{apply_manual_turret_elevation, turret_elevation_row}; mod research; pub use research::{ calc_full_research_cost, research_project_rows, ResearchCandidate, ResearchCandidateSet, @@ -1700,45 +1702,6 @@ pub fn sample_control_node_times( Ok(state.node_times.clone()) } -/// Samples the Control turret's vertical row and rows linked to its elevation. -/// -/// The input is a signed angle from the authored neutral pose. The caller -/// supplies the current component's sampled node times so unrelated tracks -/// retain their state. -pub fn apply_manual_turret_elevation( - control: &PreparedComponentControl, - radians: f32, - node_times: &mut [Option<f32>], -) { - let Some(elevation) = control - .typed_records - .iter() - .find(|record| record.tag == 1) - .and_then(|record| record.values.get(1)) - .and_then(|&index| control.timeline_rows.get(index as usize)) - else { - return; - }; - let span = f32::from_bits(elevation.raw_parameters[3]); - if radians == 0.0 || !radians.is_finite() || !span.is_finite() || span <= 0.0 { - return; - } - // shortcut: set the requested blend directly until manual slew timing - // and weapon-specific corrections are measured. - let blend = (elevation.initial_blend + radians / span).clamp(0.0, 1.0); - for row in &control.timeline_rows { - let linked = row.flags & (0x40 | 0x2000 | 0x08) == 0x08; - if row.flags & 4 != 0 || !(row.row_index == elevation.row_index || linked) { - continue; - } - let Some(sample) = node_times.get_mut(row.node_index) else { - continue; - }; - let blend = native_control_blend(blend, row.flags); - *sample = Some((1.0 - blend) * row.frame_a + blend * row.frame_b); - } -} - fn shortest_wrapped_distance(previous: f32, next: f32) -> f32 { let direct = (next - previous).abs(); direct.min((1.0 - direct).abs()) |
