aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/mission_overlay.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 18:23:04 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 18:23:04 +0300
commit077bead07a76908ac4e0e2b84de3940256cf6fd1 (patch)
tree6d01dd0b8885204a0dd054e8a64a9360985bf173 /apps/fparkan-game/src/mission_overlay.rs
parent9f442fa339371869dda44a32a9e0ec2f763d830c (diff)
downloadfparkan-077bead07a76908ac4e0e2b84de3940256cf6fd1.tar.xz
fparkan-077bead07a76908ac4e0e2b84de3940256cf6fd1.zip
feat(ui): draw the cockpit reticle from the original atlas
Use the native page9 crops, mirrored scales and hull-relative heading marker. Match the geometry against the original and run the stock Constructor cockpit with and without the satellite map under Vulkan validation.
Diffstat (limited to 'apps/fparkan-game/src/mission_overlay.rs')
-rw-r--r--apps/fparkan-game/src/mission_overlay.rs32
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();