From 6efd22eb0e6efa08abb03317c8678927d5a286c8 Mon Sep 17 00:00:00 2001 From: TheIndra55 Date: Sun, 18 Aug 2024 22:37:13 +0200 Subject: [PATCH] Underworld font readiness --- src/Options.cpp | 2 ++ src/game/Game.h | 11 ++++++++++- src/modules/MainMenu.cpp | 2 +- src/render/Font.cpp | 8 ++++---- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Options.cpp b/src/Options.cpp index af12a2f..1e08022 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -23,12 +23,14 @@ void Options::DrawOptions() noexcept { ImGui::Begin("Options", &m_show); +#ifndef TR8 if (ImGui::CollapsingHeader("General")) { DrawComboOption("IntroSkip", "Legal screen and intros", { "Don't skip", "Skip legal", "Skip legal and intros" }); DrawCheckOption("NoCinematicBars", "Disable cinematic bars"); DrawCheckOption("NoMotionBlur", "Disable motion blur"); } +#endif if (ImGui::CollapsingHeader("Camera")) { diff --git a/src/game/Game.h b/src/game/Game.h index ca239c0..4f73ac1 100644 --- a/src/game/Game.h +++ b/src/game/Game.h @@ -10,6 +10,7 @@ struct VertexPool; enum MainState { +#ifndef TR8 MS_NONE, MS_PLAYGAME, MS_LOADLEVEL, @@ -20,7 +21,15 @@ enum MainState MS_SHOW_STATIC_SCREEN, MS_QUITGAME, MS_PLAY_DARKCHRONICLE_CINEMATIC, - MS_PLAY_DARKCHRONICLE_CINEMATICMOVIE, + MS_PLAY_DARKCHRONICLE_CINEMATICMOVIE +#else + MS_NONE, + MS_PLAYGAME, + MS_LOADLEVEL, + MS_PLAY_CINEMATIC = 5, + MS_SHOW_STATIC_SCREEN = 6, + MS_DISPLAY_MAIN_MENU = 10 +#endif }; struct WipeInfo diff --git a/src/modules/MainMenu.cpp b/src/modules/MainMenu.cpp index 47638f1..80f9765 100644 --- a/src/modules/MainMenu.cpp +++ b/src/modules/MainMenu.cpp @@ -185,7 +185,7 @@ void MainMenu::OnFrame() { #ifndef TR8 // Shows the watermark in th main menu - auto mainState = *(int*)GET_ADDRESS(0x10E5868, 0x838838, 0x000000); + auto mainState = *(int*)GET_ADDRESS(0x10E5868, 0x838838, 0xE7ED60); if (mainState == MS_DISPLAY_MAIN_MENU && !m_noWatermark.GetValue()) { diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 31cf779..f7012ed 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -40,7 +40,7 @@ void Font::GetCursor(float* x, float* y) noexcept void Font::SetScale(float scaleX, float scaleY) noexcept { - auto addr = GET_ADDRESS(0x431860, 0x433E60, 0x000000); + auto addr = GET_ADDRESS(0x431860, 0x433E60, 0x474D50); Hooking::Call(addr, scaleX, scaleY); } @@ -87,14 +87,14 @@ void Font::PrintFormatted(const char* formatted, int backdrop) const noexcept float Font::GetTextWidth(const char* text) const noexcept { - auto addr = GET_ADDRESS(0x431EA0, 0x434510, 0x000000); + auto addr = GET_ADDRESS(0x431EA0, 0x434510, 0x4758C0); return Hooking::ThisCallReturn(addr, this, text); } float Font::GetHeight() const noexcept { - auto addr = GET_ADDRESS(0x431E20, 0x434440, 0x000000); + auto addr = GET_ADDRESS(0x431E20, 0x434440, 0x475870); return Hooking::ThisCallReturn(addr, this); } @@ -104,7 +104,7 @@ void Font::OnFlush(std::function callback) noexcept if (!s_callback) { // TODO pattern - auto addr = GET_ADDRESS(0x432570, 0x434C40, 0x476D80); + auto addr = GET_ADDRESS(0x432570, 0x434C40, 0x5C5A30); MH_CreateHook((void*)addr, Flush, (void**)&s_Flush); MH_EnableHook(MH_ALL_HOOKS);