aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/main.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 21:20:20 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 21:20:20 +0300
commit6954eb74b535341bed234091e67f62ed13266c25 (patch)
treee44b9869785dd8c11ad6772eda0b3ab12ade85b4 /apps/fparkan-game/src/main.rs
parent501779c19f5a86f0035683840f176d371abafc27 (diff)
downloadfparkan-6954eb74b535341bed234091e67f62ed13266c25.tar.xz
fparkan-6954eb74b535341bed234091e67f62ed13266c25.zip
feat(ui): open the authored mission satellite map
Read the minimap archive binding from mission.cfg and resolve the compass through the original UI atlas key and crop. M toggles the overlay and Ctrl+M retains the current mine command. Checked show/hide in the Constructor window and the original DLL.
Diffstat (limited to 'apps/fparkan-game/src/main.rs')
-rw-r--r--apps/fparkan-game/src/main.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs
index cd6ce717..328aff46 100644
--- a/apps/fparkan-game/src/main.rs
+++ b/apps/fparkan-game/src/main.rs
@@ -20,6 +20,7 @@ mod mission_notices;
mod mission_pause;
mod motion_effects;
mod player_collision;
+mod satellite_map;
#[cfg(test)]
use fparkan_runtime::query_building_segment_world;
#[cfg(test)]
@@ -9592,6 +9593,14 @@ fn run_static_vulkan_mode(
} else {
None
};
+ let satellite_map = if mission_engine.is_some() && demo_camera.is_none() {
+ satellite_map::SatelliteMap::load(root, mission, &mut preview).unwrap_or_else(|error| {
+ eprintln!("satellite_map_unavailable mission={mission} reason={error}");
+ None
+ })
+ } else {
+ None
+ };
let cockpit_geometry = mission_engine
.as_ref()
.map(|engine| cockpit_geometry::CockpitGeometry::prepare(engine, &mut preview))
@@ -9631,6 +9640,13 @@ fn run_static_vulkan_mode(
.retain(|index| app.world_range_index_counts.contains_key(index));
}
app.shield_effects = shield_effects;
+ if let Some(map) = &satellite_map {
+ for range in map.ranges() {
+ app.world_range_indices.retain(|&index| index != range);
+ app.world_range_index_counts.remove(&range);
+ }
+ }
+ app.satellite_map = satellite_map;
#[cfg(windows)]
{
if let Some(hints) = &mission_hints {
@@ -9864,6 +9880,7 @@ struct StaticVulkanApp {
mission_title: String,
#[cfg(windows)]
mission_hints: Option<mission_hints::MissionHints>,
+ satellite_map: Option<satellite_map::SatelliteMap>,
audio: Option<audio::GameAudio>,
camera_mode: &'static str,
mesh_components: usize,
@@ -10034,6 +10051,7 @@ impl StaticVulkanApp {
mission_title: String::new(),
#[cfg(windows)]
mission_hints: None,
+ satellite_map: None,
audio,
camera_mode: preview.camera_mode,
mesh_components: preview.mesh_components,
@@ -11648,6 +11666,9 @@ impl StaticVulkanApp {
let Some(renderer) = self.renderer.as_mut() else {
return Ok(());
};
+ if let Some(map) = &self.satellite_map {
+ map.draw(renderer, &mut self.mesh, frame.viewport)?;
+ }
#[cfg(windows)]
if let Some(hints) = &mut self.mission_hints {
hints.draw(
@@ -12453,7 +12474,13 @@ impl ApplicationHandler for StaticVulkanApp {
self.player_service_pressed = true;
}
if self.demo_camera.is_none() && code == KeyCode::KeyM {
- self.player_mine_pressed = true;
+ if self.pressed_keys.contains(&KeyCode::ControlLeft)
+ || self.pressed_keys.contains(&KeyCode::ControlRight)
+ {
+ self.player_mine_pressed = true;
+ } else if let Some(map) = &mut self.satellite_map {
+ map.toggle();
+ }
}
if let Some(slot) = [
KeyCode::Digit0,