From 0e1317235e7db3fa1b20dac2a4f12565a31e8cd0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 09:52:38 +0400 Subject: feat(ui): enter strategic view from a command post --- apps/fparkan-game/src/satellite_map.rs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'apps/fparkan-game/src/satellite_map.rs') 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, units: Vec, 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)>, - 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(()) } -- cgit v1.2.3