From f69d2a66cb8504798380c389aab2d88b33c4adb1 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sun, 8 Nov 2026 04:37:51 +0100 Subject: [PATCH 01/21] reimplement: SHC_3BB0A8C1_0x00431B60 100.0% Reimplemented BuildMenu::MenuView_BuildMenu_DoInitial, from gynt's draft (0b3b5bf04, 27.26%, and abf493fba, 27.3%, in his closed #253; on his fork's reimpl/UI-MenuViews-development 2a65f06d8, 41.59%, 722a4a220, 44.58%, 22964ce9a, 74.03%, 1f5a1aa52, 98.90%, the dropped guard restored, and fa2be92cd, 99.84%, the two hidden-tab guards as early returns; his style passes up to e9bc49c12 on his fork's reimpl/UI-MenuItems-development) and our 3717c673a, 99.9%, in the draft #356. The function is his: the menu's position by resolution, then per build menu tab its menu picture, its edge pictures and the redraw. 3717c673a added the 640x480 y store (the draft never set DAT_MenuHandlerState:: instance.y there; the original stores it for both branches at 0x00431BA3) and the style pass (decimal offsets, s_ pointers for the 98 edge pictures with their names above them, comments on what the blocks draw). New here: y is assigned in each branch instead of once before the resolution test, which puts the original's xor esi, esi before its add eax, -600 (one y before the test: quick_diff 0.9992 -> 0.9984; the rest is the listing's ret 0); the BOOLEnum pendingMenuRedraw is tested by truthiness and cleared with FALSE (neutral). reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuView_BuildMenu_DoInitial.cpp | 1020 +++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 1021 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp diff --git a/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp b/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp new file mode 100644 index 0000000000..96b133667b --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp @@ -0,0 +1,1020 @@ +#include "../BuildMenu.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Rendering/ScreenResolutionEnum.hpp" +#include "OpenSHC/UI/Enums/BuildMenuTabType.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/COL_MAGENTA.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + // FUNCTION: STRONGHOLDCRUSADER 0x00431B60 + void BuildMenu::MenuView_BuildMenu_DoInitial() + { + // the build menu sits at the bottom of the screen, at its left edge at 640x480 + // y is set in each branch, not before the test (before the test: quick_diff 0.9992 -> 0.9984) + int y; + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_640x480) { + y = DAT_WindowAndDirectDraw::instance.resolutionY - 600; + Menu* const menu = DAT_MenuHandlerState::instance.currentMenu; + menu->xPosition = 0; + menu->yPosition = y; + DAT_MenuHandlerState::instance.x = 0; + } else { + int const x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + y = DAT_WindowAndDirectDraw::instance.resolutionY - 600; + Menu* const menu = DAT_MenuHandlerState::instance.currentMenu; + menu->xPosition = x; + menu->yPosition = y; + DAT_MenuHandlerState::instance.x = x; + } + DAT_MenuHandlerState::instance.y = y; + // the soldiers tab has its own menu picture and edge pictures + if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_SOLDIERS) { + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::setMenuTabIndexUnk, + DAT_TextureRenderCoreObject::ptr)(8); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::setMenuTabIndexUnk, + DAT_TextureRenderCoreObject::ptr)(4); + } + if (!DAT_WindowAndDirectDraw::instance.pendingMenuRedraw) { + return; + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(0, + DAT_MenuHandlerState::instance.y + 406, DAT_WindowAndDirectDraw::instance.resolutionX - 1, + DAT_MenuHandlerState::instance.y + 471, COL_MAGENTA::instance.shortValue); + DAT_WindowAndDirectDraw::instance.pendingMenuRedraw = FALSE; + // the edge pictures left and right of the menu, for this resolution + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1024l_tgx_005a25c0); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + // "edge_military_1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1024l_tgx_005a25c0); + } else { + // "edge_military_1024r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1024r_tgx_005a25a8); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 896, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 912, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x600) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1024l_tgx_005a25c0); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + // "edge_military_1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1024l_tgx_005a25c0); + } else { + // "edge_military_1024r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1024r_tgx_005a25a8); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 896, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 912, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1280l_tgx_005a2590); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1280l_tgx_005a2590); + } else { + // "edge_military_1280r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1280r_tgx_005a2578); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1024 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1040, 1024 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x1200) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1600l_tgx_005a2560); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1600l_tgx_005a2560); + } else { + // "edge_military_1600r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1600r_tgx_005a2548); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1200, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x720) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1280l_tgx_005a2590); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1280l_tgx_005a2590); + } else { + // "edge_military_1280r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1280r_tgx_005a2578); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 720 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1040, 720 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1440x900) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1440l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1440l_tgx_005a2530); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1440l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1440l_tgx_005a2530); + } else { + // "edge_military_1440r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1440r_tgx_005a2518); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1120, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1080) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1920l_tgx_005a2500); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1920l_tgx_005a2500); + } else { + // "edge_military_1920r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1920r_tgx_005a24e8); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1080 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1360, 1080 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1200) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1920l_tgx_005a2500); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1920l_tgx_005a2500); + } else { + // "edge_military_1920r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1920r_tgx_005a24e8); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1360, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1440) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_2560l_tgx_005a24d0); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_2560l_tgx_005a24d0); + } else { + // "edge_military_2560r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_2560r_tgx_005a24b8); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1440 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1680, 1440 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1600) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_2560l_tgx_005a24d0); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_2560l_tgx_005a24d0); + } else { + // "edge_military_2560r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_2560r_tgx_005a24b8); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1680, 1600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1366x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1366l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1366l_tgx_005a24a0); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1366l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1366l_tgx_005a24a0); + } else { + // "edge_military_1366r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1366r_tgx_005a2488); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1082, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1360x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1360l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1360l_tgx_005a2470); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1360l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1360l_tgx_005a2470); + } else { + // "edge_military_1360r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1360r_tgx_005a2458); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1080, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1680x1050) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1680l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1680l_tgx_005a2440); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1680l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1680l_tgx_005a2440); + } else { + // "edge_military_1680r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1680r_tgx_005a2428); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1050 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1240, 1050 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x900) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1600l_tgx_005a2560); + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge_military_1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1600l_tgx_005a2560); + } else { + // "edge_military_1600r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge_military_1600r_tgx_005a2548); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1200, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + } else { + // no picture for a hidden menu or tab 62 (BuildMenuTabType has no name for it) + if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_MENU_HIDDEN) { + return; + } + if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == 62) { + return; + } + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::setMenuTabIndexUnk, + DAT_TextureRenderCoreObject::ptr)(9); + } else if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::setMenuTabIndexUnk, + DAT_TextureRenderCoreObject::ptr)(5); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::setMenuTabIndexUnk, + DAT_TextureRenderCoreObject::ptr)(0); + } + if (!DAT_WindowAndDirectDraw::instance.pendingMenuRedraw) { + return; + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(0, + DAT_MenuHandlerState::instance.y + 406, DAT_WindowAndDirectDraw::instance.resolutionX - 1, + DAT_MenuHandlerState::instance.y + 471, COL_MAGENTA::instance.shortValue); + DAT_WindowAndDirectDraw::instance.pendingMenuRedraw = FALSE; + // the edge pictures left and right of the menu, for this resolution: the editor and siege games + // show the left one on both sides + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_EDITOR + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024l_tgx_005a2388); + // "edge1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024l_tgx_005a2388); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 912, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x600) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024l_tgx_005a2388); + // "edge1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024l_tgx_005a2388); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 912, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280l_tgx_005a2378); + // "edge1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280l_tgx_005a2378); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1024 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1040, 1024 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x1200) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600l_tgx_005a2368); + // "edge1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600l_tgx_005a2368); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1200, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x720) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280l_tgx_005a2378); + // "edge1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280l_tgx_005a2378); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 720 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1040, 720 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1440x900) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1440l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1440l_tgx_005a2358); + // "edge1440l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1440l_tgx_005a2358); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1120, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1080) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920l_tgx_005a2348); + // "edge1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920l_tgx_005a2348); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1080 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1360, 1080 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1200) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920l_tgx_005a2348); + // "edge1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920l_tgx_005a2348); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1360, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1440) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560l_tgx_005a2338); + // "edge2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560l_tgx_005a2338); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1440 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1680, 1440 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1600) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560l_tgx_005a2338); + // "edge2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560l_tgx_005a2338); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1680, 1600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1366x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1366l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1366l_tgx_005a2328); + // "edge1366l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1366l_tgx_005a2328); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1082, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1360x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1360l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1360l_tgx_005a2318); + // "edge1360l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1360l_tgx_005a2318); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1080, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1680x1050) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1680l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1680l_tgx_005a2308); + // "edge1680l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1680l_tgx_005a2308); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1050 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1240, 1050 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x900) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600l_tgx_005a2368); + // "edge1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600l_tgx_005a2368); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1200, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + } else { + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024l_tgx_005a2388); + // "edge1024r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024r_tgx_005a2418); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 912, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x600) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1024l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024l_tgx_005a2388); + // "edge1024r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1024r_tgx_005a2418); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 912, 600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280l_tgx_005a2378); + // "edge1280r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280r_tgx_005a2408); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1024 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1040, 1024 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x1200) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600l_tgx_005a2368); + // "edge1600r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600r_tgx_005a23f8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1200, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x720) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1280l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280l_tgx_005a2378); + // "edge1280r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1280r_tgx_005a2408); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 720 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1040, 720 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1440x900) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1440l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1440l_tgx_005a2358); + // "edge1440r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1440r_tgx_005a23e8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1120, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1080) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920l_tgx_005a2348); + // "edge1920r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920r_tgx_005a23d8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1080 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1360, 1080 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1200) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1920l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920l_tgx_005a2348); + // "edge1920r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1920r_tgx_005a23d8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1360, 1200 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1440) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560l_tgx_005a2338); + // "edge2560r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560r_tgx_005a23c8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1440 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1680, 1440 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1600) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge2560l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560l_tgx_005a2338); + // "edge2560r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge2560r_tgx_005a23c8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1680, 1600 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1366x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1366l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1366l_tgx_005a2328); + // "edge1366r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1366r_tgx_005a23b8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1082, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1360x768) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1360l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1360l_tgx_005a2318); + // "edge1360r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1360r_tgx_005a23a8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1080, 768 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1680x1050) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1680l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1680l_tgx_005a2308); + // "edge1680r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1680r_tgx_005a2398); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 1050 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1240, 1050 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x900) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "edge1600l.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600l_tgx_005a2368); + // "edge1600r.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_edge1600r_tgx_005a23f8); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, 0, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 1, 1200, 900 - DAT_TextureRenderCoreObject::instance.loadedGfxArray[1].height); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ed989c9a21..9512b6d020 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -11079,7 +11079,7 @@ SHC_3BB0A8C1_0x00431990 | 0.0% | Pending SHC_3BB0A8C1_0x00431A90 | 0.0% | Pending -SHC_3BB0A8C1_0x00431B60 | 0.0% | Pending +SHC_3BB0A8C1_0x00431B60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00433030 | 0.0% | Pending From 1262303867a45e1021ecf32ccc2fa5287e2728ef Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 00:43:11 +0100 Subject: [PATCH 02/21] drawHeaderTextBanner's callers name their text group Fifteen of its eighteen callers passed the text group as a number: 199 is TEXT_SCENARIO, 0x4a TEXT_GAME_OPTIONS, 5 TEXT_MAINOPTIONS and 0x4f TEXT_XPLAY_WAITING_ROOM (eTextSections.hpp). Each now names it, as NewEvent, NewEventAction and EditScenario already did, and includes eTextSections.hpp. The enum converts to the int parameter, so the code is the same: all fifteen stay at reccmp 100.0. On the lines this touches, the text number is decimal and each file's first include is its own "../X.func.hpp" (style guide 18 and 14). Co-Authored-By: Claude Opus 5.5 --- .../MenuModalRenderFunction_CreateOrTriggerInvasion.cpp | 6 ++++-- .../DisableTroops/MenuModalRenderFunction_DisableTroops.cpp | 6 ++++-- .../DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp | 6 ++++-- .../MenuModalRenderFunction_EnterTitleOnGameStart.cpp | 6 ++++-- .../MenuModalRenderFunction_GameplayOptions.cpp | 6 ++++-- .../MenuModalRenderFunction_NetworkOptions.cpp | 6 ++++-- .../MenuModalRenderFunction_OnlineQuitGame.cpp | 6 ++++-- .../OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp | 6 ++++-- .../MenuModalRenderFunction_SkirmishConnectionOptions.cpp | 6 ++++-- .../MenuModalRenderFunction_SkirmishPlayOptions.cpp | 6 ++++-- .../SoundOptions/MenuModalRenderFunction_SoundOptions.cpp | 6 ++++-- .../StartGoods/MenuModalRenderFunction_StartGoods.cpp | 6 ++++-- .../MenuModalRenderFunction_TraderSettings.cpp | 6 ++++-- .../TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp | 6 ++++-- ...MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp | 6 ++++-- 15 files changed, 60 insertions(+), 30 deletions(-) diff --git a/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp b/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp index 615e9f6e78..09f0db491b 100644 --- a/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp +++ b/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/CreateOrTriggerInvasion.func.hpp" +#include "../CreateOrTriggerInvasion.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_CreateOrTriggerInvasion(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0x2e, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 46, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp b/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp index 343c0bbc36..83c2950fa4 100644 --- a/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp +++ b/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/DisableTroops.func.hpp" +#include "../DisableTroops.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_DisableTroops(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0xbc, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 188, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp b/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp index d497fc976c..066274f6c4 100644 --- a/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp +++ b/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/DisableWeapon.func.hpp" +#include "../DisableWeapon.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_DisableWeapon(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0xbd, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 189, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp b/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp index 8d5e6c26e9..fb34034188 100644 --- a/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp +++ b/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/EnterTitleOnGameStart.func.hpp" +#include "../EnterTitleOnGameStart.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_EnterTitleOnGameStart(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(5, 6, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_MAINOPTIONS, 6, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp b/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp index 061906c477..073d005236 100644 --- a/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/GameplayOptions.func.hpp" +#include "../GameplayOptions.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_GameplayOptions(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4a, 0x19, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 25, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp b/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp index d234390ae2..707d2e0613 100644 --- a/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/NetworkOptions.func.hpp" +#include "../NetworkOptions.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_NetworkOptions(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4a, 6, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 6, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp b/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp index fbba87f66f..7c39b839c1 100644 --- a/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp +++ b/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/OnlineQuitGame.func.hpp" +#include "../OnlineQuitGame.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_OnlineQuitGame(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4a, 7, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 7, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp b/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp index cae175e53f..ec6f01b044 100644 --- a/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp +++ b/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/OptionsMenu.func.hpp" +#include "../OptionsMenu.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_OptionsMenu(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4a, 1, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 1, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp b/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp index bd1fc7a9b9..79029ad791 100644 --- a/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/SkirmishConnectionOptions.func.hpp" +#include "../SkirmishConnectionOptions.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_SkirmishConnectionOptions(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4f, 0x5d, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 93, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp b/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp index 4829b68b79..c871907a35 100644 --- a/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/SkirmishPlayOptions.func.hpp" +#include "../SkirmishPlayOptions.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_SkirmishPlayOptions(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4f, 0x67, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 103, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp b/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp index 9c86cf5092..c3a2531376 100644 --- a/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/SoundOptions.func.hpp" +#include "../SoundOptions.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_SoundOptions(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(0x4a, 5, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 5, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp b/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp index b9fe397dcd..488ceb1b44 100644 --- a/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp +++ b/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/StartGoods.func.hpp" +#include "../StartGoods.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_StartGoods(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0x29, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 41, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp b/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp index c881d36bff..632c2d2298 100644 --- a/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp +++ b/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/TraderSettings.func.hpp" +#include "../TraderSettings.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_TraderSettings(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0x26, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 38, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp b/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp index f41936dada..790886a177 100644 --- a/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp +++ b/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/TriggerEvent.func.hpp" +#include "../TriggerEvent.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_TriggerEvent(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0x17, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 23, x, y, width, height); } } diff --git a/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp b/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp index 5d2f141cbb..a778720e5f 100644 --- a/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp +++ b/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp @@ -1,5 +1,7 @@ -#include "OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk.func.hpp" +#include "../UnusedSiegeAttackingForceUnk.func.hpp" + #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" @@ -12,7 +14,7 @@ namespace UI { void MenuModalRenderFunction_UnusedSiegeAttackingForceUnk(int x, int y, int width, int height) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, - DAT_PencilRenderCore::ptr)(199, 0xa4, x, y, width, height); + DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 164, x, y, width, height); } } From bf6cc6eb8a0f2571fc43134bdab45b61a2a3f849 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 00:35:13 +0100 Subject: [PATCH 03/21] header: drawHeaderTextBanner's textGroupIndex is an eTextSections As #376's description proposed. The function hands it straight to getTextStringInGroupAtOffset, whose first parameter is an eTextSections (the definition cast it), and every caller passes an eTextSections value: TEXT_SCENARIO, TEXT_GAME_OPTIONS, TEXT_MAINOPTIONS or TEXT_XPLAY_WAITING_ROOM. PencilRenderCore.hpp includes eTextSections.hpp and declares the parameter with it; the resolver in PencilRenderCore.func.hpp takes the same signature. PencilRenderCore.func.hpp includes eTextSections.hpp and has its using, as TextManager.func.hpp does. The definition follows in the next commit, so this commit alone doesn't build (C2511: the class declares eTextSections while the definition still takes int); the two stay apart because a header change goes in a commit of its own. Measured with the next commit: drawHeaderTextBanner and its 18 callers stay at reccmp 100.0. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/UI/Rendering/PencilRenderCore.func.hpp | 4 +++- src/OpenSHC/UI/Rendering/PencilRenderCore.hpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore.func.hpp b/src/OpenSHC/UI/Rendering/PencilRenderCore.func.hpp index 9dc849ed8a..534337a3c0 100644 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore.func.hpp +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore.func.hpp @@ -2,6 +2,7 @@ path: 'OpenSHC/UI/Rendering/PencilRenderCore.func.hpp' */ +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/UI/Enums/RoundedBoxEdgeRoundingLevel.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -10,6 +11,7 @@ namespace UI { namespace Rendering { namespace PencilRenderCore_Func { + using OpenSHC::DE::SHCDE::eTextSections; using OpenSHC::UI::Enums::RoundedBoxEdgeRoundingLevel; using OpenSHC::WindowsHelper::Enums::BOOLEnum; @@ -105,7 +107,7 @@ namespace UI { Address::SHC_3BB0A8C1_0x00472B20, &PencilRenderCore::drawLine) drawLine; - MACRO_FUNCTION_RESOLVER(void (PencilRenderCore::*)(int, int, int, int, int, int), false, + MACRO_FUNCTION_RESOLVER(void (PencilRenderCore::*)(eTextSections, int, int, int, int, int), false, Address::SHC_3BB0A8C1_0x00475CC0, &PencilRenderCore::drawHeaderTextBanner) drawHeaderTextBanner; diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore.hpp b/src/OpenSHC/UI/Rendering/PencilRenderCore.hpp index 3662c6c609..e16265999a 100644 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore.hpp +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore.hpp @@ -8,6 +8,7 @@ #pragma once +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Rendering/Enums/RenderTargetInt.hpp" #include "OpenSHC/UI/Enums/RoundedBoxEdgeRoundingLevel.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -16,6 +17,7 @@ namespace OpenSHC { namespace UI { namespace Rendering { + using OpenSHC::DE::SHCDE::eTextSections; using OpenSHC::Rendering::Enums::RenderTargetInt; using OpenSHC::UI::Enums::RoundedBoxEdgeRoundingLevel; using OpenSHC::WindowsHelper::Enums::BOOLEnum; @@ -103,7 +105,7 @@ namespace UI { void drawLine(int x1, int y1, int x2, int y2, ushort color); void drawHeaderTextBanner( - int textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int height); + eTextSections textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int height); }; static_assert_cpp98_obj(sizeof(PencilRenderCore) == 66, PencilRenderCore); From db68fc56df51bcc7dd701b2c72019bdbb5f57d6d Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 00:35:13 +0100 Subject: [PATCH 04/21] drawHeaderTextBanner takes the eTextSections its header declares The definition's textGroupIndex becomes eTextSections, and the cast before getTextStringInGroupAtOffset goes. reccmp 100.0 before and after; its 18 callers stay at 100.0. Co-Authored-By: Claude Opus 5.5 --- .../UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp index e53326dd71..70c0c26a53 100644 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp @@ -30,7 +30,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00475CC0 void PencilRenderCore::drawHeaderTextBanner( - int textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int height) + eTextSections textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int height) { // drawHeaderBanner's banner, with a text centred on it // The banner is one tile inside the box at the top and on both sides; width becomes the banner's own. @@ -76,7 +76,7 @@ namespace UI { yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_MASK, 0); MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((OpenSHC::DE::SHCDE::eTextSections)textGroupIndex, textNumInGroup), + DAT_TextManagerObject::ptr)(textGroupIndex, textNumInGroup), width / 2 + left, yPos + 14, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, BANNER_TEXT_FONT_SIZE, FALSE, 0); } From 2aec12b95f0db393f5d9e55b49bcec8afb9cd462 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:51 +0100 Subject: [PATCH 05/21] reimplement: SHC_3BB0A8C1_0x004F4EF0 100.0% Reimplemented BottomLeftTextDisplayState::hasPassedCountdownOrDuration, from gynt's draft (d92c05c63, 72.22%, in his closed #256; truth tests in dd1433183 on his fork's archive/UI-MenuViews-development-second-pass, locals at first use in 10280b161 on his fork's reimpl/UI-Core-development), restructured from the binary: one if/else chain in place of the goto (a duration of -1 expires the text, as in his draft), and the previous time is tested after the global is overwritten instead of through a bool copy, which added a setne. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../hasPassedCountdownOrDuration.cpp | 31 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp diff --git a/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp b/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp new file mode 100644 index 0000000000..e1428adcb5 --- /dev/null +++ b/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp @@ -0,0 +1,31 @@ +#include "../BottomLeftTextDisplayState.func.hpp" + +#include "OpenSHC/Globals/DAT_TextRelatedTime.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004F4EF0 + void BottomLeftTextDisplayState::hasPassedCountdownOrDuration() + { + if (this->currentlyDisplayedTextIsDisplayedUnk != 0) { + if (this->textMessageDurationUnk == 0) { + this->textMessageDurationUnk = -1; + } else if (this->textMessageDurationUnk == -1 + || timeGetTime() - this->textMessageTime > (DWORD)this->textMessageDurationUnk) { + this->currentlyDisplayedTextIsDisplayedUnk = 0; + this->unknownCountdown01 = 1; + } + } else if (this->unknownCountdown01 != 0) { + this->unknownCountdown01--; + } + DWORD const now = timeGetTime(); + DWORD const previousTime = DAT_TextRelatedTime::instance; + DAT_TextRelatedTime::instance = now; + if (previousTime != 0) { + this->countdown += previousTime - now; + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 9512b6d020..3e3e54ec3f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -38645,7 +38645,7 @@ SHC_3BB0A8C1_0x004F4D70 | 0.0% | Pending SHC_3BB0A8C1_0x004F4E00 | 0.0% | Pending -SHC_3BB0A8C1_0x004F4EF0 | 0.0% | Pending +SHC_3BB0A8C1_0x004F4EF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F4F60 | 0.0% | Pending From 5d8a9035233168805416a5adc8a772d807dbb376 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:52 +0100 Subject: [PATCH 06/21] reimplement: SHC_3BB0A8C1_0x004D5780 100.0% Reimplemented GreatestLord::ComputeSkMasterScore, from gynt's draft (73e93f1fd, 33.33%, in his closed #256; 36.8% in 10280b161 on his fork's reimpl/UI-Core-development). His finalResults.yearEnd, yearStart, monthStart and monthEnd are finalResults.tail.tail1's fields on main now, which is what kept the draft from compiling; the killed-lords bonus is added with +=, and the draft's (char) on finalKilledLords, already a char, goes. The arithmetic is his. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../UI/GreatestLord/ComputeSkMasterScore.cpp | 27 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/GreatestLord/ComputeSkMasterScore.cpp diff --git a/src/OpenSHC/UI/GreatestLord/ComputeSkMasterScore.cpp b/src/OpenSHC/UI/GreatestLord/ComputeSkMasterScore.cpp new file mode 100644 index 0000000000..9617b70366 --- /dev/null +++ b/src/OpenSHC/UI/GreatestLord/ComputeSkMasterScore.cpp @@ -0,0 +1,27 @@ +#include "../GreatestLord.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D5780 + int GreatestLord::ComputeSkMasterScore(int playerID) + { + int score = DAT_GameSynchronyState::instance.finalResults.finalBuildingsDestroyedWeighted[playerID] * 100 + + DAT_GameSynchronyState::instance.finalResults.finalGold[playerID] / 10 + + DAT_GameSynchronyState::instance.finalResults.finalTroopsKilledWeighted[playerID]; + score += DAT_GameSynchronyState::instance.finalResults.finalKilledLords[playerID] * score / 4; + int months = (DAT_GameSynchronyState::instance.finalResults.tail.tail1.yearEnd + - DAT_GameSynchronyState::instance.finalResults.tail.tail1.yearStart) + * 12 + - DAT_GameSynchronyState::instance.finalResults.tail.tail1.monthStart + + DAT_GameSynchronyState::instance.finalResults.tail.tail1.monthEnd; + if (months < 1) { + months = 1; + } + return score * 200 / (months + 200); + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3e3e54ec3f..1a0f4fe53b 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -35575,7 +35575,7 @@ SHC_3BB0A8C1_0x004D53E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D55D0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004D5780 | 0.0% | Pending +SHC_3BB0A8C1_0x004D5780 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D5810 | 0.0% | Pending From b445ba1088ba917ef496a3344dd26446ac479533 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:52 +0100 Subject: [PATCH 07/21] reimplement: SHC_3BB0A8C1_0x005119C0 100.0% Reimplemented HoveredState::Constructor_HoveredState, gynt's draft (bcc95973f, 20.00%, in his closed #256; 40.0% in 10280b161 on his fork's reimpl/UI-Core-development) unchanged apart from a duplicate include. The original keeps this in edx across the call to clearHoveredState, which needs link-time code generation to know that clearHoveredState leaves edx alone, so both files go into cmake/compiler-flags-gl.txt (without it: push esi / mov esi, ecx). clearHoveredState stays at reccmp 100.0%. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- cmake/compiler-flags-gl.txt | 2 ++ .../UI/HoveredState/Constructor_HoveredState.cpp | 14 ++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp diff --git a/cmake/compiler-flags-gl.txt b/cmake/compiler-flags-gl.txt index 80050216fe..78cbe5b880 100644 --- a/cmake/compiler-flags-gl.txt +++ b/cmake/compiler-flags-gl.txt @@ -120,3 +120,5 @@ src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_RenderCurrentBut src/OpenSHC/UI/DisplayElements/RenderTimeUntilDefeatDisplayElement.cpp src/OpenSHC/UI/DisplayElements/GetIfDisplayElementStateNotZero.cpp src/OpenSHC/UI/DisplayElements/FindDisplayElementWithID.cpp +src/OpenSHC/UI/HoveredState/clearHoveredState.cpp +src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp diff --git a/src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp b/src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp new file mode 100644 index 0000000000..41a1025985 --- /dev/null +++ b/src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp @@ -0,0 +1,14 @@ +#include "../HoveredState.func.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x005119C0 + HoveredState* HoveredState::Constructor_HoveredState() + { + MACRO_CALL_MEMBER(OpenSHC::UI::HoveredState_Func::clearHoveredState, this)(); + return this; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1a0f4fe53b..9ef92cfc63 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -44203,7 +44203,7 @@ SHC_3BB0A8C1_0x005119B0 | 0.0% | Pending SHC_3BB0A8C1_0x005119B4 | 0.0% | Pending -SHC_3BB0A8C1_0x005119C0 | 0.0% | Pending +SHC_3BB0A8C1_0x005119C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x005119D0 | 0.0% | Pending From 88ff943bb874472bbb53cb8640d22b6a92105a48 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:53 +0100 Subject: [PATCH 08/21] reimplement: SHC_3BB0A8C1_0x00501110 100.0% Reimplemented HoveredState::createHoverStateElement, from gynt's draft (fee5db45b, 50.00%, and 5976ab1be, 75.0%, the full-array return, in his closed #256; locals at first use in cf563c2ba and the flag comparison in f50797603 on his fork's archive/UI-MenuViews-development-second-pass; restyled in 10280b161 on reimpl/UI-Core-development), rewritten from the binary: an early return for GM_SOLITARY, and the search for a free element is one for-loop with the element's fields filled in and returned from inside it, so a full list falls off the end as in the original (the draft's while loop had an empty bound check). The expiry time adds mapTimeInTicks first, which loads it into ecx as the original does (commandDelay first: reccmp 93.8%). reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../HoveredState/createHoverStateElement.cpp | 38 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp diff --git a/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp b/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp new file mode 100644 index 0000000000..9e2f9cecaf --- /dev/null +++ b/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp @@ -0,0 +1,38 @@ +#include "../HoveredState.func.hpp" + +#include "OpenSHC/Commands/MappersEnum.hpp" +#include "OpenSHC/Game/GameMode.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + + using Commands::MappersEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00501110 + void HoveredState::createHoverStateElement(int x, int y, MappersEnum type, int size, int flag) + { + if (DAT_GameSynchronyState::instance.currentGameMode == Game::GM_SOLITARY) { + return; + } + for (int i = 0; i < countof(this->elements); ++i) { + if (this->elements[i].type == Commands::M_MAPPER_NULL) { + this->elements[i].x = x; + this->elements[i].y = y; + this->elements[i].type = type; + this->elements[i].size = size; + this->elements[i].time + = DAT_GameCore::instance.mapTimeInTicks + DAT_GameSynchronyState::instance.commandDelay + 5; + if (flag >= 80) { + flag = 15; + } + this->elements[i].rotationOrExtraInfo = flag; + return; + } + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 9ef92cfc63..403924fc86 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -41509,7 +41509,7 @@ SHC_3BB0A8C1_0x005010D0 | 0.0% | Pending SHC_3BB0A8C1_0x005010E0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00501110 | 0.0% | Pending +SHC_3BB0A8C1_0x00501110 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00501180 | 100.0% | Reimplemented From 5575c212aa5baaa93d25eb9deffc8112647c7d1c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:54 +0100 Subject: [PATCH 09/21] reimplement: SHC_3BB0A8C1_0x004F4C80 100.0% Reimplemented MenuHandlerState::startBuildMenuTransition, from gynt's draft (453d5270b, 82.35%, and 1b5e0a370, 82.4%, in his closed #256; 88.2% in 10280b161 on his fork's reimpl/UI-Core-development). The direction flip is an if/else: his (uint)(direction < 0) * 2 + -1 put the result in edx where the original reuses ecx (quick_diff 0.7647 -> 0.8824, the rest being the listing's import call and tail jump). The sound is (SoundEffectID)103, which SoundEffectID doesn't name yet (a later header commit adds SEID_UNKNOWN_0x67 for it); the draft wrote it as SEID_BURNING_MAN_SCREAM2 | SEID_WOOD_SAW. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../startBuildMenuTransition.cpp | 29 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp diff --git a/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp b/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp new file mode 100644 index 0000000000..720ffd5279 --- /dev/null +++ b/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp @@ -0,0 +1,29 @@ +#include "../MenuHandlerState.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Audio/SFX/SoundEffectID.hpp" + +#include "OpenSHC/Globals/DAT_SFXState.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::Audio::SFX::SoundEffectID; + + // FUNCTION: STRONGHOLDCRUSADER 0x004F4C80 + void MenuHandlerState::startBuildMenuTransition(int transitionDuration) + { + this->buildMenuTransitionStartTime_0x30 = timeGetTime(); + this->buildMenuTransitionDuration_0x34 = transitionDuration; + this->isBuildMenuTransitioning_0x18 = TRUE; + this->buildMenuTransitionProgress_0x38 = 0; + if (this->buildMenuTransitionDirection_0x2c < 0) { + this->buildMenuTransitionDirection_0x2c = 1; + } else { + this->buildMenuTransitionDirection_0x2c = -1; + } + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)((SoundEffectID)103); + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 403924fc86..575f5639ed 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -38637,7 +38637,7 @@ SHC_3BB0A8C1_0x004F4C30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F4C60 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004F4C80 | 0.0% | Pending +SHC_3BB0A8C1_0x004F4C80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F4CD0 | 0.0% | Pending From 979f30ac64b94c4590cc7f83d9dd768e1ff047f0 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:55 +0100 Subject: [PATCH 10/21] reimplement: SHC_3BB0A8C1_0x004F6A80 100.0% Reimplemented MenuHandlerState::setupMenuForRendering, from gynt's draft (0dfa41d35, 40.68%, and cc5c6ea99, 45.9%, the not-found return, in his closed #256; 44.1% in 10280b161 on his fork's reimpl/UI-Core-development), rewritten from the binary as one loop over the menu pairs with the setup inside it. loadMenuElements is called on this->currentMenu, which is what the original reads ([edi + 4]), not on DAT_MenuHandlerState's. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../setupMenuForRendering.cpp | 31 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp diff --git a/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp b/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp new file mode 100644 index 0000000000..575ec3a0bb --- /dev/null +++ b/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp @@ -0,0 +1,31 @@ +#include "../MenuHandlerState.func.hpp" + +#include "OpenSHC/UI/Menu.func.hpp" +#include "OpenSHC/UI/Enums/MenuItemHandleState.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x004F6A80 + void MenuHandlerState::setupMenuForRendering(MenuViewType menuID) + { + for (MenuIDMenuElementAddressPair* pair = this->pointerToMenuIDMenuElementAddressMap; + pair->menuID != OpenSHC::UI::Enums::MVT_MENUVIEWID_MENU_PAIR_ENDMARKER; ++pair) { + if (pair->menuID == menuID) { + Menu* const menu = pair->menuAddress; + this->currentMenu = menu; + MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::handleMenuItems, menu)( + OpenSHC::UI::Enums::MIHS_RESET_MENU_ITEM_STATEUnk); + menu->zero = 0; + this->currentMenu->one = 1; + MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::loadMenuElements, this->currentMenu)(0); + return; + } + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 575f5639ed..6559675e96 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -38737,7 +38737,7 @@ SHC_3BB0A8C1_0x004F6A60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F6A70 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004F6A80 | 0.0% | Pending +SHC_3BB0A8C1_0x004F6A80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F6AE0 | 0.0% | Pending From b0b8cfccb372144987c971f45c4ffa03e5e80907 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:56 +0100 Subject: [PATCH 11/21] reimplement: SHC_3BB0A8C1_0x004AA480 100.0% Reimplemented MenuModalComposition::setSliderParameters, from gynt's draft (9f04be9b5, 78.05%, in his closed #256; 93.7% with the arms swapped in e9bc49c12 on his fork's reimpl/UI-MenuItems-development), now in the form of its sibling setSliderParameters2 (0x004AA540, at 100% on main): the offset is stored first and overwritten, as the original does, and the parameters match the header (NoArgCallback*). It differs from the sibling only in which destination it sets. Its bound is range > 200, as in the binary and in setSliderParameters2; e9bc49c12 tested >= 200. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../setSliderParameters.cpp | 40 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuModalComposition/setSliderParameters.cpp diff --git a/src/OpenSHC/UI/MenuModalComposition/setSliderParameters.cpp b/src/OpenSHC/UI/MenuModalComposition/setSliderParameters.cpp new file mode 100644 index 0000000000..4d50e02c3b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalComposition/setSliderParameters.cpp @@ -0,0 +1,40 @@ +#include "../MenuModalComposition.func.hpp" + +#include "OpenSHC/Globals/Menu_OverlaySlider.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004AA480 + void MenuModalComposition::setSliderParameters( + int minimum, int maximum, int value, undefined* destination, NoArgCallback* callbackFunction) + { + int const range = maximum - minimum; + this->sliderMinimum = minimum; + this->sliderMaximum = maximum; + if (200 < range) { + // ranges wider than 200 are compressed: the lowest fifth of the values takes 4 slider steps each + int const offset = value - minimum; + // stored first and overwritten below, as the original does + this->sliderValue = offset; + if (offset > range / 5) { + this->sliderValue = range * 3 / 5 + offset; + } else { + this->sliderValue = offset * 4; + } + if (value == maximum) { + this->sliderValue = range * 3 / 5 - minimum + maximum; + } + } else { + this->sliderValue = value; + } + this->destination = (int*)destination; + this->destination2 = NULL; + Menu_OverlaySlider::instance.one = 1; + this->textGroup = -1; + this->textIndex = -1; + this->sliderCallbackFunction = callbackFunction; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6559675e96..bc6365c7b5 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25493,7 +25493,7 @@ SHC_3BB0A8C1_0x004AA3E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AA440 | 0.0% | Pending -SHC_3BB0A8C1_0x004AA480 | 0.0% | Pending +SHC_3BB0A8C1_0x004AA480 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AA540 | 100.0% | Reimplemented From 031add6094517475dc787c2c7ba8c3bcd49306cb Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:57 +0100 Subject: [PATCH 12/21] reimplement: SHC_3BB0A8C1_0x00491680 100.0% Reimplemented MenuTextInputState::Constructor_MenuTextInputState, from gynt's draft (d64401f04, 95.00%, in his closed #256; field names in 0caea1f41 on his fork's archive/UI-MenuViews-development-second-pass, restyled in 10280b161 on reimpl/UI-Core-development). Main has since merged his modalDialog_2 to modalDialog_6 into previousModalDialogs[5], so those five stores are a for-loop over the array; the rest is his. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../Constructor_MenuTextInputState.cpp | 29 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp diff --git a/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp b/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp new file mode 100644 index 0000000000..03ae22890d --- /dev/null +++ b/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp @@ -0,0 +1,29 @@ +#include "../MenuTextInputState.func.hpp" + +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x00491680 + MenuTextInputState* MenuTextInputState::Constructor_MenuTextInputState() + { + this->currentModalDialog = OpenSHC::UI::Enums::MMT_NO_MENU; + for (int i = 0; i < countof(this->previousModalDialogs); ++i) { + this->previousModalDialogs[i] = OpenSHC::UI::Enums::MMT_NO_MENU; + } + this->fileListContext = 3; + this->savedListOffset1 = 0; + this->savedListSelection1 = 0; + this->savedListSortOrder1 = 2; + this->savedListOffset2 = 0; + this->savedListSelection2 = 0; + this->savedListSortOrder2 = 2; + this->savedListOffset3 = 0; + this->savedListSelection3 = 0; + this->savedListSortOrder3 = 2; + return this; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index bc6365c7b5..3fe6087ed1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23403,7 +23403,7 @@ SHC_3BB0A8C1_0x00491270 | 0.0% | Pending SHC_3BB0A8C1_0x004914D0 | 0.0% | Pending -SHC_3BB0A8C1_0x00491680 | 0.0% | Pending +SHC_3BB0A8C1_0x00491680 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004916C0 | 100.0% | Reimplemented From 6596c6fcaff79ef15064ddf58891d285fe293ca1 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:58 +0100 Subject: [PATCH 13/21] reimplement: SHC_3BB0A8C1_0x004B6320 100.0% Reimplemented MinimapViewState::convertLoadedMinimapColors, from gynt's draft (6cbe8e730, 52.48%, in his closed #256; 63.6% in 10280b161 on his fork's reimpl/UI-Core-development), rewritten with loops. The palette copy is a memcpy, which MSVC inlines as the original's rep movsd; the RGB565 conversion reads each colour once, which keeps MSVC from unrolling that loop as the original doesn't; and the loop over the 200 x 200 tiles is a plain for-loop that MSVC unrolls by five, as in the original (the draft wrote the five stores out). The 0xffe0 mask is written ~0x1f: the same code, and main's style_lint accepts it. The draft's #pragma optimize("y", off) isn't needed. reccmp 100.0% (with --ignore-security-cookie). Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../convertLoadedMinimapColors.cpp | 34 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp diff --git a/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp b/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp new file mode 100644 index 0000000000..665830c447 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp @@ -0,0 +1,34 @@ +#include "../MinimapViewState.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Rendering/ColorMode.hpp" + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B6320 + void MinimapViewState::convertLoadedMinimapColors() + { + // a loaded minimap is a 256-colour RGB555 palette followed by one palette index per tile + int const tileCount = countof(this->loadedMiniMap) * countof(this->loadedMiniMap[0]); + ushort palette[256]; + byte* const colorIndices = (byte*)MACRO_CALL(OpenSHC::OS_Func::_malloc)(tileCount); + memcpy(palette, this->loadedMiniMap, sizeof(palette)); + MACRO_CALL(OpenSHC::OS_Func::_memcpy)(colorIndices, (byte*)this->loadedMiniMap + sizeof(palette), tileCount); + if (DAT_WindowAndDirectDraw::instance.colorBitMode == OpenSHC::Rendering::RGB_565) { + for (int i = 0; i < countof(palette); ++i) { + // read once, not per use (per use, MSVC unrolls the loop: quick_diff 0.8276 -> 0.6506) + ushort const color = palette[i]; + palette[i] = (color & ~0x1f) * 2 | color & 0x1f; + } + } + for (int i = 0; i < tileCount; ++i) { + ((ushort*)this->loadedMiniMap)[i] = palette[colorIndices[i]]; + } + MACRO_CALL(OpenSHC::OS_Func::_free_base)(colorIndices); + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3fe6087ed1..1ba9b4cfb1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -26895,7 +26895,7 @@ SHC_3BB0A8C1_0x004B5F70 | 0.0% | Pending SHC_3BB0A8C1_0x004B61F0 | 0.0% | Pending -SHC_3BB0A8C1_0x004B6320 | 0.0% | Pending +SHC_3BB0A8C1_0x004B6320 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B63C0 | 0.0% | Pending From a7ebd39eae4ee737d879f5a960a3ff6b6496e8c6 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:03:59 +0100 Subject: [PATCH 14/21] reimplement: SHC_3BB0A8C1_0x004B61F0 100.0% Reimplemented MinimapViewState::generateMinimapImage, from gynt's draft (c00d3e9e5 and 76f32dfd6, 70.33%, a2075f171, 70.3%, in his closed #256; 74.7% in 10280b161 on his fork's reimpl/UI-Core-development), rewritten from the binary as the counterpart of convertLoadedMinimapColors (0x004B6320, earlier in this branch): it packs the minimap into a palette of up to 256 colours and one index per tile. The colour mask is a ushort set in an if/else (an int mask stays in a register where the original reloads it from the stack: quick_diff 0.6404 -> 0.8315), the palette search leaves with a goto (measured against a break and an index test in its comment), the colour is compared first, and the RGB555 conversion shifts an int and masks with 0x7fe0 (measured in its comment). The two colour masks (0xf79e and 0xfbde) are written as the bits they clear. reccmp 100.0% (with --ignore-security-cookie). Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MinimapViewState/generateMinimapImage.cpp | 59 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp diff --git a/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp b/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp new file mode 100644 index 0000000000..7262a3b75d --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp @@ -0,0 +1,59 @@ +#include "../MinimapViewState.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Rendering/ColorMode.hpp" + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B61F0 + int MinimapViewState::generateMinimapImage() + { + // packs the minimap into a palette of up to 256 RGB555 colours and one palette index per tile + int const tileCount = countof(this->loadedMiniMap) * countof(this->loadedMiniMap[0]); + ushort palette[256]; + int colorCount = 0; + byte* const colorIndices = (byte*)MACRO_CALL(OpenSHC::OS_Func::_malloc)(tileCount); + // the lowest bit of each channel (of RGB565's green, the two lowest) is cleared, so close colours share an + // entry + ushort colorMask; + if (DAT_WindowAndDirectDraw::instance.colorBitMode == OpenSHC::Rendering::RGB_565) { + colorMask = (ushort) ~(1 << 11 | 3 << 5 | 1); + } else { + colorMask = (ushort) ~(1 << 10 | 1 << 5 | 1); + } + for (int i = 0; i < tileCount; ++i) { + uint const color = ((ushort*)this->loadedMiniMap)[i] & colorMask; + for (int index = 0; index < colorCount; ++index) { + if (color == palette[index]) { + colorIndices[i] = index; + // a goto out of the search, not a break and an index test (the test: quick_diff 0.8636 -> 0.8539) + goto nextTile; + } + } + if (colorCount < countof(palette)) { + palette[colorCount] = color; + colorIndices[i] = colorCount; + ++colorCount; + } else { + colorIndices[i] = 0; + } + nextTile:; + } + if (DAT_WindowAndDirectDraw::instance.colorBitMode == OpenSHC::Rendering::RGB_565) { + for (int i = 0; i < colorCount; ++i) { + int const color = palette[i]; + // 0x7fe0, not ~0x1f (~0x1f: quick_diff 0.8636 -> 0.7458) + palette[i] = color >> 1 & 0x7fe0 | color & 0x1f; + } + } + memcpy(this->loadedMiniMap, palette, sizeof(palette)); + MACRO_CALL(OpenSHC::OS_Func::_memcpy)((byte*)this->loadedMiniMap + sizeof(palette), colorIndices, tileCount); + MACRO_CALL(OpenSHC::OS_Func::_free_base)(colorIndices); + return sizeof(palette) + tileCount; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1ba9b4cfb1..5bc04afd9b 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -26893,7 +26893,7 @@ SHC_3BB0A8C1_0x004B5A20 | 0.0% | Pending SHC_3BB0A8C1_0x004B5F70 | 0.0% | Pending -SHC_3BB0A8C1_0x004B61F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B61F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B6320 | 100.0% | Reimplemented From 5383a121d7636420f6971c65cc1807320b3165ed Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:04:00 +0100 Subject: [PATCH 15/21] reimplement: SHC_3BB0A8C1_0x004B7300 100.0% Reimplemented MinimapViewState::renderMinimapMain, from gynt's draft (2e5a61f3c and 270c7e281, 45.5%, af82e4141, 65.40%, in his closed #256; field names in 2113d0bc6 and 314b50c59 on his fork's archive/UI-MenuViews-development-second-pass; 10280b161 on reimpl/UI-Core-development). The code is mostly his. Changed from the draft, to match the binary: the large-map test is mapSize > 200 (the draft's < 200 swapped the two draws at exactly 200), with the two drawMinimap calls written out per branch; the y offset adds viewportY / 8 first (the other order: quick_diff 0.9911 -> 0.9464); the counter wraps with % 4; the click test is one condition; the cursor picture is GM_MINI_CURSORS (the draft's (eGM)153); and field_0xc and someMiniMapCounterTill4 are main's names now. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../UI/MinimapViewState/renderMinimapMain.cpp | 61 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp diff --git a/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp b/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp new file mode 100644 index 0000000000..b99cecb648 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp @@ -0,0 +1,61 @@ +#include "../MinimapViewState.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B7300 + void MinimapViewState::renderMinimapMain() + { + int const xOffset = (DAT_ViewportRenderState::instance.viewportState.viewportHeight - 5) / 2 + + DAT_ViewportRenderState::instance.viewportState.viewportX / 32; + int const yOffset = DAT_ViewportRenderState::instance.viewportState.viewportY / 8 + + DAT_ViewportRenderState::instance.viewportState.viewportWidth / 2; + if (this->needsRedraw || xOffset != this->lastRenderedXOffset || yOffset != this->lastRenderedYOffset) { + if (DAT_TileMapState::instance.mapSize > 200) { + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::drawMinimap, this)( + DAT_MenuHandlerState::instance.x + 571, DAT_MenuHandlerState::instance.y + 465, 126, 126, 7, + xOffset, yOffset, 2, 1, 0); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::drawMinimap, this)( + DAT_MenuHandlerState::instance.x + 571, DAT_MenuHandlerState::instance.y + 465, 126, 126, 7, + xOffset, yOffset, 4, 2, 0); + } + } + this->lastRenderedXOffset = xOffset; + this->lastRenderedYOffset = yOffset; + this->needsRedraw = 0; + this->field_0xc = 0; + this->someMiniMapCounterTill4 = (this->someMiniMapCounterTill4 + 1) % 4; + if (DAT_TileMapState::instance.DAT_SelectionIconType && this->minimapClickEnabled + && DAT_MouseState::instance.screenSpaceX >= DAT_MenuHandlerState::instance.x + 571 + && DAT_MouseState::instance.screenSpaceX < DAT_MenuHandlerState::instance.x + 697 + && DAT_MouseState::instance.screenSpaceY >= DAT_MenuHandlerState::instance.y + 465 + && DAT_MouseState::instance.screenSpaceY < DAT_MenuHandlerState::instance.y + 591) { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_MINI_CURSORS, + DAT_TileMapState::instance.DAT_SelectionIconType, + DAT_MouseState::instance.screenSpaceX + - DAT_TextureRenderCoreObject::instance + .gmFileHeaderColorpaletteArray[OpenSHC::DE::SHCDE::GM_MINI_CURSORS] + .originX, + DAT_MouseState::instance.screenSpaceY + - DAT_TextureRenderCoreObject::instance + .gmFileHeaderColorpaletteArray[OpenSHC::DE::SHCDE::GM_MINI_CURSORS] + .originY); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 5bc04afd9b..0ae4ed7c2c 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -27063,7 +27063,7 @@ SHC_3BB0A8C1_0x004B72F9 | 0.0% | Pending SHC_3BB0A8C1_0x004B72FA | 0.0% | Pending -SHC_3BB0A8C1_0x004B7300 | 0.0% | Pending +SHC_3BB0A8C1_0x004B7300 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B7460 | 100.0% | Reimplemented From a5781f4188ee2bcd46c00dbbb6e5557c86053f76 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:04:01 +0100 Subject: [PATCH 16/21] reimplement: SHC_3BB0A8C1_0x00464300 100.0% Reimplemented Rendering::RenderCurrentButtonOnScreenMenu, from gynt's draft (6e94dc7b8, 47.27%, and ea80e97d8, 47.3%, in his closed #255). The picture number is an argument of drawTgxGmOnFlaggedSurface rather than a local (the original pushes y and x before it calls getPictureNumberInGm), and the file goes into cmake/compiler-flags-gl.txt next to getPictureNumberInGm and RenderCurrentNotActiveButtonWithPossibleAlphaTexOnCurrentSurfaceUnk: the original keeps buttonGmData in ecx across that call, which needs link-time code generation. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- cmake/compiler-flags-gl.txt | 1 + .../RenderCurrentButtonOnScreenMenu.cpp | 39 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp diff --git a/cmake/compiler-flags-gl.txt b/cmake/compiler-flags-gl.txt index 78cbe5b880..648b45607a 100644 --- a/cmake/compiler-flags-gl.txt +++ b/cmake/compiler-flags-gl.txt @@ -122,3 +122,4 @@ src/OpenSHC/UI/DisplayElements/GetIfDisplayElementStateNotZero.cpp src/OpenSHC/UI/DisplayElements/FindDisplayElementWithID.cpp src/OpenSHC/UI/HoveredState/clearHoveredState.cpp src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp +src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp diff --git a/src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp b/src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp new file mode 100644 index 0000000000..5a974f7652 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp @@ -0,0 +1,39 @@ +#include "../Rendering.func.hpp" + +#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonPictureInGm.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UIButtonDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + + using IO::Graphics::GmID; + + // FUNCTION: STRONGHOLDCRUSADER 0x00464300 + void Rendering::RenderCurrentButtonOnScreenMenu() + { + ButtonGmData* const buttonGmData + = &DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance]; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(UI::Rendering::TextureRenderCore_Func::drawTgxGmOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)((GmID)buttonGmData->gmId_0x0, + MACRO_CALL_MEMBER(UI::Rendering::ButtonGmData_Func::getPictureNumberInGm, buttonGmData)( + DAT_ButtonCurrentlyInteracting::instance), + DAT_ButtonX::instance, DAT_ButtonY::instance); + DAT_CurrentButtonPictureInGm::instance + = DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .pictureInGm_0x4; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 0ae4ed7c2c..95789cb554 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19759,7 +19759,7 @@ SHC_3BB0A8C1_0x004641A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00464260 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00464300 | 0.0% | Pending +SHC_3BB0A8C1_0x00464300 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00464370 | 0.0% | Pending From c138819216a53880b1d2ba677f1f3f1f6a93ce69 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:04:01 +0100 Subject: [PATCH 17/21] reimplement: SHC_3BB0A8C1_0x00464370 100.0% Reimplemented Rendering::RenderCurrentButtonToScreenMenuWithBlendingUnk, from gynt's draft (5fc002291, 40.00%, and 34ea3660c, 40.0%, in his closed #255), in the form of RenderCurrentButtonOnScreenMenu (0x00464300, previous commit): a blend strength of 32 returns early, the picture number is an argument of renderGMWithBlending, and the file goes into cmake/compiler-flags-gl.txt so that buttonGmData stays in ecx across getPictureNumberInGm. reccmp 100.0%. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- cmake/compiler-flags-gl.txt | 1 + ...rrentButtonToScreenMenuWithBlendingUnk.cpp | 42 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/Rendering/RenderCurrentButtonToScreenMenuWithBlendingUnk.cpp diff --git a/cmake/compiler-flags-gl.txt b/cmake/compiler-flags-gl.txt index 648b45607a..89537a3a92 100644 --- a/cmake/compiler-flags-gl.txt +++ b/cmake/compiler-flags-gl.txt @@ -123,3 +123,4 @@ src/OpenSHC/UI/DisplayElements/FindDisplayElementWithID.cpp src/OpenSHC/UI/HoveredState/clearHoveredState.cpp src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp +src/OpenSHC/UI/Rendering/RenderCurrentButtonToScreenMenuWithBlendingUnk.cpp diff --git a/src/OpenSHC/UI/Rendering/RenderCurrentButtonToScreenMenuWithBlendingUnk.cpp b/src/OpenSHC/UI/Rendering/RenderCurrentButtonToScreenMenuWithBlendingUnk.cpp new file mode 100644 index 0000000000..e2200f3fa8 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderCurrentButtonToScreenMenuWithBlendingUnk.cpp @@ -0,0 +1,42 @@ +#include "../Rendering.func.hpp" + +#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonPictureInGm.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UIButtonDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + + using IO::Graphics::GmID; + + // FUNCTION: STRONGHOLDCRUSADER 0x00464370 + void Rendering::RenderCurrentButtonToScreenMenuWithBlendingUnk(int blendStrengthUnk) + { + if (blendStrengthUnk == 32) { + return; + } + ButtonGmData* const buttonGmData + = &DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance]; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)((GmID)buttonGmData->gmId_0x0, + MACRO_CALL_MEMBER(UI::Rendering::ButtonGmData_Func::getPictureNumberInGm, buttonGmData)( + DAT_ButtonCurrentlyInteracting::instance), + DAT_ButtonX::instance, DAT_ButtonY::instance, blendStrengthUnk); + DAT_CurrentButtonPictureInGm::instance + = DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .pictureInGm_0x4; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 95789cb554..9791354bdd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19761,7 +19761,7 @@ SHC_3BB0A8C1_0x00464260 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00464300 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00464370 | 0.0% | Pending +SHC_3BB0A8C1_0x00464370 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004643F0 | 0.0% | Pending From 6905948fc41de28e74b21cf7390c9a9ca79d561b Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 19:52:55 +0100 Subject: [PATCH 18/21] header: BuildMenuTabType gets BMTT_UNKNOWN_62 MenuView_BuildMenu_DoInitial (0x00431B60) returns early when activeMenuTab.buildMenuTab is 62, a tab the enum has no name for. Main's hideOrUnhideUI (0x00471AA0) switches the build menu from BMTT_SOLDIERS to 62 when it hides the menu and from 62 back to BMTT_SOLDIERS when it shows it again, so 62 is the hidden soldiers tab. Named the way the enum already names 49 (BMTT_UNKNOWN_49) until Ghidra has a name for it. Used in a later commit; code generation is the same. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/UI/Enums/BuildMenuTabType.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenSHC/UI/Enums/BuildMenuTabType.hpp b/src/OpenSHC/UI/Enums/BuildMenuTabType.hpp index def20ec6e8..8be87d64cc 100644 --- a/src/OpenSHC/UI/Enums/BuildMenuTabType.hpp +++ b/src/OpenSHC/UI/Enums/BuildMenuTabType.hpp @@ -33,6 +33,7 @@ namespace UI { BMTT_UNKNOWN_49 = 49, // 0x00000031 BMTT_MENU_HIDDEN = 60, // 0x0000003C BMTT_SOLDIERS = 61, // 0x0000003D + BMTT_UNKNOWN_62 = 62, // 0x0000003E BMTT_CITIZEN_SELECTED = 70 // 0x00000046 } BuildMenuTabType; From 23c7f460de7c1a21009be9e97748b443a39d239d Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 19:52:56 +0100 Subject: [PATCH 19/21] header: SoundEffectID gets SEID_UNKNOWN_0x67 MenuHandlerState::startBuildMenuTransition (0x004F4C80) plays sound effect 103 (push 0x67 before setUpSFXToPlayUnk), which the enum leaves out between SEID_BURNING_MAN_SCREAM2 (100) and SEID_CATAPULT_SHOOT (106); gynt's draft wrote it SEID_BURNING_MAN_SCREAM2 | SEID_WOOD_SAW. Named in the enum's SEID_UNKNOWN_0x.. form. Used in a later commit; code generation is the same. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Audio/SFX/SoundEffectID.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenSHC/Audio/SFX/SoundEffectID.hpp b/src/OpenSHC/Audio/SFX/SoundEffectID.hpp index 79f4314fdb..920080de02 100644 --- a/src/OpenSHC/Audio/SFX/SoundEffectID.hpp +++ b/src/OpenSHC/Audio/SFX/SoundEffectID.hpp @@ -88,6 +88,7 @@ namespace Audio { SEID_RABBIT_DIE1 = 92, // 0x0000005C SEID_BURNING_MAN_SCREAM = 97, // 0x00000061 SEID_BURNING_MAN_SCREAM2 = 100, // 0x00000064 + SEID_UNKNOWN_0x67 = 103, // 0x00000067 SEID_CATAPULT_SHOOT = 106, // 0x0000006A SEID_TREBUCHET_DESTROYED = 111, // 0x0000006F SEID_SIEGE_EQUIPMENT_DESTROYED = 112, // 0x00000070 From 85b9d29404fb528b84193cb04bd08a2f872b220c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 19:54:53 +0100 Subject: [PATCH 20/21] UI: banner texts, BMTT_UNKNOWN_62 and SEID_UNKNOWN_0x67 in use, unused includes - MenuView_BuildMenu_DoInitial compares with BMTT_UNKNOWN_62 (header commit) in one early return with the hidden menu, the comments keep only their reasons, and a fixme says that from 1280x1024 on editor and siege games reset the gfx list before the second load, so slot 1 is drawn without being loaded (the original's bug; it matches). - startBuildMenuTransition plays SEID_UNKNOWN_0x67 (header commit) in place of (SoundEffectID)103. - The fifteen drawHeaderTextBanner callers have their banner text above the call, from cr.tex, as main's three named callers do. - setupMenuForRendering says why currentMenu is read again for the last two calls; renderMinimapMain writes needsRedraw = FALSE, compares DAT_SelectionIconType with 0 and the map size with MC_MAP_SIZE_200; convertLoadedMinimapColors says why one copy is inlined and the other calls _memcpy, and loses its history line; generateMinimapImage writes its mask as 31 << 10 | 31 << 5 like its colorMask lines, its comment on one line; hasPassedCountdownOrDuration uses --unknownCountdown01 and countdown -= now - previousTime. - Unused includes and usings go (MappersEnum, MenuModalType, MenuViewType, SoundEffectID's using). Kept, measured: setupMenuForRendering's pointer over the pairs (indexed: quick_diff 1.0000 -> 0.3636), with a line in the code. Everything else is quick_diff-identical, and all functions the branch touches are reccmp 100.0 in a full build. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../hasPassedCountdownOrDuration.cpp | 4 ++-- .../UI/HoveredState/createHoverStateElement.cpp | 3 --- .../MenuHandlerState/setupMenuForRendering.cpp | 5 ++--- .../startBuildMenuTransition.cpp | 5 ++--- ...dalRenderFunction_CreateOrTriggerInvasion.cpp | 1 + .../MenuModalRenderFunction_DisableTroops.cpp | 1 + .../MenuModalRenderFunction_DisableWeapon.cpp | 1 + ...ModalRenderFunction_EnterTitleOnGameStart.cpp | 1 + .../MenuModalRenderFunction_GameplayOptions.cpp | 1 + .../MenuModalRenderFunction_NetworkOptions.cpp | 1 + .../MenuModalRenderFunction_OnlineQuitGame.cpp | 1 + .../MenuModalRenderFunction_OptionsMenu.cpp | 1 + ...lRenderFunction_SkirmishConnectionOptions.cpp | 1 + ...nuModalRenderFunction_SkirmishPlayOptions.cpp | 1 + .../MenuModalRenderFunction_SoundOptions.cpp | 1 + .../MenuModalRenderFunction_StartGoods.cpp | 1 + .../MenuModalRenderFunction_TraderSettings.cpp | 1 + .../MenuModalRenderFunction_TriggerEvent.cpp | 1 + ...nderFunction_UnusedSiegeAttackingForceUnk.cpp | 1 + .../Constructor_MenuTextInputState.cpp | 2 -- .../BuildMenu/MenuView_BuildMenu_DoInitial.cpp | 16 ++++++++++------ .../convertLoadedMinimapColors.cpp | 2 +- .../UI/MinimapViewState/generateMinimapImage.cpp | 7 +++---- .../UI/MinimapViewState/renderMinimapMain.cpp | 7 ++++--- 24 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp b/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp index e1428adcb5..9e02329d77 100644 --- a/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp +++ b/src/OpenSHC/UI/BottomLeftTextDisplayState/hasPassedCountdownOrDuration.cpp @@ -17,13 +17,13 @@ namespace UI { this->unknownCountdown01 = 1; } } else if (this->unknownCountdown01 != 0) { - this->unknownCountdown01--; + --this->unknownCountdown01; } DWORD const now = timeGetTime(); DWORD const previousTime = DAT_TextRelatedTime::instance; DAT_TextRelatedTime::instance = now; if (previousTime != 0) { - this->countdown += previousTime - now; + this->countdown -= now - previousTime; } } diff --git a/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp b/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp index 9e2f9cecaf..5d30c7568a 100644 --- a/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp +++ b/src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp @@ -1,6 +1,5 @@ #include "../HoveredState.func.hpp" -#include "OpenSHC/Commands/MappersEnum.hpp" #include "OpenSHC/Game/GameMode.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -9,8 +8,6 @@ namespace OpenSHC { namespace UI { - using Commands::MappersEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x00501110 void HoveredState::createHoverStateElement(int x, int y, MappersEnum type, int size, int flag) { diff --git a/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp b/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp index 575ec3a0bb..82a9a29f28 100644 --- a/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp +++ b/src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp @@ -2,16 +2,14 @@ #include "OpenSHC/UI/Menu.func.hpp" #include "OpenSHC/UI/Enums/MenuItemHandleState.hpp" -#include "OpenSHC/UI/Enums/MenuViewType.hpp" namespace OpenSHC { namespace UI { - using OpenSHC::UI::Enums::MenuViewType; - // FUNCTION: STRONGHOLDCRUSADER 0x004F6A80 void MenuHandlerState::setupMenuForRendering(MenuViewType menuID) { + // a pointer over the pairs: indexing the map measures lower (quick_diff 1.0000 -> 0.3636) for (MenuIDMenuElementAddressPair* pair = this->pointerToMenuIDMenuElementAddressMap; pair->menuID != OpenSHC::UI::Enums::MVT_MENUVIEWID_MENU_PAIR_ENDMARKER; ++pair) { if (pair->menuID == menuID) { @@ -20,6 +18,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::handleMenuItems, menu)( OpenSHC::UI::Enums::MIHS_RESET_MENU_ITEM_STATEUnk); menu->zero = 0; + // currentMenu is read again for these two, as the original does this->currentMenu->one = 1; MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::loadMenuElements, this->currentMenu)(0); return; diff --git a/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp b/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp index 720ffd5279..f368cd69b3 100644 --- a/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp +++ b/src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp @@ -8,8 +8,6 @@ namespace OpenSHC { namespace UI { - using OpenSHC::Audio::SFX::SoundEffectID; - // FUNCTION: STRONGHOLDCRUSADER 0x004F4C80 void MenuHandlerState::startBuildMenuTransition(int transitionDuration) { @@ -22,7 +20,8 @@ namespace UI { } else { this->buildMenuTransitionDirection_0x2c = -1; } - MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)((SoundEffectID)103); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_UNKNOWN_0x67); } } diff --git a/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp b/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp index 09f0db491b..e10989d136 100644 --- a/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp +++ b/src/OpenSHC/UI/MenuModals/CreateOrTriggerInvasion/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004AB540 void MenuModalRenderFunction_CreateOrTriggerInvasion(int x, int y, int width, int height) { + // "Invasion" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 46, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp b/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp index 83c2950fa4..65f99551f8 100644 --- a/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp +++ b/src/OpenSHC/UI/MenuModals/DisableTroops/MenuModalRenderFunction_DisableTroops.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004ABCB0 void MenuModalRenderFunction_DisableTroops(int x, int y, int width, int height) { + // "Troops" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 188, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp b/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp index 066274f6c4..b209139dc8 100644 --- a/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp +++ b/src/OpenSHC/UI/MenuModals/DisableWeapon/MenuModalRenderFunction_DisableWeapon.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004ABCE0 void MenuModalRenderFunction_DisableWeapon(int x, int y, int width, int height) { + // "Weapons" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 189, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp b/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp index fb34034188..b35f615523 100644 --- a/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp +++ b/src/OpenSHC/UI/MenuModals/EnterTitleOnGameStart/MenuModalRenderFunction_EnterTitleOnGameStart.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00491BF0 void MenuModalRenderFunction_EnterTitleOnGameStart(int x, int y, int width, int height) { + // "Enter Your Title" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_MAINOPTIONS, 6, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp b/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp index 073d005236..f631628a0e 100644 --- a/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/GameplayOptions/MenuModalRenderFunction_GameplayOptions.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00491E80 void MenuModalRenderFunction_GameplayOptions(int x, int y, int width, int height) { + // "Game Play Options" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 25, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp b/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp index 707d2e0613..b0ac831483 100644 --- a/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/NetworkOptions/MenuModalRenderFunction_NetworkOptions.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00492A60 void MenuModalRenderFunction_NetworkOptions(int x, int y, int width, int height) { + // "Network Options" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 6, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp b/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp index 7c39b839c1..356dea2e0e 100644 --- a/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp +++ b/src/OpenSHC/UI/MenuModals/OnlineQuitGame/MenuModalRenderFunction_OnlineQuitGame.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004937B0 void MenuModalRenderFunction_OnlineQuitGame(int x, int y, int width, int height) { + // "Quit Mission" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 7, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp b/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp index ec6f01b044..68441feaff 100644 --- a/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp +++ b/src/OpenSHC/UI/MenuModals/OptionsMenu/MenuModalRenderFunction_OptionsMenu.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00491810 void MenuModalRenderFunction_OptionsMenu(int x, int y, int width, int height) { + // "Game Options" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 1, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp b/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp index 79029ad791..60bee8a80f 100644 --- a/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/SkirmishConnectionOptions/MenuModalRenderFunction_SkirmishConnectionOptions.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004ABE50 void MenuModalRenderFunction_SkirmishConnectionOptions(int x, int y, int width, int height) { + // "Connection options" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 93, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp b/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp index c871907a35..901ee078b1 100644 --- a/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/SkirmishPlayOptions/MenuModalRenderFunction_SkirmishPlayOptions.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004ABE80 void MenuModalRenderFunction_SkirmishPlayOptions(int x, int y, int width, int height) { + // "Play Options" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 103, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp b/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp index c3a2531376..a72f79f6fa 100644 --- a/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp +++ b/src/OpenSHC/UI/MenuModals/SoundOptions/MenuModalRenderFunction_SoundOptions.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00492660 void MenuModalRenderFunction_SoundOptions(int x, int y, int width, int height) { + // "Sound Options" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 5, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp b/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp index 488ceb1b44..a53526d45b 100644 --- a/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp +++ b/src/OpenSHC/UI/MenuModals/StartGoods/MenuModalRenderFunction_StartGoods.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004AB4E0 void MenuModalRenderFunction_StartGoods(int x, int y, int width, int height) { + // "Start Goods" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 41, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp b/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp index 632c2d2298..753295be99 100644 --- a/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp +++ b/src/OpenSHC/UI/MenuModals/TraderSettings/MenuModalRenderFunction_TraderSettings.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004AB4B0 void MenuModalRenderFunction_TraderSettings(int x, int y, int width, int height) { + // "Trader" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 38, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp b/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp index 790886a177..836a0993f4 100644 --- a/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp +++ b/src/OpenSHC/UI/MenuModals/TriggerEvent/MenuModalRenderFunction_TriggerEvent.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004AC250 void MenuModalRenderFunction_TriggerEvent(int x, int y, int width, int height) { + // "Events" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 23, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp b/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp index a778720e5f..ca04bc963e 100644 --- a/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp +++ b/src/OpenSHC/UI/MenuModals/UnusedSiegeAttackingForceUnk/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp @@ -13,6 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004AB510 void MenuModalRenderFunction_UnusedSiegeAttackingForceUnk(int x, int y, int width, int height) { + // "Attacking Force" MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 164, x, y, width, height); } diff --git a/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp b/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp index 03ae22890d..117c571a62 100644 --- a/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp +++ b/src/OpenSHC/UI/MenuTextInputState/Constructor_MenuTextInputState.cpp @@ -1,7 +1,5 @@ #include "../MenuTextInputState.func.hpp" -#include "OpenSHC/UI/Enums/MenuModalType.hpp" - namespace OpenSHC { namespace UI { diff --git a/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp b/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp index 96b133667b..70aa0c6b24 100644 --- a/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp +++ b/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp @@ -23,7 +23,7 @@ namespace UI { void BuildMenu::MenuView_BuildMenu_DoInitial() { // the build menu sits at the bottom of the screen, at its left edge at 640x480 - // y is set in each branch, not before the test (before the test: quick_diff 0.9992 -> 0.9984) + // y is set in each branch: one assignment before the test measures lower int y; if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_640x480) { y = DAT_WindowAndDirectDraw::instance.resolutionY - 600; @@ -124,6 +124,8 @@ namespace UI { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } + // fixme: from 1280x1024 on, editor and siege games reset the list before the second load, so slot 1 is + // drawn without being loaded if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; // "edge_military_1280l.tgx" @@ -449,11 +451,9 @@ namespace UI { = OpenSHC::Rendering::Enums::RT_MAP_GAME; } } else { - // no picture for a hidden menu or tab 62 (BuildMenuTabType has no name for it) - if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_MENU_HIDDEN) { - return; - } - if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == 62) { + // no picture for a hidden menu or tab 62 + if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_MENU_HIDDEN + || DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_UNKNOWN_62) { return; } if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SIEGE_THAT) { @@ -516,6 +516,8 @@ namespace UI { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } + // fixme: from 1280x1024 on, editor and siege games reset the list before the second load, so slot 1 + // is drawn without being loaded if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; // "edge1280l.tgx" @@ -783,6 +785,8 @@ namespace UI { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } + // fixme: from 1280x1024 on, editor and siege games reset the list before the second load, so slot 1 + // is drawn without being loaded if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; // "edge1280l.tgx" diff --git a/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp b/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp index 665830c447..30863c474e 100644 --- a/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp +++ b/src/OpenSHC/UI/MinimapViewState/convertLoadedMinimapColors.cpp @@ -15,11 +15,11 @@ namespace UI { int const tileCount = countof(this->loadedMiniMap) * countof(this->loadedMiniMap[0]); ushort palette[256]; byte* const colorIndices = (byte*)MACRO_CALL(OpenSHC::OS_Func::_malloc)(tileCount); + // the palette copy is inlined, the index copy calls _memcpy, as the original does memcpy(palette, this->loadedMiniMap, sizeof(palette)); MACRO_CALL(OpenSHC::OS_Func::_memcpy)(colorIndices, (byte*)this->loadedMiniMap + sizeof(palette), tileCount); if (DAT_WindowAndDirectDraw::instance.colorBitMode == OpenSHC::Rendering::RGB_565) { for (int i = 0; i < countof(palette); ++i) { - // read once, not per use (per use, MSVC unrolls the loop: quick_diff 0.8276 -> 0.6506) ushort const color = palette[i]; palette[i] = (color & ~0x1f) * 2 | color & 0x1f; } diff --git a/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp b/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp index 7262a3b75d..8db7bf37a3 100644 --- a/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp +++ b/src/OpenSHC/UI/MinimapViewState/generateMinimapImage.cpp @@ -16,8 +16,7 @@ namespace UI { ushort palette[256]; int colorCount = 0; byte* const colorIndices = (byte*)MACRO_CALL(OpenSHC::OS_Func::_malloc)(tileCount); - // the lowest bit of each channel (of RGB565's green, the two lowest) is cleared, so close colours share an - // entry + // the lowest bit of each channel (RGB565's green: the two lowest) is cleared, so close colours share an entry ushort colorMask; if (DAT_WindowAndDirectDraw::instance.colorBitMode == OpenSHC::Rendering::RGB_565) { colorMask = (ushort) ~(1 << 11 | 3 << 5 | 1); @@ -45,8 +44,8 @@ namespace UI { if (DAT_WindowAndDirectDraw::instance.colorBitMode == OpenSHC::Rendering::RGB_565) { for (int i = 0; i < colorCount; ++i) { int const color = palette[i]; - // 0x7fe0, not ~0x1f (~0x1f: quick_diff 0.8636 -> 0.7458) - palette[i] = color >> 1 & 0x7fe0 | color & 0x1f; + // red and green shifted down, not ~0x1f (~0x1f: quick_diff 0.8636 -> 0.7458) + palette[i] = color >> 1 & (31 << 10 | 31 << 5) | color & 0x1f; } } memcpy(this->loadedMiniMap, palette, sizeof(palette)); diff --git a/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp b/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp index b99cecb648..9b4a4bd74f 100644 --- a/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp +++ b/src/OpenSHC/UI/MinimapViewState/renderMinimapMain.cpp @@ -2,6 +2,7 @@ #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" #include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/Map/MapConstants.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" @@ -21,7 +22,7 @@ namespace UI { int const yOffset = DAT_ViewportRenderState::instance.viewportState.viewportY / 8 + DAT_ViewportRenderState::instance.viewportState.viewportWidth / 2; if (this->needsRedraw || xOffset != this->lastRenderedXOffset || yOffset != this->lastRenderedYOffset) { - if (DAT_TileMapState::instance.mapSize > 200) { + if (DAT_TileMapState::instance.mapSize > OpenSHC::Map::MC_MAP_SIZE_200) { MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::drawMinimap, this)( DAT_MenuHandlerState::instance.x + 571, DAT_MenuHandlerState::instance.y + 465, 126, 126, 7, xOffset, yOffset, 2, 1, 0); @@ -33,10 +34,10 @@ namespace UI { } this->lastRenderedXOffset = xOffset; this->lastRenderedYOffset = yOffset; - this->needsRedraw = 0; + this->needsRedraw = FALSE; this->field_0xc = 0; this->someMiniMapCounterTill4 = (this->someMiniMapCounterTill4 + 1) % 4; - if (DAT_TileMapState::instance.DAT_SelectionIconType && this->minimapClickEnabled + if (DAT_TileMapState::instance.DAT_SelectionIconType != 0 && this->minimapClickEnabled && DAT_MouseState::instance.screenSpaceX >= DAT_MenuHandlerState::instance.x + 571 && DAT_MouseState::instance.screenSpaceX < DAT_MenuHandlerState::instance.x + 697 && DAT_MouseState::instance.screenSpaceY >= DAT_MenuHandlerState::instance.y + 465 From 2b4a87527fd2e17bcb4ad7c9a06b2529a4692a26 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 20:20:16 +0100 Subject: [PATCH 21/21] MenuView_BuildMenu_DoInitial: the fixme only where the list is reset twice Only the soldiers tab resets totalLoadedGfx a second time, in editor and siege games, before loading slot 1; the other tabs reset it once per resolution and load both slots. The two copies of the fixme on those tabs go, and the true one fits on one line. Comments only. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp b/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp index 70aa0c6b24..e029864314 100644 --- a/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp +++ b/src/OpenSHC/UI/MenuViews/BuildMenu/MenuView_BuildMenu_DoInitial.cpp @@ -124,8 +124,7 @@ namespace UI { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } - // fixme: from 1280x1024 on, editor and siege games reset the list before the second load, so slot 1 is - // drawn without being loaded + // fixme: below, editor and siege games reset the list before the second load, so slot 1 is drawn stale if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; // "edge_military_1280l.tgx" @@ -516,8 +515,6 @@ namespace UI { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } - // fixme: from 1280x1024 on, editor and siege games reset the list before the second load, so slot 1 - // is drawn without being loaded if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; // "edge1280l.tgx" @@ -785,8 +782,6 @@ namespace UI { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } - // fixme: from 1280x1024 on, editor and siege games reset the list before the second load, so slot 1 - // is drawn without being loaded if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; // "edge1280l.tgx"