aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-msh/src
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 11:16:16 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 11:16:16 +0300
commitdfbdef7d4d1d295ee962dd8aab754ce6be902f8d (patch)
tree9c9f2b6fd6f9519ee05868df3f0d950e00318c24 /crates/fparkan-msh/src
parenta519d5efefb4d846a9f65c6b9376fa245215a0f6 (diff)
downloadfparkan-dfbdef7d4d1d295ee962dd8aab754ce6be902f8d.tar.xz
fparkan-dfbdef7d4d1d295ee962dd8aab754ce6be902f8d.zip
fix(ai): follow capture passages through building doors
A stock Two Fortresses run now takes the generator after the capturer descends its authored hallway. Symmetric Res17 door links drive the CTLD animation and unsupported routes retain explicit coverage. Checked the approach and descent in the game window with Vulkan validation and verified the owner transfer in a licensed test.
Diffstat (limited to 'crates/fparkan-msh/src')
-rw-r--r--crates/fparkan-msh/src/hallway.rs27
-rw-r--r--crates/fparkan-msh/src/lib.rs2
2 files changed, 24 insertions, 5 deletions
diff --git a/crates/fparkan-msh/src/hallway.rs b/crates/fparkan-msh/src/hallway.rs
index d0d646d8..5145c3df 100644
--- a/crates/fparkan-msh/src/hallway.rs
+++ b/crates/fparkan-msh/src/hallway.rs
@@ -5,8 +5,17 @@ use crate::{read_f32, read_u32, MshError, NodeId, RawStream};
pub struct Hallway {
/// Points in native selection order.
pub points: Vec<HallwayPoint>,
- /// Start and end point indexes for each authored link.
- pub links: Vec<[u32; 2]>,
+ /// Authored links between passage points.
+ pub links: Vec<HallwayLink>,
+}
+
+/// A passage connection and its four directional access pairs.
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub struct HallwayLink {
+ /// Start and end point indexes.
+ pub endpoints: [u32; 2],
+ /// Raw pairs of device key and state mask.
+ pub access: [[u32; 2]; 4],
}
/// A navigation point attached to a mesh node.
@@ -48,7 +57,16 @@ pub(super) fn parse(stream: &RawStream) -> Result<Hallway, MshError> {
.collect::<Result<_, MshError>>()?;
let links = link_bytes
.chunks_exact(LINK_BYTES)
- .map(|link| Ok([read_u32(link, 0)?, read_u32(link, 4)?]))
+ .map(|link| {
+ let mut access = [[0; 2]; 4];
+ for (i, pair) in access.iter_mut().enumerate() {
+ *pair = [read_u32(link, 8 + i * 8)?, read_u32(link, 12 + i * 8)?];
+ }
+ Ok(HallwayLink {
+ endpoints: [read_u32(link, 0)?, read_u32(link, 4)?],
+ access,
+ })
+ })
.collect::<Result<_, MshError>>()?;
Ok(Hallway { points, links })
}
@@ -124,7 +142,8 @@ mod tests {
node: NodeId(4),
}
);
- assert_eq!(hallway.links, [[1, 0]]);
+ assert_eq!(hallway.links[0].endpoints, [1, 0]);
+ assert_eq!(hallway.links[0].access, [[0; 2]; 4]);
assert_eq!(hallway.hero_exits(5).unwrap(), [(NodeId(2), [0.0; 3])]);
}
}
diff --git a/crates/fparkan-msh/src/lib.rs b/crates/fparkan-msh/src/lib.rs
index 7a388e3d..016998e3 100644
--- a/crates/fparkan-msh/src/lib.rs
+++ b/crates/fparkan-msh/src/lib.rs
@@ -9,7 +9,7 @@ use fparkan_animation::{
use fparkan_nres::{EntryMeta, NresDocument, NresError};
mod hallway;
-pub use hallway::{Hallway, HallwayPoint};
+pub use hallway::{Hallway, HallwayLink, HallwayPoint};
/// Node table stream.
pub const STREAM_NODE_TABLE: u32 = 1;