diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 00:04:24 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 00:04:24 +0300 |
| commit | 752d34af83acf9a818e22c621fb034913079acff (patch) | |
| tree | 65b0f47859be8f8a33b8e37fecad81cfd660739c /apps/fparkan-game/src/mission_overlay.rs | |
| parent | 029297446ec0b235602b4f4d9197786a3466a6fe (diff) | |
| download | fparkan-752d34af83acf9a818e22c621fb034913079acff.tar.xz fparkan-752d34af83acf9a818e22c621fb034913079acff.zip | |
feat(ui): plot local detections on the cockpit radar
Draw each current detection from the occupied unit sensor in camera-relative coordinates, with the original range scale, clan color and screen-pixel marks. Check stock Two Fortresses before and after a free-look turn and exercise the native rectangle and line callbacks.
Diffstat (limited to 'apps/fparkan-game/src/mission_overlay.rs')
| -rw-r--r-- | apps/fparkan-game/src/mission_overlay.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/fparkan-game/src/mission_overlay.rs b/apps/fparkan-game/src/mission_overlay.rs index fb669e8d..66c0f837 100644 --- a/apps/fparkan-game/src/mission_overlay.rs +++ b/apps/fparkan-game/src/mission_overlay.rs @@ -1,6 +1,6 @@ use super::{ - altimeter_hud::AltimeterHud, course_hud::CourseHud, horizontal_fov, - satellite_map::SatelliteMap, StaticPreviewScene, StaticVulkanApp, + altimeter_hud::AltimeterHud, cockpit_radar_hud::CockpitRadarHud, course_hud::CourseHud, + horizontal_fov, satellite_map::SatelliteMap, StaticPreviewScene, StaticVulkanApp, }; #[cfg(windows)] use super::{mission_hints::MissionHints, weapon_hud::WeaponHud}; @@ -28,6 +28,7 @@ pub(super) struct MissionOverlay { pub(super) satellite_map: Option<SatelliteMap>, course: Option<CourseHud>, altimeter: Option<AltimeterHud>, + pub(super) radar: Option<CockpitRadarHud>, #[cfg(windows)] pub(super) hints: Option<MissionHints>, #[cfg(windows)] @@ -62,6 +63,14 @@ impl MissionOverlay { None }) }); + let radar = cockpit.and_then(|_| { + CockpitRadarHud::load(preview) + .map(Some) + .unwrap_or_else(|error| { + eprintln!("cockpit_radar_unavailable reason={error}"); + None + }) + }); #[cfg(windows)] let hints = MissionHints::load(root, mission, preview) .map(Some) @@ -87,6 +96,7 @@ impl MissionOverlay { satellite_map, course, altimeter, + radar, #[cfg(windows)] hints, #[cfg(windows)] @@ -113,6 +123,9 @@ impl MissionOverlay { if let Some(altimeter) = &self.altimeter { remove(altimeter.range_index(), ranges, counts); } + if let Some(radar) = &self.radar { + remove(radar.range_index, ranges, counts); + } if let Some(course) = &self.course { for range in course.ranges() { remove(range, ranges, counts); |
