diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 08:52:38 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 08:52:38 +0300 |
| commit | 0e1317235e7db3fa1b20dac2a4f12565a31e8cd0 (patch) | |
| tree | f0be6ba752084f58fd30c658810ae3c3db439f15 /apps/fparkan-game/src/satellite_map.rs | |
| parent | 9f360911f4af29307b566c0acacf1f5661ea9970 (diff) | |
| download | fparkan-0e1317235e7db3fa1b20dac2a4f12565a31e8cd0.tar.xz fparkan-0e1317235e7db3fa1b20dac2a4f12565a31e8cd0.zip | |
feat(ui): enter strategic view from a command post
Diffstat (limited to 'apps/fparkan-game/src/satellite_map.rs')
| -rw-r--r-- | apps/fparkan-game/src/satellite_map.rs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/apps/fparkan-game/src/satellite_map.rs b/apps/fparkan-game/src/satellite_map.rs index d2a240eb..032ce555 100644 --- a/apps/fparkan-game/src/satellite_map.rs +++ b/apps/fparkan-game/src/satellite_map.rs @@ -1,6 +1,6 @@ use super::{ mission_overlay::{add_overlay_sprite, overlay_texture}, - EnvironmentGpuRange, StaticPreviewScene, VulkanSmokeRenderer, + EnvironmentGpuRange, StaticPreviewScene, VulkanSmokeRenderer, VulkanStaticMesh, }; use fparkan_assets::{ satellite_map::{load_satellite_map, MAP_INSET, MAP_RECT}, @@ -15,6 +15,8 @@ use std::{path::Path, sync::Arc}; const MAP_TINT: [f32; 3] = [55.0 / 255.0, 1.0, 55.0 / 255.0]; const MAP_ALPHA: f32 = 128.0 / 255.0; const MAP_SIZE: usize = 256; +// iron3d+0x733e0 gives the mode-2 map its own frame, below the command readouts. +const COMMAND_FRAME_SHIFT: f32 = 63.0 * (2.0 / 480.0); pub(super) struct SatelliteMap { frame: EnvironmentGpuRange, @@ -26,6 +28,7 @@ pub(super) struct SatelliteMap { buildings: Vec<satellite_contacts::BuildingContact>, units: Vec<satellite_contacts::UnitContact>, visible: bool, + command_layout: bool, } impl SatelliteMap { @@ -59,6 +62,7 @@ impl SatelliteMap { buildings: Vec::new(), units: Vec::new(), visible: false, + command_layout: false, })) } @@ -78,10 +82,12 @@ impl SatelliteMap { pub(super) fn draw( &mut self, renderer: &mut VulkanSmokeRenderer, + mesh: &mut VulkanStaticMesh, player: Option<(&Engine, StartingCockpit, Option<ObjectHandle>)>, - strategy: bool, + automatic: bool, + command_layout: bool, ) -> Result<(), String> { - let visible = self.visible || strategy; + let visible = self.visible || automatic; let count = if visible { 6 } else { 0 }; for index in self.ranges() { renderer @@ -91,6 +97,25 @@ impl SatelliteMap { if !visible { return Ok(()); } + if self.command_layout != command_layout { + self.command_layout = command_layout; + let shift = if command_layout { + COMMAND_FRAME_SHIFT + } else { + -COMMAND_FRAME_SHIFT + }; + for range in [ + self.frame, + self.background, + self.compass, + self.contact_layer, + ] { + let start = range.vertex_start; + for vertex in &mut mesh.vertices[start..start + 4] { + vertex.position[1] += shift; + } + } + } self.update_contacts(renderer, player)?; Ok(()) } |
