From 5121e7cf86ddaa4bdb480ae7c87cacc62cd691df Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 21 Nov 2026 12:29:06 +0100 Subject: [PATCH] reimplement: SHC_3BB0A8C1_0x00428AC0 100.0% Reimplemented General::MenuItemRenderFunction_General_AdvancedGameOptions, rewritten from the original's listing. gynt's draft: fd61234e8 at 40.37% ("reordered stores") on his fork's reimpl/UI-MenuItems-development, whose status line records 40.4% (the newest commit on the file there is e63ae309a, a style commit); his reimpl/UI-MenuItems has 2c8203859 at 40.03%, status line 40.0% ("Style pass, asm differs"), after 77fde3641 at 41.32%, his highest there. Our draft (530c671e7, then 53bea5fdf and 07a33e2bb; 42.5% in the draft PR #328) was his code with a mechanical pass. The function draws the advanced game options of the lobby and the skirmish setup, one menu item per call, chosen by the item's number: a label at the left and the option's value at the right (a text, a number, or a tick picture for the on / off options). It draws nothing behind the map dialogs, the round table and the lord choices, only the skirmish options' own items while those are open, and some items only for the host or outside a single player skirmish. Behaviour fixes against the draft, each in the draft's own listing. Most of its items had no return, so they ran on into the code that draws the other items' label, with their own number as the text's number: - 31 (tech level), 36 (win condition), 83 (troops) and -1000 (the Back button) drew a second text after theirs, text number 31, 36, 83 or -1000 of TEXT_XPLAY_WAITING_ROOM. The original returns after each (0x00428C8F, 0x00428CE6, 0x00428D8A, 0x00428E8B). - 103 did the same after its button, and with the colour unset. The original leaves through the button's function (a tail jump at 0x00428E97). - -11 (no dogs) and -13 (extreme mode) drew that second text after their tick picture. The original returns (0x004290E5, 0x00428FBA). - -12 (no rush) drew it after the value text for setting 5. The original returns (0x00429318). - 99 (strong walls) never returned: after its picture the draft went back to its own text and picture, an endless loop. The original returns (0x004290E5). gynt's fd61234e8 and 2c8203859 end 99 with the same goto into -11's block and loop too; his 77fde3641 has a return in that block's ticked arm, so there 99 loops only with strong walls off, and with them on it returns without the picture, leaving drawBufferChoiceValue at RT_SCREEN_MENU (2c8203859, "bug fix", took that return out). - 100 (alliances) drew both value texts, 101 and then 102, when alliances are off. The original draws one of the two (0x004295D3). What decided the match. The counts are differing lines of our own exact listing compare against the original's 961 instructions (operands with the original's addresses and every jump's landing), each with that one thing changed from the final code, which has 0: - The item blocks in the original's order, each ending in a return: 36 before 31: 217; 103 before -1000: 32; 99 before -10: 56; -12 before -10: 486. - 83's value text number is held in the parameter: the code stores 84 in `button` for troops that cost gold, as AlliesOrder_Main on main does. With a variable of its own: 877; with a call in each arm: 802. - The colour is set before the call in the interacting arm and after it in the other (the other way: 342 and 2), and it has no first value: 103 never sets it (with `= 0`: 30). - The flag items' tick picture with a renderGM call in each arm. One call with a conditional expression: 705. - The alpha written out in every call. One local for the items from -10 on: 352. - No-rush and auto-save test each value in its own if. As else-if chains: 43 and 27. - Smaller: the tech level's text number computed whole before the first call (only `/ 2` early: 4; in the call: 19), 109's number in a local with one call (a call in each arm: 44), 100's alliances as a truth test (`== 0` with the arms swapped: 6). These gave the same code, and the plainer form stands: the modal filter as one else-if (nested ifs tie), the single player filter as one condition, 103's flag in a nested if, 109's number by if / else (where the draft added a comparison to 109), the value's x as W + X - 20 or W - 20 + X, and 83's number in `button` written directly or named through a reference. The text numbers carry their texts from the game's cr.tex (TEXT_XPLAY_WAITING_ROOM, TEXT_SKIRMISH_MISC, TEXT_GAME_OPTIONS) as comments. Neither they nor the other new comments change the listing: this code compiles to the same instructions, line for line, as the code the narrow build with the callees and the full build measured. Measured in a narrow build on main 3458fea34 of that code and the four finished functions it calls, struct resolvers and their resolvers on: renderGM (0x00455300), renderBasicButton (0x00463A90), renderNonInteractingButtonBackground (0x004246E0) and MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface (0x00463FF0), which 103 tail-calls. reccmp 100.0, normalized 100.0, no diff line. The last of the four is on main's /GL list and reads 67.3 in that build, as its own callee is not in it. With only this file, as committed, in the list, the callees' resolvers off, the function reads 100.0 (100.0 normalized) too. Not run in game. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...erFunction_General_AdvancedGameOptions.cpp | 418 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 419 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_AdvancedGameOptions.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_AdvancedGameOptions.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_AdvancedGameOptions.cpp new file mode 100644 index 0000000000..53988a4282 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_AdvancedGameOptions.cpp @@ -0,0 +1,418 @@ +#include "../General.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00428AC0 + void General::MenuItemRenderFunction_General_AdvancedGameOptions(int button, ...) + { + // nothing behind the map dialogs, the round table or the lord choices; skirmish options: only their items + if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_LOAD_MAP + || DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_SEND_MAP_TO + || DAT_MenuModalComposition1::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_RECEIVE_MAP_FROM) { + return; + } + if (DAT_MenuModalComposition1::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_SKIRMISH_PLAY_OPTIONS) { + if (button != -1000 && button != -10 && button != -11 && button != -12 && button != -13 && button != -14 + && button != 99 && button != 100 && button != 83 && button != 109 && button != 82 && button != 94) { + return; + } + } else if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_ROUNDTABLE + || DAT_MenuModalComposition1::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_BASIC_AI_LORD_SELECT + || DAT_MenuModalComposition1::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { + return; + } + if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER + && (button == 93 || button == 31)) { + return; + } + if (button == 103) { + DAT_ButtonUnknownZero::instance = FALSE; + if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER) { + DAT_ButtonUnknownZero::instance = TRUE; + return; + } + } + if (!DAT_GameSynchronyState::instance.isHost) { + if (button == 103) { + DAT_ButtonUnknownZero::instance = TRUE; + return; + } + if (button == 93) { + return; + } + } + if (button == -1) { + DAT_ButtonUnknownZero::instance = TRUE; + return; + } + // not set for 103, whose button another function draws (a first value loses the match) + uint color; + if (button != 103) { + // the colour before the call here and after it below (the other way, the match is lost) + if (DAT_ButtonCurrentlyInteracting::instance && DAT_GameSynchronyState::instance.isHost) { + color = OpenSHC::Rendering::Colors::COL_CCFAFF; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton, + AlphaAndButtonSurfaceObj::ptr)( + DAT_ButtonBackgroundBlendStrength::instance, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); + } else { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderNonInteractingButtonBackground, + AlphaAndButtonSurfaceObj::ptr)(DAT_ButtonBackgroundBlendStrength::instance); + color = OpenSHC::Rendering::Colors::COL_C2F0EB; + } + } + // one block per item, in the original's order (another order loses the match) + if (button == 31) { + // before the first call (computed in the call, the match is lost) + int const levelText = DAT_GameSynchronyState::instance.skirmishTechLevel / 2 + 79; + // the alpha written the long way round at every call, as the original computes it + // "Tech Level" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 85, DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + // "Early", "Middle" or "Late" (79 to 81) + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, levelText, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 36) { + // "Win: Regicide" (36), "Win: 10000 Gold" (37), "Win: 3" to "Win: 10" (38 to 45) + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, + DAT_GameSynchronyState::instance.skirmishWinCondition + 36, + DAT_ButtonW::instance / 2 + DAT_ButtonX::instance, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_CENTER, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 83) { + // "Troops" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 86, DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + // the parameter becomes the value's text number, 83 or 84 (a variable of its own loses the match) + if (DAT_GameSynchronyState::instance.skirmishTroopsCostGold) { + button = 84; + } + // "Free" (83) or "Cost Gold" (84) + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, button, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 109) { + // "Fog Of War" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 109, DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + // the number in a local and one call (a call in each arm loses the match) + int fogText; + // "Off" (95), "Fog Of War" (109) or "Reveal Map" (110) + if (DAT_GameState::instance.mapAndTime.skirmishFogOfWar == 0) { + fogText = 95; + } else if (DAT_GameState::instance.mapAndTime.skirmishFogOfWar == 1) { + fogText = 109; + } else { + fogText = 110; + } + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, fogText, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == -1000) { + // "Back" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 17, DAT_ButtonW::instance / 2 + DAT_ButtonX::instance, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_CENTER, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 103) { + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + return; + } + // the alpha written out in every call (one local for the items from here on loses the match) + if (button == -10) { + // "No Cow Throwing" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 5, DAT_ButtonX::instance + 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + // 206 when the option is on, 208 when it is off + // a call in each arm (one call with a conditional expression loses the match) + if (DAT_GameSynchronyState::instance.skirmishNoCowThrowing) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 206, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 208, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + if (button == -11) { + // "No Dogs" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 6, DAT_ButtonX::instance + 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (DAT_GameSynchronyState::instance.skirmishNoDogs) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 206, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 208, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + if (button == -13) { + // "Extreme Mode" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 13, DAT_ButtonX::instance + 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (DAT_GameSynchronyState::instance.skirmishExtremeMode) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 206, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 208, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + if (button == -14) { + // "Extreme Powers Around Lord" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 14, DAT_ButtonX::instance + 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (DAT_GameSynchronyState::instance.skirmishExtremeMode2 + && DAT_GameSynchronyState::instance.skirmishExtremeMode) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 206, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 208, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + if (button == 99) { + // "Strong Walls" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 99, DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (DAT_GameSynchronyState::instance.skirmishStrongWalls) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 206, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, 208, + DAT_ButtonW::instance + DAT_ButtonX::instance - 50, DAT_ButtonY::instance); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + if (button == -12) { + // "No Rush" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 7, DAT_ButtonX::instance + 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + // each value its own if (an else-if chain loses the match) + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 0) { + // "Off" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 1) { + // "5 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 96, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 2) { + // "10 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 97, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 3) { + // "20 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 98, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 4) { + // "30 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 8, DAT_ButtonW::instance + DAT_ButtonX::instance - 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, + 18, FALSE, (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 5) { + // "1 hour" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 9, DAT_ButtonW::instance + DAT_ButtonX::instance - 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, + 18, FALSE, (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + return; + } + // the other items: their own text, "Gold" (14), "Popularity" (15), "Game Speed" (82), + // "Connection options" (93), "Auto save game" (94) or "Alliances" (100), and for some a value + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextFromTextGroup, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, button, DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 7, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + if (button == 14) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance.skirmishStartGold, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 15) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance.skirmishDefaultPopularity, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 82) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance.skirmishGameSpeedLevel, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + return; + } + if (button == 94) { + // each value its own if, as above + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 0) { + // "Off" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 5) { + // "5 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 96, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 10) { + // "10 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 97, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 20) { + // "20 minutes" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 98, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + return; + } + if (button == 100) { + // a truth test (== 0 with the arms swapped loses the match) + if (DAT_GameSynchronyState::instance.skirmishAlliances) { + // "Start Only" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 102, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } else { + // "Anytime" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 101, + DAT_ButtonW::instance + DAT_ButtonX::instance - 20, DAT_ButtonY::instance + 7, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, FALSE, + (DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b62540e14f..1ac24c7f41 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6889,7 +6889,7 @@ SHC_3BB0A8C1_0x00428A50 | 0.0% | Pending SHC_3BB0A8C1_0x00428A60 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00428AC0 | 0.0% | Pending +SHC_3BB0A8C1_0x00428AC0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00429630 | 100.0% | Reimplemented