diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 16:09:19 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 16:09:19 +0300 |
| commit | faeb22084ea59194036785d84b68396981dfcbae (patch) | |
| tree | f68bb63e8ddef18e363d4c507cd87ed226e006e0 /apps/fparkan-game/src/strategic_tooltip_hud.rs | |
| parent | 2918dbe5c591ab6b1d4a76512b7fc8f258997558 (diff) | |
| download | fparkan-faeb22084ea59194036785d84b68396981dfcbae.tar.xz fparkan-faeb22084ea59194036785d84b68396981dfcbae.zip | |
feat(ui): inspect the current factory project
Diffstat (limited to 'apps/fparkan-game/src/strategic_tooltip_hud.rs')
| -rw-r--r-- | apps/fparkan-game/src/strategic_tooltip_hud.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/fparkan-game/src/strategic_tooltip_hud.rs b/apps/fparkan-game/src/strategic_tooltip_hud.rs index 2572ad61..0e8ee3af 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_factory, strategic_roster::{hit_test, CockpitControl, ListHit}, strategy_toolbar::{button_index_at, ToolbarLayout, TOOLTIP_IDS}, ui_tooltip::{self, TooltipHover}, @@ -14,7 +15,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 LABEL_COUNT: usize = TOOLTIP_IDS.len() + CARD_LABELS.len(); +const FACTORY_OFFSET: usize = TOOLTIP_IDS.len() + CARD_LABELS.len(); +const LABEL_COUNT: usize = FACTORY_OFFSET + strategic_factory::TOOLTIP_IDS.len(); #[derive(Clone, Copy, Default)] struct Frame { @@ -35,6 +37,7 @@ impl StrategicTooltipHud { let labels = TOOLTIP_IDS .into_iter() .chain(CARD_LABELS) + .chain(strategic_factory::TOOLTIP_IDS) .map(|id| { strings .get(id) @@ -98,12 +101,19 @@ impl StrategicTooltipHud { pointer: Option<[f32; 2]>, toolbar_layout: Option<ToolbarLayout>, card_rows: usize, + factory_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 label = toolbar_label.or_else(|| { + let factory_label = factory_tip.and_then(|id| { + strategic_factory::TOOLTIP_IDS + .iter() + .position(|&known| id == known) + .map(|index| FACTORY_OFFSET + index) + }); + let label = toolbar_label.or(factory_label).or_else(|| { let card = match hit_test(xy, card_rows)? { ListHit::Cockpit(CockpitControl::Manual) => 0, ListHit::Cockpit(CockpitControl::AutoGunner) => 1, |
