From 85ad303d4db79dc9ee13c304145d4f49378c1dde Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:56 +0100 Subject: [PATCH 01/45] reimplement: SHC_3BB0A8C1_0x00425720 100.0% Reimplemented MenuItemActionHandler_HistoricCampaignSelect_Main, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at b3069fd30 (2026-10-07), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ionHandler_HistoricCampaignSelect_Main.cpp | 132 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp new file mode 100644 index 0000000000..7febd74a13 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp @@ -0,0 +1,132 @@ +#include "../HistoricCampaignSelect.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00425720 + void HistoricCampaignSelect::MenuItemActionHandler_HistoricCampaignSelect_Main(int param_1, ...) + { + switch (param_1) { + case 1: + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty; + DAT_GameCore::instance.gameSuspended = 0; + DAT_GameCore::instance.missionNumber1to20 = 1; + DAT_GameCore::instance.historicCampaignNumber = 1; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 2: + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty; + DAT_GameCore::instance.gameSuspended = 0; + DAT_GameCore::instance.missionNumber1to20 = 6; + DAT_GameCore::instance.historicCampaignNumber = 2; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 3: + DAT_GameCore::instance.gameSuspended = 0; + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty; + DAT_GameCore::instance.missionNumber1to20 = 11; + DAT_GameCore::instance.historicCampaignNumber = 3; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 4: + DAT_GameCore::instance.gameSuspended = 0; + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty; + DAT_GameCore::instance.missionNumber1to20 = 16; + DAT_GameCore::instance.historicCampaignNumber = 4; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 5: + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAIN_MENU, 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ed989c9a21..6ed0643f78 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6713,7 +6713,7 @@ SHC_3BB0A8C1_0x00425580 | 0.0% | Pending SHC_3BB0A8C1_0x004255D0 | 0.0% | Pending -SHC_3BB0A8C1_0x00425720 | 0.0% | Pending +SHC_3BB0A8C1_0x00425720 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004259BC | 0.0% | Pending From 762c592262bad52d95c0a291fd5ac2d3fe757c82 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:56 +0100 Subject: [PATCH 02/45] reimplement: SHC_3BB0A8C1_0x00425C20 100.0% Reimplemented MenuItemActionHandler_UnusedEconomicGametypeSelect_Main, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at b3069fd30 (2026-10-07), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...dler_UnusedEconomicGametypeSelect_Main.cpp | 133 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp new file mode 100644 index 0000000000..6424053ccd --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp @@ -0,0 +1,133 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_MapMissionType.hpp" +#include "OpenSHC/Globals/INT_00b95b64.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Game::GameMode2; + using UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00425C20 + void Unused::MenuItemActionHandler_UnusedEconomicGametypeSelect_Main(int param_1, ...) + { + switch (param_1) { + case 1: + DAT_GameCore::instance.gameSuspended = 0; + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty2; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_UNUSED_ECONOMIC_MISSION_SELECTUnk, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 2: + DAT_GameCore::instance.missionNumber1to20 = 0; + DAT_GameCore::instance.gameMode_2 = Game::GM_BUILDERUnk; + DAT_GameCore::instance.xbowProducible_logic = 1; + DAT_GameCore::instance.pikeProducible_logic = 1; + DAT_GameCore::instance.swordProducible_logic = 1; + DAT_GameCore::instance.bowProducible_logic = 1; + DAT_GameCore::instance.spearProducible_logic = 1; + DAT_GameCore::instance.maceProducible_logic = 1; + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::resetTeams, DAT_GameState::ptr)(); + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty_1; + DAT_MapMissionType::instance = 1; + INT_00b95b64::instance = 1; + DAT_GameCore::instance.standaloneFilename[0] = '\0'; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 3: + DAT_GameCore::instance.missionNumber1to20 = 0; + DAT_GameCore::instance.gameMode_2 = Game::GM_BUILDERUnk; + DAT_GameCore::instance.xbowProducible_logic = 1; + DAT_GameCore::instance.pikeProducible_logic = 1; + DAT_GameCore::instance.swordProducible_logic = 1; + DAT_GameCore::instance.bowProducible_logic = 1; + DAT_GameCore::instance.spearProducible_logic = 1; + DAT_GameCore::instance.maceProducible_logic = 1; + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::resetTeams, DAT_GameState::ptr)(); + DAT_MapMissionType::instance = 0; + INT_00b95b64::instance = 1; + DAT_GameCore::instance.standaloneFilename[0] = '\0'; + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty_0; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 4: + goto switchD_00425c32_caseD_4; + case 5: + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAIN_MENU, 0); + switchD_00425c32_caseD_4: + return; + default: + break; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6ed0643f78..c125a8ca0e 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6739,7 +6739,7 @@ SHC_3BB0A8C1_0x00425C0C | 0.0% | Pending SHC_3BB0A8C1_0x00425C10 | 0.0% | Pending -SHC_3BB0A8C1_0x00425C20 | 0.0% | Pending +SHC_3BB0A8C1_0x00425C20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00425E84 | 0.0% | Pending From 8811a14b236077e53142a196e432a5db4f8f901a Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:56 +0100 Subject: [PATCH 03/45] reimplement: SHC_3BB0A8C1_0x00426B80 100.0% Reimplemented MenuItemActionHandler_HistoricMissionSelect_General, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at 0a7d9924e (2026-10-25), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...nHandler_HistoricMissionSelect_General.cpp | 75 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp new file mode 100644 index 0000000000..d5e77a5f51 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -0,0 +1,75 @@ +#include "../HistoricMissionSelect.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/BOOL_CurrentMenuClickState.hpp" +#include "OpenSHC/Globals/DAT_00b96100.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Game::GameMode2; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::UI::Enums::MenuViewType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00426B80 + void HistoricMissionSelect::MenuItemActionHandler_HistoricMissionSelect_General(int param_1, ...) + { + if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) + && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + /* + a chain of `sub`s with a `je` after each (0x426ba7) is MSVC's sparse switch, + and the arm bodies are laid out default, 0x14, 0x12, 0xd + */ + switch (param_1) { + default: { + BOOL_CurrentMenuClickState::instance = FALSE; + DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - param_1) + -1; + DWORD DVar1 = timeGetTime(); + if (DAT_GameCore::instance.missionNumber1to20 + != DAT_MenuTextInputState::instance.lastClickedListIndex + || 500 <= (int)(DVar1 - DAT_MenuTextInputState::instance.lastListClickTime)) { + DAT_MenuTextInputState::instance.lastClickedListIndex + = DAT_GameCore::instance.missionNumber1to20; + DAT_MenuTextInputState::instance.lastListClickTime = DVar1; + return; + } + goto LAB_00426c1c; + } + case 0x14: { + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameState::instance.mapAndTime.difficulty + 1; + /* the original compares against 4 (`cmp eax, 4; jl`), not 3 */ + if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { + DAT_GameState::instance.mapAndTime.difficulty = 0; + } + return; + } + case 0x12: { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_HISTORIC_CAMPAIGN_SELECT, 0); + return; + } + case 0xd: + LAB_00426c1c: + DAT_GameCore::instance.missionNumber1to20 = DAT_GameCore::instance.missionNumber1to20 + -1; + DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_CAMPAIGN_MISSION; + DAT_GameCore::instance.field26_0x74 = 1; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMissionProgress, DAT_GameCore::ptr)(); + return; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index c125a8ca0e..90fad08fec 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6783,7 +6783,7 @@ SHC_3BB0A8C1_0x004268C0 | 0.0% | Pending SHC_3BB0A8C1_0x004269E0 | 0.0% | Pending -SHC_3BB0A8C1_0x00426B80 | 0.0% | Pending +SHC_3BB0A8C1_0x00426B80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00426C50 | 0.0% | Pending From 72af1589ccd0a302ee6e529c49729f9666764d67 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:56 +0100 Subject: [PATCH 04/45] reimplement: SHC_3BB0A8C1_0x00426ED0 100.0% Reimplemented MenuItemActionHandler_UnusedEconomicMissionSelect_General, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at 0a7d9924e (2026-10-25), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...er_UnusedEconomicMissionSelect_General.cpp | 74 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp new file mode 100644 index 0000000000..9d77aca224 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -0,0 +1,74 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/BOOL_CurrentMenuClickState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Game::GameMode2; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::UI::Enums::MenuViewType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00426ED0 + void Unused::MenuItemActionHandler_UnusedEconomicMissionSelect_General(int param_1, ...) + { + if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) + && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + /* + a chain of `sub`s with a `je` after each (0x426ee9) is MSVC's sparse + switch, and the arm bodies are laid out default, 0x14, 0x12, 0xd + */ + switch (param_1) { + default: { + BOOL_CurrentMenuClickState::instance = FALSE; + DAT_GameCore::instance.missionNumber1to20 = -param_1; + DWORD DVar1 = timeGetTime(); + if (DAT_GameCore::instance.missionNumber1to20 + != DAT_MenuTextInputState::instance.lastClickedListIndex + || 500 <= (int)(DVar1 - DAT_MenuTextInputState::instance.lastListClickTime)) { + DAT_MenuTextInputState::instance.lastClickedListIndex + = DAT_GameCore::instance.missionNumber1to20; + DAT_MenuTextInputState::instance.lastListClickTime = DVar1; + return; + } + goto LAB_00426f5c; + } + case 0x14: { + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameState::instance.mapAndTime.difficulty + 1; + /* the original compares against 4 (`cmp eax, 4; jl`), not 3 */ + if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { + DAT_GameState::instance.mapAndTime.difficulty = 0; + } + return; + } + case 0x12: { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); + return; + } + case 0xd: + LAB_00426f5c: + DAT_GameCore::instance.missionNumber1to20 = DAT_GameCore::instance.missionNumber1to20 + -1; + DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_ECONOMIC_CAMPAIGN_SH1; + DAT_GameCore::instance.field26_0x74 = 1; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMission, DAT_GameCore::ptr)(); + return; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 90fad08fec..0013fcff43 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6791,7 +6791,7 @@ SHC_3BB0A8C1_0x00426CA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00426D30 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00426ED0 | 0.0% | Pending +SHC_3BB0A8C1_0x00426ED0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00426F80 | 100.0% | Reimplemented From bae71c1735c7c5d9cbdfb480db4660ededfba1e8 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:57 +0100 Subject: [PATCH 05/45] reimplement: SHC_3BB0A8C1_0x00427080 100.0% Reimplemented MenuItemActionHandler_UnusedSomeMissionStartUnk_General, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 9b61ac276 (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...dler_UnusedSomeMissionStartUnk_General.cpp | 69 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp new file mode 100644 index 0000000000..ede58b3eac --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -0,0 +1,69 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Commands::GameCommandType; + using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::UI::Enums::MenuViewType; + + /* + WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names + */ + /* + WARNING: Enum "DPERRInt": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00427080 + void Unused::MenuItemActionHandler_UnusedSomeMissionStartUnk_General(int param_1, ...) + { + if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) + && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + /* + the original dispatches with a `sub eax, K; je` chain (0x427096), + MSVC's sparse switch, and the `case 0xe` body sits first + */ + switch (param_1) { + case 0xe: + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); + break; + case 0xd: + DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_HUNTERSHUT; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); + DAT_GameCore::instance.section1066 = 1; + DAT_GameCore::instance.landscapingmenuMenuTabToSwitchTo = 0xe7; + MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::loadMissionMapAndSetLord, + DAT_MapPropertiesState::ptr)(DAT_GameCore::instance.missionNumber1to20); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearModalDialog2to6, DAT_MenuTextInputState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ASK_FOR_SLOT_ASSIGNMENT); + break; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 0013fcff43..d85945bcef 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6797,7 +6797,7 @@ SHC_3BB0A8C1_0x00426F80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00426FB0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00427080 | 0.0% | Pending +SHC_3BB0A8C1_0x00427080 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00427110 | 0.0% | Pending From 1e52fc12aa626e2552baff180ed2fcbd330dd749 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:57 +0100 Subject: [PATCH 06/45] reimplement: SHC_3BB0A8C1_0x00428980 100.0% Reimplemented MenuItemActionHandler_LobbyMenu_MapDescScrollbar, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at cf563c2ba (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...tionHandler_LobbyMenu_MapDescScrollbar.cpp | 53 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp new file mode 100644 index 0000000000..679e983865 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp @@ -0,0 +1,53 @@ +#include "../LobbyMenu.func.hpp" + +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_00b95b74.hpp" +#include "OpenSHC/Globals/DAT_00b960dc.hpp" +#include "OpenSHC/Globals/DAT_00b960f4.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00428980 + void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapDescScrollbar( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + if (!DAT_00b960dc::instance + && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_ROUNDTABLE + && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_BASIC_AI_LORD_SELECT + && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { + int iVar1 = 0; + if (!param_1) { + iVar1 = 0xcc; + } else if (param_1 == 1) { + iVar1 = 0x6e; + } + switch (param_2) { + case 1: + *minValue = -0x13; + *maxValue = DAT_00b95b74::instance - iVar1; + *currentValue = 0; + return; + case 2: + case 3: + DAT_00b960f4::instance = *currentValue; + return; + case 4: + *minValue = -0x13; + *maxValue = DAT_00b95b74::instance - iVar1; + *currentValue = DAT_00b960f4::instance; + return; + case 7: + *currentValue = iVar1 + -0xe; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index d85945bcef..6a2eedd26a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6871,7 +6871,7 @@ SHC_3BB0A8C1_0x004285C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004285F0 | 0.0% | Pending -SHC_3BB0A8C1_0x00428980 | 0.0% | Pending +SHC_3BB0A8C1_0x00428980 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00428A38 | 0.0% | Pending From f196635a04c598b7d888bbfa26e8a568a76edd3c Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:57 +0100 Subject: [PATCH 07/45] reimplement: SHC_3BB0A8C1_0x00428A60 100.0% Reimplemented MenuItemRenderFunction_LobbyMenu_MapDescScrollbar, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at cf563c2ba (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...derFunction_LobbyMenu_MapDescScrollbar.cpp | 42 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp new file mode 100644 index 0000000000..6744ab0e1a --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp @@ -0,0 +1,42 @@ +#include "../LobbyMenu.func.hpp" + +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00428A60 + void LobbyMenu::MenuItemRenderFunction_LobbyMenu_MapDescScrollbar( + int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + { + if (DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_ROUNDTABLE + && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_BASIC_AI_LORD_SELECT + && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { + BOOLEnum BVar1 = MACRO_CALL(UI::Helpers_Func::AModalDialogIsActiveButIsNotQuitting)(); + if (!BVar1) { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = BVar1; + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonH::instance), thumbYPos, + isDragged, thumbHeight, (int)(DAT_ButtonBackgroundBlendStrength::instance)); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6a2eedd26a..24e94bbcb0 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6887,7 +6887,7 @@ SHC_3BB0A8C1_0x00428A4C | 0.0% | Pending SHC_3BB0A8C1_0x00428A50 | 0.0% | Pending -SHC_3BB0A8C1_0x00428A60 | 0.0% | Pending +SHC_3BB0A8C1_0x00428A60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00428AC0 | 0.0% | Pending From 2efd915e4eddf45e4b6bcf96a12086303274413f Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:57 +0100 Subject: [PATCH 08/45] reimplement: SHC_3BB0A8C1_0x0042B470 100.0% Reimplemented MenuItemActionHandler_LobbyMenu_MapSelectTable, gynt's work as it stands on his fork's reimpl/UI-MenuItems at bb50b3f18 (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ActionHandler_LobbyMenu_MapSelectTable.cpp | 56 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp new file mode 100644 index 0000000000..fd84a1f1e6 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp @@ -0,0 +1,56 @@ +#include "../LobbyMenu.func.hpp" + +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Commands::GameCommandType; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + /* + WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names + */ + /* + WARNING: Enum "DPERRInt": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x0042B470 + void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapSelectTable(int param_1, ...) + { + if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_ROUNDTABLE) { + return; + } + if (DAT_MenuModalComposition1::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_BASIC_AI_LORD_SELECT) { + return; + } + if (DAT_MenuModalComposition1::instance.activeModalDialogID + == OpenSHC::UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { + return; + } + if (DAT_GameSynchronyState::instance.isHost == FALSE) { + return; + } + if ((int)DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset + param_1 + >= (int)DAT_GameSynchronyState::instance.DAT_MapSelectionTotalNumber) { + return; + } + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = param_1; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_CHANGE_MAP_SELECTION); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 24e94bbcb0..3d3617ba14 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -7417,7 +7417,7 @@ SHC_3BB0A8C1_0x0042B45F | 0.0% | Pending SHC_3BB0A8C1_0x0042B460 | 0.0% | Pending -SHC_3BB0A8C1_0x0042B470 | 0.0% | Pending +SHC_3BB0A8C1_0x0042B470 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042B4C0 | 0.0% | Pending From 112abc2c3e2ce28126549a23d68b49c82060aa76 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:58 +0100 Subject: [PATCH 09/45] reimplement: SHC_3BB0A8C1_0x0042DC60 100.0% Reimplemented MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 81e1041dd (2026-10-03), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...nction_SingleplayerMapChoice_Scrollbar.cpp | 32 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp new file mode 100644 index 0000000000..7b06cb7de1 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp @@ -0,0 +1,32 @@ +#include "../SinglePlayerMapChoice.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Enums::RenderTarget; + + // FUNCTION: STRONGHOLDCRUSADER 0x0042DC60 + void SinglePlayerMapChoice::MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar( + int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, (int)((int)(DAT_ButtonY::instance)), (int)((int)(DAT_ButtonH::instance)), + thumbYPos, isDragged, thumbHeight, (int)((int)(DAT_ButtonBackgroundBlendStrength::instance))); + 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 3d3617ba14..126973bbfe 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8253,7 +8253,7 @@ SHC_3BB0A8C1_0x0042D9A0 | 100.0% | Reimplemented, Security Cookie mismatches SHC_3BB0A8C1_0x0042DBB0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0042DC60 | 0.0% | Pending +SHC_3BB0A8C1_0x0042DC60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042DCB0 | 0.0% | Pending From 456ec527bba8a9dd6469038e3420a7ab8c724d74 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:58 +0100 Subject: [PATCH 10/45] reimplement: SHC_3BB0A8C1_0x0042DEB0 100.0% Reimplemented MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at de6f8e09b (2026-10-27), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...tion_UnusedOldTitleMenu_ContinueButton.cpp | 53 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp new file mode 100644 index 0000000000..d70a4dba58 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp @@ -0,0 +1,53 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/COL_WHITE.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0042DEB0 + void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton(int param_1, ...) + { + /* + the original jumps out of line on `== FALSE`, so the interacting + arm is the one the source wrote first + */ + if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + DAT_TextManagerObject::instance.textColor = 0xff; + DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; + } else { + DAT_TextManagerObject::instance.textColor = 0; + DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_WHITE::instance.shortValue; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), + (int)(DAT_ButtonW::instance + DAT_ButtonX::instance), + (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), DAT_PencilRenderCore::instance.otherColorUnk_0x0); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + "Continue", (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), + (TextAlignment)((int)(DAT_ButtonW::instance)), + (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 0x11, FALSE, 0); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 126973bbfe..4ddfc4a77d 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8261,7 +8261,7 @@ SHC_3BB0A8C1_0x0042DD00 | 0.0% | Pending SHC_3BB0A8C1_0x0042DE20 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0042DEB0 | 0.0% | Pending +SHC_3BB0A8C1_0x0042DEB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042DF40 | 0.0% | Pending From 366ef8672e7d753fe01a8550efcf1adef141daaa Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:58 +0100 Subject: [PATCH 11/45] reimplement: SHC_3BB0A8C1_0x0042DF40 100.0% Reimplemented MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at de6f8e09b (2026-10-27), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ction_UnusedOldTitleMenu_TestMapButton.cpp | 53 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp new file mode 100644 index 0000000000..a502872128 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp @@ -0,0 +1,53 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/COL_WHITE.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0042DF40 + void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton(int param_1, ...) + { + /* + the original jumps out of line on `== FALSE`, so the interacting + arm is the one the source wrote first + */ + if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + DAT_TextManagerObject::instance.textColor = 0xff; + DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; + } else { + DAT_TextManagerObject::instance.textColor = 0; + DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_WHITE::instance.shortValue; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), + (int)(DAT_ButtonW::instance + DAT_ButtonX::instance), + (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), DAT_PencilRenderCore::instance.otherColorUnk_0x0); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + "Test map", (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), + (TextAlignment)((int)(DAT_ButtonW::instance)), + (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 0x11, FALSE, 0); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 4ddfc4a77d..7165005e22 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8263,7 +8263,7 @@ SHC_3BB0A8C1_0x0042DE20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042DEB0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0042DF40 | 0.0% | Pending +SHC_3BB0A8C1_0x0042DF40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042DFD0 | 100.0% | Reimplemented From 60963abe90f5a5b23360bd5a07810cb275db77e5 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:58 +0100 Subject: [PATCH 12/45] reimplement: SHC_3BB0A8C1_0x0042EDF0 100.0% Reimplemented MenuItemActionHandler_MapEditorProperties_MapDescriptionBox, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 71eb42a45 (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ..._MapEditorProperties_MapDescriptionBox.cpp | 41 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp new file mode 100644 index 0000000000..8628184fe4 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp @@ -0,0 +1,41 @@ +#include "../MapEditorProperties.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" +#include "OpenSHC/Globals/INT_00b95f68.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0042EDF0 + void MapEditorProperties::MenuItemActionHandler_MapEditorProperties_MapDescriptionBox() + { + if (DAT_GameCore::instance.U2_mapType_singleOrMulti && DAT_GameCore::instance.mapLoadedForEditor + && DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE + && (INT_00b95f68::instance = 1, !DAT_GameCore::instance.unknownAlwaysZero03)) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); + DAT_TextEditorState::instance.customTextMaxLength = 1000; + MACRO_CALL_MEMBER(Text::TextEditorState_Func::openMapDescriptionEditorDialog, DAT_TextEditorState::ptr)( + 0); + MACRO_CALL_MEMBER(Text::TextEditorState_Func::setCustomHelpText, DAT_TextEditorState::ptr)( + DAT_GameCore::instance.temporaryTextBufferOfSize1000, 999); + MACRO_CALL(OS_Func::_memset)(DAT_GameCore::instance.temporaryTextBufferOfSize1000, 0, 1000); + DAT_GameCore::instance.descriptionUseStringTable = 0; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 7165005e22..e37e7d17e0 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8699,7 +8699,7 @@ SHC_3BB0A8C1_0x0042EA59 | 0.0% | Pending SHC_3BB0A8C1_0x0042EBC0 | 0.0% | Pending -SHC_3BB0A8C1_0x0042EDF0 | 0.0% | Pending +SHC_3BB0A8C1_0x0042EDF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042EE80 | 100.0% | Reimplemented From eb6910624e3bc89ced4863f4c60655e86a90fd28 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:58 +0100 Subject: [PATCH 13/45] reimplement: SHC_3BB0A8C1_0x0042EF80 100.0% Reimplemented MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at dd1433183 (2026-10-06), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...itorProperties_MapDescriptionScrollbar.cpp | 40 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp new file mode 100644 index 0000000000..b005397789 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp @@ -0,0 +1,40 @@ +#include "../MapEditorProperties.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::UI::Enums::MenuModalType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0042EF80 + void MapEditorProperties::MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar( + int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + { + if (((DAT_GameCore::instance.U2_mapType_singleOrMulti) + && (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU)) + && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, + DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance, (int)((int)(DAT_ButtonY::instance)), + (int)((int)(DAT_ButtonH::instance)), thumbYPos, isDragged, thumbHeight, 0); + 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 e37e7d17e0..577448ca04 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8717,7 +8717,7 @@ SHC_3BB0A8C1_0x0042EF74 | 0.0% | Pending SHC_3BB0A8C1_0x0042EF78 | 0.0% | Pending -SHC_3BB0A8C1_0x0042EF80 | 0.0% | Pending +SHC_3BB0A8C1_0x0042EF80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042EFE0 | 100.0% | Reimplemented From c487d4363d90e50a8b8c42f18f0578e11348b3dd Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:59 +0100 Subject: [PATCH 14/45] reimplement: SHC_3BB0A8C1_0x0042F2B0 100.0% Reimplemented MenuItemActionHandler_NewMapMaptype_Buttons, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at a389f84e6 (2026-10-04), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...temActionHandler_NewMapMaptype_Buttons.cpp | 72 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp diff --git a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp new file mode 100644 index 0000000000..60571ccae5 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp @@ -0,0 +1,72 @@ +#include "../NewMapMaptype.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Map::MapType2; + using UI::Enums::MenuModalType; + using UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0042F2B0 + void NewMapMaptype::MenuItemActionHandler_NewMapMaptype_Buttons(int param_1, ...) + { + if ((DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU) + && (DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE)) { + switch (param_1) { + case 1: + DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 = Map::MT_JUST_BUILD; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_NEW_MAP_MAPSIZE, 0); + return; + case 2: + DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 = Map::MT_INVASION; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_NEW_MAP_MAPSIZE, 0); + return; + case 3: + MACRO_CALL(UI::Helpers_Func::InitializeBasicMap)(); + DAT_GameCore::instance.U2_mapType_singleOrMulti = 1; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_NEW_MAP_MAPSIZE, 0); + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + return; + case 7: + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_CUSTOM_SCENARIOS, 0); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 577448ca04..8ea77cf0c2 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8725,7 +8725,7 @@ SHC_3BB0A8C1_0x0042F010 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042F140 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0042F2B0 | 0.0% | Pending +SHC_3BB0A8C1_0x0042F2B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042F3A8 | 0.0% | Pending From d0c2c8741ac7859346be4b005a89c5304a9ffd44 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:59 +0100 Subject: [PATCH 15/45] reimplement: SHC_3BB0A8C1_0x0047E3E0 100.0% Reimplemented MenuItemActionHandler_WaitingForHost_Button, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at a389f84e6 (2026-10-04), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...temActionHandler_WaitingForHost_Button.cpp | 40 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp diff --git a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp new file mode 100644 index 0000000000..e67820c12c --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp @@ -0,0 +1,40 @@ +#include "../WaitingForHost.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + using UI::Enums::MenuViewType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0047E3E0 + void WaitingForHost::MenuItemActionHandler_WaitingForHost_Button(int param_1, ...) + { + if (param_1 == 3) { + MACRO_CALL_MEMBER( + Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAIN_MENU, 0); + MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 8ea77cf0c2..a5ca093281 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22363,7 +22363,7 @@ SHC_3BB0A8C1_0x0047E240 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047E3A0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047E3E0 | 0.0% | Pending +SHC_3BB0A8C1_0x0047E3E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047E420 | 100.0% | Reimplemented From 04a5f175510dd453e3d12618cc7c866b43807a72 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:59 +0100 Subject: [PATCH 16/45] reimplement: SHC_3BB0A8C1_0x00491CE0 100.0% Reimplemented MenuItemActionHandler_IdentityOptions_LordIcons, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 81e1041dd (2026-10-03), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ctionHandler_IdentityOptions_LordIcons.cpp | 36 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp new file mode 100644 index 0000000000..0a3b52637a --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp @@ -0,0 +1,36 @@ +#include "../IdentityOptions.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00491CE0 + void IdentityOptions::MenuItemActionHandler_IdentityOptions_LordIcons(int param_1, ...) + { + if (param_1 == 0x15) { + DAT_GameCore::instance.selectedLordTypeUnk = 0; + if (DAT_GameCore::instance.lordIconUnk < 0x14) { + DAT_GameCore::instance.lordIconUnk = 2; + } + } else if (param_1 == 0x16) { + DAT_GameCore::instance.selectedLordTypeUnk = 1; + if (DAT_GameCore::instance.lordIconUnk < 0x14) { + DAT_GameCore::instance.lordIconUnk = 3; + } + } else if (param_1 == 0x28) { + DAT_GameCore::instance.lordIconUnk = DAT_GameCore::instance.lordIconUnk + -1; + if (DAT_GameCore::instance.lordIconUnk < 2) { + DAT_GameCore::instance.lordIconUnk = 21; + } + } else if ((param_1 == 0x29) + && (DAT_GameCore::instance.lordIconUnk = DAT_GameCore::instance.lordIconUnk + 1, + 0x15 < DAT_GameCore::instance.lordIconUnk)) { + DAT_GameCore::instance.lordIconUnk = 2; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index a5ca093281..07cd84da94 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23427,7 +23427,7 @@ SHC_3BB0A8C1_0x00491C20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00491C50 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00491CE0 | 0.0% | Pending +SHC_3BB0A8C1_0x00491CE0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00491D70 | 100.0% | Reimplemented From 491e50d4b72c97ec4b88f30b73e6a850a9e183ed Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:59 +0100 Subject: [PATCH 17/45] reimplement: SHC_3BB0A8C1_0x00492BA0 100.0% Reimplemented MenuItemActionHandler_SaveLoadMap_Scrollbar, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at 0a7d9924e (2026-10-25), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...temActionHandler_SaveLoadMap_Scrollbar.cpp | 53 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp new file mode 100644 index 0000000000..63c4058de1 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp @@ -0,0 +1,53 @@ +#include "../SaveLoadMap.func.hpp" + +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00492BA0 + void SaveLoadMap::MenuItemActionHandler_SaveLoadMap_Scrollbar( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + switch (param_2) { + case 1: + *minValue = 0; + *maxValue + = DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount; + *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + return; + case 2: + case 3: + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset = *currentValue; + return; + case 4: + *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + return; + case 7: + *currentValue = DAT_MenuTextInputState::instance.fileListVisibleRowCount + -1; + return; + case 5: + if (0 < (int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset) { + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + -1; + *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + return; + } + break; + case 6: + if ((int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + < (int)DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount) { + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + 1; + } + break; + default: + return; + } + *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 07cd84da94..2aec2069a3 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23505,7 +23505,7 @@ SHC_3BB0A8C1_0x00492A60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00492A90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00492BA0 | 0.0% | Pending +SHC_3BB0A8C1_0x00492BA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00492C44 | 0.0% | Pending From 559ee57c5b43301a70c45f50e8afa8f517721ca3 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:59 +0100 Subject: [PATCH 18/45] reimplement: SHC_3BB0A8C1_0x004932A0 100.0% Reimplemented MenuItemActionHandler_SaveMap_TableContent, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 6d85b5f55 (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ItemActionHandler_SaveMap_TableContent.cpp | 35 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp new file mode 100644 index 0000000000..04dedd4eae --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -0,0 +1,35 @@ +#include "../SaveMap.func.hpp" + +#include "OpenSHC/IO/ResourceManager.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_ResourceManager.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004932A0 + void SaveMap::MenuItemActionHandler_SaveMap_TableContent(int param_1, ...) + { + char* pcVar1; + if ((int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + param_1 + < (int)DAT_MenuTextInputState::instance.field32_0x74) { + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionIndex = param_1; + pcVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, + DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance + .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + + param_1 + -1]); + MACRO_CALL_MEMBER( + OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(pcVar1); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 2aec2069a3..eac557f04a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23551,7 +23551,7 @@ SHC_3BB0A8C1_0x00493050 | 100.0% | Reimplemented, Security Cookie mismatches SHC_3BB0A8C1_0x004931A0 | 0.0% | Pending -SHC_3BB0A8C1_0x004932A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004932A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004932E0 | 100.0% | Reimplemented From c530cf638153f112326fd75c101e70c0f56cec91 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:00 +0100 Subject: [PATCH 19/45] reimplement: SHC_3BB0A8C1_0x00493BD0 100.0% Reimplemented MenuItemActionHandler_OptionsMenu_SubOptionsButtons, gynt's work as it stands on his fork's reimpl/UI-MenuItems at cdeb8de25 (2026-10-09), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...nHandler_OptionsMenu_SubOptionsButtons.cpp | 79 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp diff --git a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp new file mode 100644 index 0000000000..fe2fdeac29 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp @@ -0,0 +1,79 @@ +#include "../OptionsMenu.func.hpp" + +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_ScrollingHandler.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::MenuModalType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00493BD0 + void OptionsMenu::MenuItemActionHandler_OptionsMenu_SubOptionsButtons(int param_1, ...) + { + switch (param_1) { + case 0x19: + DAT_MenuTextInputState::instance.field12_0x30 = DAT_GameCore::instance.gameSpeedLevel; + DAT_MenuTextInputState::instance.field14_0x38 = DAT_GameCore::instance.settingBubbleHelp; + DAT_MenuTextInputState::instance.field15_0x3c = DAT_GameCore::instance.unusedOption1; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_GAMEPLAY_OPTIONS); + break; + case 4: + DAT_MenuTextInputState::instance.menuCurrentlySelectedResolution + = DAT_WindowAndDirectDraw::instance.currentGameResolution; + DAT_MenuTextInputState::instance.unknownZoomRelatedFlag01 + = DAT_ViewportRenderState::instance.viewportState.isZoomedOutUnk; + DAT_MenuTextInputState::instance.menuScrollSpeedSetting + = DAT_ScrollingHandler::instance.scrollSpeedSetting_0x38; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_VIDEO_OPTIONS); + DAT_MenuTextInputState::instance.menuCursorType = DAT_MouseState::instance.cursorType; + return; + case 5: + DAT_MenuTextInputState::instance.DAT_GenieVoiceActiveMenuVar = DAT_GameCore::instance.genieVoiceActive; + DAT_MenuTextInputState::instance.DAT_SoundActiveMenuVar + = DAT_SoundSystemState::instance.soundActiveUnk_0x0; + DAT_MenuTextInputState::instance.field20_0x44 = DAT_SoundSystemState::instance.streamVolume[0]; + DAT_MenuTextInputState::instance.field21_0x48 = DAT_SoundSystemState::instance.streamVolume[1]; + DAT_MenuTextInputState::instance.field22_0x4c = DAT_SoundSystemState::instance.streamVolume[3]; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_SOUND_OPTIONS); + return; + case 0x2d: + DAT_UserTextHandlerState::instance.allowUserTextInput = 0; + MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + 0); + MACRO_CALL_MEMBER( + OpenSHC::Text::UserTextHandler_Func::moveCursorToEnd, DAT_UserTextHandlerState::ptr)(); + DAT_UserTextHandlerState::instance.allowUserTextInput = 1; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_IDENTITY_OPTIONS); + break; + case 6: + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_NETWORK_OPTIONS); + return; + case 0x11: + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + return; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index eac557f04a..25f57c486f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23651,7 +23651,7 @@ SHC_3BB0A8C1_0x00493980 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00493AC0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00493BD0 | 0.0% | Pending +SHC_3BB0A8C1_0x00493BD0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00493CE8 | 0.0% | Pending From 6d46922201e6e414af94902873fde60326ace360 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:00 +0100 Subject: [PATCH 20/45] reimplement: SHC_3BB0A8C1_0x00493D30 100.0% Reimplemented MenuItemActionHandler_IdentityOptions_Confirm, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at a389f84e6 (2026-10-04), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...mActionHandler_IdentityOptions_Confirm.cpp | 38 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp new file mode 100644 index 0000000000..9073fe51c3 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp @@ -0,0 +1,38 @@ +#include "../IdentityOptions.func.hpp" + +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Game/GameMode.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Commands::GameCommandType; + using Game::GameMode; + + // FUNCTION: STRONGHOLDCRUSADER 0x00493D30 + void IdentityOptions::MenuItemActionHandler_IdentityOptions_Confirm(int param_1, ...) + { + if (param_1 == 0x11) { + DAT_UserTextHandlerState::instance.allowUserTextInput = 0; + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + 9); + DAT_UserTextHandlerState::instance.allowUserTextInput = 1; + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY) { + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(((GameCommandType)0x60)); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 25f57c486f..38f708fec9 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23751,7 +23751,7 @@ SHC_3BB0A8C1_0x00493D2C | 0.0% | Pending SHC_3BB0A8C1_0x00493D2D | 0.0% | Pending -SHC_3BB0A8C1_0x00493D30 | 0.0% | Pending +SHC_3BB0A8C1_0x00493D30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00493D80 | 100.0% | Reimplemented From a4af953be5834c116fc332876dcfebe164130631 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:00 +0100 Subject: [PATCH 21/45] reimplement: SHC_3BB0A8C1_0x004948C0 100.0% Reimplemented MenuItemActionHandler_LoadMap_TableContent, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 0d89dce24 (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ItemActionHandler_LoadMap_TableContent.cpp | 36 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp diff --git a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp new file mode 100644 index 0000000000..b1e0d5647e --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp @@ -0,0 +1,36 @@ +#include "../LoadMap.func.hpp" + +#include "OpenSHC/UI/MenuItems/SaveLoadMap.func.hpp" + +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004948C0 + void LoadMap::MenuItemActionHandler_LoadMap_TableContent(int param_1, ...) + { + DWORD DVar1; + DVar1 = timeGetTime(); + if ((int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + param_1 + < (int)DAT_MenuTextInputState::instance.field32_0x74) { + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionIndex = param_1; + if ((DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + param_1 + == DAT_MenuTextInputState::instance.field38_0x8c) + && ((int)(DVar1 - DAT_MenuTextInputState::instance.field39_0x90) < 500)) { + MACRO_CALL(OpenSHC::UI::MenuItems::SaveLoadMap_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(2); + } + DAT_MenuTextInputState::instance.field38_0x8c + = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionIndex + + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + DAT_MenuTextInputState::instance.field39_0x90 = DVar1; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 38f708fec9..3217fc444a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -24109,7 +24109,7 @@ SHC_3BB0A8C1_0x004948BE | 0.0% | Pending SHC_3BB0A8C1_0x004948BF | 0.0% | Pending -SHC_3BB0A8C1_0x004948C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004948C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00494920 | 100.0% | Reimplemented From 3e8b10cb14637fc318705de8d66c191c16f6f7a7 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:00 +0100 Subject: [PATCH 22/45] reimplement: SHC_3BB0A8C1_0x004B0F70 100.0% Reimplemented MenuItemActionHandler_OverlaySlider_Deselect, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at de6f8e09b (2026-10-27), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...emActionHandler_OverlaySlider_Deselect.cpp | 47 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp diff --git a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp new file mode 100644 index 0000000000..0bad8dfbbb --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp @@ -0,0 +1,47 @@ +#include "../OverlaySlider.func.hpp" + +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B0F70 + void OverlaySlider::MenuItemActionHandler_OverlaySlider_Deselect(int param_1, ...) + { + if ((DAT_MouseState::instance.rightClickStart != 0) + && (MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE), + DAT_MenuModalComposition2::instance.sliderCallbackFunction != (undefined*)0x0)) { + ((void (*)())DAT_MenuModalComposition2::instance.sliderCallbackFunction)(); + DAT_MenuModalComposition2::instance.minus1 = -1; + } + if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_MouseState::instance.screenSpaceX >= DAT_MenuModalComposition2::instance.modalMenu.x + && DAT_MouseState::instance.screenSpaceX < DAT_MenuModalComposition2::instance.modalMenu.width + + DAT_MenuModalComposition2::instance.modalMenu.x + && DAT_MouseState::instance.screenSpaceY >= DAT_MenuModalComposition2::instance.modalMenu.y + && DAT_MouseState::instance.screenSpaceY < DAT_MenuModalComposition2::instance.modalMenu.height + + DAT_MenuModalComposition2::instance.modalMenu.y) { + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + if (DAT_MenuModalComposition2::instance.sliderCallbackFunction != (undefined*)0x0) { + ((void (*)())DAT_MenuModalComposition2::instance.sliderCallbackFunction)(); + DAT_MenuModalComposition2::instance.minus1 = -1; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3217fc444a..f1791ad9a1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25963,7 +25963,7 @@ SHC_3BB0A8C1_0x004B0F64 | 0.0% | Pending SHC_3BB0A8C1_0x004B0F68 | 0.0% | Pending -SHC_3BB0A8C1_0x004B0F70 | 0.0% | Pending +SHC_3BB0A8C1_0x004B0F70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B1000 | 0.0% | Pending From dbd405a14bcdde1ce823d27673d166280ae8f691 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:00 +0100 Subject: [PATCH 23/45] reimplement: SHC_3BB0A8C1_0x004B1000 100.0% Reimplemented MenuItemActionHandler_UnusedWinCondition_DeselectUnk, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at de6f8e09b (2026-10-27), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...Handler_UnusedWinCondition_DeselectUnk.cpp | 48 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp new file mode 100644 index 0000000000..d26f7a7818 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp @@ -0,0 +1,48 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B1000 + void Unused::MenuItemActionHandler_UnusedWinCondition_DeselectUnk(int param_1, ...) + { + if ((DAT_MouseState::instance.rightClickStart != 0) + && (MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE), + DAT_MenuModalComposition1::instance.sliderCallbackFunction != (undefined*)0x0)) { + ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); + DAT_MenuModalComposition1::instance.minus1 = -1; + } + if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_MouseState::instance.screenSpaceX >= DAT_MenuModalComposition2::instance.modalMenu.x + && DAT_MouseState::instance.screenSpaceX < DAT_MenuModalComposition2::instance.modalMenu.width + + DAT_MenuModalComposition2::instance.modalMenu.x + && DAT_MouseState::instance.screenSpaceY >= DAT_MenuModalComposition2::instance.modalMenu.y + && DAT_MouseState::instance.screenSpaceY < DAT_MenuModalComposition2::instance.modalMenu.height + + DAT_MenuModalComposition2::instance.modalMenu.y) { + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != (undefined*)0x0) { + ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); + DAT_MenuModalComposition1::instance.minus1 = -1; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index f1791ad9a1..fab9b6563f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25965,7 +25965,7 @@ SHC_3BB0A8C1_0x004B0F68 | 0.0% | Pending SHC_3BB0A8C1_0x004B0F70 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B1000 | 0.0% | Pending +SHC_3BB0A8C1_0x004B1000 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B1090 | 100.0% | Reimplemented From 0dc8badbe110554764abde6bbdccf9e92be1b719 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:01 +0100 Subject: [PATCH 24/45] reimplement: SHC_3BB0A8C1_0x004B6530 100.0% Reimplemented MenuItemActionHandler_InGameMenu_MapEventIconUnk, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 8a77b619a (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...tionHandler_InGameMenu_MapEventIconUnk.cpp | 39 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp new file mode 100644 index 0000000000..7e2f3c8f86 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp @@ -0,0 +1,39 @@ +#include "../InGameMenu.func.hpp" + +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004B6530 + void InGameMenu::MenuItemActionHandler_InGameMenu_MapEventIconUnk(int param_1, ...) + { + int iVar1; + MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::focusOnCoordinate, + DAT_ViewportRenderState::ptr)(DAT_MinimapViewState::instance.spawnMomentX[0], + (int)((int)(DAT_MinimapViewState::instance.spawnMomentY[0]))); + iVar1 = 1; + if (1 < (int)DAT_MinimapViewState::instance.spawnMomentCount) { + do { + DAT_MinimapViewState::instance.spawnMomentX[iVar1 + -1] + = DAT_MinimapViewState::instance.spawnMomentX[iVar1]; + DAT_MinimapViewState::instance.spawnMomentX[iVar1 + 0x13] + = DAT_MinimapViewState::instance.spawnMomentY[iVar1]; + DAT_MinimapViewState::instance.spawnMomentY[iVar1 + 0x13] + = DAT_MinimapViewState::instance.spawnMoment[iVar1]; + iVar1 = iVar1 + 1; + } while (iVar1 < (int)DAT_MinimapViewState::instance.spawnMomentCount); + } + DAT_MinimapViewState::instance.spawnMomentCount = DAT_MinimapViewState::instance.spawnMomentCount + -1; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index fab9b6563f..761ac2945f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -26907,7 +26907,7 @@ SHC_3BB0A8C1_0x004B64D0 | 0.0% | Pending SHC_3BB0A8C1_0x004B6500 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B6530 | 0.0% | Pending +SHC_3BB0A8C1_0x004B6530 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B6560 | 0.0% | Pending From afad59ececdb4447cadf258c4abfc431675c34b5 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:01 +0100 Subject: [PATCH 25/45] reimplement: SHC_3BB0A8C1_0x004B65A0 100.0% Reimplemented MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol, gynt's work as it stands on his fork's reimpl/UI-MenuItems at ff59286a9 (2026-10-08), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...Function_InGameMenu_KeepEnclosedSymbol.cpp | 49 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp new file mode 100644 index 0000000000..eb72157d23 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp @@ -0,0 +1,49 @@ +#include "../InGameMenu.func.hpp" + +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MiniMapDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + /* + WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names + */ + /* + WARNING: Enum "DPERRInt": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004B65A0 + void InGameMenu::MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol(int param_1, ...) + { + BOOLEnum BVar1; + BVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::checkKeepEnclosed, DAT_GameState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID); + if (BVar1 != DAT_MiniMapDefinedData::instance.field91_0x2bc) { + DAT_GameCore::instance.countdown = 2; + } + DAT_MiniMapDefinedData::instance.field91_0x2bc = BVar1; + if (BVar1 == FALSE) { + DAT_ButtonUnknownZero::instance = 1; + return; + } + DAT_ButtonUnknownZero::instance = 0; + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 761ac2945f..749be43935 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -26911,7 +26911,7 @@ SHC_3BB0A8C1_0x004B6530 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B6560 | 0.0% | Pending -SHC_3BB0A8C1_0x004B65A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B65A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B65F0 | 0.0% | Pending From ee33b77b89ce792e8e9c4edcb2c6422faba2d4c7 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:01 +0100 Subject: [PATCH 26/45] reimplement: SHC_3BB0A8C1_0x004B65F0 100.0% Reimplemented MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at dd1433183 (2026-10-06), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...tion_InGameMenu_BikMessagePlayerShield.cpp | 39 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp new file mode 100644 index 0000000000..2d801ea0ba --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp @@ -0,0 +1,39 @@ +#include "../InGameMenu.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_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eGM; + using OpenSHC::Rendering::Enums::RenderTarget; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B65F0 + void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int param_1, ...) + { + dword dVar1; + if (DAT_VideoBikQueue::instance.mbr_0x928) { + dVar1 = DAT_VideoBikQueue::instance.mbr_0x928; + if ((int)DAT_VideoBikQueue::instance.mbr_0x928 < 0) { + dVar1 = -DAT_VideoBikQueue::instance.mbr_0x928; + } + 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_INTERFACE_ICONS2, + (int)((int)(dVar1 + 0x1d5)), (int)((int)(DAT_ButtonX::instance)), + (int)((int)(DAT_ButtonY::instance))); + 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 749be43935..64e78607d4 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -26913,7 +26913,7 @@ SHC_3BB0A8C1_0x004B6560 | 0.0% | Pending SHC_3BB0A8C1_0x004B65A0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B65F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B65F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B6640 | 100.0% | Reimplemented From 5acc0b6ef293efb6dbbf21c047d7f8e615a0024b Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:01 +0100 Subject: [PATCH 27/45] reimplement: SHC_3BB0A8C1_0x004B94A0 100.0% Reimplemented MenuItemActionHandler_NewInvasion_RepeatSlider, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 81e1041dd (2026-10-03), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ActionHandler_NewInvasion_RepeatSlider.cpp | 39 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp diff --git a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp new file mode 100644 index 0000000000..40201897b3 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp @@ -0,0 +1,39 @@ +#include "../NewInvasion.func.hpp" + +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B94A0 + void NewInvasion::MenuItemActionHandler_NewInvasion_RepeatSlider( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = 120; + /* + repeatMonths + */ + *currentValue + = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.invasion.repeatMonths; + return; + case 2: + case 3: + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.invasion.repeatMonths = *currentValue; + return; + case 4: + *currentValue + = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.invasion.repeatMonths; + *maxValue = 120; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 64e78607d4..602990869b 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -27627,7 +27627,7 @@ SHC_3BB0A8C1_0x004B9498 | 0.0% | Pending SHC_3BB0A8C1_0x004B949C | 0.0% | Pending -SHC_3BB0A8C1_0x004B94A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B94A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B951C | 0.0% | Pending From 22d9e5fa2f6db7d5657b84d16c3bbf4044743a53 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:02 +0100 Subject: [PATCH 28/45] reimplement: SHC_3BB0A8C1_0x004BA560 100.0% Reimplemented MenuItemActionHandler_UnusedCreateMessageEvent_Unknown, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at de6f8e09b (2026-10-27), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ndler_UnusedCreateMessageEvent_Unknown.cpp | 28 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp new file mode 100644 index 0000000000..88de5e4078 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp @@ -0,0 +1,28 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004BA560 + void Unused::MenuItemActionHandler_UnusedCreateMessageEvent_Unknown(int index, ...) + { + if (((int)DAT_MapPropertiesState::instance.offset + index < (int)DAT_MapPropertiesState::instance.total) + && (DAT_MapPropertiesState::instance.indexStored = index, index != -1)) { + DAT_MapPropertiesState::instance.value + = DAT_MapPropertiesState::instance.unknownArray_01[DAT_MapPropertiesState::instance.offset + index]; + if (DAT_MapPropertiesState::instance.flag == 0) { + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.scenario.actionData = DAT_MapPropertiesState::instance.value; + return; + } + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.scenario.actionData = DAT_MapPropertiesState::instance.value; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 602990869b..f79bfa92f4 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -29079,7 +29079,7 @@ SHC_3BB0A8C1_0x004BA558 | 0.0% | Pending SHC_3BB0A8C1_0x004BA559 | 0.0% | Pending -SHC_3BB0A8C1_0x004BA560 | 0.0% | Pending +SHC_3BB0A8C1_0x004BA560 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BA5C0 | 0.0% | Pending From a0921844eddbc302777d275c1b22f6145b468ca6 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:02 +0100 Subject: [PATCH 29/45] reimplement: SHC_3BB0A8C1_0x004BF720 100.0% Reimplemented MenuItemActionHandler_UnusedChooseMessageBox_Unknown, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 05f58dabc (2026-10-10), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...Handler_UnusedChooseMessageBox_Unknown.cpp | 29 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp new file mode 100644 index 0000000000..5b2cb8d5f6 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp @@ -0,0 +1,29 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004BF720 + void Unused::MenuItemActionHandler_UnusedChooseMessageBox_Unknown(int param_1, ...) + { + DWORD DVar1; + int iVar2; + DVar1 = timeGetTime(); + iVar2 = DAT_MapPropertiesState::instance.offset + param_1; + if (iVar2 < (int)DAT_MapPropertiesState::instance.total) { + DAT_MapPropertiesState::instance.indexStored = param_1; + DAT_MapPropertiesState::instance.value = DAT_MapPropertiesState::instance.unknownArray_01[iVar2]; + DAT_MapPropertiesState::instance.selectedAbsoluteIndex = iVar2; + DAT_MapPropertiesState::instance.selectionTime = DVar1; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index f79bfa92f4..2b856687c1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -30723,7 +30723,7 @@ SHC_3BB0A8C1_0x004BF711 | 0.0% | Pending SHC_3BB0A8C1_0x004BF712 | 0.0% | Pending -SHC_3BB0A8C1_0x004BF720 | 0.0% | Pending +SHC_3BB0A8C1_0x004BF720 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BF760 | 100.0% | Reimplemented, only the atol call target differs From 28805e706c8a1372703467f876f19d341bac2ce3 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:02 +0100 Subject: [PATCH 30/45] reimplement: SHC_3BB0A8C1_0x004D6F20 100.0% Reimplemented MenuItemActionHandler_Unknown27CampaignUnk_Main, gynt's work as it stands on his fork's reimpl/UI-MenuItems at d39ef7e59 (2026-10-08), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...ctionHandler_Unknown27CampaignUnk_Main.cpp | 39 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp new file mode 100644 index 0000000000..1f36610add --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp @@ -0,0 +1,39 @@ +#include "../Unknown27CampaignUnk.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::UI::Enums::MenuViewType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004D6F20 + void Unknown27CampaignUnk::MenuItemActionHandler_Unknown27CampaignUnk_Main(int param_1, ...) + { + if (((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) + && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) + && (param_1 == 10)) { + if (DAT_GameCore::instance.missionNumber1to20 == 1) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); + return; + } + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_UNKNOWN_26_CAMPAIGN_RELATEDUnk, 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 2b856687c1..ba9644029d 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -35835,7 +35835,7 @@ SHC_3BB0A8C1_0x004D6D20 | 0.0% | Pending SHC_3BB0A8C1_0x004D6EF0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004D6F20 | 0.0% | Pending +SHC_3BB0A8C1_0x004D6F20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D6F60 | 0.0% | Pending From 76c0003362f942120a837a919a1fbffd04d7806c Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:02 +0100 Subject: [PATCH 31/45] reimplement: SHC_3BB0A8C1_0x004D9C10 100.0% Reimplemented MenuItemRenderFunction_RankingGames_Scrollbar, gynt's work as it stands on his fork's reimpl/UI-MenuItems-100 at 0a7d9924e (2026-10-25), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...mRenderFunction_RankingGames_Scrollbar.cpp | 41 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp new file mode 100644 index 0000000000..94e6e99bc6 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp @@ -0,0 +1,41 @@ +#include "../RankingGames.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Enums::RenderTarget; + + // FUNCTION: STRONGHOLDCRUSADER 0x004D9C10 + void RankingGames::MenuItemRenderFunction_RankingGames_Scrollbar( + int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + { + DAT_ButtonUnknownZero::instance = 0; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonX::instance + 0x13), + (int)(DAT_ButtonY::instance + DAT_ButtonH::instance + -1), (ushort)(COL_BLACK::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonH::instance), thumbYPos, isDragged, + thumbHeight, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance - 1, (int)(DAT_ButtonY::instance + -1), (int)(DAT_ButtonX::instance + 0x14), + (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), + (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ba9644029d..edf0effe1b 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -36049,7 +36049,7 @@ SHC_3BB0A8C1_0x004D9C04 | 0.0% | Pending SHC_3BB0A8C1_0x004D9C08 | 0.0% | Pending -SHC_3BB0A8C1_0x004D9C10 | 0.0% | Pending +SHC_3BB0A8C1_0x004D9C10 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D9CC0 | 0.0% | Pending From 3163ef006fcd616a3399d2dbf2e4b3a312ec35bf Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:59:02 +0100 Subject: [PATCH 32/45] reimplement: SHC_3BB0A8C1_0x004DA050 100.0% Reimplemented MenuItemActionHandler_TacticalPowerBar_Main, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 846f2c8df (2026-10-09), where its status line reads 100%. Taken over unchanged; main's later renames and the style rules follow in commits of their own. Co-Authored-By: Claude Opus 5.5 --- ...temActionHandler_TacticalPowerBar_Main.cpp | 94 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp new file mode 100644 index 0000000000..f86df73f10 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp @@ -0,0 +1,94 @@ +#include "../TacticalPowerBar.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Audio/SFX/SoundEffectID.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Game/GameMode.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MissionDefinedData.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_TacticalPowersHelpTextDisplayBool.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Audio::SFX::SoundEffectID; + using OpenSHC::Commands::GameCommandType; + using OpenSHC::Game::GameMode; + + /* + WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names + */ + /* + WARNING: Enum "DPERRInt": Some values do not have unique names + */ + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004DA050 + void TacticalPowerBar::MenuItemActionHandler_TacticalPowerBar_Main(int param_1, ...) + { + int iVar1; + if ((((DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) + || (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) + || (DAT_GameState::instance.mapAndTime.skirmishNoRushTicks == 0)) + && ((iVar1 + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .tacticalPowersBarLevel, + MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(), + iVar1 >= (param_1 + 1) * 0x27c + && (DAT_GameState::instance + .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .lordKilledByPlayerID + == 0)))) { + if (DAT_TacticalPowersHelpTextDisplayBool::instance != false) { + DAT_MissionDefinedData::instance.field39_0x1370 = 0; + DAT_TacticalPowersHelpTextDisplayBool::instance = false; + } + if (param_1 == 5) { + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 + = DAT_GameSynchronyState::instance.currentPlayerSlotID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 5; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = 0; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ACTIVATE_TACTICAL_POWERS); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + ((SoundEffectID)0x100)); + return; + } + DAT_TileMapState::instance.field178_0x5549ec = param_1; + DAT_TileMapState::instance.shiftRelated0or3 = 5; + switch (param_1) { + case 2: + case 3: + case 4: + case 6: + case 0xd: + case 0x10: + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + ((SoundEffectID)0x104)); + return; + case 1: + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_CHAPEL_BELL); + return; + case 7: + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + ((SoundEffectID)0x105)); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index edf0effe1b..bf68f2b2b6 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -36081,7 +36081,7 @@ SHC_3BB0A8C1_0x004DA044 | 0.0% | Pending SHC_3BB0A8C1_0x004DA048 | 0.0% | Pending -SHC_3BB0A8C1_0x004DA050 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA050 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DA160 | 0.0% | Pending From 44344dd5b19e704994d60535f4bdbfcf181dc68d Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:59:43 +0100 Subject: [PATCH 33/45] fix: main's names and types since gynt's base, in 13 of the batch's files gynt's drafts were written against an older main. Main's Ghidra syncs have renamed or retyped what these files use, so they would not compile as they stand. Renamed by tools/reimplementation-helper/batch/refactor_struct_fields.py from the compiler errors, by offset, and by hand where a type changed: (undefined*)0x0 -> NULL; 0xe7 -> buildMenuTab; DAT_00b95b74 -> INT_00b95b74; DAT_MenuLoadGameRelativeSelectionIndex -> menuLoadGameRelativeSelectionIndex; DAT_MenuLoadGameRelativeSelectionOffset -> menuLoadGameRelativeSelectionOffset; field12_0x30 -> pendingGameSpeedLevel; field14_0x38 -> pendingSettingBubbleHelp; field15_0x3c -> pendingUnusedOption1; field178_0x5549ec -> activeTacticalPower; field20_0x44 -> pendingStreamVolume0; field21_0x48 -> pendingStreamVolume1; field22_0x4c -> pendingStreamVolume3; field26_0x74 -> field_0x74; field32_0x74 -> fileListEntryCount; field38_0x8c -> lastClickedListIndex; field39_0x90 -> lastListClickTime; field91_0x2bc -> cachedKeepEnclosed; unknownAlwaysZero03 -> showTextMessageInsteadOfEdit. buildMenuTab = 231 writes the 0xe7 into the ActiveMenuTab field as main's hideOrUnhideUI does; NULL is the (undefined*)0x0 the callback pointers are compared with, now that they are NoArgCallback*. No logic changes. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...nHandler_HistoricMissionSelect_General.cpp | 2 +- ...Function_InGameMenu_KeepEnclosedSymbol.cpp | 4 ++-- ...ItemActionHandler_LoadMap_TableContent.cpp | 20 ++++++++--------- ...tionHandler_LobbyMenu_MapDescScrollbar.cpp | 6 ++--- ..._MapEditorProperties_MapDescriptionBox.cpp | 2 +- ...nHandler_OptionsMenu_SubOptionsButtons.cpp | 12 +++++----- ...emActionHandler_OverlaySlider_Deselect.cpp | 4 ++-- ...temActionHandler_SaveLoadMap_Scrollbar.cpp | 22 +++++++++---------- ...ItemActionHandler_SaveMap_TableContent.cpp | 8 +++---- ...temActionHandler_TacticalPowerBar_Main.cpp | 2 +- ...er_UnusedEconomicMissionSelect_General.cpp | 2 +- ...dler_UnusedSomeMissionStartUnk_General.cpp | 2 +- ...Handler_UnusedWinCondition_DeselectUnk.cpp | 4 ++-- 13 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index d5e77a5f51..896080d90e 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -63,7 +63,7 @@ namespace UI { LAB_00426c1c: DAT_GameCore::instance.missionNumber1to20 = DAT_GameCore::instance.missionNumber1to20 + -1; DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_CAMPAIGN_MISSION; - DAT_GameCore::instance.field26_0x74 = 1; + DAT_GameCore::instance.field_0x74 = 1; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMissionProgress, DAT_GameCore::ptr)(); return; } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp index eb72157d23..5113b6e32a 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp @@ -31,10 +31,10 @@ namespace UI { BOOLEnum BVar1; BVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::checkKeepEnclosed, DAT_GameState::ptr)( DAT_GameSynchronyState::instance.currentPlayerSlotID); - if (BVar1 != DAT_MiniMapDefinedData::instance.field91_0x2bc) { + if (BVar1 != DAT_MiniMapDefinedData::instance.cachedKeepEnclosed) { DAT_GameCore::instance.countdown = 2; } - DAT_MiniMapDefinedData::instance.field91_0x2bc = BVar1; + DAT_MiniMapDefinedData::instance.cachedKeepEnclosed = BVar1; if (BVar1 == FALSE) { DAT_ButtonUnknownZero::instance = 1; return; diff --git a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp index b1e0d5647e..769732d5eb 100644 --- a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp @@ -16,18 +16,18 @@ namespace UI { { DWORD DVar1; DVar1 = timeGetTime(); - if ((int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + param_1 - < (int)DAT_MenuTextInputState::instance.field32_0x74) { - DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionIndex = param_1; - if ((DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + param_1 - == DAT_MenuTextInputState::instance.field38_0x8c) - && ((int)(DVar1 - DAT_MenuTextInputState::instance.field39_0x90) < 500)) { + if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 + < (int)DAT_MenuTextInputState::instance.fileListEntryCount) { + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = param_1; + if ((DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 + == DAT_MenuTextInputState::instance.lastClickedListIndex) + && ((int)(DVar1 - DAT_MenuTextInputState::instance.lastListClickTime) < 500)) { MACRO_CALL(OpenSHC::UI::MenuItems::SaveLoadMap_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(2); } - DAT_MenuTextInputState::instance.field38_0x8c - = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionIndex - + DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; - DAT_MenuTextInputState::instance.field39_0x90 = DVar1; + DAT_MenuTextInputState::instance.lastClickedListIndex + = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex + + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; + DAT_MenuTextInputState::instance.lastListClickTime = DVar1; } } diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp index 679e983865..e4671f69db 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp @@ -2,7 +2,7 @@ #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/Globals/DAT_00b95b74.hpp" +#include "OpenSHC/Globals/INT_00b95b74.hpp" #include "OpenSHC/Globals/DAT_00b960dc.hpp" #include "OpenSHC/Globals/DAT_00b960f4.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" @@ -30,7 +30,7 @@ namespace UI { switch (param_2) { case 1: *minValue = -0x13; - *maxValue = DAT_00b95b74::instance - iVar1; + *maxValue = INT_00b95b74::instance - iVar1; *currentValue = 0; return; case 2: @@ -39,7 +39,7 @@ namespace UI { return; case 4: *minValue = -0x13; - *maxValue = DAT_00b95b74::instance - iVar1; + *maxValue = INT_00b95b74::instance - iVar1; *currentValue = DAT_00b960f4::instance; return; case 7: diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp index 8628184fe4..44e3173fc8 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp @@ -24,7 +24,7 @@ namespace UI { if (DAT_GameCore::instance.U2_mapType_singleOrMulti && DAT_GameCore::instance.mapLoadedForEditor && DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU && DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE - && (INT_00b95f68::instance = 1, !DAT_GameCore::instance.unknownAlwaysZero03)) { + && (INT_00b95f68::instance = 1, !DAT_GameCore::instance.showTextMessageInsteadOfEdit)) { MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); DAT_TextEditorState::instance.customTextMaxLength = 1000; MACRO_CALL_MEMBER(Text::TextEditorState_Func::openMapDescriptionEditorDialog, DAT_TextEditorState::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp index fe2fdeac29..732d7008d9 100644 --- a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp @@ -27,9 +27,9 @@ namespace UI { { switch (param_1) { case 0x19: - DAT_MenuTextInputState::instance.field12_0x30 = DAT_GameCore::instance.gameSpeedLevel; - DAT_MenuTextInputState::instance.field14_0x38 = DAT_GameCore::instance.settingBubbleHelp; - DAT_MenuTextInputState::instance.field15_0x3c = DAT_GameCore::instance.unusedOption1; + DAT_MenuTextInputState::instance.pendingGameSpeedLevel = DAT_GameCore::instance.gameSpeedLevel; + DAT_MenuTextInputState::instance.pendingSettingBubbleHelp = DAT_GameCore::instance.settingBubbleHelp; + DAT_MenuTextInputState::instance.pendingUnusedOption1 = DAT_GameCore::instance.unusedOption1; MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_GAMEPLAY_OPTIONS); break; @@ -48,9 +48,9 @@ namespace UI { DAT_MenuTextInputState::instance.DAT_GenieVoiceActiveMenuVar = DAT_GameCore::instance.genieVoiceActive; DAT_MenuTextInputState::instance.DAT_SoundActiveMenuVar = DAT_SoundSystemState::instance.soundActiveUnk_0x0; - DAT_MenuTextInputState::instance.field20_0x44 = DAT_SoundSystemState::instance.streamVolume[0]; - DAT_MenuTextInputState::instance.field21_0x48 = DAT_SoundSystemState::instance.streamVolume[1]; - DAT_MenuTextInputState::instance.field22_0x4c = DAT_SoundSystemState::instance.streamVolume[3]; + DAT_MenuTextInputState::instance.pendingStreamVolume0 = DAT_SoundSystemState::instance.streamVolume[0]; + DAT_MenuTextInputState::instance.pendingStreamVolume1 = DAT_SoundSystemState::instance.streamVolume[1]; + DAT_MenuTextInputState::instance.pendingStreamVolume3 = DAT_SoundSystemState::instance.streamVolume[3]; MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_SOUND_OPTIONS); return; diff --git a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp index 0bad8dfbbb..2d73888533 100644 --- a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp +++ b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp @@ -20,7 +20,7 @@ namespace UI { if ((DAT_MouseState::instance.rightClickStart != 0) && (MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE), - DAT_MenuModalComposition2::instance.sliderCallbackFunction != (undefined*)0x0)) { + DAT_MenuModalComposition2::instance.sliderCallbackFunction != NULL)) { ((void (*)())DAT_MenuModalComposition2::instance.sliderCallbackFunction)(); DAT_MenuModalComposition2::instance.minus1 = -1; } @@ -35,7 +35,7 @@ namespace UI { } MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); - if (DAT_MenuModalComposition2::instance.sliderCallbackFunction != (undefined*)0x0) { + if (DAT_MenuModalComposition2::instance.sliderCallbackFunction != NULL) { ((void (*)())DAT_MenuModalComposition2::instance.sliderCallbackFunction)(); DAT_MenuModalComposition2::instance.minus1 = -1; } diff --git a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp index 63c4058de1..68bb4df995 100644 --- a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp @@ -15,37 +15,37 @@ namespace UI { *minValue = 0; *maxValue = DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount; - *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; case 2: case 3: - DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset = *currentValue; + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset = *currentValue; return; case 4: - *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; case 7: *currentValue = DAT_MenuTextInputState::instance.fileListVisibleRowCount + -1; return; case 5: - if (0 < (int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset) { - DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset - = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + -1; - *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + if (0 < (int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset) { + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + -1; + *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; } break; case 6: - if ((int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset < (int)DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount) { - DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset - = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + 1; + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + 1; } break; default: return; } - *currentValue = DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset; + *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; } } diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp index 04dedd4eae..c793123036 100644 --- a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -18,12 +18,12 @@ namespace UI { void SaveMap::MenuItemActionHandler_SaveMap_TableContent(int param_1, ...) { char* pcVar1; - if ((int)DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + param_1 - < (int)DAT_MenuTextInputState::instance.field32_0x74) { - DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionIndex = param_1; + if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 + < (int)DAT_MenuTextInputState::instance.fileListEntryCount) { + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = param_1; pcVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance - .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.DAT_MenuLoadGameRelativeSelectionOffset + .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 + -1]); MACRO_CALL_MEMBER( OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(pcVar1); diff --git a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp index f86df73f10..671869715b 100644 --- a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp @@ -66,7 +66,7 @@ namespace UI { ((SoundEffectID)0x100)); return; } - DAT_TileMapState::instance.field178_0x5549ec = param_1; + DAT_TileMapState::instance.activeTacticalPower = param_1; DAT_TileMapState::instance.shiftRelated0or3 = 5; switch (param_1) { case 2: diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp index 9d77aca224..2e15d47190 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -62,7 +62,7 @@ namespace UI { LAB_00426f5c: DAT_GameCore::instance.missionNumber1to20 = DAT_GameCore::instance.missionNumber1to20 + -1; DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_ECONOMIC_CAMPAIGN_SH1; - DAT_GameCore::instance.field26_0x74 = 1; + DAT_GameCore::instance.field_0x74 = 1; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMission, DAT_GameCore::ptr)(); return; } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index ede58b3eac..e3a514b4d9 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -52,7 +52,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); DAT_GameCore::instance.section1066 = 1; - DAT_GameCore::instance.landscapingmenuMenuTabToSwitchTo = 0xe7; + DAT_GameCore::instance.landscapingmenuMenuTabToSwitchTo.buildMenuTab = 231; MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::loadMissionMapAndSetLord, DAT_MapPropertiesState::ptr)(DAT_GameCore::instance.missionNumber1to20); MACRO_CALL_MEMBER( diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp index d26f7a7818..1d87ce666a 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp @@ -21,7 +21,7 @@ namespace UI { if ((DAT_MouseState::instance.rightClickStart != 0) && (MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE), - DAT_MenuModalComposition1::instance.sliderCallbackFunction != (undefined*)0x0)) { + DAT_MenuModalComposition1::instance.sliderCallbackFunction != NULL)) { ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); DAT_MenuModalComposition1::instance.minus1 = -1; } @@ -36,7 +36,7 @@ namespace UI { } MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); - if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != (undefined*)0x0) { + if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != NULL) { ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); DAT_MenuModalComposition1::instance.minus1 = -1; } From 3f91b1841fa2fa58b9bd0d456e0a0dd69ed6946c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:01:17 +0100 Subject: [PATCH 34/45] style: the review asks over the batch: decimals, compound assignment, truth tests, no using lines The style fixer's pass over the lines the batch adds, then clang-format: hexadecimal constants as decimals, x = x + n as x += n, + -n as - n, == FALSE / != FALSE on BOOL values as truth tests, and the decompiler's using declarations dropped (the names are written qualified). The code is unchanged: quick_diff gives the same output for every file before and after. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...ctionHandler_HistoricCampaignSelect_Main.cpp | 2 -- ...ionHandler_HistoricMissionSelect_General.cpp | 17 ++++++----------- ...temActionHandler_IdentityOptions_Confirm.cpp | 10 ++++------ ...mActionHandler_IdentityOptions_LordIcons.cpp | 16 ++++++++-------- ...ActionHandler_InGameMenu_MapEventIconUnk.cpp | 10 +++++----- ...nction_InGameMenu_BikMessagePlayerShield.cpp | 5 +---- ...erFunction_InGameMenu_KeepEnclosedSymbol.cpp | 2 +- ...ActionHandler_LobbyMenu_MapDescScrollbar.cpp | 14 ++++++-------- ...emActionHandler_LobbyMenu_MapSelectTable.cpp | 6 +----- ...enderFunction_LobbyMenu_MapDescScrollbar.cpp | 1 - ...er_MapEditorProperties_MapDescriptionBox.cpp | 2 -- ...EditorProperties_MapDescriptionScrollbar.cpp | 3 --- ...uItemActionHandler_NewMapMaptype_Buttons.cpp | 4 ---- ...ionHandler_OptionsMenu_SubOptionsButtons.cpp | 10 ++++------ ...ItemActionHandler_OverlaySlider_Deselect.cpp | 3 --- ...temRenderFunction_RankingGames_Scrollbar.cpp | 8 +++----- ...uItemActionHandler_SaveLoadMap_Scrollbar.cpp | 11 ++++++----- ...nuItemActionHandler_SaveMap_TableContent.cpp | 2 +- ...Function_SingleplayerMapChoice_Scrollbar.cpp | 2 -- ...uItemActionHandler_TacticalPowerBar_Main.cpp | 14 ++++++-------- ...mActionHandler_Unknown27CampaignUnk_Main.cpp | 3 --- ...andler_UnusedEconomicGametypeSelect_Main.cpp | 3 --- ...dler_UnusedEconomicMissionSelect_General.cpp | 15 +++++---------- ...andler_UnusedSomeMissionStartUnk_General.cpp | 9 ++------- ...onHandler_UnusedWinCondition_DeselectUnk.cpp | 3 --- ...nction_UnusedOldTitleMenu_ContinueButton.cpp | 5 ++--- ...unction_UnusedOldTitleMenu_TestMapButton.cpp | 5 ++--- ...uItemActionHandler_WaitingForHost_Button.cpp | 11 +++-------- 28 files changed, 66 insertions(+), 130 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp index 7febd74a13..571a121348 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp @@ -11,8 +11,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuViewType; - // FUNCTION: STRONGHOLDCRUSADER 0x00425720 void HistoricCampaignSelect::MenuItemActionHandler_HistoricCampaignSelect_Main(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index 896080d90e..34be786e63 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -17,11 +17,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Game::GameMode2; - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::UI::Enums::MenuViewType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x00426B80 void HistoricMissionSelect::MenuItemActionHandler_HistoricMissionSelect_General(int param_1, ...) { @@ -34,7 +29,7 @@ namespace UI { switch (param_1) { default: { BOOL_CurrentMenuClickState::instance = FALSE; - DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - param_1) + -1; + DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - param_1) - 1; DWORD DVar1 = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex @@ -46,22 +41,22 @@ namespace UI { } goto LAB_00426c1c; } - case 0x14: { - DAT_GameState::instance.mapAndTime.difficulty = DAT_GameState::instance.mapAndTime.difficulty + 1; + case 20: { + ++DAT_GameState::instance.mapAndTime.difficulty; /* the original compares against 4 (`cmp eax, 4; jl`), not 3 */ if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { DAT_GameState::instance.mapAndTime.difficulty = 0; } return; } - case 0x12: { + case 18: { MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_HISTORIC_CAMPAIGN_SELECT, 0); return; } - case 0xd: + case 13: LAB_00426c1c: - DAT_GameCore::instance.missionNumber1to20 = DAT_GameCore::instance.missionNumber1to20 + -1; + --DAT_GameCore::instance.missionNumber1to20; DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_CAMPAIGN_MISSION; DAT_GameCore::instance.field_0x74 = 1; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMissionProgress, DAT_GameCore::ptr)(); diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp index 9073fe51c3..ed418ae122 100644 --- a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp @@ -15,20 +15,18 @@ namespace UI { namespace MenuItems { using Commands::GameCommandType; - using Game::GameMode; // FUNCTION: STRONGHOLDCRUSADER 0x00493D30 void IdentityOptions::MenuItemActionHandler_IdentityOptions_Confirm(int param_1, ...) { - if (param_1 == 0x11) { + if (param_1 == 17) { DAT_UserTextHandlerState::instance.allowUserTextInput = 0; - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( - 9); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); DAT_UserTextHandlerState::instance.allowUserTextInput = 1; MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY) { - MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, - DAT_GameSynchronyState::ptr)(((GameCommandType)0x60)); + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + ((GameCommandType)96)); } } } diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp index 0a3b52637a..700cb3f4ba 100644 --- a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp @@ -9,24 +9,24 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00491CE0 void IdentityOptions::MenuItemActionHandler_IdentityOptions_LordIcons(int param_1, ...) { - if (param_1 == 0x15) { + if (param_1 == 21) { DAT_GameCore::instance.selectedLordTypeUnk = 0; - if (DAT_GameCore::instance.lordIconUnk < 0x14) { + if (DAT_GameCore::instance.lordIconUnk < 20) { DAT_GameCore::instance.lordIconUnk = 2; } - } else if (param_1 == 0x16) { + } else if (param_1 == 22) { DAT_GameCore::instance.selectedLordTypeUnk = 1; - if (DAT_GameCore::instance.lordIconUnk < 0x14) { + if (DAT_GameCore::instance.lordIconUnk < 20) { DAT_GameCore::instance.lordIconUnk = 3; } - } else if (param_1 == 0x28) { - DAT_GameCore::instance.lordIconUnk = DAT_GameCore::instance.lordIconUnk + -1; + } else if (param_1 == 40) { + --DAT_GameCore::instance.lordIconUnk; if (DAT_GameCore::instance.lordIconUnk < 2) { DAT_GameCore::instance.lordIconUnk = 21; } - } else if ((param_1 == 0x29) + } else if ((param_1 == 41) && (DAT_GameCore::instance.lordIconUnk = DAT_GameCore::instance.lordIconUnk + 1, - 0x15 < DAT_GameCore::instance.lordIconUnk)) { + 21 < DAT_GameCore::instance.lordIconUnk)) { DAT_GameCore::instance.lordIconUnk = 2; } } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp index 7e2f3c8f86..f04a267ae5 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp @@ -22,16 +22,16 @@ namespace UI { iVar1 = 1; if (1 < (int)DAT_MinimapViewState::instance.spawnMomentCount) { do { - DAT_MinimapViewState::instance.spawnMomentX[iVar1 + -1] + DAT_MinimapViewState::instance.spawnMomentX[iVar1 - 1] = DAT_MinimapViewState::instance.spawnMomentX[iVar1]; - DAT_MinimapViewState::instance.spawnMomentX[iVar1 + 0x13] + DAT_MinimapViewState::instance.spawnMomentX[iVar1 + 19] = DAT_MinimapViewState::instance.spawnMomentY[iVar1]; - DAT_MinimapViewState::instance.spawnMomentY[iVar1 + 0x13] + DAT_MinimapViewState::instance.spawnMomentY[iVar1 + 19] = DAT_MinimapViewState::instance.spawnMoment[iVar1]; - iVar1 = iVar1 + 1; + ++iVar1; } while (iVar1 < (int)DAT_MinimapViewState::instance.spawnMomentCount); } - DAT_MinimapViewState::instance.spawnMomentCount = DAT_MinimapViewState::instance.spawnMomentCount + -1; + --DAT_MinimapViewState::instance.spawnMomentCount; } } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp index 2d801ea0ba..d1ba88c6b4 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp @@ -13,9 +13,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::DE::SHCDE::eGM; - using OpenSHC::Rendering::Enums::RenderTarget; - // FUNCTION: STRONGHOLDCRUSADER 0x004B65F0 void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int param_1, ...) { @@ -28,7 +25,7 @@ namespace UI { 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_INTERFACE_ICONS2, - (int)((int)(dVar1 + 0x1d5)), (int)((int)(DAT_ButtonX::instance)), + (int)((int)(dVar1 + 469)), (int)((int)(DAT_ButtonX::instance)), (int)((int)(DAT_ButtonY::instance))); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp index 5113b6e32a..05bf12d84d 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp @@ -35,7 +35,7 @@ namespace UI { DAT_GameCore::instance.countdown = 2; } DAT_MiniMapDefinedData::instance.cachedKeepEnclosed = BVar1; - if (BVar1 == FALSE) { + if (!BVar1) { DAT_ButtonUnknownZero::instance = 1; return; } diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp index e4671f69db..492e681570 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp @@ -2,17 +2,15 @@ #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/Globals/INT_00b95b74.hpp" #include "OpenSHC/Globals/DAT_00b960dc.hpp" #include "OpenSHC/Globals/DAT_00b960f4.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/INT_00b95b74.hpp" namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuModalType; - // FUNCTION: STRONGHOLDCRUSADER 0x00428980 void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapDescScrollbar( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) @@ -23,13 +21,13 @@ namespace UI { && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { int iVar1 = 0; if (!param_1) { - iVar1 = 0xcc; + iVar1 = 204; } else if (param_1 == 1) { - iVar1 = 0x6e; + iVar1 = 110; } switch (param_2) { case 1: - *minValue = -0x13; + *minValue = -19; *maxValue = INT_00b95b74::instance - iVar1; *currentValue = 0; return; @@ -38,12 +36,12 @@ namespace UI { DAT_00b960f4::instance = *currentValue; return; case 4: - *minValue = -0x13; + *minValue = -19; *maxValue = INT_00b95b74::instance - iVar1; *currentValue = DAT_00b960f4::instance; return; case 7: - *currentValue = iVar1 + -0xe; + *currentValue = iVar1 - 14; } } } diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp index fd84a1f1e6..065c9292e0 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp @@ -12,10 +12,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Commands::GameCommandType; - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names */ @@ -39,7 +35,7 @@ namespace UI { == OpenSHC::UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { return; } - if (DAT_GameSynchronyState::instance.isHost == FALSE) { + if (!DAT_GameSynchronyState::instance.isHost) { return; } if ((int)DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset + param_1 diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp index 6744ab0e1a..64a8fd0d13 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp @@ -17,7 +17,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuModalType; using WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x00428A60 diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp index 44e3173fc8..bba0bcddfc 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp @@ -16,8 +16,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuModalType; - // FUNCTION: STRONGHOLDCRUSADER 0x0042EDF0 void MapEditorProperties::MenuItemActionHandler_MapEditorProperties_MapDescriptionBox() { diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp index b005397789..1d30943e41 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp @@ -17,9 +17,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - using OpenSHC::UI::Enums::MenuModalType; - // FUNCTION: STRONGHOLDCRUSADER 0x0042EF80 void MapEditorProperties::MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) diff --git a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp index 60571ccae5..e0bf5b9f11 100644 --- a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp +++ b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp @@ -16,10 +16,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Map::MapType2; - using UI::Enums::MenuModalType; - using UI::Enums::MenuViewType; - // FUNCTION: STRONGHOLDCRUSADER 0x0042F2B0 void NewMapMaptype::MenuItemActionHandler_NewMapMaptype_Buttons(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp index 732d7008d9..7f2e3ff0ca 100644 --- a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp @@ -17,8 +17,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::UI::Enums::MenuModalType; - /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ @@ -26,7 +24,7 @@ namespace UI { void OptionsMenu::MenuItemActionHandler_OptionsMenu_SubOptionsButtons(int param_1, ...) { switch (param_1) { - case 0x19: + case 25: DAT_MenuTextInputState::instance.pendingGameSpeedLevel = DAT_GameCore::instance.gameSpeedLevel; DAT_MenuTextInputState::instance.pendingSettingBubbleHelp = DAT_GameCore::instance.settingBubbleHelp; DAT_MenuTextInputState::instance.pendingUnusedOption1 = DAT_GameCore::instance.unusedOption1; @@ -54,7 +52,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_SOUND_OPTIONS); return; - case 0x2d: + case 45: DAT_UserTextHandlerState::instance.allowUserTextInput = 0; MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( 0); @@ -63,12 +61,12 @@ namespace UI { DAT_UserTextHandlerState::instance.allowUserTextInput = 1; MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_IDENTITY_OPTIONS); - break; + break; case 6: MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_NETWORK_OPTIONS); return; - case 0x11: + case 17: MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); return; } diff --git a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp index 2d73888533..b5f21ce9ec 100644 --- a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp +++ b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp @@ -11,9 +11,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004B0F70 void OverlaySlider::MenuItemActionHandler_OverlaySlider_Deselect(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp index 94e6e99bc6..1614318778 100644 --- a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp @@ -16,8 +16,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - // FUNCTION: STRONGHOLDCRUSADER 0x004D9C10 void RankingGames::MenuItemRenderFunction_RankingGames_Scrollbar( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) @@ -25,13 +23,13 @@ namespace UI { DAT_ButtonUnknownZero::instance = 0; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonX::instance + 0x13), - (int)(DAT_ButtonY::instance + DAT_ButtonH::instance + -1), (ushort)(COL_BLACK::instance.shortValue)); + DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonX::instance + 19), + (int)(DAT_ButtonY::instance + DAT_ButtonH::instance - 1), (ushort)(COL_BLACK::instance.shortValue)); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonH::instance), thumbYPos, isDragged, thumbHeight, 0); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance - 1, (int)(DAT_ButtonY::instance + -1), (int)(DAT_ButtonX::instance + 0x14), + DAT_ButtonX::instance - 1, (int)(DAT_ButtonY::instance - 1), (int)(DAT_ButtonX::instance + 20), (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); } diff --git a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp index 68bb4df995..662eceee28 100644 --- a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp @@ -13,8 +13,8 @@ namespace UI { switch (param_2) { case 1: *minValue = 0; - *maxValue - = DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount; + *maxValue = DAT_MenuTextInputState::instance.fileListEntryCount + - DAT_MenuTextInputState::instance.fileListVisibleRowCount; *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; case 2: @@ -25,19 +25,20 @@ namespace UI { *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; case 7: - *currentValue = DAT_MenuTextInputState::instance.fileListVisibleRowCount + -1; + *currentValue = DAT_MenuTextInputState::instance.fileListVisibleRowCount - 1; return; case 5: if (0 < (int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + -1; + = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - 1; *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; } break; case 6: if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - < (int)DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount) { + < (int)DAT_MenuTextInputState::instance.fileListEntryCount + - DAT_MenuTextInputState::instance.fileListVisibleRowCount) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + 1; } diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp index c793123036..d1335c8018 100644 --- a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -24,7 +24,7 @@ namespace UI { pcVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - + param_1 + -1]); + + param_1 - 1]); MACRO_CALL_MEMBER( OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(pcVar1); } diff --git a/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp index 7b06cb7de1..6541b9cca9 100644 --- a/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp @@ -14,8 +14,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - // FUNCTION: STRONGHOLDCRUSADER 0x0042DC60 void SinglePlayerMapChoice::MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) diff --git a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp index 671869715b..1040a1d5ab 100644 --- a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp @@ -20,8 +20,6 @@ namespace UI { namespace MenuItems { using OpenSHC::Audio::SFX::SoundEffectID; - using OpenSHC::Commands::GameCommandType; - using OpenSHC::Game::GameMode; /* WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names @@ -46,7 +44,7 @@ namespace UI { = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .tacticalPowersBarLevel, MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(), - iVar1 >= (param_1 + 1) * 0x27c + iVar1 >= (param_1 + 1) * 636 && (DAT_GameState::instance .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .lordKilledByPlayerID @@ -63,7 +61,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ACTIVATE_TACTICAL_POWERS); MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - ((SoundEffectID)0x100)); + ((SoundEffectID)256)); return; } DAT_TileMapState::instance.activeTacticalPower = param_1; @@ -73,10 +71,10 @@ namespace UI { case 3: case 4: case 6: - case 0xd: - case 0x10: + case 13: + case 16: MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - ((SoundEffectID)0x104)); + ((SoundEffectID)260)); return; case 1: MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( @@ -84,7 +82,7 @@ namespace UI { return; case 7: MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - ((SoundEffectID)0x105)); + ((SoundEffectID)261)); } } } diff --git a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp index 1f36610add..d34d256904 100644 --- a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp @@ -12,9 +12,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::UI::Enums::MenuViewType; - /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp index 6424053ccd..19b846d476 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp @@ -15,9 +15,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Game::GameMode2; - using UI::Enums::MenuViewType; - // FUNCTION: STRONGHOLDCRUSADER 0x00425C20 void Unused::MenuItemActionHandler_UnusedEconomicGametypeSelect_Main(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp index 2e15d47190..8d4eaa6024 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -16,11 +16,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Game::GameMode2; - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::UI::Enums::MenuViewType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x00426ED0 void Unused::MenuItemActionHandler_UnusedEconomicMissionSelect_General(int param_1, ...) { @@ -45,22 +40,22 @@ namespace UI { } goto LAB_00426f5c; } - case 0x14: { - DAT_GameState::instance.mapAndTime.difficulty = DAT_GameState::instance.mapAndTime.difficulty + 1; + case 20: { + ++DAT_GameState::instance.mapAndTime.difficulty; /* the original compares against 4 (`cmp eax, 4; jl`), not 3 */ if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { DAT_GameState::instance.mapAndTime.difficulty = 0; } return; } - case 0x12: { + case 18: { MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); return; } - case 0xd: + case 13: LAB_00426f5c: - DAT_GameCore::instance.missionNumber1to20 = DAT_GameCore::instance.missionNumber1to20 + -1; + --DAT_GameCore::instance.missionNumber1to20; DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_ECONOMIC_CAMPAIGN_SH1; DAT_GameCore::instance.field_0x74 = 1; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::incrementMission, DAT_GameCore::ptr)(); diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index e3a514b4d9..83f259e541 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -19,11 +19,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Commands::GameCommandType; - using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::UI::Enums::MenuViewType; - /* WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names */ @@ -43,11 +38,11 @@ namespace UI { MSVC's sparse switch, and the `case 0xe` body sits first */ switch (param_1) { - case 0xe: + case 14: MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); break; - case 0xd: + case 13: DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_HUNTERSHUT; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp index 1d87ce666a..ed593e6f49 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp @@ -12,9 +12,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::UI::Enums::MenuModalType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004B1000 void Unused::MenuItemActionHandler_UnusedWinCondition_DeselectUnk(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp index d70a4dba58..43e2d663dc 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp @@ -22,7 +22,6 @@ namespace UI { using OpenSHC::Rendering::Colors::BGR24; using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x0042DEB0 void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton(int param_1, ...) @@ -31,7 +30,7 @@ namespace UI { the original jumps out of line on `== FALSE`, so the interacting arm is the one the source wrote first */ - if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + if (DAT_ButtonCurrentlyInteracting::instance) { DAT_TextManagerObject::instance.textColor = 0xff; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; } else { @@ -45,7 +44,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( "Continue", (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), (TextAlignment)((int)(DAT_ButtonW::instance)), - (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 0x11, FALSE, 0); + (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp index a502872128..5187d857cd 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp @@ -22,7 +22,6 @@ namespace UI { using OpenSHC::Rendering::Colors::BGR24; using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x0042DF40 void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton(int param_1, ...) @@ -31,7 +30,7 @@ namespace UI { the original jumps out of line on `== FALSE`, so the interacting arm is the one the source wrote first */ - if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + if (DAT_ButtonCurrentlyInteracting::instance) { DAT_TextManagerObject::instance.textColor = 0xff; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; } else { @@ -45,7 +44,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( "Test map", (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), (TextAlignment)((int)(DAT_ButtonW::instance)), - (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 0x11, FALSE, 0); + (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp index e67820c12c..4d1ef36a81 100644 --- a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp +++ b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp @@ -17,18 +17,13 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuModalType; - using UI::Enums::MenuViewType; - using WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x0047E3E0 void WaitingForHost::MenuItemActionHandler_WaitingForHost_Button(int param_1, ...) { if (param_1 == 3) { - MACRO_CALL_MEMBER( - Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); - MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, - DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_NONE, FALSE); MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_MAIN_MENU, 0); MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); From 355394328f1775a595dcf0db5e597f3b41b76db6 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:06:55 +0100 Subject: [PATCH 35/45] style: no imported plate comments, declarations at first use tools/reimplementation-helper/batch/strip_noise_comments.py drops the decompiler's block comments above each // FUNCTION: line (the WARNING: Enum and decompilerscript plates), and declare_at_use.py moves the declarations that were still at the top of four functions (MapEventIconUnk, BikMessagePlayerShield, LoadMap_TableContent, UnusedChooseMessageBox_Unknown) down to their first assignment. The code is unchanged: quick_diff gives the same output for every file before and after. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...uItemActionHandler_InGameMenu_MapEventIconUnk.cpp | 6 +----- ...derFunction_InGameMenu_BikMessagePlayerShield.cpp | 3 +-- ...mRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp | 9 --------- .../MenuItemActionHandler_LoadMap_TableContent.cpp | 6 +----- ...enuItemActionHandler_LobbyMenu_MapSelectTable.cpp | 9 --------- ...emActionHandler_OptionsMenu_SubOptionsButtons.cpp | 3 --- .../MenuItemActionHandler_SaveMap_TableContent.cpp | 3 --- .../MenuItemActionHandler_TacticalPowerBar_Main.cpp | 12 ------------ ...nuItemActionHandler_Unknown27CampaignUnk_Main.cpp | 3 --- ...mActionHandler_UnusedChooseMessageBox_Unknown.cpp | 9 ++------- ...tionHandler_UnusedSomeMissionStartUnk_General.cpp | 9 --------- 11 files changed, 5 insertions(+), 67 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp index f04a267ae5..907667bdef 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp @@ -9,17 +9,13 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004B6530 void InGameMenu::MenuItemActionHandler_InGameMenu_MapEventIconUnk(int param_1, ...) { - int iVar1; MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::focusOnCoordinate, DAT_ViewportRenderState::ptr)(DAT_MinimapViewState::instance.spawnMomentX[0], (int)((int)(DAT_MinimapViewState::instance.spawnMomentY[0]))); - iVar1 = 1; + int iVar1 = 1; if (1 < (int)DAT_MinimapViewState::instance.spawnMomentCount) { do { DAT_MinimapViewState::instance.spawnMomentX[iVar1 - 1] diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp index d1ba88c6b4..b2b9c23321 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp @@ -16,9 +16,8 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004B65F0 void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int param_1, ...) { - dword dVar1; if (DAT_VideoBikQueue::instance.mbr_0x928) { - dVar1 = DAT_VideoBikQueue::instance.mbr_0x928; + dword dVar1 = DAT_VideoBikQueue::instance.mbr_0x928; if ((int)DAT_VideoBikQueue::instance.mbr_0x928 < 0) { dVar1 = -DAT_VideoBikQueue::instance.mbr_0x928; } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp index 05bf12d84d..6865ad224d 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp @@ -16,15 +16,6 @@ namespace UI { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ - /* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004B65A0 void InGameMenu::MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp index 769732d5eb..57c4dacc88 100644 --- a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp @@ -8,14 +8,10 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004948C0 void LoadMap::MenuItemActionHandler_LoadMap_TableContent(int param_1, ...) { - DWORD DVar1; - DVar1 = timeGetTime(); + DWORD DVar1 = timeGetTime(); if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 < (int)DAT_MenuTextInputState::instance.fileListEntryCount) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = param_1; diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp index 065c9292e0..cd2671e720 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp @@ -12,15 +12,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ - /* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x0042B470 void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapSelectTable(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp index 7f2e3ff0ca..6d57cf5af9 100644 --- a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp @@ -17,9 +17,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x00493BD0 void OptionsMenu::MenuItemActionHandler_OptionsMenu_SubOptionsButtons(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp index d1335c8018..b9b1823b84 100644 --- a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -11,9 +11,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004932A0 void SaveMap::MenuItemActionHandler_SaveMap_TableContent(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp index 1040a1d5ab..ccb7affce2 100644 --- a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp @@ -21,18 +21,6 @@ namespace UI { using OpenSHC::Audio::SFX::SoundEffectID; - /* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ - /* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004DA050 void TacticalPowerBar::MenuItemActionHandler_TacticalPowerBar_Main(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp index d34d256904..16b18f1f70 100644 --- a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp @@ -12,9 +12,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004D6F20 void Unknown27CampaignUnk::MenuItemActionHandler_Unknown27CampaignUnk_Main(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp index 5b2cb8d5f6..4f09141944 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp @@ -6,16 +6,11 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004BF720 void Unused::MenuItemActionHandler_UnusedChooseMessageBox_Unknown(int param_1, ...) { - DWORD DVar1; - int iVar2; - DVar1 = timeGetTime(); - iVar2 = DAT_MapPropertiesState::instance.offset + param_1; + DWORD DVar1 = timeGetTime(); + int iVar2 = DAT_MapPropertiesState::instance.offset + param_1; if (iVar2 < (int)DAT_MapPropertiesState::instance.total) { DAT_MapPropertiesState::instance.indexStored = param_1; DAT_MapPropertiesState::instance.value = DAT_MapPropertiesState::instance.unknownArray_01[iVar2]; diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index 83f259e541..0a7d914e78 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -19,15 +19,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ - /* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x00427080 void Unused::MenuItemActionHandler_UnusedSomeMissionStartUnk_General(int param_1, ...) { From 3c288d3f77ef0b4b378a6464ba58c755c370b77e Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:18:43 +0100 Subject: [PATCH 36/45] style: names for the decompiler's locals and labels, // comments, colours by name, loops The rest of the checker's ERRORs on the batch, file by file: the decompiler's iVar / dVar / pcVar / BVar / DVar locals get names that say what they hold and are declared where first assigned; block comments inside the bodies become // lines, and NewInvasion_RepeatSlider's, which only repeated the field name, goes; the old title menu's text colour is written by its ColorsEnum name (COL_0000FF) and its two button captions by their string pointers; BOOLEnum stores are TRUE / FALSE; MapDescriptionBox clears its buffer with sizeof the buffer; runs of nine copies of one statement and MapEventIconUnk's if / do-while pair become for loops, which MSVC unrolls or lays out the same. quick_diff gives the same output for every file before and after, but for the jump table's label number in the listing of three files whose loops add labels (HistoricCampaignSelect_Main, NewMapMaptype_Buttons, UnusedEconomicGametypeSelect_Main; their .text and .rdata compare identical). UnusedEconomicGametypeSelect_Main's goto to a bare return becomes that return. Two gotos stay, in HistoricMissionSelect_General and UnusedEconomicMissionSelect_General, with their labels named: the label has two predecessors, and writing the shared tail out twice costs 9 and 7 instructions. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...ionHandler_HistoricCampaignSelect_Main.cpp | 88 ++++--------------- ...nHandler_HistoricMissionSelect_General.cpp | 18 ++-- ...tionHandler_InGameMenu_MapEventIconUnk.cpp | 18 ++-- ...tion_InGameMenu_BikMessagePlayerShield.cpp | 6 +- ...Function_InGameMenu_KeepEnclosedSymbol.cpp | 15 ++-- ...tionHandler_LobbyMenu_MapDescScrollbar.cpp | 12 +-- ..._MapEditorProperties_MapDescriptionBox.cpp | 3 +- ...ActionHandler_NewInvasion_RepeatSlider.cpp | 3 - ...temActionHandler_NewMapMaptype_Buttons.cpp | 22 +---- ...mRenderFunction_RankingGames_Scrollbar.cpp | 2 +- ...ItemActionHandler_SaveMap_TableContent.cpp | 12 +-- ...temActionHandler_TacticalPowerBar_Main.cpp | 6 +- ...Handler_UnusedChooseMessageBox_Unknown.cpp | 13 +-- ...dler_UnusedEconomicGametypeSelect_Main.cpp | 72 +++------------ ...er_UnusedEconomicMissionSelect_General.cpp | 19 ++-- ...dler_UnusedSomeMissionStartUnk_General.cpp | 6 +- ...tion_UnusedOldTitleMenu_ContinueButton.cpp | 13 +-- ...ction_UnusedOldTitleMenu_TestMapButton.cpp | 13 +-- 18 files changed, 108 insertions(+), 233 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp index 571a121348..a9a646f6ec 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp @@ -22,24 +22,10 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 1; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 2: DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty; @@ -48,24 +34,10 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 2; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 3: DAT_GameCore::instance.gameSuspended = 0; @@ -74,24 +46,10 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 3; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 4: DAT_GameCore::instance.gameSuspended = 0; @@ -100,24 +58,10 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 4; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 5: MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index 34be786e63..0bd7b9833a 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -22,28 +22,26 @@ namespace UI { { if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { - /* - a chain of `sub`s with a `je` after each (0x426ba7) is MSVC's sparse switch, - and the arm bodies are laid out default, 0x14, 0x12, 0xd - */ + // a chain of `sub`s with a `je` after each (0x426ba7) is MSVC's sparse switch, + // and the arm bodies are laid out default, 0x14, 0x12, 0xd switch (param_1) { default: { BOOL_CurrentMenuClickState::instance = FALSE; DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - param_1) - 1; - DWORD DVar1 = timeGetTime(); + DWORD const clickTime = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex - || 500 <= (int)(DVar1 - DAT_MenuTextInputState::instance.lastListClickTime)) { + || 500 <= (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime)) { DAT_MenuTextInputState::instance.lastClickedListIndex = DAT_GameCore::instance.missionNumber1to20; - DAT_MenuTextInputState::instance.lastListClickTime = DVar1; + DAT_MenuTextInputState::instance.lastListClickTime = clickTime; return; } - goto LAB_00426c1c; + goto startMission; } case 20: { ++DAT_GameState::instance.mapAndTime.difficulty; - /* the original compares against 4 (`cmp eax, 4; jl`), not 3 */ + // the original compares against 4 (`cmp eax, 4; jl`), not 3 if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { DAT_GameState::instance.mapAndTime.difficulty = 0; } @@ -55,7 +53,7 @@ namespace UI { return; } case 13: - LAB_00426c1c: + startMission: --DAT_GameCore::instance.missionNumber1to20; DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_CAMPAIGN_MISSION; DAT_GameCore::instance.field_0x74 = 1; diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp index 907667bdef..56093ec936 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp @@ -15,17 +15,13 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::focusOnCoordinate, DAT_ViewportRenderState::ptr)(DAT_MinimapViewState::instance.spawnMomentX[0], (int)((int)(DAT_MinimapViewState::instance.spawnMomentY[0]))); - int iVar1 = 1; - if (1 < (int)DAT_MinimapViewState::instance.spawnMomentCount) { - do { - DAT_MinimapViewState::instance.spawnMomentX[iVar1 - 1] - = DAT_MinimapViewState::instance.spawnMomentX[iVar1]; - DAT_MinimapViewState::instance.spawnMomentX[iVar1 + 19] - = DAT_MinimapViewState::instance.spawnMomentY[iVar1]; - DAT_MinimapViewState::instance.spawnMomentY[iVar1 + 19] - = DAT_MinimapViewState::instance.spawnMoment[iVar1]; - ++iVar1; - } while (iVar1 < (int)DAT_MinimapViewState::instance.spawnMomentCount); + for (int eventIndex = 1; eventIndex < (int)DAT_MinimapViewState::instance.spawnMomentCount; ++eventIndex) { + DAT_MinimapViewState::instance.spawnMomentX[eventIndex - 1] + = DAT_MinimapViewState::instance.spawnMomentX[eventIndex]; + DAT_MinimapViewState::instance.spawnMomentX[eventIndex + 19] + = DAT_MinimapViewState::instance.spawnMomentY[eventIndex]; + DAT_MinimapViewState::instance.spawnMomentY[eventIndex + 19] + = DAT_MinimapViewState::instance.spawnMoment[eventIndex]; } --DAT_MinimapViewState::instance.spawnMomentCount; } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp index b2b9c23321..a48bef96fd 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp @@ -17,14 +17,14 @@ namespace UI { void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int param_1, ...) { if (DAT_VideoBikQueue::instance.mbr_0x928) { - dword dVar1 = DAT_VideoBikQueue::instance.mbr_0x928; + dword shieldIndex = DAT_VideoBikQueue::instance.mbr_0x928; if ((int)DAT_VideoBikQueue::instance.mbr_0x928 < 0) { - dVar1 = -DAT_VideoBikQueue::instance.mbr_0x928; + shieldIndex = -DAT_VideoBikQueue::instance.mbr_0x928; } 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_INTERFACE_ICONS2, - (int)((int)(dVar1 + 469)), (int)((int)(DAT_ButtonX::instance)), + (int)((int)(shieldIndex + 469)), (int)((int)(DAT_ButtonX::instance)), (int)((int)(DAT_ButtonY::instance))); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp index 6865ad224d..393fe72163 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp @@ -19,18 +19,17 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004B65A0 void InGameMenu::MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol(int param_1, ...) { - BOOLEnum BVar1; - BVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::checkKeepEnclosed, DAT_GameState::ptr)( - DAT_GameSynchronyState::instance.currentPlayerSlotID); - if (BVar1 != DAT_MiniMapDefinedData::instance.cachedKeepEnclosed) { + BOOLEnum const keepEnclosed = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::checkKeepEnclosed, + DAT_GameState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID); + if (keepEnclosed != DAT_MiniMapDefinedData::instance.cachedKeepEnclosed) { DAT_GameCore::instance.countdown = 2; } - DAT_MiniMapDefinedData::instance.cachedKeepEnclosed = BVar1; - if (!BVar1) { - DAT_ButtonUnknownZero::instance = 1; + DAT_MiniMapDefinedData::instance.cachedKeepEnclosed = keepEnclosed; + if (!keepEnclosed) { + DAT_ButtonUnknownZero::instance = TRUE; return; } - DAT_ButtonUnknownZero::instance = 0; + DAT_ButtonUnknownZero::instance = FALSE; MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); } diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp index 492e681570..cf6831f385 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp @@ -19,16 +19,16 @@ namespace UI { && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_ROUNDTABLE && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_BASIC_AI_LORD_SELECT && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { - int iVar1 = 0; + int visibleHeight = 0; if (!param_1) { - iVar1 = 204; + visibleHeight = 204; } else if (param_1 == 1) { - iVar1 = 110; + visibleHeight = 110; } switch (param_2) { case 1: *minValue = -19; - *maxValue = INT_00b95b74::instance - iVar1; + *maxValue = INT_00b95b74::instance - visibleHeight; *currentValue = 0; return; case 2: @@ -37,11 +37,11 @@ namespace UI { return; case 4: *minValue = -19; - *maxValue = INT_00b95b74::instance - iVar1; + *maxValue = INT_00b95b74::instance - visibleHeight; *currentValue = DAT_00b960f4::instance; return; case 7: - *currentValue = iVar1 - 14; + *currentValue = visibleHeight - 14; } } } diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp index bba0bcddfc..b956cc34a8 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp @@ -29,7 +29,8 @@ namespace UI { 0); MACRO_CALL_MEMBER(Text::TextEditorState_Func::setCustomHelpText, DAT_TextEditorState::ptr)( DAT_GameCore::instance.temporaryTextBufferOfSize1000, 999); - MACRO_CALL(OS_Func::_memset)(DAT_GameCore::instance.temporaryTextBufferOfSize1000, 0, 1000); + MACRO_CALL(OS_Func::_memset)(DAT_GameCore::instance.temporaryTextBufferOfSize1000, 0, + sizeof(DAT_GameCore::instance.temporaryTextBufferOfSize1000)); DAT_GameCore::instance.descriptionUseStringTable = 0; } } diff --git a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp index 40201897b3..c9fd6d1f15 100644 --- a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp @@ -14,9 +14,6 @@ namespace UI { case 1: *minValue = 0; *maxValue = 120; - /* - repeatMonths - */ *currentValue = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] .data.invasion.repeatMonths; diff --git a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp index e0bf5b9f11..e1ee3f37e3 100644 --- a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp +++ b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp @@ -37,24 +37,10 @@ namespace UI { DAT_GameCore::instance.U2_mapType_singleOrMulti = 1; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_NEW_MAP_MAPSIZE, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int playerSlot = 0; playerSlot < 9; playerSlot++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[playerSlot] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[playerSlot]; + } return; case 7: MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp index 1614318778..f4ca7b2516 100644 --- a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp @@ -20,7 +20,7 @@ namespace UI { void RankingGames::MenuItemRenderFunction_RankingGames_Scrollbar( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) { - DAT_ButtonUnknownZero::instance = 0; + DAT_ButtonUnknownZero::instance = FALSE; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonX::instance + 19), diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp index b9b1823b84..1374b34a8d 100644 --- a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -14,16 +14,16 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004932A0 void SaveMap::MenuItemActionHandler_SaveMap_TableContent(int param_1, ...) { - char* pcVar1; if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 < (int)DAT_MenuTextInputState::instance.fileListEntryCount) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = param_1; - pcVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, - DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance - .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - + param_1 - 1]); + char* const mapName + = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, + DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance + .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + + param_1 - 1]); MACRO_CALL_MEMBER( - OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(pcVar1); + OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(mapName); } } diff --git a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp index ccb7affce2..bba97f0c9c 100644 --- a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp @@ -24,15 +24,15 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DA050 void TacticalPowerBar::MenuItemActionHandler_TacticalPowerBar_Main(int param_1, ...) { - int iVar1; + int barLevel; if ((((DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) || (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) || (DAT_GameState::instance.mapAndTime.skirmishNoRushTicks == 0)) - && ((iVar1 + && ((barLevel = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .tacticalPowersBarLevel, MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(), - iVar1 >= (param_1 + 1) * 636 + barLevel >= (param_1 + 1) * 636 && (DAT_GameState::instance .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .lordKilledByPlayerID diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp index 4f09141944..54135f65bb 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp @@ -9,13 +9,14 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004BF720 void Unused::MenuItemActionHandler_UnusedChooseMessageBox_Unknown(int param_1, ...) { - DWORD DVar1 = timeGetTime(); - int iVar2 = DAT_MapPropertiesState::instance.offset + param_1; - if (iVar2 < (int)DAT_MapPropertiesState::instance.total) { + DWORD const currentTime = timeGetTime(); + int const absoluteIndex = DAT_MapPropertiesState::instance.offset + param_1; + if (absoluteIndex < (int)DAT_MapPropertiesState::instance.total) { DAT_MapPropertiesState::instance.indexStored = param_1; - DAT_MapPropertiesState::instance.value = DAT_MapPropertiesState::instance.unknownArray_01[iVar2]; - DAT_MapPropertiesState::instance.selectedAbsoluteIndex = iVar2; - DAT_MapPropertiesState::instance.selectionTime = DVar1; + DAT_MapPropertiesState::instance.value + = DAT_MapPropertiesState::instance.unknownArray_01[absoluteIndex]; + DAT_MapPropertiesState::instance.selectedAbsoluteIndex = absoluteIndex; + DAT_MapPropertiesState::instance.selectionTime = currentTime; } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp index 19b846d476..176712eb2f 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp @@ -24,24 +24,10 @@ namespace UI { DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty2; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_UNUSED_ECONOMIC_MISSION_SELECTUnk, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 2: DAT_GameCore::instance.missionNumber1to20 = 0; @@ -59,24 +45,10 @@ namespace UI { DAT_GameCore::instance.standaloneFilename[0] = '\0'; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 3: DAT_GameCore::instance.missionNumber1to20 = 0; @@ -94,34 +66,16 @@ namespace UI { DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty_0; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[0] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[0]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[1] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[1]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[2] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[2]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[3] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[3]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[4] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[4]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[5] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[5]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[6] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[6]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[7] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[7]; - DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[8] - = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[8]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 4: - goto switchD_00425c32_caseD_4; + return; case 5: MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_MAIN_MENU, 0); - switchD_00425c32_caseD_4: - return; - default: - break; } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp index 8d4eaa6024..0adc2de769 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -21,28 +21,27 @@ namespace UI { { if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { - /* - a chain of `sub`s with a `je` after each (0x426ee9) is MSVC's sparse - switch, and the arm bodies are laid out default, 0x14, 0x12, 0xd - */ + // a chain of `sub`s with a `je` after each (0x426ee9) is MSVC's sparse + // switch, and the arm bodies are laid out default, 0x14, 0x12, 0xd switch (param_1) { default: { BOOL_CurrentMenuClickState::instance = FALSE; DAT_GameCore::instance.missionNumber1to20 = -param_1; - DWORD DVar1 = timeGetTime(); + DWORD const clickTime = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex - || 500 <= (int)(DVar1 - DAT_MenuTextInputState::instance.lastListClickTime)) { + || 500 <= (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime)) { DAT_MenuTextInputState::instance.lastClickedListIndex = DAT_GameCore::instance.missionNumber1to20; - DAT_MenuTextInputState::instance.lastListClickTime = DVar1; + DAT_MenuTextInputState::instance.lastListClickTime = clickTime; return; } - goto LAB_00426f5c; + // the original shares this tail with case 13; writing it out twice changes the code + goto startSelectedMission; } case 20: { ++DAT_GameState::instance.mapAndTime.difficulty; - /* the original compares against 4 (`cmp eax, 4; jl`), not 3 */ + // the original compares against 4 (`cmp eax, 4; jl`), not 3 if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { DAT_GameState::instance.mapAndTime.difficulty = 0; } @@ -54,7 +53,7 @@ namespace UI { return; } case 13: - LAB_00426f5c: + startSelectedMission: --DAT_GameCore::instance.missionNumber1to20; DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_ECONOMIC_CAMPAIGN_SH1; DAT_GameCore::instance.field_0x74 = 1; diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index 0a7d914e78..b927562385 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -24,10 +24,8 @@ namespace UI { { if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { - /* - the original dispatches with a `sub eax, K; je` chain (0x427096), - MSVC's sparse switch, and the `case 0xe` body sits first - */ + // the original dispatches with a `sub eax, K; je` chain (0x427096), + // MSVC's sparse switch, and the `case 0xe` body sits first switch (param_1) { case 14: MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp index 43e2d663dc..362bd8b9c9 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp @@ -3,8 +3,10 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" #include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/COL_BLACK.hpp" #include "OpenSHC/Globals/COL_WHITE.hpp" @@ -26,12 +28,10 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042DEB0 void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton(int param_1, ...) { - /* - the original jumps out of line on `== FALSE`, so the interacting - arm is the one the source wrote first - */ + // the original jumps out of line on `== FALSE`, so the interacting + // arm is the one the source wrote first if (DAT_ButtonCurrentlyInteracting::instance) { - DAT_TextManagerObject::instance.textColor = 0xff; + DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_0000FF; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; } else { DAT_TextManagerObject::instance.textColor = 0; @@ -41,8 +41,9 @@ namespace UI { DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonW::instance + DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), DAT_PencilRenderCore::instance.otherColorUnk_0x0); + // "Continue" MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( - "Continue", (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), + s_Continue_005a22d8, (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), (TextAlignment)((int)(DAT_ButtonW::instance)), (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 17, FALSE, 0); } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp index 5187d857cd..e7dbe54e53 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp @@ -3,8 +3,10 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" #include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/COL_BLACK.hpp" #include "OpenSHC/Globals/COL_WHITE.hpp" @@ -26,12 +28,10 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042DF40 void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton(int param_1, ...) { - /* - the original jumps out of line on `== FALSE`, so the interacting - arm is the one the source wrote first - */ + // the original jumps out of line on `== FALSE`, so the interacting + // arm is the one the source wrote first if (DAT_ButtonCurrentlyInteracting::instance) { - DAT_TextManagerObject::instance.textColor = 0xff; + DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_0000FF; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; } else { DAT_TextManagerObject::instance.textColor = 0; @@ -41,8 +41,9 @@ namespace UI { DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonW::instance + DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), DAT_PencilRenderCore::instance.otherColorUnk_0x0); + // "Test map" MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( - "Test map", (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), + s_Test_map_005a22e4, (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), (TextAlignment)((int)(DAT_ButtonW::instance)), (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 17, FALSE, 0); } From a9abca04210eebdb7b6ebd48669fa39d9225683d Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:20:58 +0100 Subject: [PATCH 37/45] style: the new loops step with ++i up to countof, and the kept goto says why The for loops of the previous commit count to countof(the array) instead of 9 and step with ++i, as main's other loops do, and the goto that stays in HistoricMissionSelect_General gets the one-line reason its sibling has. The code is unchanged: quick_diff gives the same output (but for the listing's label numbers). Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuItemActionHandler_HistoricCampaignSelect_Main.cpp | 8 ++++---- ...enuItemActionHandler_HistoricMissionSelect_General.cpp | 1 + .../MenuItemActionHandler_NewMapMaptype_Buttons.cpp | 3 ++- ...temActionHandler_UnusedEconomicGametypeSelect_Main.cpp | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp index a9a646f6ec..44fbf2306d 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp @@ -22,7 +22,7 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 1; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } @@ -34,7 +34,7 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 2; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } @@ -46,7 +46,7 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 3; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } @@ -58,7 +58,7 @@ namespace UI { DAT_GameCore::instance.historicCampaignNumber = 4; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index 0bd7b9833a..f87f1e692d 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -37,6 +37,7 @@ namespace UI { DAT_MenuTextInputState::instance.lastListClickTime = clickTime; return; } + // the original shares this tail with the case below; writing it out twice changes the code goto startMission; } case 20: { diff --git a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp index e1ee3f37e3..71ddb3195d 100644 --- a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp +++ b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp @@ -37,7 +37,8 @@ namespace UI { DAT_GameCore::instance.U2_mapType_singleOrMulti = 1; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_NEW_MAP_MAPSIZE, 0); - for (int playerSlot = 0; playerSlot < 9; playerSlot++) { + for (int playerSlot = 0; + playerSlot < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++playerSlot) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[playerSlot] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[playerSlot]; } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp index 176712eb2f..3c57250222 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp @@ -24,7 +24,7 @@ namespace UI { DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty2; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_UNUSED_ECONOMIC_MISSION_SELECTUnk, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } @@ -45,7 +45,7 @@ namespace UI { DAT_GameCore::instance.standaloneFilename[0] = '\0'; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } @@ -66,7 +66,7 @@ namespace UI { DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty_0; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); - for (int i = 0; i < 9; i++) { + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } From 95ba5bd60f0fef6acad4c79b257106deecd3024c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:48:36 +0100 Subject: [PATCH 38/45] fix: SaveMap_TableContent indexes DAT_ArrayOfMapIndices from main's base gynt wrote DAT_ArrayOfMapIndices[offset + row - 1] against a header where DAT_MapSelectionPreloadMapIndexMapping sat at 0x880 of MenuTextInputState and the array began at 0x884. Main has merged the two into one int[501] at 0x880, four bytes earlier, so gynt's [i - 1] is main's [i], and with the - 1 kept the function read the element before the one the original reads (reccmp on main: 92.9%, [eax*4 + instance+2172] against the original's +2176). Without it the function is 100.0% raw and normalized again. The batch has no other user of the array. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp index 1374b34a8d..767ac00fdc 100644 --- a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -21,7 +21,7 @@ namespace UI { = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - + param_1 - 1]); + + param_1]); MACRO_CALL_MEMBER( OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(mapName); } From 15636583ad2c69b4ddae680f49488e235c3c70a0 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:27:53 +0100 Subject: [PATCH 39/45] headers: GameCommandType value 96 as GCT_UNKNOWN_96 MenuItemActionHandler_IdentityOptions_Confirm (0x00493D30) queues command 96 (push 0x60; call 0x489100, queueCommand) when the identity options are confirmed outside GM_SOLITARY. The enum had 95 and 98 but not 96; it gets the placeholder name form of GCT_UNKNOWN_98. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Commands/GameCommandType.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenSHC/Commands/GameCommandType.hpp b/src/OpenSHC/Commands/GameCommandType.hpp index d5f01b51d2..af4b909ff8 100644 --- a/src/OpenSHC/Commands/GameCommandType.hpp +++ b/src/OpenSHC/Commands/GameCommandType.hpp @@ -89,6 +89,7 @@ namespace Commands { GCT_UNKNOWN_93 = 93, // 0x0000005D GCT_CLOSE_MODAL_DIALOG_FOR_ALL = 94, // 0x0000005E GCT_LEAVE_GAME = 95, // 0x0000005F + GCT_UNKNOWN_96 = 96, // 0x00000060 GCT_UNKNOWN_98 = 98, // 0x00000062 GCT_UNKNOWN_99 = 99, // 0x00000063 GCT_SHARE_GAME_STATE_PARTIAL_HASHES = 100, // 0x00000064 From 43e6ffc0b2b8efac992a7cefc61b887111ea986c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:27:53 +0100 Subject: [PATCH 40/45] headers: SoundEffectID values 260 and 261 as SEID_UNKNOWN_0x104 and SEID_UNKNOWN_0x105 MenuItemActionHandler_TacticalPowerBar_Main (0x004DA050) plays sound effect 260 (push 0x104; call 0x449c40, setUpSFXToPlayUnk) when tactical power 2, 3, 4, 6, 13 or 16 is picked, and 261 (push 0x105) for power 7. The enum ended at 257; they get the same placeholder name form as SEID_UNKNOWN_0x100 and SEID_UNKNOWN_0x101, and 0x101's line gains a comma. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Audio/SFX/SoundEffectID.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenSHC/Audio/SFX/SoundEffectID.hpp b/src/OpenSHC/Audio/SFX/SoundEffectID.hpp index 79f4314fdb..a4a1e7b531 100644 --- a/src/OpenSHC/Audio/SFX/SoundEffectID.hpp +++ b/src/OpenSHC/Audio/SFX/SoundEffectID.hpp @@ -209,7 +209,9 @@ namespace Audio { SEID_UNKNOWN_0xFE = 254, // 0x000000FE SEID_UNKNOWN_0xFF = 255, // 0x000000FF SEID_UNKNOWN_0x100 = 256, // 0x00000100 - SEID_UNKNOWN_0x101 = 257 // 0x00000101 + SEID_UNKNOWN_0x101 = 257, // 0x00000101 + SEID_UNKNOWN_0x104 = 260, // 0x00000104 + SEID_UNKNOWN_0x105 = 261 // 0x00000105 } SoundEffectID; From ebfbc603c2a55009edf61461956b28fcbe0db9f4 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:34:15 +0100 Subject: [PATCH 41/45] fix: MapEventIconUnk shifts spawnMomentY and spawnMoment by their own index The loop that drops the first spawn moment wrote spawnMomentX[i + 19] and spawnMomentY[i + 19], past the end of the 20-element X and Y arrays. Those are the addresses of spawnMomentY[i - 1] and spawnMoment[i - 1] (X at 0x61B04, Y at 0x61B54, spawnMoment at 0x61BA4 in MinimapViewState), so they are written that way, as main's clearOldSpawnMoment does. The code is unchanged: quick_diff and the listing give the same instructions and the same offsets (instance+400208 and +400288) before and after. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp index 56093ec936..aa59231cde 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp @@ -18,9 +18,9 @@ namespace UI { for (int eventIndex = 1; eventIndex < (int)DAT_MinimapViewState::instance.spawnMomentCount; ++eventIndex) { DAT_MinimapViewState::instance.spawnMomentX[eventIndex - 1] = DAT_MinimapViewState::instance.spawnMomentX[eventIndex]; - DAT_MinimapViewState::instance.spawnMomentX[eventIndex + 19] + DAT_MinimapViewState::instance.spawnMomentY[eventIndex - 1] = DAT_MinimapViewState::instance.spawnMomentY[eventIndex]; - DAT_MinimapViewState::instance.spawnMomentY[eventIndex + 19] + DAT_MinimapViewState::instance.spawnMoment[eventIndex - 1] = DAT_MinimapViewState::instance.spawnMoment[eventIndex]; } --DAT_MinimapViewState::instance.spawnMomentCount; From 3d213584d9d1d25e4f7d4f31377ce77fa161ee13 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:34:15 +0100 Subject: [PATCH 42/45] fix: UnusedSomeMissionStartUnk writes its build menu tab as BMTT_CASTLE buildmenuMenuTabToSwitchTo is an ActiveMenuTab union; the draft stored the 10 through its tabType member as BASMTT_HUNTERSHUT. It is the build menu's tab, so it is written through buildMenuTab as BMTT_CASTLE (also 10), as main's hideOrUnhideUI writes the same field. Same offset, same value: quick_diff and the listing are unchanged. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...enuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index b927562385..06d4bf8345 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -5,7 +5,7 @@ #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/UI/MenuTextInputState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" -#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/UI/Enums/BuildMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" @@ -32,7 +32,7 @@ namespace UI { OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); break; case 13: - DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_HUNTERSHUT; + DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab = OpenSHC::UI::Enums::BMTT_CASTLE; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); DAT_GameCore::instance.section1066 = 1; From a782be3d7a21b0bfa11653f7596f3f76ebf30796 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:35:06 +0100 Subject: [PATCH 43/45] style: the review's names, casts, early returns and includes over the batch These come from the review of the branch, and none of them changes the generated code: - param_N gets main's names: button for the menu buttons (tacticalPower for TacticalPowerBar_Main, whose value becomes activeTacticalPower), row for the table rows, unused where the parameter is not read, unused and scrollbarEvent for the scrollbar handlers, unused and sliderValue for the scrollbar renders, and descBoxIndexUnk for LobbyMenu_MapDescScrollbar, which picks 204 or 110 by it. - The last decompiler locals: DVar1 in LoadMap_TableContent is clickTime, and the BVar1 of the LobbyMenu MapDescScrollbar render goes: it returns when AModalDialogIsActiveButIsNotQuitting is set and stores RT_SCREEN_MENU by name (MSVC still stores the zero it tested). - Ghidra's comma operators inside if conditions become statements with early returns or nested ifs: TacticalPowerBar_Main (whose barLevel is now declared where it is assigned), MapDescriptionBox, OverlaySlider_Deselect, UnusedWinCondition_DeselectUnk, LordIcons and UnusedCreateMessageEvent. - Casts that restated a field's own type go: DAT_ButtonX/Y/W/H, DAT_ButtonBackgroundBlendStrength, menuLoadGameRelativeSelectionOffset, fileListEntryCount, DAT_MapSelectionScrollOffset/TotalNumber, spawnMomentY, spawnMomentCount, MapPropertiesState::offset, (ushort) on the COL_*.shortValue arguments, (BGR24)((int)textColor), (int)((int)(shieldIndex + 469)) and the function pointer casts on sliderCallbackFunction. The ones that change signedness or type stay: (int)mbr_0x928, (int)total, (TextAlignment)DAT_ButtonW and (int)(clickTime - lastListClickTime). - Number casts become enum names: GCT_UNKNOWN_96, SEID_UNKNOWN_0x100, SEID_UNKNOWN_0x104 and SEID_UNKNOWN_0x105, and their using lines go. The old title menu's textColor = 0 is COL_000000, and its BGR24 include and using line go with the (BGR24)((int)textColor) cast they served. - BOOLEnum.hpp is dropped from the 8 files that never name BOOLEnum, and BOOLEnum values are tested by truth and stored as TRUE / FALSE where these lines touch them. - The three sparse-switch comments are one line each, and the comments on the two gotos that stay give what writing the shared tail out twice costs: 9 instructions in HistoricMissionSelect_General, 7 in UnusedEconomicMissionSelect_General. quick_diff gives the same output for every file before and after, but for the jump table's label numbers in TacticalPowerBar_Main's listing; each function's body in the /FA listing, with the globals' offsets, compares identical. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...ionHandler_HistoricCampaignSelect_Main.cpp | 4 +- ...nHandler_HistoricMissionSelect_General.cpp | 12 +-- ...mActionHandler_IdentityOptions_Confirm.cpp | 8 +- ...ctionHandler_IdentityOptions_LordIcons.cpp | 17 +-- ...tionHandler_InGameMenu_MapEventIconUnk.cpp | 10 +- ...tion_InGameMenu_BikMessagePlayerShield.cpp | 7 +- ...Function_InGameMenu_KeepEnclosedSymbol.cpp | 2 +- ...ItemActionHandler_LoadMap_TableContent.cpp | 16 +-- ...tionHandler_LobbyMenu_MapDescScrollbar.cpp | 8 +- ...ActionHandler_LobbyMenu_MapSelectTable.cpp | 9 +- ...derFunction_LobbyMenu_MapDescScrollbar.cpp | 15 +-- ..._MapEditorProperties_MapDescriptionBox.cpp | 29 ++--- ...itorProperties_MapDescriptionScrollbar.cpp | 6 +- ...ActionHandler_NewInvasion_RepeatSlider.cpp | 4 +- ...temActionHandler_NewMapMaptype_Buttons.cpp | 4 +- ...nHandler_OptionsMenu_SubOptionsButtons.cpp | 4 +- ...emActionHandler_OverlaySlider_Deselect.cpp | 20 ++-- ...mRenderFunction_RankingGames_Scrollbar.cpp | 15 ++- ...temActionHandler_SaveLoadMap_Scrollbar.cpp | 10 +- ...ItemActionHandler_SaveMap_TableContent.cpp | 10 +- ...nction_SingleplayerMapChoice_Scrollbar.cpp | 6 +- ...temActionHandler_TacticalPowerBar_Main.cpp | 101 +++++++++--------- ...ctionHandler_Unknown27CampaignUnk_Main.cpp | 4 +- ...Handler_UnusedChooseMessageBox_Unknown.cpp | 6 +- ...ndler_UnusedCreateMessageEvent_Unknown.cpp | 22 ++-- ...dler_UnusedEconomicGametypeSelect_Main.cpp | 4 +- ...er_UnusedEconomicMissionSelect_General.cpp | 12 +-- ...dler_UnusedSomeMissionStartUnk_General.cpp | 7 +- ...Handler_UnusedWinCondition_DeselectUnk.cpp | 20 ++-- ...tion_UnusedOldTitleMenu_ContinueButton.cpp | 17 ++- ...ction_UnusedOldTitleMenu_TestMapButton.cpp | 17 ++- ...temActionHandler_WaitingForHost_Button.cpp | 5 +- 32 files changed, 209 insertions(+), 222 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp index 44fbf2306d..1b9f332126 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricCampaignSelect/MenuItemActionHandler_HistoricCampaignSelect_Main.cpp @@ -12,9 +12,9 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00425720 - void HistoricCampaignSelect::MenuItemActionHandler_HistoricCampaignSelect_Main(int param_1, ...) + void HistoricCampaignSelect::MenuItemActionHandler_HistoricCampaignSelect_Main(int button, ...) { - switch (param_1) { + switch (button) { case 1: DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty; DAT_GameCore::instance.gameSuspended = 0; diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index f87f1e692d..d7503641a0 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -4,7 +4,6 @@ #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/BOOL_CurrentMenuClickState.hpp" #include "OpenSHC/Globals/DAT_00b96100.hpp" @@ -18,16 +17,15 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00426B80 - void HistoricMissionSelect::MenuItemActionHandler_HistoricMissionSelect_General(int param_1, ...) + void HistoricMissionSelect::MenuItemActionHandler_HistoricMissionSelect_General(int button, ...) { if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { - // a chain of `sub`s with a `je` after each (0x426ba7) is MSVC's sparse switch, - // and the arm bodies are laid out default, 0x14, 0x12, 0xd - switch (param_1) { + // a sparse switch; the original lays its arms out default, 20, 18, 13 + switch (button) { default: { BOOL_CurrentMenuClickState::instance = FALSE; - DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - param_1) - 1; + DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - button) - 1; DWORD const clickTime = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex @@ -37,7 +35,7 @@ namespace UI { DAT_MenuTextInputState::instance.lastListClickTime = clickTime; return; } - // the original shares this tail with the case below; writing it out twice changes the code + // the original shares this tail with case 13; writing it out twice adds 9 instructions goto startMission; } case 20: { diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp index ed418ae122..ea0c5402c6 100644 --- a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp @@ -14,19 +14,17 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Commands::GameCommandType; - // FUNCTION: STRONGHOLDCRUSADER 0x00493D30 - void IdentityOptions::MenuItemActionHandler_IdentityOptions_Confirm(int param_1, ...) + void IdentityOptions::MenuItemActionHandler_IdentityOptions_Confirm(int button, ...) { - if (param_1 == 17) { + if (button == 17) { DAT_UserTextHandlerState::instance.allowUserTextInput = 0; MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); DAT_UserTextHandlerState::instance.allowUserTextInput = 1; MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY) { MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( - ((GameCommandType)96)); + Commands::GCT_UNKNOWN_96); } } } diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp index 700cb3f4ba..ec3b4a06d4 100644 --- a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_LordIcons.cpp @@ -7,27 +7,28 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00491CE0 - void IdentityOptions::MenuItemActionHandler_IdentityOptions_LordIcons(int param_1, ...) + void IdentityOptions::MenuItemActionHandler_IdentityOptions_LordIcons(int button, ...) { - if (param_1 == 21) { + if (button == 21) { DAT_GameCore::instance.selectedLordTypeUnk = 0; if (DAT_GameCore::instance.lordIconUnk < 20) { DAT_GameCore::instance.lordIconUnk = 2; } - } else if (param_1 == 22) { + } else if (button == 22) { DAT_GameCore::instance.selectedLordTypeUnk = 1; if (DAT_GameCore::instance.lordIconUnk < 20) { DAT_GameCore::instance.lordIconUnk = 3; } - } else if (param_1 == 40) { + } else if (button == 40) { --DAT_GameCore::instance.lordIconUnk; if (DAT_GameCore::instance.lordIconUnk < 2) { DAT_GameCore::instance.lordIconUnk = 21; } - } else if ((param_1 == 41) - && (DAT_GameCore::instance.lordIconUnk = DAT_GameCore::instance.lordIconUnk + 1, - 21 < DAT_GameCore::instance.lordIconUnk)) { - DAT_GameCore::instance.lordIconUnk = 2; + } else if (button == 41) { + ++DAT_GameCore::instance.lordIconUnk; + if (DAT_GameCore::instance.lordIconUnk > 21) { + DAT_GameCore::instance.lordIconUnk = 2; + } } } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp index aa59231cde..59a43def4f 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_MapEventIconUnk.cpp @@ -10,12 +10,12 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004B6530 - void InGameMenu::MenuItemActionHandler_InGameMenu_MapEventIconUnk(int param_1, ...) + void InGameMenu::MenuItemActionHandler_InGameMenu_MapEventIconUnk(int unused, ...) { - MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::focusOnCoordinate, - DAT_ViewportRenderState::ptr)(DAT_MinimapViewState::instance.spawnMomentX[0], - (int)((int)(DAT_MinimapViewState::instance.spawnMomentY[0]))); - for (int eventIndex = 1; eventIndex < (int)DAT_MinimapViewState::instance.spawnMomentCount; ++eventIndex) { + MACRO_CALL_MEMBER( + OpenSHC::Rendering::ViewportRenderState_Func::focusOnCoordinate, DAT_ViewportRenderState::ptr)( + DAT_MinimapViewState::instance.spawnMomentX[0], DAT_MinimapViewState::instance.spawnMomentY[0]); + for (int eventIndex = 1; eventIndex < DAT_MinimapViewState::instance.spawnMomentCount; ++eventIndex) { DAT_MinimapViewState::instance.spawnMomentX[eventIndex - 1] = DAT_MinimapViewState::instance.spawnMomentX[eventIndex]; DAT_MinimapViewState::instance.spawnMomentY[eventIndex - 1] diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp index a48bef96fd..51ae2b7268 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield.cpp @@ -14,7 +14,7 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004B65F0 - void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int param_1, ...) + void InGameMenu::MenuItemRenderFunction_InGameMenu_BikMessagePlayerShield(int unused, ...) { if (DAT_VideoBikQueue::instance.mbr_0x928) { dword shieldIndex = DAT_VideoBikQueue::instance.mbr_0x928; @@ -23,9 +23,8 @@ namespace UI { } 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_INTERFACE_ICONS2, - (int)((int)(shieldIndex + 469)), (int)((int)(DAT_ButtonX::instance)), - (int)((int)(DAT_ButtonY::instance))); + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, shieldIndex + 469, + DAT_ButtonX::instance, DAT_ButtonY::instance); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } } diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp index 393fe72163..46f662bdaa 100644 --- a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol.cpp @@ -17,7 +17,7 @@ namespace UI { using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x004B65A0 - void InGameMenu::MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol(int param_1, ...) + void InGameMenu::MenuItemRenderFunction_InGameMenu_KeepEnclosedSymbol(int unused, ...) { BOOLEnum const keepEnclosed = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::checkKeepEnclosed, DAT_GameState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID); diff --git a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp index 57c4dacc88..a1e143572d 100644 --- a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp @@ -9,21 +9,21 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004948C0 - void LoadMap::MenuItemActionHandler_LoadMap_TableContent(int param_1, ...) + void LoadMap::MenuItemActionHandler_LoadMap_TableContent(int row, ...) { - DWORD DVar1 = timeGetTime(); - if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 - < (int)DAT_MenuTextInputState::instance.fileListEntryCount) { - DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = param_1; - if ((DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 + DWORD const clickTime = timeGetTime(); + if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row + < DAT_MenuTextInputState::instance.fileListEntryCount) { + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = row; + if ((DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row == DAT_MenuTextInputState::instance.lastClickedListIndex) - && ((int)(DVar1 - DAT_MenuTextInputState::instance.lastListClickTime) < 500)) { + && ((int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) < 500)) { MACRO_CALL(OpenSHC::UI::MenuItems::SaveLoadMap_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(2); } DAT_MenuTextInputState::instance.lastClickedListIndex = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; - DAT_MenuTextInputState::instance.lastListClickTime = DVar1; + DAT_MenuTextInputState::instance.lastListClickTime = clickTime; } } diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp index cf6831f385..19a5992c2e 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp @@ -13,19 +13,19 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00428980 void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapDescScrollbar( - int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + int descBoxIndexUnk, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { if (!DAT_00b960dc::instance && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_ROUNDTABLE && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_BASIC_AI_LORD_SELECT && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { int visibleHeight = 0; - if (!param_1) { + if (descBoxIndexUnk == 0) { visibleHeight = 204; - } else if (param_1 == 1) { + } else if (descBoxIndexUnk == 1) { visibleHeight = 110; } - switch (param_2) { + switch (scrollbarEvent) { case 1: *minValue = -19; *maxValue = INT_00b95b74::instance - visibleHeight; diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp index cd2671e720..9e8affbd60 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapSelectTable.cpp @@ -3,7 +3,6 @@ #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" @@ -13,7 +12,7 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0042B470 - void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapSelectTable(int param_1, ...) + void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapSelectTable(int row, ...) { if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_ROUNDTABLE) { return; @@ -29,11 +28,11 @@ namespace UI { if (!DAT_GameSynchronyState::instance.isHost) { return; } - if ((int)DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset + param_1 - >= (int)DAT_GameSynchronyState::instance.DAT_MapSelectionTotalNumber) { + if (DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset + row + >= DAT_GameSynchronyState::instance.DAT_MapSelectionTotalNumber) { return; } - DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = param_1; + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = row; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( OpenSHC::Commands::GCT_CHANGE_MAP_SELECTION); } diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp index 64a8fd0d13..b432de5f46 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemRenderFunction_LobbyMenu_MapDescScrollbar.cpp @@ -2,6 +2,7 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -21,18 +22,18 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00428A60 void LobbyMenu::MenuItemRenderFunction_LobbyMenu_MapDescScrollbar( - int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + int unused, int thumbYPos, int sliderValue, int thumbHeight, BOOLEnum isDragged) { if (DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_ROUNDTABLE && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_BASIC_AI_LORD_SELECT && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { - BOOLEnum BVar1 = MACRO_CALL(UI::Helpers_Func::AModalDialogIsActiveButIsNotQuitting)(); - if (!BVar1) { - DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = BVar1; - MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonH::instance), thumbYPos, - isDragged, thumbHeight, (int)(DAT_ButtonBackgroundBlendStrength::instance)); + if (MACRO_CALL(UI::Helpers_Func::AModalDialogIsActiveButIsNotQuitting)()) { + return; } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonH::instance, thumbYPos, isDragged, + thumbHeight, DAT_ButtonBackgroundBlendStrength::instance); } } diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp index b956cc34a8..c0a536c86a 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp @@ -19,20 +19,23 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042EDF0 void MapEditorProperties::MenuItemActionHandler_MapEditorProperties_MapDescriptionBox() { - if (DAT_GameCore::instance.U2_mapType_singleOrMulti && DAT_GameCore::instance.mapLoadedForEditor - && DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU - && DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE - && (INT_00b95f68::instance = 1, !DAT_GameCore::instance.showTextMessageInsteadOfEdit)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); - DAT_TextEditorState::instance.customTextMaxLength = 1000; - MACRO_CALL_MEMBER(Text::TextEditorState_Func::openMapDescriptionEditorDialog, DAT_TextEditorState::ptr)( - 0); - MACRO_CALL_MEMBER(Text::TextEditorState_Func::setCustomHelpText, DAT_TextEditorState::ptr)( - DAT_GameCore::instance.temporaryTextBufferOfSize1000, 999); - MACRO_CALL(OS_Func::_memset)(DAT_GameCore::instance.temporaryTextBufferOfSize1000, 0, - sizeof(DAT_GameCore::instance.temporaryTextBufferOfSize1000)); - DAT_GameCore::instance.descriptionUseStringTable = 0; + if (!DAT_GameCore::instance.U2_mapType_singleOrMulti || !DAT_GameCore::instance.mapLoadedForEditor + || DAT_MenuTextInputState::instance.currentModalDialog != UI::Enums::MMT_NO_MENU + || DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_NONE) { + return; } + INT_00b95f68::instance = TRUE; + if (DAT_GameCore::instance.showTextMessageInsteadOfEdit) { + return; + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); + DAT_TextEditorState::instance.customTextMaxLength = 1000; + MACRO_CALL_MEMBER(Text::TextEditorState_Func::openMapDescriptionEditorDialog, DAT_TextEditorState::ptr)(0); + MACRO_CALL_MEMBER(Text::TextEditorState_Func::setCustomHelpText, DAT_TextEditorState::ptr)( + DAT_GameCore::instance.temporaryTextBufferOfSize1000, 999); + MACRO_CALL(OS_Func::_memset)(DAT_GameCore::instance.temporaryTextBufferOfSize1000, 0, + sizeof(DAT_GameCore::instance.temporaryTextBufferOfSize1000)); + DAT_GameCore::instance.descriptionUseStringTable = FALSE; } } diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp index 1d30943e41..add5639379 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp @@ -19,15 +19,15 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042EF80 void MapEditorProperties::MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar( - int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + int unused, int thumbYPos, int sliderValue, int thumbHeight, BOOLEnum isDragged) { if (((DAT_GameCore::instance.U2_mapType_singleOrMulti) && (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU)) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, - DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance, (int)((int)(DAT_ButtonY::instance)), - (int)((int)(DAT_ButtonH::instance)), thumbYPos, isDragged, thumbHeight, 0); + DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonH::instance, + thumbYPos, isDragged, thumbHeight, 0); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } } diff --git a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp index c9fd6d1f15..f11d78abd9 100644 --- a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_RepeatSlider.cpp @@ -8,9 +8,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004B94A0 void NewInvasion::MenuItemActionHandler_NewInvasion_RepeatSlider( - int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { - switch (param_2) { + switch (scrollbarEvent) { case 1: *minValue = 0; *maxValue = 120; diff --git a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp index 71ddb3195d..a8718eb4bb 100644 --- a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp +++ b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp @@ -17,11 +17,11 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0042F2B0 - void NewMapMaptype::MenuItemActionHandler_NewMapMaptype_Buttons(int param_1, ...) + void NewMapMaptype::MenuItemActionHandler_NewMapMaptype_Buttons(int button, ...) { if ((DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE)) { - switch (param_1) { + switch (button) { case 1: DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 = Map::MT_JUST_BUILD; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp index 6d57cf5af9..52c02fcb02 100644 --- a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp @@ -18,9 +18,9 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00493BD0 - void OptionsMenu::MenuItemActionHandler_OptionsMenu_SubOptionsButtons(int param_1, ...) + void OptionsMenu::MenuItemActionHandler_OptionsMenu_SubOptionsButtons(int button, ...) { - switch (param_1) { + switch (button) { case 25: DAT_MenuTextInputState::instance.pendingGameSpeedLevel = DAT_GameCore::instance.gameSpeedLevel; DAT_MenuTextInputState::instance.pendingSettingBubbleHelp = DAT_GameCore::instance.settingBubbleHelp; diff --git a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp index b5f21ce9ec..22a51456f0 100644 --- a/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp +++ b/src/OpenSHC/UI/MenuItems/OverlaySlider/MenuItemActionHandler_OverlaySlider_Deselect.cpp @@ -2,7 +2,6 @@ #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" #include "OpenSHC/Globals/DAT_MouseState.hpp" @@ -12,16 +11,17 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004B0F70 - void OverlaySlider::MenuItemActionHandler_OverlaySlider_Deselect(int param_1, ...) + void OverlaySlider::MenuItemActionHandler_OverlaySlider_Deselect(int unused, ...) { - if ((DAT_MouseState::instance.rightClickStart != 0) - && (MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, - DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE), - DAT_MenuModalComposition2::instance.sliderCallbackFunction != NULL)) { - ((void (*)())DAT_MenuModalComposition2::instance.sliderCallbackFunction)(); - DAT_MenuModalComposition2::instance.minus1 = -1; + if (DAT_MouseState::instance.rightClickStart) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + if (DAT_MenuModalComposition2::instance.sliderCallbackFunction != NULL) { + DAT_MenuModalComposition2::instance.sliderCallbackFunction(); + DAT_MenuModalComposition2::instance.minus1 = -1; + } } - if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_MouseState::instance.leftClickStart) { if (DAT_MouseState::instance.screenSpaceX >= DAT_MenuModalComposition2::instance.modalMenu.x && DAT_MouseState::instance.screenSpaceX < DAT_MenuModalComposition2::instance.modalMenu.width + DAT_MenuModalComposition2::instance.modalMenu.x @@ -33,7 +33,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); if (DAT_MenuModalComposition2::instance.sliderCallbackFunction != NULL) { - ((void (*)())DAT_MenuModalComposition2::instance.sliderCallbackFunction)(); + DAT_MenuModalComposition2::instance.sliderCallbackFunction(); DAT_MenuModalComposition2::instance.minus1 = -1; } } diff --git a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp index f4ca7b2516..cf0d95b736 100644 --- a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemRenderFunction_RankingGames_Scrollbar.cpp @@ -18,20 +18,19 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004D9C10 void RankingGames::MenuItemRenderFunction_RankingGames_Scrollbar( - int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + int unused, int thumbYPos, int sliderValue, int thumbHeight, BOOLEnum isDragged) { DAT_ButtonUnknownZero::instance = FALSE; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonX::instance + 19), - (int)(DAT_ButtonY::instance + DAT_ButtonH::instance - 1), (ushort)(COL_BLACK::instance.shortValue)); + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonX::instance + 19, + DAT_ButtonY::instance + DAT_ButtonH::instance - 1, COL_BLACK::instance.shortValue); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), (int)(DAT_ButtonH::instance), thumbYPos, isDragged, - thumbHeight, 0); + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonH::instance, thumbYPos, isDragged, thumbHeight, + 0); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance - 1, (int)(DAT_ButtonY::instance - 1), (int)(DAT_ButtonX::instance + 20), - (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), - (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + DAT_ButtonX::instance - 1, DAT_ButtonY::instance - 1, DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + DAT_ButtonH::instance, COL_VERY_SOFT_YELLOW::instance.shortValue); } } diff --git a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp index 662eceee28..c88fb74299 100644 --- a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp @@ -8,9 +8,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00492BA0 void SaveLoadMap::MenuItemActionHandler_SaveLoadMap_Scrollbar( - int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { - switch (param_2) { + switch (scrollbarEvent) { case 1: *minValue = 0; *maxValue = DAT_MenuTextInputState::instance.fileListEntryCount @@ -28,7 +28,7 @@ namespace UI { *currentValue = DAT_MenuTextInputState::instance.fileListVisibleRowCount - 1; return; case 5: - if (0 < (int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset) { + if (0 < DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - 1; *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; @@ -36,8 +36,8 @@ namespace UI { } break; case 6: - if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - < (int)DAT_MenuTextInputState::instance.fileListEntryCount + if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + < DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + 1; diff --git a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp index 767ac00fdc..9f0e74d275 100644 --- a/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveMap/MenuItemActionHandler_SaveMap_TableContent.cpp @@ -12,16 +12,16 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004932A0 - void SaveMap::MenuItemActionHandler_SaveMap_TableContent(int param_1, ...) + void SaveMap::MenuItemActionHandler_SaveMap_TableContent(int row, ...) { - if ((int)DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + param_1 - < (int)DAT_MenuTextInputState::instance.fileListEntryCount) { - DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = param_1; + if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row + < DAT_MenuTextInputState::instance.fileListEntryCount) { + DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = row; char* const mapName = MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, DAT_ResourceManager::ptr)(DAT_MenuTextInputState::instance .DAT_ArrayOfMapIndices[DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - + param_1]); + + row]); MACRO_CALL_MEMBER( OpenSHC::Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(mapName); } diff --git a/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp index 6541b9cca9..b39a62402b 100644 --- a/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/SinglePlayerMapChoice/MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar.cpp @@ -16,12 +16,12 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042DC60 void SinglePlayerMapChoice::MenuItemRenderFunction_SingleplayerMapChoice_Scrollbar( - int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + int unused, int thumbYPos, int sliderValue, int thumbHeight, BOOLEnum isDragged) { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)((int)(DAT_ButtonY::instance)), (int)((int)(DAT_ButtonH::instance)), - thumbYPos, isDragged, thumbHeight, (int)((int)(DAT_ButtonBackgroundBlendStrength::instance))); + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonH::instance, thumbYPos, isDragged, thumbHeight, + DAT_ButtonBackgroundBlendStrength::instance); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } diff --git a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp index bba97f0c9c..891197e6ba 100644 --- a/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/TacticalPowerBar/MenuItemActionHandler_TacticalPowerBar_Main.cpp @@ -19,59 +19,58 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Audio::SFX::SoundEffectID; - // FUNCTION: STRONGHOLDCRUSADER 0x004DA050 - void TacticalPowerBar::MenuItemActionHandler_TacticalPowerBar_Main(int param_1, ...) + void TacticalPowerBar::MenuItemActionHandler_TacticalPowerBar_Main(int tacticalPower, ...) { - int barLevel; - if ((((DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) - || (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) - || (DAT_GameState::instance.mapAndTime.skirmishNoRushTicks == 0)) - && ((barLevel - = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .tacticalPowersBarLevel, - MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(), - barLevel >= (param_1 + 1) * 636 - && (DAT_GameState::instance - .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .lordKilledByPlayerID - == 0)))) { - if (DAT_TacticalPowersHelpTextDisplayBool::instance != false) { - DAT_MissionDefinedData::instance.field39_0x1370 = 0; - DAT_TacticalPowersHelpTextDisplayBool::instance = false; - } - if (param_1 == 5) { - DAT_GameSynchronyState::instance.DAT_GameCommandParam2 - = DAT_GameSynchronyState::instance.currentPlayerSlotID; - DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 5; - DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = 0; - MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, - DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ACTIVATE_TACTICAL_POWERS); - MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - ((SoundEffectID)256)); - return; - } - DAT_TileMapState::instance.activeTacticalPower = param_1; - DAT_TileMapState::instance.shiftRelated0or3 = 5; - switch (param_1) { - case 2: - case 3: - case 4: - case 6: - case 13: - case 16: - MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - ((SoundEffectID)260)); - return; - case 1: - MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - OpenSHC::Audio::SFX::SEID_CHAPEL_BELL); - return; - case 7: - MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - ((SoundEffectID)261)); - } + if (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY + && DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER + && DAT_GameState::instance.mapAndTime.skirmishNoRushTicks != 0) { + return; + } + int const barLevel + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .tacticalPowersBarLevel; + MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + if (barLevel < (tacticalPower + 1) * 636 + || DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .lordKilledByPlayerID + != 0) { + return; + } + if (DAT_TacticalPowersHelpTextDisplayBool::instance) { + DAT_MissionDefinedData::instance.field39_0x1370 = 0; + DAT_TacticalPowersHelpTextDisplayBool::instance = false; + } + if (tacticalPower == 5) { + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 + = DAT_GameSynchronyState::instance.currentPlayerSlotID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 5; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = 0; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ACTIVATE_TACTICAL_POWERS); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_UNKNOWN_0x100); + return; + } + DAT_TileMapState::instance.activeTacticalPower = tacticalPower; + DAT_TileMapState::instance.shiftRelated0or3 = 5; + switch (tacticalPower) { + case 2: + case 3: + case 4: + case 6: + case 13: + case 16: + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_UNKNOWN_0x104); + return; + case 1: + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_CHAPEL_BELL); + return; + case 7: + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_UNKNOWN_0x105); } } diff --git a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp index 16b18f1f70..58a4fac8c8 100644 --- a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp @@ -13,11 +13,11 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004D6F20 - void Unknown27CampaignUnk::MenuItemActionHandler_Unknown27CampaignUnk_Main(int param_1, ...) + void Unknown27CampaignUnk::MenuItemActionHandler_Unknown27CampaignUnk_Main(int button, ...) { if (((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) - && (param_1 == 10)) { + && (button == 10)) { if (DAT_GameCore::instance.missionNumber1to20 == 1) { MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp index 54135f65bb..38cc2c81b2 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedChooseMessageBox_Unknown.cpp @@ -7,12 +7,12 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004BF720 - void Unused::MenuItemActionHandler_UnusedChooseMessageBox_Unknown(int param_1, ...) + void Unused::MenuItemActionHandler_UnusedChooseMessageBox_Unknown(int row, ...) { DWORD const currentTime = timeGetTime(); - int const absoluteIndex = DAT_MapPropertiesState::instance.offset + param_1; + int const absoluteIndex = DAT_MapPropertiesState::instance.offset + row; if (absoluteIndex < (int)DAT_MapPropertiesState::instance.total) { - DAT_MapPropertiesState::instance.indexStored = param_1; + DAT_MapPropertiesState::instance.indexStored = row; DAT_MapPropertiesState::instance.value = DAT_MapPropertiesState::instance.unknownArray_01[absoluteIndex]; DAT_MapPropertiesState::instance.selectedAbsoluteIndex = absoluteIndex; diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp index 88de5e4078..ccfc883aa5 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp @@ -9,18 +9,22 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004BA560 void Unused::MenuItemActionHandler_UnusedCreateMessageEvent_Unknown(int index, ...) { - if (((int)DAT_MapPropertiesState::instance.offset + index < (int)DAT_MapPropertiesState::instance.total) - && (DAT_MapPropertiesState::instance.indexStored = index, index != -1)) { - DAT_MapPropertiesState::instance.value - = DAT_MapPropertiesState::instance.unknownArray_01[DAT_MapPropertiesState::instance.offset + index]; - if (DAT_MapPropertiesState::instance.flag == 0) { - DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] - .data.scenario.actionData = DAT_MapPropertiesState::instance.value; - return; - } + if (DAT_MapPropertiesState::instance.offset + index >= (int)DAT_MapPropertiesState::instance.total) { + return; + } + DAT_MapPropertiesState::instance.indexStored = index; + if (index == -1) { + return; + } + DAT_MapPropertiesState::instance.value + = DAT_MapPropertiesState::instance.unknownArray_01[DAT_MapPropertiesState::instance.offset + index]; + if (!DAT_MapPropertiesState::instance.flag) { DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] .data.scenario.actionData = DAT_MapPropertiesState::instance.value; + return; } + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.scenario.actionData = DAT_MapPropertiesState::instance.value; } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp index 3c57250222..fa6d6eb7aa 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp @@ -16,9 +16,9 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00425C20 - void Unused::MenuItemActionHandler_UnusedEconomicGametypeSelect_Main(int param_1, ...) + void Unused::MenuItemActionHandler_UnusedEconomicGametypeSelect_Main(int button, ...) { - switch (param_1) { + switch (button) { case 1: DAT_GameCore::instance.gameSuspended = 0; DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty2; diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp index 0adc2de769..41398488b6 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -4,7 +4,6 @@ #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/BOOL_CurrentMenuClickState.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -17,16 +16,15 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00426ED0 - void Unused::MenuItemActionHandler_UnusedEconomicMissionSelect_General(int param_1, ...) + void Unused::MenuItemActionHandler_UnusedEconomicMissionSelect_General(int button, ...) { if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { - // a chain of `sub`s with a `je` after each (0x426ee9) is MSVC's sparse - // switch, and the arm bodies are laid out default, 0x14, 0x12, 0xd - switch (param_1) { + // a sparse switch; the original lays its arms out default, 20, 18, 13 + switch (button) { default: { BOOL_CurrentMenuClickState::instance = FALSE; - DAT_GameCore::instance.missionNumber1to20 = -param_1; + DAT_GameCore::instance.missionNumber1to20 = -button; DWORD const clickTime = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex @@ -36,7 +34,7 @@ namespace UI { DAT_MenuTextInputState::instance.lastListClickTime = clickTime; return; } - // the original shares this tail with case 13; writing it out twice changes the code + // the original shares this tail with case 13; writing it out twice adds 7 instructions goto startSelectedMission; } case 20: { diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index 06d4bf8345..d7bee8d74d 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -20,13 +20,12 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00427080 - void Unused::MenuItemActionHandler_UnusedSomeMissionStartUnk_General(int param_1, ...) + void Unused::MenuItemActionHandler_UnusedSomeMissionStartUnk_General(int button, ...) { if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { - // the original dispatches with a `sub eax, K; je` chain (0x427096), - // MSVC's sparse switch, and the `case 0xe` body sits first - switch (param_1) { + // a sparse switch; the original lays out the case 14 arm first + switch (button) { case 14: MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp index ed593e6f49..6bb27a06c8 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedWinCondition_DeselectUnk.cpp @@ -2,7 +2,6 @@ #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" @@ -13,16 +12,17 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004B1000 - void Unused::MenuItemActionHandler_UnusedWinCondition_DeselectUnk(int param_1, ...) + void Unused::MenuItemActionHandler_UnusedWinCondition_DeselectUnk(int unused, ...) { - if ((DAT_MouseState::instance.rightClickStart != 0) - && (MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, - DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE), - DAT_MenuModalComposition1::instance.sliderCallbackFunction != NULL)) { - ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); - DAT_MenuModalComposition1::instance.minus1 = -1; + if (DAT_MouseState::instance.rightClickStart) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != NULL) { + DAT_MenuModalComposition1::instance.sliderCallbackFunction(); + DAT_MenuModalComposition1::instance.minus1 = -1; + } } - if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_MouseState::instance.leftClickStart) { if (DAT_MouseState::instance.screenSpaceX >= DAT_MenuModalComposition2::instance.modalMenu.x && DAT_MouseState::instance.screenSpaceX < DAT_MenuModalComposition2::instance.modalMenu.width + DAT_MenuModalComposition2::instance.modalMenu.x @@ -34,7 +34,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != NULL) { - ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); + DAT_MenuModalComposition1::instance.sliderCallbackFunction(); DAT_MenuModalComposition1::instance.minus1 = -1; } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp index 362bd8b9c9..0c99e700ba 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp @@ -2,10 +2,8 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/Rendering/Colors/BGR24.hpp" #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/COL_BLACK.hpp" @@ -22,11 +20,10 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Colors::BGR24; using OpenSHC::Text::TextAlignment; // FUNCTION: STRONGHOLDCRUSADER 0x0042DEB0 - void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton(int param_1, ...) + void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton(int unused, ...) { // the original jumps out of line on `== FALSE`, so the interacting // arm is the one the source wrote first @@ -34,18 +31,16 @@ namespace UI { DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_0000FF; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; } else { - DAT_TextManagerObject::instance.textColor = 0; + DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_000000; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_WHITE::instance.shortValue; } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), - (int)(DAT_ButtonW::instance + DAT_ButtonX::instance), - (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), DAT_PencilRenderCore::instance.otherColorUnk_0x0); + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonW::instance + DAT_ButtonX::instance, + DAT_ButtonY::instance + DAT_ButtonH::instance, DAT_PencilRenderCore::instance.otherColorUnk_0x0); // "Continue" MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( - s_Continue_005a22d8, (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), - (TextAlignment)((int)(DAT_ButtonW::instance)), - (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 17, FALSE, 0); + s_Continue_005a22d8, DAT_ButtonX::instance, DAT_ButtonY::instance + 6, + (TextAlignment)DAT_ButtonW::instance, DAT_TextManagerObject::instance.textColor, 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp index e7dbe54e53..64e5b80735 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp @@ -2,10 +2,8 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" -#include "OpenSHC/Rendering/Colors/BGR24.hpp" #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/COL_BLACK.hpp" @@ -22,11 +20,10 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Colors::BGR24; using OpenSHC::Text::TextAlignment; // FUNCTION: STRONGHOLDCRUSADER 0x0042DF40 - void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton(int param_1, ...) + void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton(int unused, ...) { // the original jumps out of line on `== FALSE`, so the interacting // arm is the one the source wrote first @@ -34,18 +31,16 @@ namespace UI { DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_0000FF; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; } else { - DAT_TextManagerObject::instance.textColor = 0; + DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_000000; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_WHITE::instance.shortValue; } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)( - DAT_ButtonX::instance, (int)(DAT_ButtonY::instance), - (int)(DAT_ButtonW::instance + DAT_ButtonX::instance), - (int)(DAT_ButtonY::instance + DAT_ButtonH::instance), DAT_PencilRenderCore::instance.otherColorUnk_0x0); + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonW::instance + DAT_ButtonX::instance, + DAT_ButtonY::instance + DAT_ButtonH::instance, DAT_PencilRenderCore::instance.otherColorUnk_0x0); // "Test map" MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( - s_Test_map_005a22e4, (int)(DAT_ButtonX::instance), (int)(DAT_ButtonY::instance + 6), - (TextAlignment)((int)(DAT_ButtonW::instance)), - (BGR24)((int)(DAT_TextManagerObject::instance.textColor)), 17, FALSE, 0); + s_Test_map_005a22e4, DAT_ButtonX::instance, DAT_ButtonY::instance + 6, + (TextAlignment)DAT_ButtonW::instance, DAT_TextManagerObject::instance.textColor, 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp index 4d1ef36a81..ac88b496e0 100644 --- a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp +++ b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_Button.cpp @@ -6,7 +6,6 @@ #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" @@ -18,9 +17,9 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0047E3E0 - void WaitingForHost::MenuItemActionHandler_WaitingForHost_Button(int param_1, ...) + void WaitingForHost::MenuItemActionHandler_WaitingForHost_Button(int button, ...) { - if (param_1 == 3) { + if (button == 3) { MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( UI::Enums::MMT_NONE, FALSE); From 92c4600b8dfa24309b156e41be2cda922237ba2b Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 17:13:25 +0100 Subject: [PATCH 44/45] style: the second review's comments, conditions, case braces and early returns over the batch These come from the second review of the branch, and none of them changes the generated code: - The old title menu's ContinueButton and TestMapButton lose their two lines of assembly over a plain if / else, as main's ExitButton has it. - HistoricMissionSelect_General and UnusedEconomicMissionSelect_General test difficulty >= 4 and (int)(clickTime - lastListClickTime) >= 500 with the constant on the right. The assembly comment over the first becomes one line saying why it is not > 3 (> 3 takes quick_diff from 0.9111 to 0.8667). Cases 18 and 20 lose the braces they did not need; the default keeps its own for clickTime, and the goto still lands where it did. - The decompiler's parentheses go: (DAT_00b96100 - button) - 1, the if ((a == x) && (b == y)) tests in HistoricMissionSelect_General, UnusedEconomicMissionSelect_General, UnusedSomeMissionStartUnk_General, NewMapMaptype_Buttons and LoadMap_TableContent, and the nested ones in MapDescriptionScrollbar and Unknown27CampaignUnk_Main. - SaveLoadMap_Scrollbar tests the offset with > 0, steps it with --x / ++x, and its case 5 gets main's line from BuildingAvailability_Scrollbar on why it stores and returns. - UnusedCreateMessageEvent_Unknown's second arm stores data.message.messageID, which sits at the same offset 0 of InGameEventUnion as the first arm's data.scenario.actionData, so the two arms no longer look like one store written twice. - LobbyMenu_MapDescScrollbar returns early instead of wrapping its body, OptionsMenu_SubOptionsButtons returns from its two arms that broke out of the switch, and UnusedEconomicGametypeSelect_Main loses its empty case 4. - resetToTextIndex gets TAIT names, as main's callers write them: TAIT_NINE__FILTER_B in IdentityOptions_Confirm and MapDescriptionBox, TAIT_ZERO in OptionsMenu_SubOptionsButtons. quick_diff gives the same output for every file before and after, and each function's body in the /FA listing, with the globals' offsets, compares identical. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...nHandler_HistoricMissionSelect_General.cpp | 18 +++--- ...mActionHandler_IdentityOptions_Confirm.cpp | 4 +- ...ItemActionHandler_LoadMap_TableContent.cpp | 6 +- ...tionHandler_LobbyMenu_MapDescScrollbar.cpp | 57 ++++++++++--------- ..._MapEditorProperties_MapDescriptionBox.cpp | 4 +- ...itorProperties_MapDescriptionScrollbar.cpp | 6 +- ...temActionHandler_NewMapMaptype_Buttons.cpp | 4 +- ...nHandler_OptionsMenu_SubOptionsButtons.cpp | 7 ++- ...temActionHandler_SaveLoadMap_Scrollbar.cpp | 9 ++- ...ctionHandler_Unknown27CampaignUnk_Main.cpp | 6 +- ...ndler_UnusedCreateMessageEvent_Unknown.cpp | 2 +- ...dler_UnusedEconomicGametypeSelect_Main.cpp | 2 - ...er_UnusedEconomicMissionSelect_General.cpp | 16 +++--- ...dler_UnusedSomeMissionStartUnk_General.cpp | 4 +- ...tion_UnusedOldTitleMenu_ContinueButton.cpp | 2 - ...ction_UnusedOldTitleMenu_TestMapButton.cpp | 2 - 16 files changed, 72 insertions(+), 77 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index d7503641a0..8e8a2d2bd5 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -19,17 +19,17 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00426B80 void HistoricMissionSelect::MenuItemActionHandler_HistoricMissionSelect_General(int button, ...) { - if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) - && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { // a sparse switch; the original lays its arms out default, 20, 18, 13 switch (button) { default: { BOOL_CurrentMenuClickState::instance = FALSE; - DAT_GameCore::instance.missionNumber1to20 = (DAT_00b96100::instance - button) - 1; + DAT_GameCore::instance.missionNumber1to20 = DAT_00b96100::instance - button - 1; DWORD const clickTime = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex - || 500 <= (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime)) { + || (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) >= 500) { DAT_MenuTextInputState::instance.lastClickedListIndex = DAT_GameCore::instance.missionNumber1to20; DAT_MenuTextInputState::instance.lastListClickTime = clickTime; @@ -38,19 +38,17 @@ namespace UI { // the original shares this tail with case 13; writing it out twice adds 9 instructions goto startMission; } - case 20: { + case 20: ++DAT_GameState::instance.mapAndTime.difficulty; - // the original compares against 4 (`cmp eax, 4; jl`), not 3 - if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { + // >= 4, not > 3: they compile differently + if (DAT_GameState::instance.mapAndTime.difficulty >= 4) { DAT_GameState::instance.mapAndTime.difficulty = 0; } return; - } - case 18: { + case 18: MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_HISTORIC_CAMPAIGN_SELECT, 0); return; - } case 13: startMission: --DAT_GameCore::instance.missionNumber1to20; diff --git a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp index ea0c5402c6..d913992e7a 100644 --- a/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp +++ b/src/OpenSHC/UI/MenuItems/IdentityOptions/MenuItemActionHandler_IdentityOptions_Confirm.cpp @@ -5,6 +5,7 @@ #include "OpenSHC/UI/MenuTextInputState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" #include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" #include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" @@ -19,7 +20,8 @@ namespace UI { { if (button == 17) { DAT_UserTextHandlerState::instance.allowUserTextInput = 0; - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_NINE__FILTER_B); DAT_UserTextHandlerState::instance.allowUserTextInput = 1; MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY) { diff --git a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp index a1e143572d..b771c9e46d 100644 --- a/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp +++ b/src/OpenSHC/UI/MenuItems/LoadMap/MenuItemActionHandler_LoadMap_TableContent.cpp @@ -15,9 +15,9 @@ namespace UI { if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row < DAT_MenuTextInputState::instance.fileListEntryCount) { DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionIndex = row; - if ((DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row - == DAT_MenuTextInputState::instance.lastClickedListIndex) - && ((int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) < 500)) { + if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + row + == DAT_MenuTextInputState::instance.lastClickedListIndex + && (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) < 500) { MACRO_CALL(OpenSHC::UI::MenuItems::SaveLoadMap_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(2); } DAT_MenuTextInputState::instance.lastClickedListIndex diff --git a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp index 19a5992c2e..7614ce4b83 100644 --- a/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/LobbyMenu/MenuItemActionHandler_LobbyMenu_MapDescScrollbar.cpp @@ -15,34 +15,35 @@ namespace UI { void LobbyMenu::MenuItemActionHandler_LobbyMenu_MapDescScrollbar( int descBoxIndexUnk, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { - if (!DAT_00b960dc::instance - && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_ROUNDTABLE - && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_BASIC_AI_LORD_SELECT - && DAT_MenuModalComposition1::instance.activeModalDialogID != UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { - int visibleHeight = 0; - if (descBoxIndexUnk == 0) { - visibleHeight = 204; - } else if (descBoxIndexUnk == 1) { - visibleHeight = 110; - } - switch (scrollbarEvent) { - case 1: - *minValue = -19; - *maxValue = INT_00b95b74::instance - visibleHeight; - *currentValue = 0; - return; - case 2: - case 3: - DAT_00b960f4::instance = *currentValue; - return; - case 4: - *minValue = -19; - *maxValue = INT_00b95b74::instance - visibleHeight; - *currentValue = DAT_00b960f4::instance; - return; - case 7: - *currentValue = visibleHeight - 14; - } + if (DAT_00b960dc::instance + || DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_ROUNDTABLE + || DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_BASIC_AI_LORD_SELECT + || DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_EXTENDED_AI_LORD_SELECT) { + return; + } + int visibleHeight = 0; + if (descBoxIndexUnk == 0) { + visibleHeight = 204; + } else if (descBoxIndexUnk == 1) { + visibleHeight = 110; + } + switch (scrollbarEvent) { + case 1: + *minValue = -19; + *maxValue = INT_00b95b74::instance - visibleHeight; + *currentValue = 0; + return; + case 2: + case 3: + DAT_00b960f4::instance = *currentValue; + return; + case 4: + *minValue = -19; + *maxValue = INT_00b95b74::instance - visibleHeight; + *currentValue = DAT_00b960f4::instance; + return; + case 7: + *currentValue = visibleHeight - 14; } } diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp index c0a536c86a..07afff3462 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemActionHandler_MapEditorProperties_MapDescriptionBox.cpp @@ -3,6 +3,7 @@ #include "OpenSHC/OS.func.hpp" #include "OpenSHC/Text/TextEditorState.func.hpp" #include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -28,7 +29,8 @@ namespace UI { if (DAT_GameCore::instance.showTextMessageInsteadOfEdit) { return; } - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_NINE__FILTER_B); DAT_TextEditorState::instance.customTextMaxLength = 1000; MACRO_CALL_MEMBER(Text::TextEditorState_Func::openMapDescriptionEditorDialog, DAT_TextEditorState::ptr)(0); MACRO_CALL_MEMBER(Text::TextEditorState_Func::setCustomHelpText, DAT_TextEditorState::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp index add5639379..83d6fe5d7b 100644 --- a/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/MapEditorProperties/MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar.cpp @@ -21,9 +21,9 @@ namespace UI { void MapEditorProperties::MenuItemRenderFunction_MapEditorProperties_MapDescriptionScrollbar( int unused, int thumbYPos, int sliderValue, int thumbHeight, BOOLEnum isDragged) { - if (((DAT_GameCore::instance.U2_mapType_singleOrMulti) - && (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU)) - && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + if (DAT_GameCore::instance.U2_mapType_singleOrMulti + && DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonH::instance, diff --git a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp index a8718eb4bb..a30c20c1bb 100644 --- a/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp +++ b/src/OpenSHC/UI/MenuItems/NewMapMaptype/MenuItemActionHandler_NewMapMaptype_Buttons.cpp @@ -19,8 +19,8 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042F2B0 void NewMapMaptype::MenuItemActionHandler_NewMapMaptype_Buttons(int button, ...) { - if ((DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU) - && (DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE)) { + if (DAT_MenuTextInputState::instance.currentModalDialog == UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == UI::Enums::MMT_NONE) { switch (button) { case 1: DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 = Map::MT_JUST_BUILD; diff --git a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp index 52c02fcb02..578efa6682 100644 --- a/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/OptionsMenu/MenuItemActionHandler_OptionsMenu_SubOptionsButtons.cpp @@ -2,6 +2,7 @@ #include "OpenSHC/Text/UserTextHandler.func.hpp" #include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -27,7 +28,7 @@ namespace UI { DAT_MenuTextInputState::instance.pendingUnusedOption1 = DAT_GameCore::instance.unusedOption1; MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_GAMEPLAY_OPTIONS); - break; + return; case 4: DAT_MenuTextInputState::instance.menuCurrentlySelectedResolution = DAT_WindowAndDirectDraw::instance.currentGameResolution; @@ -52,13 +53,13 @@ namespace UI { case 45: DAT_UserTextHandlerState::instance.allowUserTextInput = 0; MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( - 0); + OpenSHC::Text::TAIT_ZERO); MACRO_CALL_MEMBER( OpenSHC::Text::UserTextHandler_Func::moveCursorToEnd, DAT_UserTextHandlerState::ptr)(); DAT_UserTextHandlerState::instance.allowUserTextInput = 1; MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_IDENTITY_OPTIONS); - break; + return; case 6: MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_NETWORK_OPTIONS); diff --git a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp index c88fb74299..06174f5814 100644 --- a/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/SaveLoadMap/MenuItemActionHandler_SaveLoadMap_Scrollbar.cpp @@ -28,9 +28,9 @@ namespace UI { *currentValue = DAT_MenuTextInputState::instance.fileListVisibleRowCount - 1; return; case 5: - if (0 < DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset) { - DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - 1; + // Stores and returns here rather than through the shared store below, as the original does. + if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset > 0) { + --DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; *currentValue = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; return; } @@ -39,8 +39,7 @@ namespace UI { if (DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset < DAT_MenuTextInputState::instance.fileListEntryCount - DAT_MenuTextInputState::instance.fileListVisibleRowCount) { - DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset - = DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset + 1; + ++DAT_MenuTextInputState::instance.menuLoadGameRelativeSelectionOffset; } break; default: diff --git a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp index 58a4fac8c8..61613634e7 100644 --- a/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unknown27CampaignUnk/MenuItemActionHandler_Unknown27CampaignUnk_Main.cpp @@ -15,9 +15,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004D6F20 void Unknown27CampaignUnk::MenuItemActionHandler_Unknown27CampaignUnk_Main(int button, ...) { - if (((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) - && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) - && (button == 10)) { + if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE + && button == 10) { if (DAT_GameCore::instance.missionNumber1to20 == 1) { MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp index ccfc883aa5..0bd0cf8b6f 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_Unknown.cpp @@ -24,7 +24,7 @@ namespace UI { return; } DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] - .data.scenario.actionData = DAT_MapPropertiesState::instance.value; + .data.message.messageID = DAT_MapPropertiesState::instance.value; } } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp index fa6d6eb7aa..f5b815727b 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicGametypeSelect_Main.cpp @@ -71,8 +71,6 @@ namespace UI { = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; } return; - case 4: - return; case 5: MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_MAIN_MENU, 0); diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp index 41398488b6..adf789d00c 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -18,8 +18,8 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00426ED0 void Unused::MenuItemActionHandler_UnusedEconomicMissionSelect_General(int button, ...) { - if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) - && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { // a sparse switch; the original lays its arms out default, 20, 18, 13 switch (button) { default: { @@ -28,7 +28,7 @@ namespace UI { DWORD const clickTime = timeGetTime(); if (DAT_GameCore::instance.missionNumber1to20 != DAT_MenuTextInputState::instance.lastClickedListIndex - || 500 <= (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime)) { + || (int)(clickTime - DAT_MenuTextInputState::instance.lastListClickTime) >= 500) { DAT_MenuTextInputState::instance.lastClickedListIndex = DAT_GameCore::instance.missionNumber1to20; DAT_MenuTextInputState::instance.lastListClickTime = clickTime; @@ -37,19 +37,17 @@ namespace UI { // the original shares this tail with case 13; writing it out twice adds 7 instructions goto startSelectedMission; } - case 20: { + case 20: ++DAT_GameState::instance.mapAndTime.difficulty; - // the original compares against 4 (`cmp eax, 4; jl`), not 3 - if (4 <= DAT_GameState::instance.mapAndTime.difficulty) { + // >= 4, not > 3: they compile differently + if (DAT_GameState::instance.mapAndTime.difficulty >= 4) { DAT_GameState::instance.mapAndTime.difficulty = 0; } return; - } - case 18: { + case 18: MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); return; - } case 13: startSelectedMission: --DAT_GameCore::instance.missionNumber1to20; diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp index d7bee8d74d..1b36f3e65e 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedSomeMissionStartUnk_General.cpp @@ -22,8 +22,8 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00427080 void Unused::MenuItemActionHandler_UnusedSomeMissionStartUnk_General(int button, ...) { - if ((DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) - && (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE)) { + if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU + && DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { // a sparse switch; the original lays out the case 14 arm first switch (button) { case 14: diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp index 0c99e700ba..ce7dd8e20e 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton.cpp @@ -25,8 +25,6 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042DEB0 void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_ContinueButton(int unused, ...) { - // the original jumps out of line on `== FALSE`, so the interacting - // arm is the one the source wrote first if (DAT_ButtonCurrentlyInteracting::instance) { DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_0000FF; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp index 64e5b80735..ab943a68a5 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton.cpp @@ -25,8 +25,6 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0042DF40 void Unused::MenuItemRenderFunction_UnusedOldTitleMenu_TestMapButton(int unused, ...) { - // the original jumps out of line on `== FALSE`, so the interacting - // arm is the one the source wrote first if (DAT_ButtonCurrentlyInteracting::instance) { DAT_TextManagerObject::instance.textColor = OpenSHC::Rendering::Colors::COL_0000FF; DAT_PencilRenderCore::instance.otherColorUnk_0x0 = COL_BLACK::instance.shortValue; From 78cc7cb4db52564775207eaa34904de56348c7df Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 18:38:58 +0100 Subject: [PATCH 45/45] MenuItems backlog: the >= 4 comments give their measurement In HistoricMissionSelect_General and UnusedEconomicMissionSelect_General, in main's one-line form. Comment only. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuItemActionHandler_HistoricMissionSelect_General.cpp | 2 +- ...enuItemActionHandler_UnusedEconomicMissionSelect_General.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp index 8e8a2d2bd5..34b34f7a2c 100644 --- a/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/HistoricMissionSelect/MenuItemActionHandler_HistoricMissionSelect_General.cpp @@ -40,7 +40,7 @@ namespace UI { } case 20: ++DAT_GameState::instance.mapAndTime.difficulty; - // >= 4, not > 3: they compile differently + // >= 4, not > 3 (> 3: quick_diff 0.9111 -> 0.8667) if (DAT_GameState::instance.mapAndTime.difficulty >= 4) { DAT_GameState::instance.mapAndTime.difficulty = 0; } diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp index adf789d00c..4a7c6fc452 100644 --- a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedEconomicMissionSelect_General.cpp @@ -39,7 +39,7 @@ namespace UI { } case 20: ++DAT_GameState::instance.mapAndTime.difficulty; - // >= 4, not > 3: they compile differently + // >= 4, not > 3 (> 3: quick_diff 0.9111 -> 0.8667) if (DAT_GameState::instance.mapAndTime.difficulty >= 4) { DAT_GameState::instance.mapAndTime.difficulty = 0; }