From 1776dd8007169ef4f04969f0a5edcc423b6d67bc Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 3 Dec 2026 18:14:49 +0400 Subject: feat(ui): restore cockpit status indicators --- apps/fparkan-game/src/mission_overlay.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'apps/fparkan-game/src/mission_overlay.rs') diff --git a/apps/fparkan-game/src/mission_overlay.rs b/apps/fparkan-game/src/mission_overlay.rs index fe646cc6..a2aafd4b 100644 --- a/apps/fparkan-game/src/mission_overlay.rs +++ b/apps/fparkan-game/src/mission_overlay.rs @@ -3,6 +3,7 @@ use super::{ cockpit_dial::CockpitDial, cockpit_radar_hud::CockpitRadarHud, cockpit_reticle::CockpitReticle, + cockpit_status_hud::CockpitStatusHud, factory_menu::FactoryProjectPanel, horizontal_fov, quad_indices, satellite_map::SatelliteMap, @@ -27,6 +28,7 @@ use super::{ use fparkan_assets::RgbaImage; use fparkan_runtime::{ cockpit_altimeter::cockpit_altimeter, + cockpit_indicators::cockpit_indicators, cockpit_speedometer::cockpit_speedometer, radar::{cockpit_radar_period, cockpit_range_readout}, AutoDemoCamera, Engine, StartingCockpit, @@ -51,6 +53,7 @@ pub(super) struct MissionOverlay { #[cfg(windows)] strategic_tooltip: Option, dial: Option, + cockpit_status: Option, reticle: Option, #[cfg(windows)] pub(super) instrument: Option, @@ -94,6 +97,11 @@ impl MissionOverlay { None }) }); + let cockpit_status = cockpit.and_then(|_| { + CockpitStatusHud::load(root, preview) + .inspect_err(|error| eprintln!("cockpit_status_unavailable reason={error}")) + .ok() + }); let reticle = cockpit.and_then(|_| { CockpitReticle::load(root, preview) .inspect_err(|error| eprintln!("cockpit_reticle_unavailable reason={error}")) @@ -219,6 +227,7 @@ impl MissionOverlay { #[cfg(windows)] strategic_tooltip, dial, + cockpit_status, reticle, #[cfg(windows)] instrument, @@ -233,6 +242,12 @@ impl MissionOverlay { } } + pub(super) fn note_exit_result(&mut self, clock_ms: u32, rejected: bool) { + if let Some(status) = &mut self.cockpit_status { + status.note_exit_result(clock_ms, rejected); + } + } + pub(super) fn remove_world_ranges( &self, ranges: &mut Vec, @@ -268,6 +283,11 @@ impl MissionOverlay { remove(range, ranges, counts); } } + if let Some(status) = &self.cockpit_status { + for range in status.ranges() { + remove(range, ranges, counts); + } + } #[cfg(windows)] if let Some(balance) = &self.strategy_balance { remove(balance.range_index(), ranges, counts); @@ -537,6 +557,10 @@ impl StaticVulkanApp { speed, )?; } + if let Some(status) = &self.overlay.cockpit_status { + let state = occupant.and_then(|(engine, cockpit)| cockpit_indicators(engine, cockpit)); + status.draw(renderer, &mut self.mesh, state, frame.clock.time_ms)?; + } if let Some(radar) = &mut self.overlay.radar { let period = occupant.and_then(|(engine, cockpit)| cockpit_radar_period(engine, cockpit)); -- cgit v1.2.3