diff --git a/crates/asset_game/src/menu_catalog.rs b/crates/asset_game/src/menu_catalog.rs index 6b513ef..6b3dfb3 100644 --- a/crates/asset_game/src/menu_catalog.rs +++ b/crates/asset_game/src/menu_catalog.rs @@ -552,6 +552,23 @@ pub const HUD_CHROME_MENUS: &[&str] = &[ "perks_info_hd", ]; +fn cover_wide_hud_overlays(catalog: &mut MenuCatalog) { + for name in HUD_CHROME_MENUS { + let Some(menu) = catalog.menus.get_mut(*name) else { + continue; + }; + for item in &mut menu.items { + let rect = &item.rect; + if !item.background.is_empty() + && (rect.x, rect.y, rect.w, rect.h) == (-427.0, -240.0, 854.0, 480.0) + && (rect.horz_align, rect.vert_align) == (2, 2) + { + item.cover = true; + } + } + } +} + pub fn ui_games_root(games: &GamesRoot) -> Result { let anchor = find_zone_file(games, "iw4:common_mp")?; game_root_for_zone(&anchor.path).map(GamesRoot) @@ -1025,6 +1042,7 @@ impl MenuSink { fn finish_and_take(mut self, games: Option<&Path>) -> MenuCatalog { self.finish_ui_images(games); + cover_wide_hud_overlays(&mut self.catalog); self.catalog } diff --git a/crates/hud/src/chrome.rs b/crates/hud/src/chrome.rs index 9e8090e..f1b6cf8 100644 --- a/crates/hud/src/chrome.rs +++ b/crates/hud/src/chrome.rs @@ -948,10 +948,12 @@ fn push_stretch( ); if rest.w > f32::EPSILON && rest.w < surface.width() { let grow = surface.width() / rest.w; - let centre = applied.x + applied.w * 0.5; + let centre_x = applied.x + applied.w * 0.5; + let centre_y = applied.y + applied.h * 0.5; applied.w *= grow; applied.h *= grow; - applied.x = centre - applied.w * 0.5; + applied.x = centre_x - applied.w * 0.5; + applied.y = centre_y - applied.h * 0.5; } } let color = style.fill_color(item);