aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-terrain
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 11:12:06 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 11:12:06 +0300
commit733f9d92e0d4e40ed40db42fa6cd11294e49eb7b (patch)
tree824dde369c5fbb7b3180c42899c4f0555929ca4b /crates/fparkan-terrain
parent61208d874cb3d9bf93e9f7c60aceebc287454b62 (diff)
downloadfparkan-733f9d92e0d4e40ed40db42fa6cd11294e49eb7b.tar.xz
fparkan-733f9d92e0d4e40ed40db42fa6cd11294e49eb7b.zip
feat(ui): show native strategic waypoint cursors
Read the animated cursor strips and their hotspots from the installed UI atlas. Use the native Land.map areal flag and chassis selector for both the preview cursor and waypoint input. In stock Two Fortresses, compared one accepted and one rejected map point against the original and checked the return to the cockpit with Vulkan validation.
Diffstat (limited to 'crates/fparkan-terrain')
-rw-r--r--crates/fparkan-terrain/src/lib.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/fparkan-terrain/src/lib.rs b/crates/fparkan-terrain/src/lib.rs
index 7e2ae588..659acf86 100644
--- a/crates/fparkan-terrain/src/lib.rs
+++ b/crates/fparkan-terrain/src/lib.rs
@@ -251,6 +251,7 @@ impl TerrainWorld {
);
areals.push(RuntimeAreal {
id,
+ logic_flag: areal.logic_flag,
polygon: areal
.vertices
.iter()
@@ -427,6 +428,12 @@ impl TerrainWorld {
self.areals.len()
}
+ /// Logic flag from the prefix of this logical area in `Land.map`.
+ #[must_use]
+ pub fn areal_logic_flag(&self, id: ArealId) -> Option<u32> {
+ self.areals.get(id.0 as usize).map(|areal| areal.logic_flag)
+ }
+
/// Returns the midpoint of the boundary edge linking two consecutive areas.
/// Links through polygon slots have no boundary midpoint.
#[must_use]
@@ -974,6 +981,7 @@ impl RuntimeTriangle {
#[derive(Clone, Debug)]
struct RuntimeAreal {
id: ArealId,
+ logic_flag: u32,
polygon: Vec<[f32; 2]>,
edge_neighbors: Vec<Option<u32>>,
}
@@ -1280,10 +1288,15 @@ mod tests {
#[test]
fn locates_areal_and_routes_synthetic_neighbors() {
- let map = synthetic_land_map();
+ let mut map = synthetic_land_map();
+ map.areals[0].logic_flag = 0;
+ map.areals[1].logic_flag = 1;
let world = TerrainWorld::from_land_map(&map).expect("world");
assert_eq!(world.areal_count(), 2);
+ assert_eq!(world.areal_logic_flag(ArealId(0)), Some(0));
+ assert_eq!(world.areal_logic_flag(ArealId(1)), Some(1));
+ assert_eq!(world.areal_logic_flag(ArealId(2)), None);
assert_eq!(
world.route_crossing(ArealId(0), ArealId(1)),
Some([1.0, 0.5])