[TextRenderer]: Added 'UpdateGameFontsAndText'

This commit is contained in:
JerryALT 2024-03-29 20:04:45 +03:00
parent dd88caffb7
commit c0c604d718
2 changed files with 37 additions and 0 deletions

View File

@ -2,6 +2,41 @@
namespace Components namespace Components
{ {
//Rename function in future
void TextRenderer::UpdateGameFontsAndText()
{
Utils::Hook::Set<const char*>(0x42937B, "EXE_GAMESAVED");
// Forced setup the stock fonts
Utils::Hook::Set<const char*>(0x564783, "fonts/objectivefont");
Utils::Hook::Set<const char*>(0x56475C, "fonts/extrabigfont");
Utils::Hook::Set<const char*>(0x564736, "fonts/normalfont");
// Changing the font in video cinematic from 'normalFont' to 'extraBigFont'.
Utils::Hook::Set<DWORD>(0x56502B, 0x6ABEC4);
Utils::Hook::Set<const char*>(0x56470F, "fonts/boldfont");
Utils::Hook::Set<const char*>(0x5646C2, "fonts/smallfont");
Utils::Hook::Set<const char*>(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<const char*>(0x42937B, "EXE_CHECKPOINT_REACHED");
Utils::Hook::Set<const char*>(0x564783, "fonts/objectivefontxenon");
Utils::Hook::Set<const char*>(0x56475C, "fonts/extrabigfontxenon");
Utils::Hook::Set<const char*>(0x564736, "fonts/normalfontxenon");
Utils::Hook::Set<const char*>(0x56502B, "fonts/normalfontxenon");
Utils::Hook::Set<const char*>(0x56470F, "fonts/boldfontxenon");
Utils::Hook::Set<const char*>(0x5646C2, "fonts/smallfontxenon");
Utils::Hook::Set<const char*>(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 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; float s0, s1, t0, t1;

View File

@ -16,6 +16,8 @@ namespace Components
{ {
public: public:
TextRenderer(); TextRenderer();
static void UpdateGameFontsAndText();
private: private:
static void R_TextWidth_Stub01(); static void R_TextWidth_Stub01();
static void R_TextWidth_Stub02(); static void R_TextWidth_Stub02();