aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/main.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 13:38:56 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 13:38:56 +0300
commit05da53f0344416a5f14211a73f1f48d72c88b954 (patch)
treed27d22f56a1bd185447b27223c79c9f97f7cc165 /apps/fparkan-game/src/main.rs
parent787279a1f514fbbaf09ca9dd6e5015bdce36635b (diff)
downloadfparkan-05da53f0344416a5f14211a73f1f48d72c88b954.tar.xz
fparkan-05da53f0344416a5f14211a73f1f48d72c88b954.zip
feat(ui): drive a strategic warbot with an automatic gunner
Diffstat (limited to 'apps/fparkan-game/src/main.rs')
-rw-r--r--apps/fparkan-game/src/main.rs19
1 files changed, 13 insertions, 6 deletions
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))
}),
)?;