aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/strategic_tooltip_hud.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 18:05:52 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 18:05:52 +0300
commit9f442fa339371869dda44a32a9e0ec2f763d830c (patch)
treebec91edfe30d42a278502561af155c11a32de764 /apps/fparkan-game/src/strategic_tooltip_hud.rs
parent3b5a8aa4e6465ca56763cb96b4100bb1ff1c0ccf (diff)
downloadfparkan-9f442fa339371869dda44a32a9e0ec2f763d830c.tar.xz
fparkan-9f442fa339371869dda44a32a9e0ec2f763d830c.zip
feat(ui): connect the bunker list to the strategic camera
Show clan bunkers with the original compound controls and map selection. The strategic command button switches the camera anchor and preserves a view already bound to that bunker. Check the stock Two Fortresses window with Vulkan validation and exercise retargeting and the ownership guard with the licensed runtime test.
Diffstat (limited to 'apps/fparkan-game/src/strategic_tooltip_hud.rs')
-rw-r--r--apps/fparkan-game/src/strategic_tooltip_hud.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/fparkan-game/src/strategic_tooltip_hud.rs b/apps/fparkan-game/src/strategic_tooltip_hud.rs
index 0e8ee3af..812c6e06 100644
--- a/apps/fparkan-game/src/strategic_tooltip_hud.rs
+++ b/apps/fparkan-game/src/strategic_tooltip_hud.rs
@@ -4,6 +4,7 @@ use super::{
};
use fparkan_assets::{
game_font::{load_tool_font, TOOL_FONT_EXTENTS},
+ strategic_buildings::COMMAND_TOOLTIP,
strategic_factory,
strategic_roster::{hit_test, CockpitControl, ListHit},
strategy_toolbar::{button_index_at, ToolbarLayout, TOOLTIP_IDS},
@@ -16,7 +17,8 @@ use std::{path::Path, time::Instant};
// In the order in which iron3d+0x82930 assigns the original texts to the buttons.
const CARD_LABELS: [u32; 4] = [0x05de, 0x05ef, 0x05ee, 0x1864];
const FACTORY_OFFSET: usize = TOOLTIP_IDS.len() + CARD_LABELS.len();
-const LABEL_COUNT: usize = FACTORY_OFFSET + strategic_factory::TOOLTIP_IDS.len();
+const BUNKER_OFFSET: usize = FACTORY_OFFSET + strategic_factory::TOOLTIP_IDS.len();
+const LABEL_COUNT: usize = BUNKER_OFFSET + 1;
#[derive(Clone, Copy, Default)]
struct Frame {
@@ -38,6 +40,7 @@ impl StrategicTooltipHud {
.into_iter()
.chain(CARD_LABELS)
.chain(strategic_factory::TOOLTIP_IDS)
+ .chain([COMMAND_TOOLTIP])
.map(|id| {
strings
.get(id)
@@ -101,19 +104,20 @@ impl StrategicTooltipHud {
pointer: Option<[f32; 2]>,
toolbar_layout: Option<ToolbarLayout>,
card_rows: usize,
- factory_tip: Option<u32>,
+ panel_tip: Option<u32>,
) -> Result<(), String> {
let tooltip = pointer.and_then(|xy| {
let toolbar_label = toolbar_layout
.filter(|layout| layout.button_visible(xy[1]))
.and_then(|_| button_index_at(xy));
- let factory_label = factory_tip.and_then(|id| {
+ let panel_label = panel_tip.and_then(|id| {
strategic_factory::TOOLTIP_IDS
.iter()
.position(|&known| id == known)
.map(|index| FACTORY_OFFSET + index)
+ .or_else(|| (id == COMMAND_TOOLTIP).then_some(BUNKER_OFFSET))
});
- let label = toolbar_label.or(factory_label).or_else(|| {
+ let label = toolbar_label.or(panel_label).or_else(|| {
let card = match hit_test(xy, card_rows)? {
ListHit::Cockpit(CockpitControl::Manual) => 0,
ListHit::Cockpit(CockpitControl::AutoGunner) => 1,