From 05da53f0344416a5f14211a73f1f48d72c88b954 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 14:38:56 +0400 Subject: feat(ui): drive a strategic warbot with an automatic gunner --- apps/fparkan-game/src/main.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'apps/fparkan-game/src/main.rs') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index d7befa93..57890f8f 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -9856,15 +9856,18 @@ impl StaticVulkanApp { 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 sights = fparkan_render::forward_cockpit_camera( + let sights = cockpit_geometry::cockpit_sights( LegacyIron3dEulerTransform { translation, orientation_radians: state.orientation.map(f32::from_bits), }, state.scale.map(f32::from_bits), point, - )? - .with_cockpit_pitch(f32::from_bits(frame.player_pitch_bits))?; + pose.rotation, + self.auto_gunner_weapons() + .is_none() + .then(|| f32::from_bits(frame.player_pitch_bits)), + )?; let sights_view = sights.try_direct3d7_view_row_major()?; let camera = sights .with_cockpit_yaw(view_yaw)? @@ -10605,11 +10608,15 @@ impl StaticVulkanApp { ) }) }); + let auto_gunner = self + .mission_engine + .as_ref() + .and_then(fparkan_runtime::remote_auto_gunner_weapons); update_gameplay_animation_pose_buffers( &mut self.control_animation_instances, &mut self.component_pose_buffers, control_clock_ms, - self.cockpit.zip( + self.cockpit.filter(|_| auto_gunner.is_none()).zip( self.mission_frame .as_ref() .map(|frame| f32::from_bits(frame.player_pitch_bits)), @@ -10626,8 +10633,8 @@ impl StaticVulkanApp { ) }), self.cockpit.and_then(|cockpit| { - self.player_weapon_banks - .get(&cockpit.handle) + auto_gunner + .or_else(|| self.player_weapon_banks.get(&cockpit.handle)) .map(|bank| (cockpit.object_index, bank)) }), )?; -- cgit v1.2.3