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 | |
| 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.
| -rw-r--r-- | apps/fparkan-game/src/main.rs | 11 | ||||
| -rw-r--r-- | crates/fparkan-assets/src/lib.rs | 41 | ||||
| -rw-r--r-- | crates/fparkan-assets/src/turret_elevation.rs | 48 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/hero_look.rs | 221 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 3 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/player_motion.rs | 45 | ||||
| -rw-r--r-- | docs/appendices/knowledge-boundaries.md | 4 | ||||
| -rw-r--r-- | docs/tomes/06-behavior.md | 30 |
8 files changed, 258 insertions, 145 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index dfd7be88..45d076fc 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -15879,7 +15879,9 @@ mod tests { Some(frame_with_player_motion(&mut engine, 32, cockpit, aimed, false).unwrap()); app.update_mission_camera(0.016, [800.0, 600.0]).unwrap(); assert_eq!(app.view_camera.position, moved); - assert!((app.view_camera.forward[2] - 0.5_f32.sin()).abs() < 1e-6); + let pitch = f32::from_bits(app.mission_frame.as_ref().unwrap().player_pitch_bits); + assert!((pitch.abs().to_degrees() - 18.81).abs() < 1e-4); + assert!((app.view_camera.forward[2] - pitch.sin()).abs() < 1e-6); let mut instances = vec![Vec::new(); cockpit.object_index + 1]; instances[cockpit.object_index].resize_with(cockpit.component_index + 1, || None); @@ -15934,14 +15936,11 @@ mod tests { &mut instances, &mut app.component_pose_buffers, 32, - Some(( - cockpit, - f32::from_bits(app.mission_frame.as_ref().unwrap().player_pitch_bits), - )), + Some((cockpit, pitch)), ) .unwrap(); assert_ne!(turret_pose(&app, 34).rotation, target.rotation); - assert!(target_elevation(turret_pose(&app, 34)) > target_elevation(target)); + assert!((target_elevation(turret_pose(&app, 34)) - target_elevation(target)) * pitch > 0.0); assert_ne!(turret_pose(&app, 12).translation, gun.translation); assert_eq!(turret_pose(&app, 1), base); let aimed_mesh = geometry_for_turret( 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()) diff --git a/crates/fparkan-assets/src/turret_elevation.rs b/crates/fparkan-assets/src/turret_elevation.rs new file mode 100644 index 00000000..9ba20e4b --- /dev/null +++ b/crates/fparkan-assets/src/turret_elevation.rs @@ -0,0 +1,48 @@ +use super::{native_control_blend, PreparedComponentControl, PreparedControlTimelineRow}; + +/// Returns the vertical timeline named by the first Control turret record. +#[must_use] +pub fn turret_elevation_row( + control: &PreparedComponentControl, +) -> Option<&PreparedControlTimelineRow> { + let index = control + .typed_records + .iter() + .find(|record| record.tag == 1)? + .values + .get(1)?; + control.timeline_rows.get(*index as usize) +} + +/// 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) = turret_elevation_row(control) 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: share this blend with linked tracks until 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); + } +} diff --git a/crates/fparkan-runtime/src/hero_look.rs b/crates/fparkan-runtime/src/hero_look.rs index 57bd62b1..8e15effd 100644 --- a/crates/fparkan-runtime/src/hero_look.rs +++ b/crates/fparkan-runtime/src/hero_look.rs @@ -4,9 +4,11 @@ use std::f32::consts::TAU; #[derive(Clone, Copy, Debug)] pub(super) struct HeroLook { - turns: f32, + yaw_turns: f32, + pitch_blend: f32, + reverse_y: bool, sensitivity: f32, - filtered_x: f32, + filtered: [f32; 2], phase: f32, } @@ -16,47 +18,67 @@ impl HeroLook { let path = normalize_relative(name, PathPolicy::StrictLegacy).ok()?; vfs.read(&path).ok() }; - let table = read(b"hero.tbl"); - let settings = read(b"Iron_3D.ini"); + let table_bytes = read(b"hero.tbl"); + let settings_bytes = read(b"Iron_3D.ini"); + let table = String::from_utf8_lossy(table_bytes.as_deref().unwrap_or_default()); + let settings = String::from_utf8_lossy(settings_bytes.as_deref().unwrap_or_default()); Self { - turns: table - .as_deref() - .and_then(|bytes| horizontal_binding(&String::from_utf8_lossy(bytes))) - .unwrap_or(0.15), - sensitivity: settings - .as_deref() - .and_then(|bytes| mouse_sensitivity(&String::from_utf8_lossy(bytes))) - .unwrap_or(1.0), - filtered_x: 0.0, + yaw_turns: mouse_binding( + &table, + "SCAN_MOUSE_X", + "CICLS_UNKNOWN", + "MCMD_ANGLE_Z", + "MAN_WRAP", + ) + .unwrap_or(0.15), + pitch_blend: mouse_binding( + &table, + "SCAN_MOUSE_Y", + "CICLS_TURRET", + "MCMD_ANGLE_Y", + "MAN_NOTWRAP", + ) + .unwrap_or(0.25), + reverse_y: control_setting(&settings, "MOUSE_REV_Y").unwrap_or(0) != 0, + sensitivity: control_setting(&settings, "MOUSE_SENS") + .map_or(1.0, |value| value as f32 * 0.01), + filtered: [0.0; 2], phase: 0.5, } } pub(super) fn reset(&mut self) { - self.filtered_x = 0.0; + self.filtered = [0.0; 2]; self.phase = 0.5; } pub(super) fn has_state(self) -> bool { - self.filtered_x != 0.0 || self.phase != 0.5 + self.filtered != [0.0; 2] || self.phase != 0.5 } - /// Samples the input once and returns the yaw delivered by this tick. - pub(super) fn advance(&mut self, dx: f32, dy: f32, max_angle: f32) -> f32 { - self.filtered_x = if dx == 0.0 && dy == 0.0 { - 0.0 + /// Returns delivered yaw in radians and the requested change in turret blend. + pub(super) fn advance(&mut self, raw: [f32; 2], max_angle: f32) -> [f32; 2] { + self.filtered = if raw == [0.0; 2] { + [0.0; 2] } else { - dx.clamp(i32::MIN as f32, i32::MAX as f32) * self.sensitivity * 0.95 - + self.filtered_x * 0.05 + std::array::from_fn(|axis| { + raw[axis].clamp(i32::MIN as f32, i32::MAX as f32) + * self.sensitivity + * [1.0, 1.2][axis] + * 0.95 + + self.filtered[axis] * 0.05 + }) }; - let scaled = self.filtered_x * 0.006; - let axis = if scaled.abs() > 0.999 { - scaled.signum() - } else { - scaled - }; - if axis != 0.0 { - let phase = self.phase + axis * self.turns; + let [x, y] = self.filtered.map(|filtered| { + let scaled = filtered * 0.006; + if scaled.abs() > 0.999 { + scaled.signum() + } else { + scaled + } + }); + if x != 0.0 { + let phase = self.phase + x * self.yaw_turns; self.phase = if phase >= 1.0 { phase - 1.0 } else if phase <= 0.0 { @@ -73,32 +95,40 @@ impl HeroLook { } else { (self.phase + delivered * (1.0 / TAU)).rem_euclid(1.0) }; - delivered + let pitch = y * self.pitch_blend; + [delivered, if self.reverse_y { -pitch } else { pitch }] + } +} + +pub(super) fn turret_pitch( + row: &fparkan_assets::PreparedControlTimelineRow, + previous: f32, + blend_delta: f32, +) -> Option<f32> { + let neutral = row.initial_blend; + let span = f32::from_bits(row.raw_parameters[3]); + if row.flags & 4 != 0 || !span.is_finite() || span <= 0.0 || !(0.0..=1.0).contains(&neutral) { + return None; } + let target = (neutral + previous / span + blend_delta).clamp(0.0, 1.0); + Some((target - neutral) * span) } -fn horizontal_binding(table: &str) -> Option<f32> { +fn mouse_binding(table: &str, axis: &str, class: &str, command: &str, wrap: &str) -> Option<f32> { table.lines().find_map(|line| { let line = line.split_once("//").map_or(line, |(binding, _)| binding); let mut words = line.split_ascii_whitespace(); - for name in [ - "MOUSE", - "SCAN_NULL", - "SCAN_MOUSE_X", - "1", - "CICLS_UNKNOWN", - "MCMD_ANGLE_Z", - ] { + for name in ["MOUSE", "SCAN_NULL", axis, "1", class, command] { if !words.next()?.eq_ignore_ascii_case(name) { return None; } } let turns = words.next()?.parse::<f32>().ok()?; - (turns.abs() <= 1.0 && words.nth(1)?.eq_ignore_ascii_case("MAN_WRAP")).then_some(turns) + (turns.abs() <= 1.0 && words.nth(1)?.eq_ignore_ascii_case(wrap)).then_some(turns) }) } -fn mouse_sensitivity(settings: &str) -> Option<f32> { +fn control_setting(settings: &str, key: &str) -> Option<i32> { let mut controls = false; for line in settings.lines().map(str::trim) { if let Some(section) = line.strip_prefix('[').and_then(|line| line.split_once(']')) { @@ -106,8 +136,8 @@ fn mouse_sensitivity(settings: &str) -> Option<f32> { } if controls { if let Some((name, value)) = line.split_once('=') { - if name.trim().eq_ignore_ascii_case("MOUSE_SENS") { - return Some(value.trim().parse::<i32>().ok()? as f32 * 0.01); + if name.trim().eq_ignore_ascii_case(key) { + return value.trim().parse().ok(); } } } @@ -119,49 +149,102 @@ fn mouse_sensitivity(settings: &str) -> Option<f32> { mod tests { use super::*; + fn stock_look() -> HeroLook { + HeroLook { + yaw_turns: 0.15, + pitch_blend: 0.25, + reverse_y: true, + sensitivity: 1.0, + filtered: [0.0; 2], + phase: 0.5, + } + } + #[test] - fn horizontal_profile_reads_only_unmodified_body_turn() { - let bindings = - "+MOUSE SCAN_SHIFT SCAN_MOUSE_X 1 CICLS_UNKNOWN MCMD_ANGLE_Z 0.10 0 MAN_WRAP 0.0 0 + fn hero_profile_reads_body_yaw_and_turret_pitch_without_shift() { + let bindings = "\ +MOUSE SCAN_LSHIFT SCAN_MOUSE_X 1 CICLS_CAMERA MCMD_ANGLE_X 0.10 1 MAN_WRAP 0.0 0 +MOUSE SCAN_LSHIFT SCAN_MOUSE_Y 1 CICLS_CAMERA MCMD_ANGLE_Y 0.15 1 MAN_NOTWRAP 0.0 0 MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_UNKNOWN MCMD_ANGLE_Z 0.25 0 MAN_WRAP 0.0 0 -MOUSE SCAN_NULL SCAN_MOUSE_X 1 CICLS_UNKNOWN MCMD_ANGLE_Z 0.20 0 MAN_WRAP 0.0 0 // body"; - assert_eq!(horizontal_binding(bindings), Some(0.20)); - let settings = "[VIDEO]\nMOUSE_SENS=100\n[cs]\n mouse_sens = 50"; - assert_eq!(mouse_sensitivity(settings), Some(0.5)); +MOUSE SCAN_NULL SCAN_MOUSE_X 1 CICLS_UNKNOWN MCMD_ANGLE_Z 0.20 0 MAN_WRAP 0.0 0 // body +MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_TURRET MCMD_ANGLE_Y 0.30 1 MAN_NOTWRAP 0.0 0 // turret"; + assert_eq!( + mouse_binding( + bindings, + "SCAN_MOUSE_X", + "CICLS_UNKNOWN", + "MCMD_ANGLE_Z", + "MAN_WRAP" + ), + Some(0.20) + ); + assert_eq!( + mouse_binding( + bindings, + "SCAN_MOUSE_Y", + "CICLS_TURRET", + "MCMD_ANGLE_Y", + "MAN_NOTWRAP" + ), + Some(0.30) + ); + let settings = "[VIDEO]\nMOUSE_SENS=100\n[cs]\n mouse_sens = 50\n mouse_rev_y=1"; + assert_eq!(control_setting(settings, "MOUSE_SENS"), Some(50)); + assert_eq!(control_setting(settings, "MOUSE_REV_Y"), Some(1)); } #[test] fn hero_mouse_matches_world3d_dispatch() { - let mut look = HeroLook { - turns: 0.15, - sensitivity: 1.0, - filtered_x: 0.0, - phase: 0.5, - }; + let mut look = stock_look(); for (dx, expected) in [(100.0, 0.0855), (-100.0, -0.0855), (250.0, 0.15)] { look.reset(); - assert!((look.advance(dx, 0.0, TAU) / -TAU - expected).abs() < 1e-6); + assert!((look.advance([dx, 0.0], TAU)[0] / -TAU - expected).abs() < 1e-6); } look.reset(); - look.advance(100.0, 0.0, TAU); - assert!((look.advance(0.0, 1.0, TAU) / -TAU - 0.004275).abs() < 1e-6); - assert_eq!(look.filtered_x, 4.75); - assert_eq!(look.advance(0.0, 0.0, TAU), 0.0); + look.advance([100.0, 0.0], TAU); + assert!((look.advance([0.0, 1.0], TAU)[0] / -TAU - 0.004275).abs() < 1e-6); + assert_eq!(look.filtered[0], 4.75); + assert_eq!(look.advance([0.0; 2], TAU), [0.0; 2]); assert!(!look.has_state()); } #[test] fn hero_finishes_a_capped_turn_on_the_next_tick_without_mouse_input() { - let mut look = HeroLook { - turns: 0.15, - sensitivity: 1.0, - filtered_x: 0.0, - phase: 0.5, - }; + let mut look = stock_look(); let max_angle = 50.22849 * 0.01; - assert!((look.advance(250.0, 0.0, max_angle) + 0.5022847).abs() < 1e-6); + assert!((look.advance([250.0, 0.0], max_angle)[0] + 0.5022847).abs() < 1e-6); assert!((look.phase - 0.5700589).abs() < 1e-6); - assert!((look.advance(0.0, 0.0, max_angle) + 0.44019294).abs() < 1e-6); + assert!((look.advance([0.0; 2], max_angle)[0] + 0.44019294).abs() < 1e-6); assert!(!look.has_state()); } + + #[test] + fn hero_turret_uses_world3d_axis_and_control_elevation_endpoints() { + let mut look = stock_look(); + let row = fparkan_assets::PreparedControlTimelineRow { + row_index: 2, + node_index: 34, + frame_a: 55.0, + frame_b: 57.0, + initial_blend: 0.27272728, + raw_parameters: [0, 0, 0, 1.9198622_f32.to_bits()], + flags: 0, + }; + let pitch = |previous, blend| turret_pitch(&row, previous, blend).unwrap().to_degrees(); + let upward = look.advance([0.0, -100.0], TAU)[1]; + assert!((upward - 0.171).abs() < 1e-6); + assert!((pitch(0.0, upward) - 18.81).abs() < 1e-5); + let tail = look.advance([1.0, 0.0], TAU)[1]; + assert!((tail - 0.00855).abs() < 1e-6); + + look.reset(); + let downward = look.advance([0.0, 300.0], TAU)[1]; + assert_eq!(downward, -0.25); + assert!((pitch(-25.0_f32.to_radians(), downward) + 30.0).abs() < 1e-5); + assert!((pitch(70.0_f32.to_radians(), upward) - 80.0).abs() < 1e-5); + + look.reset(); + look.reverse_y = false; + assert!((look.advance([0.0, 100.0], TAU)[1] - upward).abs() < 1e-6); + } } diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 527f2f85..f62c0784 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -18006,7 +18006,8 @@ mod tests { assert_eq!(turned.position, original.position); assert_ne!(turned.orientation[2], original.orientation[2]); assert_eq!(turned.orientation[..2], original.orientation[..2]); - assert_eq!(f32::from_bits(blocked.player_pitch_bits), 1.0); + let pitch = f32::from_bits(blocked.player_pitch_bits); + assert!((pitch.abs().to_degrees() - 27.5).abs() < 1e-4); let movement = PlayerMotion { mouse_x: 0.0, mouse_y: 0.0, diff --git a/crates/fparkan-runtime/src/player_motion.rs b/crates/fparkan-runtime/src/player_motion.rs index b2f91270..de988a89 100644 --- a/crates/fparkan-runtime/src/player_motion.rs +++ b/crates/fparkan-runtime/src/player_motion.rs @@ -1,5 +1,5 @@ use super::{transform_state, Engine, EngineError, StartingCockpit, SurfaceQuery, TransformState}; -use crate::hero_look::HeroLook; +use crate::hero_look::{turret_pitch, HeroLook}; use crate::manual_flight::{FlightDrive, FlightProfile}; use crate::{hero_walk::WalkingDrive, TerrainWorld}; use fparkan_resource::CachedResourceRepository; @@ -472,15 +472,35 @@ fn plan_player_steps( return Err(EngineError::Movement("invalid player step".into())); } let mut hero_look = hero_control.then_some(mission.hero_look); - let mut yaw_delta = if let Some(look) = hero_look.as_mut() { + // shortcut: mounted chassis use fixed gains until their bindings are wired. + let fallback_pitch = || (pitch - input.mouse_y * 0.005).clamp(-1.0, 1.0); + let (mut yaw_delta, pitch) = if let Some(look) = hero_look.as_mut() { let max_angle = hero_profile .map(|words| f32::from_bits(words[11])) .filter(|speed| speed.is_finite() && *speed >= 0.0) .map_or(f32::INFINITY, |speed| speed * input.delta_seconds); - look.advance(input.mouse_x, input.mouse_y, max_angle) + let [yaw, blend_delta] = look.advance([input.mouse_x, input.mouse_y], max_angle); + let next_pitch = || { + let control = mission + .mission_assets + .object_component_controls + .get(cockpit.object_index)? + .get(cockpit.component_index)? + .as_ref()?; + let row = fparkan_assets::turret_elevation_row(control)?; + turret_pitch(row, pitch, blend_delta) + }; + let pitch = if blend_delta != 0.0 { + next_pitch().unwrap_or_else(fallback_pitch) + } else { + pitch + }; + (yaw, pitch) } else { - // shortcut: mounted chassis still use a constant mouse gain. - -input.mouse_x.clamp(-1_000.0, 1_000.0) * 0.003 + ( + -input.mouse_x.clamp(-1_000.0, 1_000.0) * 0.003, + fallback_pitch(), + ) }; let speeds = if boarded.is_some() && !flying { crate::manual_chassis::speed_limits(mission, cockpit.handle) @@ -514,7 +534,6 @@ fn plan_player_steps( input.delta_seconds /= count as f32; let mut previous = pose; let mut previous_surface = WalkingSurface::Ground; - let mut pitch = pitch; for index in 0..count { let mut propose = |walk: Option<([f32; 2], [f32; 2])>| { let ground_displacement = walk.map_or_else( @@ -561,8 +580,6 @@ fn plan_player_steps( return Ok(Some(step)); } yaw_delta = 0.0; - input.mouse_y = 0.0; - pitch = f32::from_bits(step.pitch_bits); previous = step.pose; previous_surface = step.surface; if let (Some(drive), Some(velocity)) = (walking.as_mut(), step.hero_walk_velocity) { @@ -618,14 +635,7 @@ fn plan_motion( if !input .movement .into_iter() - .chain([ - input.mouse_y, - input.climb, - input.delta_seconds, - yaw, - yaw_delta, - pitch, - ]) + .chain([input.climb, input.delta_seconds, yaw, yaw_delta, pitch]) .chain(from) .all(f32::is_finite) || input.delta_seconds < 0.0 @@ -698,9 +708,6 @@ fn plan_motion( } } } - // shortcut: use a bounded camera aim until the native turret travel and - // sensitivity are recovered. The body remains aligned to the terrain. - let pitch = (pitch - input.mouse_y * 0.005).clamp(-1.0, 1.0); Ok(PlayerMotionStep { pose, pitch_bits: pitch.to_bits(), diff --git a/docs/appendices/knowledge-boundaries.md b/docs/appendices/knowledge-boundaries.md index 50a746e8..f04cf444 100644 --- a/docs/appendices/knowledge-boundaries.md +++ b/docs/appendices/knowledge-boundaries.md @@ -145,8 +145,8 @@ authoring API без динамического подтверждения. и приближённый поворот варбота, проверку корпуса короткими отрезками и расчёт смещения на склоне по крайним скоростям шага. После задержки дольше полусекунды ходьба учитывает только первые 500 мс. `cockpit_aim_approx` -отмечает приближённый вертикальный угол камеры и выбор позы башни. -Время доводки, поправки направления орудий и отдельный обзор со Shift открыты. +отмечает приближённые поправки орудий и применение угла в матрице камеры. +Отдельный обзор со Shift и ручное наведение варботов открыты. Вход и выход у BAS используют вырезанный рельеф и опоры геометрии здания. Через стыки без результата пробы сохраняется высота. Выбор героя по владельцу, пределы ступеней и физика падения ещё открыты. diff --git a/docs/tomes/06-behavior.md b/docs/tomes/06-behavior.md index b8b935ad..6b908483 100644 --- a/docs/tomes/06-behavior.md +++ b/docs/tomes/06-behavior.md @@ -2673,13 +2673,25 @@ zone/threshold и временной характеристикой. СтрокÐ `MAN_NOTWRAP`, а также параметры ускорения в миллисекундах. В `hero.tbl` вертикальное движение мыши без Shift отправляет -`MCMD_ANGLE_Y` башне. С Shift эта же ось направлена камере. FParkan -сохраняет вертикальный угол между тиками и использует его для наклона -взгляда и выбора позы прицела. Подъём взгляда сохраняет положение героя -на земле. Прицел и связанные с ним детали берут позы из дорожек `CTL` -и кадров `MSH` того же компонента. Например, у башни героя в -«Конструкторе» дорожка меняет положение и направление узлов орудий -около их собственных осей, а точка `CameraCenter` остаётся в кабине. +`MCMD_ANGLE_Y` башне. С Shift эта же ось направлена камере. +В `World3D.dll` свежий отсчёт Y перед фильтром умножается ещё на 1,2 +(RVA `0xf277`). Команда использует коэффициент 0,25 из `hero.tbl` +и направление из `[CS] MOUSE_REV_Y`. `MAN_NOTWRAP` ограничивает +относительное изменение дорожки её концами (RVA `0xfb40` → `0x10a50`). +Вызов DLL подтвердил прибавление 0,171 к доле дорожки при движении +мыши на 100 отсчётов вверх с включённым `MOUSE_REV_Y`, а также +удержание на 0 и 1 при попытке выйти за предел. + +Нейтраль и размах задаёт вторая дорожка записи Control типа 1. У башни +скафандра в «Огневом рубеже» доля нейтрали равна 3/11, а размах — +110°. Нижнее положение получается на −30°, верхнее на +80° от +нейтрали. Ручная ветвь `0x200` обновления `Control.dll` по RVA +`0x27470` передаёт ограниченную долю вертикальной дорожке в тот же +шаг. Вызов этой ветви подтвердил значения для нейтрали, обеих границ +и промежуточных углов. В FParkan один угол задаёт наклон взгляда и +долю основной дорожки башни. Прицел и подвижные детали читают позы +из дорожек `CTL` и кадров `MSH`. Точка `CameraCenter` остаётся +в кабине, корпус героя сохраняет прежнюю высоту. На участке устойчивой ходьбы героя в запущенной GOG-сборке высота камеры менялась на 0,35 единицы от нижней точки до верхней. Полный @@ -2708,8 +2720,8 @@ FParkan берёт из неё `step_hg` для грунта и `step_hf` для через `0x28200`. При выборе дополнительной дорожки флаг `0x40` исключает её из этого прохода, а `0x2000` выбирает отдельную ветвь. FParkan переводит угол относительно нейтральной позы в долю диапазона -ресурса и сразу вычисляет кадр между концами дорожки. Пределы мыши, -время доводки и поправки отдельных орудий ещё требуют сверки. +ресурса и вычисляет кадр между концами дорожки. Поправки отдельных +орудий ещё требуют сверки. Simulation читает подготовленный input snapshot. Renderer не должен самостоятельно опрашивать OS, иначе одно и то же нажатие будет зависеть от |
