aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-assets/src/satellite_map_chrome.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 17:50:37 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 17:50:37 +0300
commit3b5a8aa4e6465ca56763cb96b4100bb1ff1c0ccf (patch)
tree7ccd3b6b20a2211d3c2f72f0707f2d28f9faaf2c /crates/fparkan-assets/src/satellite_map_chrome.rs
parentbd7811533a348e56d2be9c7281d0533fc8c46024 (diff)
downloadfparkan-3b5a8aa4e6465ca56763cb96b4100bb1ff1c0ccf.tar.xz
fparkan-3b5a8aa4e6465ca56763cb96b4100bb1ff1c0ccf.zip
feat(ui): link the other buildings panel to the satellite map
Use the installed compound controls, font, and class glyphs for live clan buildings and their durability. Compare the stock Two Fortresses list order, first selection, two-way map selection, and close behavior in the original and in FParkan with Vulkan validation.
Diffstat (limited to 'crates/fparkan-assets/src/satellite_map_chrome.rs')
-rw-r--r--crates/fparkan-assets/src/satellite_map_chrome.rs40
1 files changed, 27 insertions, 13 deletions
diff --git a/crates/fparkan-assets/src/satellite_map_chrome.rs b/crates/fparkan-assets/src/satellite_map_chrome.rs
index 30b41e06..5ae81bea 100644
--- a/crates/fparkan-assets/src/satellite_map_chrome.rs
+++ b/crates/fparkan-assets/src/satellite_map_chrome.rs
@@ -172,9 +172,7 @@ impl MapChrome {
(false, 2) => [255, 128, 128],
(false, 3) => [128, 255, 128],
(false, 4) => [128, 128, 255],
- (true, 2) => [255, 0, 0],
- (true, 3) => [0, 255, 0],
- (true, 4 | 5) => [0, 0, 255],
+ (true, size) => building_glyph_tint(size),
_ => [255; 3],
};
let atlas = if contact.class == 0x8000_0200 {
@@ -186,16 +184,7 @@ impl MapChrome {
0x0100_2000 => Some([81, 110]),
0x0100_4000 => Some([65, 110]),
0x0100_8000 | 0x0101_0000 | 0x0102_0000 => Some([49, 110]),
- 0x8000_0002 => Some([113, 126]),
- 0x8000_0004 => Some([129, 126]),
- 0x8000_0008 => Some([81, 110]),
- 0x8000_0010 => Some([129, 94]),
- 0x8000_0040 => Some([97, 126]),
- 0x8000_0200 => Some([148, 27]),
- 0x8000_0400 => Some([49, 126]),
- 0x8001_0000 | 0x8002_0000 | 0x8004_0000 => Some([65, 126]),
- 0x8010_0000 | 0x8020_0000 => Some([81, 126]),
- _ => None,
+ class => building_glyph(class),
};
if let Some(glyph) = class.and_then(|[x, y]| atlas_region(atlas, [x, y, 15, 15])) {
stamp(image, &glyph, [26, 2, 41, 17], tint);
@@ -215,6 +204,31 @@ impl MapChrome {
}
}
+// The list and map readout both call iron3d+0x346a0 for building glyphs.
+pub(crate) fn building_glyph(class: u32) -> Option<[u32; 2]> {
+ Some(match class {
+ 0x8000_0002 => [113, 126],
+ 0x8000_0004 => [129, 126],
+ 0x8000_0008 => [81, 110],
+ 0x8000_0010 => [129, 94],
+ 0x8000_0040 => [97, 126],
+ 0x8000_0200 => [148, 27],
+ 0x8000_0400 => [49, 126],
+ 0x8001_0000 | 0x8002_0000 | 0x8004_0000 => [65, 126],
+ 0x8010_0000 | 0x8020_0000 => [81, 126],
+ _ => return None,
+ })
+}
+
+pub(crate) fn building_glyph_tint(size: u32) -> [u8; 3] {
+ match size {
+ 2 => [255, 0, 0],
+ 3 => [0, 255, 0],
+ 4 | 5 => [0, 0, 255],
+ _ => [255; 3],
+ }
+}
+
fn empty_strip() -> RgbaImage {
RgbaImage {
width: WIDTH,