diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | apps/fparkan-game/src/main.rs | 40 | ||||
| -rw-r--r-- | crates/fparkan-render/src/lib.rs | 42 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/hero_look.rs | 139 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 7 | ||||
| -rw-r--r-- | crates/fparkan-runtime/src/player_motion.rs | 41 | ||||
| -rw-r--r-- | docs/appendices/knowledge-boundaries.md | 4 | ||||
| -rw-r--r-- | docs/reference/render-frame.md | 5 | ||||
| -rw-r--r-- | docs/tomes/06-behavior.md | 17 |
9 files changed, 255 insertions, 44 deletions
@@ -47,7 +47,9 @@ cargo run --release -p fparkan-game -- ` Если в одиночной миссии найден один герой с точкой `CameraCenter`, окно открывается с видом из его кабины. Стрелки двигают героя вперёд, назад и вбок. Мышь поворачивает корпус по горизонтали и наклоняет взгляд по -вертикали. `Esc` освобождает указатель, правая кнопка возвращает захват. +вертикали. Удерживайте левый Shift, чтобы осмотреться из кабины. +Отпускание Shift или правая кнопка при зажатом Shift возвращают взгляд +к прицелу. `Esc` освобождает указатель, правая кнопка возвращает захват. Заголовок окна показывает, кем вы управляете, здоровье, запас руды и доступную и запрошенную энергию клана. Цифры выбирают орудие, `0` выбирает все. Левая кнопка запускает огонь diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 45d076fc..ea5c1bd1 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -9951,6 +9951,7 @@ struct StaticVulkanApp { player_move_pressed: [bool; PLAYER_MOVEMENT_KEYS.len()], mouse_look: bool, player_mouse: [f32; 2], + player_center_view: bool, player_weapon_layouts: HashMap<usize, PlayerWeaponLayout>, player_weapon_banks: HashMap<ObjectHandle, PlayerWeapons>, projectile_draws: Vec<Option<ProjectileDraw>>, @@ -10117,6 +10118,7 @@ impl StaticVulkanApp { player_move_pressed: Default::default(), mouse_look: false, player_mouse: [0.0; 2], + player_center_view: false, player_weapon_layouts: HashMap::new(), player_weapon_banks: HashMap::new(), projectile_draws: Vec::new(), @@ -10485,6 +10487,7 @@ impl StaticVulkanApp { if let Some(engine) = &self.mission_engine { translation[2] += fparkan_runtime::player_walk_camera_lift(engine, cockpit); } + let [view_yaw, view_pitch] = frame.player_view_offset_bits.map(f32::from_bits); let camera = fparkan_render::forward_cockpit_camera( LegacyIron3dEulerTransform { translation, @@ -10493,7 +10496,9 @@ impl StaticVulkanApp { state.scale.map(f32::from_bits), point, )? - .with_cockpit_pitch(f32::from_bits(frame.player_pitch_bits))?; + .with_cockpit_pitch(f32::from_bits(frame.player_pitch_bits))? + .with_cockpit_yaw(view_yaw)? + .with_cockpit_pitch(view_pitch)?; PreviewCameraFrame::from_legacy_d3d7( camera, LegacyD3d7Projection { @@ -10925,6 +10930,7 @@ impl StaticVulkanApp { } // A held key and accumulated device motion belong to this simulation sample. let [mouse_x, mouse_y] = std::mem::take(&mut self.player_mouse); + let center_view = std::mem::take(&mut self.player_center_view); if let (Some(engine), Some(cockpit), None) = (&self.mission_engine, self.cockpit, &self.demo_camera) { @@ -10942,6 +10948,8 @@ impl StaticVulkanApp { climb: climb - descend, mouse_x, mouse_y, + look_around: self.pressed_keys.contains(&KeyCode::ShiftLeft), + center_view, delta_seconds: clock.delta_seconds, }, |step| { @@ -12516,6 +12524,7 @@ impl ApplicationHandler for StaticVulkanApp { self.player_mine_pressed = false; self.player_disembark_pressed = false; self.player_mouse = [0.0; 2]; + self.player_center_view = false; self.set_mouse_look(false); } else if self.cockpit.is_some() && self.demo_camera.is_none() @@ -12625,6 +12634,7 @@ impl ApplicationHandler for StaticVulkanApp { } } else { self.pressed_keys.remove(&code); + self.player_center_view |= code == KeyCode::ShiftLeft; } } } @@ -12643,6 +12653,7 @@ impl ApplicationHandler for StaticVulkanApp { if self.cockpit.is_none() { self.set_mouse_look(state == ElementState::Pressed); } else if state == ElementState::Pressed && !self.mission_paused { + self.player_center_view |= self.pressed_keys.contains(&KeyCode::ShiftLeft); self.set_mouse_look(true); } } @@ -15958,6 +15969,33 @@ mod tests { .any(|(neutral, aimed)| neutral.position != aimed.position)); app.update_mission_camera(0.016, [800.0, 600.0]).unwrap(); assert_eq!(app.view_camera.position, moved); + let sights_forward = app.view_camera.forward; + let turned = plan_player_motion( + &engine, + cockpit, + PlayerMotion { + mouse_x: 100.0, + look_around: true, + ..PlayerMotion::default() + }, + ) + .unwrap() + .unwrap(); + let frame = frame_with_player_motion(&mut engine, 48, cockpit, turned, false).unwrap(); + assert_eq!(frame.player_pitch_bits, pitch.to_bits()); + app.mission_frame = Some(frame); + app.update_mission_camera(0.016, [800.0, 600.0]).unwrap(); + assert_eq!(app.view_camera.position, moved); + assert_ne!(app.view_camera.forward, sights_forward); + + let released = plan_player_motion(&engine, cockpit, PlayerMotion::default()) + .unwrap() + .unwrap(); + let frame = frame_with_player_motion(&mut engine, 64, cockpit, released, false).unwrap(); + assert_eq!(frame.player_pitch_bits, pitch.to_bits()); + app.mission_frame = Some(frame); + app.update_mission_camera(0.016, [800.0, 600.0]).unwrap(); + assert_eq!(app.view_camera.forward, sights_forward); } #[test] diff --git a/crates/fparkan-render/src/lib.rs b/crates/fparkan-render/src/lib.rs index c8c94e09..49954f3e 100644 --- a/crates/fparkan-render/src/lib.rs +++ b/crates/fparkan-render/src/lib.rs @@ -25,6 +25,24 @@ impl RawCameraTransform { Self::TRANSLATION_WORD_INDICES.map(|index| f32::from_bits(self.words[index])) } + /// Rotates the cockpit view about its up axis, preserving the camera point. + #[must_use] + pub fn with_cockpit_yaw(mut self, radians: f32) -> Option<Self> { + if !radians.is_finite() { + return None; + } + if radians != 0.0 { + let (sin, cos) = radians.sin_cos(); + for row in self.words[..12].chunks_exact_mut(4) { + let forward = f32::from_bits(row[0]); + let lateral = f32::from_bits(row[1]); + row[0] = (forward * cos + lateral * sin).to_bits(); + row[1] = (lateral * cos - forward * sin).to_bits(); + } + } + Some(self) + } + /// Rotates a cockpit's forward and up axes about its lateral axis, /// preserving the camera point. #[must_use] @@ -648,6 +666,30 @@ mod tests { } #[test] + fn cockpit_offsets_follow_control_camera_axes_in_yaw_then_pitch_order() { + use std::f32::consts::{FRAC_1_SQRT_2, FRAC_PI_2, FRAC_PI_4}; + + let unit = LegacyIron3dEulerTransform { + translation: [20.0, 30.0, 40.0], + orientation_radians: [0.0; 3], + }; + let neutral = forward_cockpit_camera(unit, [1.0; 3], [0.0; 3]).unwrap(); + let looked = neutral + .with_cockpit_yaw(-FRAC_PI_2) + .unwrap() + .with_cockpit_pitch(-FRAC_PI_4) + .unwrap(); + assert_eq!(looked.translation(), neutral.translation()); + let forward = [0, 4, 8].map(|word| f32::from_bits(looked.words[word])); + for (actual, expected) in forward + .into_iter() + .zip([FRAC_1_SQRT_2, 0.0, -FRAC_1_SQRT_2]) + { + assert!((actual - expected).abs() < 1e-6); + } + } + + #[test] fn water_reflection_preserves_the_plane_and_reverses_height_before_projection() { let matrix = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, diff --git a/crates/fparkan-runtime/src/hero_look.rs b/crates/fparkan-runtime/src/hero_look.rs index 8e15effd..d671f2b7 100644 --- a/crates/fparkan-runtime/src/hero_look.rs +++ b/crates/fparkan-runtime/src/hero_look.rs @@ -1,15 +1,17 @@ use fparkan_path::{normalize_relative, PathPolicy}; use fparkan_vfs::Vfs; -use std::f32::consts::TAU; +use std::f32::consts::{PI, TAU}; #[derive(Clone, Copy, Debug)] pub(super) struct HeroLook { yaw_turns: f32, pitch_blend: f32, + camera_gain: [f32; 2], reverse_y: bool, sensitivity: f32, filtered: [f32; 2], phase: f32, + camera_phase: [f32; 2], } impl HeroLook { @@ -25,6 +27,7 @@ impl HeroLook { Self { yaw_turns: mouse_binding( &table, + "SCAN_NULL", "SCAN_MOUSE_X", "CICLS_UNKNOWN", "MCMD_ANGLE_Z", @@ -33,31 +36,66 @@ impl HeroLook { .unwrap_or(0.15), pitch_blend: mouse_binding( &table, + "SCAN_NULL", "SCAN_MOUSE_Y", "CICLS_TURRET", "MCMD_ANGLE_Y", "MAN_NOTWRAP", ) .unwrap_or(0.25), + camera_gain: [ + mouse_binding( + &table, + "SCAN_LSHIFT", + "SCAN_MOUSE_X", + "CICLS_CAMERA", + "MCMD_ANGLE_X", + "MAN_WRAP", + ) + .unwrap_or(0.1), + mouse_binding( + &table, + "SCAN_LSHIFT", + "SCAN_MOUSE_Y", + "CICLS_CAMERA", + "MCMD_ANGLE_Y", + "MAN_NOTWRAP", + ) + .unwrap_or(0.15), + ], 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, + camera_phase: [0.5; 2], } } pub(super) fn reset(&mut self) { self.filtered = [0.0; 2]; self.phase = 0.5; + self.camera_phase = [0.5; 2]; } pub(super) fn has_state(self) -> bool { - self.filtered != [0.0; 2] || self.phase != 0.5 + self.filtered != [0.0; 2] || self.phase != 0.5 || self.camera_phase != [0.5; 2] + } + + /// Local yaw and pitch relative to the direction of the sights. + pub(super) fn camera_offset(self) -> [f32; 2] { + let [x, y] = self.camera_phase; + [(0.5 - x) * TAU, (0.5 - y) * PI] } /// 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] { + pub(super) fn advance( + &mut self, + raw: [f32; 2], + max_angle: f32, + look_around: bool, + center_view: bool, + ) -> [f32; 2] { self.filtered = if raw == [0.0; 2] { [0.0; 2] } else { @@ -77,15 +115,16 @@ impl HeroLook { 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 { - phase + 1.0 - } else { - phase - }; + let y = if self.reverse_y { -y } else { y }; + if !look_around || center_view { + self.camera_phase = [0.5; 2]; + } else { + let [horizontal, vertical] = self.camera_gain; + self.camera_phase[0] = wrap_angle(self.camera_phase[0] + x * horizontal); + self.camera_phase[1] = (self.camera_phase[1] + y * vertical).clamp(0.0, 1.0); + } + if x != 0.0 && !look_around { + self.phase = wrap_angle(self.phase + x * self.yaw_turns); } let requested = -(self.phase - 0.5) * TAU; @@ -95,8 +134,24 @@ impl HeroLook { } else { (self.phase + delivered * (1.0 / TAU)).rem_euclid(1.0) }; - let pitch = y * self.pitch_blend; - [delivered, if self.reverse_y { -pitch } else { pitch }] + [ + delivered, + if look_around { + 0.0 + } else { + y * self.pitch_blend + }, + ] + } +} + +fn wrap_angle(phase: f32) -> f32 { + if phase >= 1.0 { + phase - 1.0 + } else if phase <= 0.0 { + phase + 1.0 + } else { + phase } } @@ -114,11 +169,18 @@ pub(super) fn turret_pitch( Some((target - neutral) * span) } -fn mouse_binding(table: &str, axis: &str, class: &str, command: &str, wrap: &str) -> Option<f32> { +fn mouse_binding( + table: &str, + modifier: &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", axis, "1", class, command] { + for name in ["MOUSE", modifier, axis, "1", class, command] { if !words.next()?.eq_ignore_ascii_case(name) { return None; } @@ -153,10 +215,12 @@ mod tests { HeroLook { yaw_turns: 0.15, pitch_blend: 0.25, + camera_gain: [0.1, 0.15], reverse_y: true, sensitivity: 1.0, filtered: [0.0; 2], phase: 0.5, + camera_phase: [0.5; 2], } } @@ -171,6 +235,7 @@ MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_TURRET MCMD_ANGLE_Y 0.30 1 MAN_NOTWRAP 0.0 assert_eq!( mouse_binding( bindings, + "SCAN_NULL", "SCAN_MOUSE_X", "CICLS_UNKNOWN", "MCMD_ANGLE_Z", @@ -181,6 +246,7 @@ MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_TURRET MCMD_ANGLE_Y 0.30 1 MAN_NOTWRAP 0.0 assert_eq!( mouse_binding( bindings, + "SCAN_NULL", "SCAN_MOUSE_Y", "CICLS_TURRET", "MCMD_ANGLE_Y", @@ -198,13 +264,13 @@ MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_TURRET MCMD_ANGLE_Y 0.30 1 MAN_NOTWRAP 0.0 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)[0] / -TAU - expected).abs() < 1e-6); + assert!((look.advance([dx, 0.0], TAU, false, false)[0] / -TAU - expected).abs() < 1e-6); } look.reset(); - look.advance([100.0, 0.0], TAU); - assert!((look.advance([0.0, 1.0], TAU)[0] / -TAU - 0.004275).abs() < 1e-6); + look.advance([100.0, 0.0], TAU, false, false); + assert!((look.advance([0.0, 1.0], TAU, false, false)[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_eq!(look.advance([0.0; 2], TAU, false, false), [0.0; 2]); assert!(!look.has_state()); } @@ -212,9 +278,9 @@ MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_TURRET MCMD_ANGLE_Y 0.30 1 MAN_NOTWRAP 0.0 fn hero_finishes_a_capped_turn_on_the_next_tick_without_mouse_input() { let mut look = stock_look(); let max_angle = 50.22849 * 0.01; - assert!((look.advance([250.0, 0.0], max_angle)[0] + 0.5022847).abs() < 1e-6); + assert!((look.advance([250.0, 0.0], max_angle, false, false)[0] + 0.5022847).abs() < 1e-6); assert!((look.phase - 0.5700589).abs() < 1e-6); - assert!((look.advance([0.0; 2], max_angle)[0] + 0.44019294).abs() < 1e-6); + assert!((look.advance([0.0; 2], max_angle, false, false)[0] + 0.44019294).abs() < 1e-6); assert!(!look.has_state()); } @@ -231,20 +297,41 @@ MOUSE SCAN_NULL SCAN_MOUSE_Y 1 CICLS_TURRET MCMD_ANGLE_Y 0.30 1 MAN_NOTWRAP 0.0 flags: 0, }; let pitch = |previous, blend| turret_pitch(&row, previous, blend).unwrap().to_degrees(); - let upward = look.advance([0.0, -100.0], TAU)[1]; + let upward = look.advance([0.0, -100.0], TAU, false, false)[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]; + let tail = look.advance([1.0, 0.0], TAU, false, false)[1]; assert!((tail - 0.00855).abs() < 1e-6); look.reset(); - let downward = look.advance([0.0, 300.0], TAU)[1]; + let downward = look.advance([0.0, 300.0], TAU, false, false)[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); + assert!((look.advance([0.0, 100.0], TAU, false, false)[1] - upward).abs() < 1e-6); + } + + #[test] + fn shift_routes_motion_to_camera_and_release_or_center_restores_sights() { + let mut look = stock_look(); + assert_eq!(look.advance([100.0, -100.0], TAU, true, false), [0.0; 2]); + let [yaw, pitch] = look.camera_offset(); + assert!((yaw + 0.057 * TAU).abs() < 1e-6); + assert!((pitch + 0.1026 * PI).abs() < 1e-6); + look.advance([0.0; 2], TAU, true, false); + assert_eq!(look.camera_offset(), [yaw, pitch]); + look.advance([0.0; 2], TAU, false, false); + assert_eq!(look.camera_offset(), [0.0; 2]); + assert!(!look.has_state()); + + look.camera_phase = [0.99; 2]; + look.advance([100.0, -100.0], TAU, true, false); + assert!((look.camera_phase[0] - 0.047).abs() < 1e-6); + assert_eq!(look.camera_phase[1], 1.0); + look.advance([100.0, -100.0], TAU, true, true); + assert_eq!(look.camera_offset(), [0.0; 2]); } } diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index f62c0784..3aa78bbe 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -1408,6 +1408,8 @@ pub struct FrameResult { pub clan_notices: Vec<MissionNotice>, /// Vertical aim of the controlled hero as an IEEE-754 radian value. pub player_pitch_bits: u32, + /// View-only yaw and pitch relative to the sights, encoded as radians. + pub player_view_offset_bits: [u32; 2], /// Footstep from the accepted player motion, if this tick reached a footfall. pub player_footstep: Option<PlayerFootstep>, /// Autonomous combat events during the step. @@ -2990,6 +2992,9 @@ pub fn step_headless( .loaded .as_ref() .map_or(0, |mission| mission.player_pitch_bits), + player_view_offset_bits: engine.loaded.as_ref().map_or([0; 2], |mission| { + mission.hero_look.camera_offset().map(f32::to_bits) + }), }) } @@ -3045,6 +3050,7 @@ pub fn frame_with_player_motion( motion, blocked || drowned || landing.is_some(), ); + frame.player_view_offset_bits = mission.hero_look.camera_offset().map(f32::to_bits); if !blocked && !drowned && landing.is_none() @@ -17987,6 +17993,7 @@ mod tests { mouse_x: 100.0, mouse_y: -500.0, delta_seconds: 0.1, + ..Default::default() }; let proposed = plan_player_motion(&engine, cockpit, input) .unwrap() diff --git a/crates/fparkan-runtime/src/player_motion.rs b/crates/fparkan-runtime/src/player_motion.rs index de988a89..525bc7b3 100644 --- a/crates/fparkan-runtime/src/player_motion.rs +++ b/crates/fparkan-runtime/src/player_motion.rs @@ -56,6 +56,10 @@ pub struct PlayerMotion { pub mouse_x: f32, /// Relative vertical mouse motion for this step, positive down. pub mouse_y: f32, + /// While held, mouse input turns the cockpit view independently of the weapons. + pub look_around: bool, + /// Return the cockpit view to the sights, even if free look remains held. + pub center_view: bool, /// Time spent on this simulation step, excluding time spent paused. pub delta_seconds: f32, } @@ -459,7 +463,7 @@ fn plan_player_steps( && flight.is_none_or(|drive| input.climb == 0.0 && drive.velocity == [0.0; 3]) && input.mouse_x == 0.0 && input.mouse_y == 0.0 - && (!hero_control || !mission.hero_look.has_state()) + && !mission.hero_look.has_state() { return Ok(None); } @@ -471,15 +475,20 @@ 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 look = mission.hero_look; + 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); + let [yaw, blend_delta] = look.advance( + [input.mouse_x, input.mouse_y], + max_angle, + input.look_around, + input.center_view, + ); // 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); - let [yaw, blend_delta] = look.advance([input.mouse_x, input.mouse_y], max_angle); + let (mut yaw_delta, pitch) = if hero_control { let next_pitch = || { let control = mission .mission_assets @@ -496,6 +505,8 @@ fn plan_player_steps( pitch }; (yaw, pitch) + } else if input.look_around { + (0.0, pitch) } else { ( -input.mouse_x.clamp(-1_000.0, 1_000.0) * 0.003, @@ -551,7 +562,7 @@ fn plan_player_steps( )?; step.max_floor_clearance = max_floor_clearance; step.hero_walk_velocity = walk.map(|(velocity, _)| velocity); - step.hero_look = hero_look; + step.hero_look = Some(look); match resolve.as_mut() { Some(resolve) => resolve(step), None => Ok((step, false)), @@ -599,10 +610,14 @@ pub(super) fn commit_motion_state( if let Some(velocity) = step.hero_walk_velocity { mission.hero_walk_velocity = if blocked { [0.0; 2] } else { velocity }; } - if mission.boarding.is_none() { - if let Some(look) = step.hero_look { - mission.hero_look = look; - } + } + let active_cockpit = mission.boarding.map_or_else( + || mission.local_hero == Some(cockpit.handle), + |boarding| boarding.cockpit.handle == cockpit.handle, + ); + if active_cockpit { + if let Some(look) = step.hero_look { + mission.hero_look = look; } } if let (Some(boarding), Some(velocity)) = (&mut mission.boarding, step.flight_velocity) { diff --git a/docs/appendices/knowledge-boundaries.md b/docs/appendices/knowledge-boundaries.md index f04cf444..08ca2fbc 100644 --- a/docs/appendices/knowledge-boundaries.md +++ b/docs/appendices/knowledge-boundaries.md @@ -146,7 +146,9 @@ authoring API без динамического подтверждения. и расчёт смещения на склоне по крайним скоростям шага. После задержки дольше полусекунды ходьба учитывает только первые 500 мс. `cockpit_aim_approx` отмечает приближённые поправки орудий и применение угла в матрице камеры. -Отдельный обзор со Shift и ручное наведение варботов открыты. +Ручное наведение варботов остаётся приближённым. Отдельный обзор со Shift +использует штатные углы камеры. Полное положение и качание её опоры +в оригинале ещё требуют сверки. Вход и выход у BAS используют вырезанный рельеф и опоры геометрии здания. Через стыки без результата пробы сохраняется высота. Выбор героя по владельцу, пределы ступеней и физика падения ещё открыты. diff --git a/docs/reference/render-frame.md b/docs/reference/render-frame.md index 09e50d94..01c7bf75 100644 --- a/docs/reference/render-frame.md +++ b/docs/reference/render-frame.md @@ -56,8 +56,9 @@ FParkan подключает кабину, когда найден один ге узел, крепление башни и корневую позу из снимка мира. В «Конструкторе» стартовая позиция FParkan находится в пределах 0,13 единицы от замера оригинала при неизменном направлении героя. Направление вдоль локальной -оси +Y следует из горизонтальной проекции камеры оригинала. В FParkan -взгляд пока фиксирован и горизонтален на стартовой позе. +оси +Y следует из горизонтальной проекции камеры оригинала. Прицел задаёт +вертикальный угол, а отдельный обзор с левым Shift добавляет локальные +повороты к этой позе камеры. Оба поворота сохраняют точку обзора. ## Автоматическая камера AutoDemo diff --git a/docs/tomes/06-behavior.md b/docs/tomes/06-behavior.md index 6b908483..9af444b7 100644 --- a/docs/tomes/06-behavior.md +++ b/docs/tomes/06-behavior.md @@ -2693,6 +2693,23 @@ zone/threshold и временной характеристикой. СтрокÐ из дорожек `CTL` и кадров `MSH`. Точка `CameraCenter` остаётся в кабине, корпус героя сохраняет прежнюю высоту. +С зажатым левым Shift `World3D.dll` направляет обе оси к +`CICLS_CAMERA`. В ходе выбора привязки по RVA `0xf37c` нажатый +модификатор выбирает свою строку. В `hero.tbl`, `m1.tbl` и `m2.tbl` +горизонталь прибавляет к фазе отсчёт с коэффициентом 0,1 и переносит +его через границу оборота. Вертикаль использует коэффициент 0,15 и +ограничивает фазу диапазоном 0–1. Отпускание Shift и правая кнопка +мыши при зажатом Shift записывают 0,5 в обе оси. Вызов диспетчера +`0xfb40` подтвердил относительный ход, перенос, ограничение и возврат. + +Ручная ветвь камеры `Control.dll` по RVA `0x23788` переводит фазы +в углы `(0,5 − x) × 2π` и `(0,5 − y) × π`. Сначала камера +поворачивается вокруг своей вертикали, затем вокруг поперечной оси. +Вызов этой ветви подтвердил направление и порядок поворотов, в том числе +для совмещённого движения мыши. Повороты сохраняют точку обзора. +Угол башни сохраняется, а корпус может закончить поворот, запрошенный +до нажатия Shift. + На участке устойчивой ходьбы героя в запущенной GOG-сборке высота камеры менялась на 0,35 единицы от нижней точки до верхней. Полный цикл занимал примерно 0,45 секунды. Положение снималось с активной |
