From c0c604d718fa80d186f0c29193d269a3e62904b4 Mon Sep 17 00:00:00 2001 From: JerryALT Date: Fri, 29 Mar 2024 20:04:45 +0300 Subject: [PATCH] [TextRenderer]: Added 'UpdateGameFontsAndText' --- src/Components/Modules/TextRenderer.cpp | 35 +++++++++++++++++++++++++ src/Components/Modules/TextRenderer.hpp | 2 ++ 2 files changed, 37 insertions(+) diff --git a/src/Components/Modules/TextRenderer.cpp b/src/Components/Modules/TextRenderer.cpp index 06f927c..f46c2fb 100644 --- a/src/Components/Modules/TextRenderer.cpp +++ b/src/Components/Modules/TextRenderer.cpp @@ -2,6 +2,41 @@ namespace Components { + //Rename function in future + void TextRenderer::UpdateGameFontsAndText() + { + Utils::Hook::Set(0x42937B, "EXE_GAMESAVED"); + // Forced setup the stock fonts + Utils::Hook::Set(0x564783, "fonts/objectivefont"); + Utils::Hook::Set(0x56475C, "fonts/extrabigfont"); + Utils::Hook::Set(0x564736, "fonts/normalfont"); + // Changing the font in video cinematic from 'normalFont' to 'extraBigFont'. + Utils::Hook::Set(0x56502B, 0x6ABEC4); + Utils::Hook::Set(0x56470F, "fonts/boldfont"); + Utils::Hook::Set(0x5646C2, "fonts/smallfont"); + Utils::Hook::Set(0x56469B, "fonts/bigfont"); + + // DO NOT APPLYING CHANGES FOR ANY MODS!!! + if (Game::HasLoadedMod()) + return; + + std::string language = Language::GetCurrentLanguage(); + if (language == "english" || language == "french" || language == "german" || language == "italian" || language == "spanish") + { + if (Dvars::console_menu_style->current.enabled) + { + Utils::Hook::Set(0x42937B, "EXE_CHECKPOINT_REACHED"); + Utils::Hook::Set(0x564783, "fonts/objectivefontxenon"); + Utils::Hook::Set(0x56475C, "fonts/extrabigfontxenon"); + Utils::Hook::Set(0x564736, "fonts/normalfontxenon"); + Utils::Hook::Set(0x56502B, "fonts/normalfontxenon"); + Utils::Hook::Set(0x56470F, "fonts/boldfontxenon"); + Utils::Hook::Set(0x5646C2, "fonts/smallfontxenon"); + Utils::Hook::Set(0x56469B, "fonts/bigfontxenon"); + } + } + } + float TextRenderer::DrawHudIcon(const char* text, const Game::Font_s* font, const float x, const float y, const float sinAngle, const float cosAngle, const float xScale, const float yScale, Game::GfxColor color) { float s0, s1, t0, t1; diff --git a/src/Components/Modules/TextRenderer.hpp b/src/Components/Modules/TextRenderer.hpp index f858415..5a3b7df 100644 --- a/src/Components/Modules/TextRenderer.hpp +++ b/src/Components/Modules/TextRenderer.hpp @@ -16,6 +16,8 @@ namespace Components { public: TextRenderer(); + + static void UpdateGameFontsAndText(); private: static void R_TextWidth_Stub01(); static void R_TextWidth_Stub02();