From 1fd51e5bbcfb4d5590fbc1ded8308fc40f6158f4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 19:57:36 +0400 Subject: feat(ui): enable manual control from the bunker list Use the active Control camera record and its separate CPT origin and direction for the fixed turret. The original hand control opens the cockpit, its two weapon slots and aim tracks while leaving the operator at the command post. Verified from the stock Two Fortresses start against the GOG cockpit with Vulkan validation. The licensed tests cover the native camera pose, mounted weapon selection and stationary bunker and operator. --- crates/fparkan-runtime/src/boarding.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'crates/fparkan-runtime/src/boarding.rs') diff --git a/crates/fparkan-runtime/src/boarding.rs b/crates/fparkan-runtime/src/boarding.rs index 95acc7e0..bbcc4615 100644 --- a/crates/fparkan-runtime/src/boarding.rs +++ b/crates/fparkan-runtime/src/boarding.rs @@ -11,6 +11,7 @@ use fparkan_world::{ }; pub(super) const WARBOT_CLASS: u32 = 0x0100_8000; +pub mod bunker; mod remote_control; pub use remote_control::{ can_control_warbot_remotely, control_warbot_remotely, remote_automatic_weapons, @@ -38,6 +39,7 @@ pub(super) struct Boarding { pub(super) cockpit: StartingCockpit, pub(super) hero: StartingCockpit, pub(super) remote: Option, + pub(super) turret: Option, pub(super) can_fly: bool, pub(super) ground: Option, pub(super) on_building_floor: bool, @@ -46,7 +48,7 @@ pub(super) struct Boarding { impl Boarding { pub(super) fn controls_chassis(self) -> bool { - self.remote != Some(RemoteWarbotControl::Autopilot) + self.turret.is_none() && self.remote != Some(RemoteWarbotControl::Autopilot) } pub(super) fn controls_weapons(self) -> bool { @@ -183,24 +185,27 @@ pub fn board_friendly_warbot( ..hero_pose }, )?; - start_warbot_control(engine, hero, cockpit, None); + start_player_control(engine, hero, cockpit, None, None); Ok(Some(cockpit)) } -fn start_warbot_control( +fn start_player_control( engine: &mut Engine, hero: StartingCockpit, cockpit: StartingCockpit, remote: Option, + turret: Option, ) { - let can_fly = crate::player_motion::warbot_can_fly(engine, cockpit.object_index); + let can_fly = + turret.is_none() && crate::player_motion::warbot_can_fly(engine, cockpit.object_index); if let Some(mission) = &mut engine.loaded { mission.boarding = Some(Boarding { cockpit, hero, remote, + turret, can_fly, - ground: (!can_fly) + ground: (turret.is_none() && !can_fly) .then(|| { crate::ground_support::GroundSupport::prepare( &mission.mission_assets, @@ -314,6 +319,7 @@ pub fn disembark_warbot(engine: &mut Engine) -> Result, cockpit: vehicle, hero, remote, + turret, can_fly, on_building_floor, .. @@ -370,6 +376,11 @@ pub fn disembark_warbot(engine: &mut Engine) -> Result, mission.boarding = None; mission.player_pitch_bits = 0; mission.hero_walk_velocity = [0.0; 2]; + if turret.is_some() { + if let Some(vfs) = &engine.services.vfs { + mission.hero_look = crate::hero_look::HeroLook::load(vfs.as_ref()); + } + } mission.hero_look.reset(); Ok(Some(hero)) } -- cgit v1.2.3