diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 11:12:06 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 11:12:06 +0300 |
| commit | 733f9d92e0d4e40ed40db42fa6cd11294e49eb7b (patch) | |
| tree | 824dde369c5fbb7b3180c42899c4f0555929ca4b /crates/fparkan-runtime/src | |
| parent | 61208d874cb3d9bf93e9f7c60aceebc287454b62 (diff) | |
| download | fparkan-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-runtime/src')
| -rw-r--r-- | crates/fparkan-runtime/src/strategic_orders.rs | 37 |
1 files changed, 35 insertions, 2 deletions
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())) |
