diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-01 21:32:55 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-01 21:32:55 +0300 |
| commit | b48fb2caccc7a72b85f07e6ab652081af57c7855 (patch) | |
| tree | 851858e8881e9c0ba1892b1173212092b53ff86c /apps | |
| parent | 6954eb74b535341bed234091e67f62ed13266c25 (diff) | |
| download | fparkan-b48fb2caccc7a72b85f07e6ab652081af57c7855.tar.xz fparkan-b48fb2caccc7a72b85f07e6ab652081af57c7855.zip | |
feat(ui): render mission hints with the original game font
Resolve the witnessed 800x600 GAME_FONT through the installed resource configuration. Draw CP1251 bytes from the Tfnt atlas using the original variable-width metrics. Checked the original measurement routine and the first Constructor hint in the game window.
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/fparkan-game/src/mission_hints.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/fparkan-game/src/mission_hints.rs b/apps/fparkan-game/src/mission_hints.rs index 9e6e2055..3ec9c440 100644 --- a/apps/fparkan-game/src/mission_hints.rs +++ b/apps/fparkan-game/src/mission_hints.rs @@ -4,6 +4,7 @@ use super::{ EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, StaticPreviewScene, Vfs, VulkanSmokeRenderer, VulkanStaticMesh, VulkanStaticTexture, }; +use fparkan_assets::game_font::{load_game_font, BitmapFont}; use fparkan_path::{normalize_relative, PathPolicy}; use fparkan_platform_winit::text::{caption, StringResources}; use fparkan_runtime::MissionScriptOutcome; @@ -48,6 +49,7 @@ struct MessageResources { catalog: Arc<[u8]>, strings: StringResources, sender_strings: Option<StringResources>, + font: BitmapFont, } impl MissionHints { @@ -163,7 +165,12 @@ impl MissionHints { self.active = None; if pager_visible(message.posted_ms, clock) { let index = message.index; - let (height, rgba) = match caption(&message.body, WIDTH, HEIGHT) { + let font = &self + .messages + .as_ref() + .expect("posted message resources") + .font; + let (height, rgba) = match font.caption(&message.body, WIDTH, HEIGHT) { Ok(caption) => caption, Err(error) => { eprintln!( @@ -266,6 +273,7 @@ impl MessageResources { catalog, strings, sender_strings, + font: load_game_font(&vfs)?, })) } } |
