diff options
Diffstat (limited to 'apps/fparkan-game/src/mission_overlay.rs')
| -rw-r--r-- | apps/fparkan-game/src/mission_overlay.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/fparkan-game/src/mission_overlay.rs b/apps/fparkan-game/src/mission_overlay.rs index d253a074..f7b99c3a 100644 --- a/apps/fparkan-game/src/mission_overlay.rs +++ b/apps/fparkan-game/src/mission_overlay.rs @@ -2,6 +2,7 @@ use super::{ append_environment_gradient_material, append_environment_range, cockpit_dial::CockpitDial, cockpit_radar_hud::CockpitRadarHud, + cockpit_reticle::CockpitReticle, factory_menu::FactoryProjectPanel, horizontal_fov, quad_indices, satellite_map::SatelliteMap, @@ -44,6 +45,7 @@ pub(super) struct MissionOverlay { #[cfg(windows)] strategic_tooltip: Option<StrategicTooltipHud>, dial: Option<CockpitDial>, + reticle: Option<CockpitReticle>, pub(super) factory_projects: Option<FactoryProjectPanel>, pub(super) radar: Option<CockpitRadarHud>, #[cfg(windows)] @@ -84,6 +86,11 @@ impl MissionOverlay { None }) }); + let reticle = cockpit.and_then(|_| { + CockpitReticle::load(root, preview) + .inspect_err(|error| eprintln!("cockpit_reticle_unavailable reason={error}")) + .ok() + }); // iron3d+0x2cbb0 draws the AutoDemo balance rows under its top-aligned map. #[cfg(windows)] let strategy_balance = (autodemo || cockpit.is_some()) @@ -198,6 +205,7 @@ impl MissionOverlay { #[cfg(windows)] strategic_tooltip, dial, + reticle, factory_projects, radar, #[cfg(windows)] @@ -233,6 +241,11 @@ impl MissionOverlay { remove(range, ranges, counts); } } + if let Some(reticle) = &self.reticle { + for range in reticle.ranges() { + remove(range, ranges, counts); + } + } #[cfg(windows)] if let Some(balance) = &self.strategy_balance { remove(balance.range_index(), ranges, counts); @@ -443,6 +456,25 @@ impl StaticVulkanApp { }; let cockpit = self.cockpit.filter(|_| self.command_view.is_none()); let occupant = self.mission_engine.as_ref().zip(cockpit); + if let Some(reticle) = &self.overlay.reticle { + let orientation = + cockpit + .zip(self.mission_frame.as_ref()) + .and_then(|(cockpit, frame)| { + frame + .snapshot + .transforms + .iter() + .find(|(handle, _)| *handle == cockpit.handle) + .map(|(_, pose)| pose.orientation) + }); + reticle.draw( + renderer, + &mut self.mesh, + orientation, + frame.camera.forward(), + )?; + } if let Some(dial) = &mut self.overlay.dial { let view = cockpit.map(|_| { let [x, y, _] = frame.camera.forward(); |
