From 733f9d92e0d4e40ed40db42fa6cd11294e49eb7b Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 12:12:06 +0400 Subject: 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. --- crates/fparkan-runtime/src/strategic_orders.rs | 37 ++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'crates/fparkan-runtime/src') diff --git a/crates/fparkan-runtime/src/strategic_orders.rs b/crates/fparkan-runtime/src/strategic_orders.rs index 9e364786..2c40c31f 100644 --- a/crates/fparkan-runtime/src/strategic_orders.rs +++ b/crates/fparkan-runtime/src/strategic_orders.rs @@ -1,7 +1,36 @@ //! Orders issued by the player from the strategic warbot panel. use crate::{strategic_roster::warbot_rows, unit_patrol::UnitPatrol, Engine, StartingCockpit}; -use fparkan_world::ObjectHandle; +use fparkan_terrain::NavigationQuery; +use fparkan_world::{identity_metadata, ObjectHandle}; + +/// Tests a route waypoint using the selected warbot's chassis and the native areal flag. +pub fn accepts_waypoint(engine: &Engine, actor: ObjectHandle, [x, y]: [f32; 2]) -> bool { + if !x.is_finite() || !y.is_finite() { + return false; + } + let Some(mission) = &engine.loaded else { + return false; + }; + let Some(original) = identity_metadata(&engine.world, actor) + .ok() + .and_then(|meta| meta.original_id) + else { + return false; + }; + let terrain = &mission.terrain; + let Some(areal) = terrain.locate_areal([x, y, 0.0]).ok().flatten() else { + return false; + }; + // iron3d+0x76bc0 allows chassis selector 1 in any resolved areal. + mission + .unit_chassis_flags + .get(&original.0) + .is_some_and(|flags| flags.chassis_type == Some(1)) + || terrain + .areal_logic_flag(areal) + .is_some_and(|flag| flag != 0) +} /// Stops the selected warbot and clears its outstanding movement orders. pub fn stand(engine: &mut Engine, cockpit: StartingCockpit, actor: ObjectHandle) -> bool { @@ -15,7 +44,11 @@ pub fn follow_route( actor: ObjectHandle, points: &[[f32; 2]], ) -> bool { - if points.is_empty() || !points.iter().flatten().all(|value| value.is_finite()) { + if points.is_empty() + || !points + .iter() + .all(|&point| accepts_waypoint(engine, actor, point)) + { return false; } issue(engine, cockpit, actor, Some(points.to_vec())) -- cgit v1.2.3