diff options
Diffstat (limited to 'apps/fparkan-game/src/main.rs')
| -rw-r--r-- | apps/fparkan-game/src/main.rs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 835a01c0..d3d36128 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -34,6 +34,7 @@ mod model_mounts; mod motion_effects; mod player_collision; mod satellite_map; +mod strategic_view; #[cfg(windows)] mod weapon_hud; #[cfg(test)] @@ -9309,6 +9310,7 @@ struct StaticVulkanApp { player_mine_pressed: bool, player_disembark_pressed: bool, boarded_hero_index: Option<usize>, + command_view: Option<strategic_view::ActiveCommandView>, laboratory_status: Option<String>, mission_title: String, overlay: mission_overlay::MissionOverlay, @@ -9478,6 +9480,7 @@ impl StaticVulkanApp { player_mine_pressed: false, player_disembark_pressed: false, boarded_hero_index: None, + command_view: None, laboratory_status: None, mission_title: String::new(), overlay: mission_overlay::MissionOverlay::default(), @@ -9748,6 +9751,11 @@ impl StaticVulkanApp { ) -> Result<(), String> { self.cockpit_geometry.clear(); self.player_aim_direction = None; + if let Some(camera) = self.strategic_frame(viewport) { + self.camera = camera.vulkan_camera(); + self.view_camera = camera; + return Ok(()); + } if let (Some(demo), Some(frame)) = (&mut self.demo_camera, &self.mission_frame) { let mode_and_camera = match demo.sample(self.simulation_time_ms, &frame.snapshot, &self.terrain)? { @@ -10222,9 +10230,11 @@ 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) - { + if let (Some(engine), Some(cockpit), None) = ( + &self.mission_engine, + self.cockpit.filter(|_| self.command_view.is_none()), + &self.demo_camera, + ) { let pressed = std::mem::take(&mut self.player_move_pressed); let [right, left, forward, back, climb, descend] = std::array::from_fn(|index| { f32::from( @@ -11435,7 +11445,7 @@ impl StaticVulkanApp { } fn set_mouse_look(&mut self, active: bool) { - let active = active && self.factory_menu.is_none(); + let active = active && self.factory_menu.is_none() && self.command_view.is_none(); self.mouse_look = active; if !active { self.player_fire_held = false; @@ -11769,7 +11779,11 @@ impl ApplicationHandler for StaticVulkanApp { } self.window_id = Some(window.id()); self.window = Some(window); - if self.cockpit.is_some() && self.demo_camera.is_none() && self.window_focused { + if !self.open_strategy() + && self.cockpit.is_some() + && self.demo_camera.is_none() + && self.window_focused + { self.set_mouse_look(true); } self.renderer = Some(renderer); @@ -11808,6 +11822,9 @@ impl ApplicationHandler for StaticVulkanApp { if self.handle_factory_pointer(&event) { return; } + if self.handle_strategy_pointer(&event) { + return; + } match event { WindowEvent::CloseRequested => { self.complete(event_loop); @@ -11859,6 +11876,9 @@ impl ApplicationHandler for StaticVulkanApp { ) { return; } + if self.handle_strategy_key(&event) { + return; + } let key = if self.cockpit.is_some() && self.demo_camera.is_none() { player_movement_key(event.physical_key, &event.logical_key) .map_or(event.physical_key, PhysicalKey::Code) |
