diff options
Diffstat (limited to 'apps/fparkan-game/src/strategic_tooltip_hud.rs')
| -rw-r--r-- | apps/fparkan-game/src/strategic_tooltip_hud.rs | 12 |
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, |
