aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/boarding.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 18:57:36 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 18:57:36 +0300
commit1fd51e5bbcfb4d5590fbc1ded8308fc40f6158f4 (patch)
tree9ef8276c399e238a2a692862de09f54bf5dcee65 /crates/fparkan-runtime/src/boarding.rs
parent077bead07a76908ac4e0e2b84de3940256cf6fd1 (diff)
downloadfparkan-1fd51e5bbcfb4d5590fbc1ded8308fc40f6158f4.tar.xz
fparkan-1fd51e5bbcfb4d5590fbc1ded8308fc40f6158f4.zip
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.
Diffstat (limited to 'crates/fparkan-runtime/src/boarding.rs')
-rw-r--r--crates/fparkan-runtime/src/boarding.rs21
1 files changed, 16 insertions, 5 deletions
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<RemoteWarbotControl>,
+ pub(super) turret: Option<crate::TurretAim>,
pub(super) can_fly: bool,
pub(super) ground: Option<crate::ground_support::GroundSupport>,
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<RemoteWarbotControl>,
+ turret: Option<crate::TurretAim>,
) {
- 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<Option<StartingCockpit>,
cockpit: vehicle,
hero,
remote,
+ turret,
can_fly,
on_building_floor,
..
@@ -370,6 +376,11 @@ pub fn disembark_warbot(engine: &mut Engine) -> Result<Option<StartingCockpit>,
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))
}