// SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include #include #include #include "formats/vga.hpp" #include "formats/textd.hpp" #include "formats/font.hpp" #include "formats/le.hpp" #include "game/highscore.hpp" namespace bmh::ui { // EXE-backed Source word/hyphen wrapping, exposed for deterministic presenter // checks and reuse by text-only UI code. std::vector wrap_source_text(const std::filesystem::path& data, std::string_view text, int max_width); // RealityReporterPanel2/RealityReporterPanel3: full overflow rows may use flag2 (blocksatz); the final // flush is never justified. Text and returned rows use Original bytes. std::vector wrap_source_text(const Font&, const LeImage&, std::string_view text, int max_width, bool justify = false); struct GameEndRenderOptions { bool plain_background = false; // Original PlainBackground, not its inverse bool gradient_text = true; // TextGradientDisabled==0 && BMH.exe[TextGradientMode]==2 }; // Rendering-only projection. Names retain the Source ISO646-DE bytes; values and order have // already been resolved by the caller. No career state is mutated here. class GameEndHighscoreScreen { public: GameEndHighscoreScreen(const std::filesystem::path& data, HighscoreProjection projection, GameEndRenderOptions options = {}); Image render() const; private: HighscoreProjection projection_; GameEndRenderOptions options_; Image background_, logo_; TextDb texts_; struct FontData; std::shared_ptr font_; }; // Source's two end-of-career messages; drawing only, with acknowledgement owned // by the application loop (the Original then waits and exits the process). class GameEndFinalScreen { public: explicit GameEndFinalScreen(const std::filesystem::path& data, GameEndRenderOptions options = {}); Image render() const; private: Image background_; GameEndRenderOptions options_; TextDb texts_; struct FontData; std::shared_ptr font_; }; enum class TaxDialogKind { acknowledgement, question }; // PresentLoanReturn: Original full-screen program-error diagnostic, no manager identity. class ProgramErrorScreen { public: ProgramErrorScreen(const std::filesystem::path& data, uint16_t code, GameEndRenderOptions options = {}); Image render() const; private: uint16_t code_; GameEndRenderOptions options_; TextDb texts_; struct FontData; std::shared_ptr font_; }; struct TaxDialogProjection { TaxDialogKind kind = TaxDialogKind::acknowledgement; bool compact_dialog_frame = false; // PresentManagerDialog selects its frame shadow path from this flag uint8_t source_manager_flags = 0; // PresentManagerDialog param1; 0x40 timed, 0x80 interactive ACK uint16_t source_flags = 0; // PresentManagerDialog param3; selects labels in the loaded TEXTD pointer table bool source_system_identity = false; // PresentManagerDialog low-six-bit identity 4 (SystemManagerNameText, portrait 14 twice) std::string manager_name; std::string body; // exact, already-composed Source ISO646-DE text int portrait = 0; bool badge_fallback = false; // Source runtime club gate, distinct from sprite identity int badge_sprite = 0; // Source selector game.club_heap_78[team*2] & 0x1ff }; class GameEndTaxDialog { public: enum class Button { none, acknowledge, yes, no }; GameEndTaxDialog(const std::filesystem::path& data, TaxDialogProjection projection, GameEndRenderOptions options = {}, std::optional restored_backdrop = {}); Image backdrop() const; Image render(std::optional