From 6c48c8c73b68298bdd1656c67a5180f8c4f8cc41 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:49 +0100 Subject: [PATCH 01/46] reimplement: SHC_3BB0A8C1_0x00434300 100.0% Reimplemented MenuItemRenderFunction_BuildMenu_MiniMapInteraction, 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 --- ...rFunction_BuildMenu_MiniMapInteraction.cpp | 35 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp new file mode 100644 index 0000000000..aef3ae39b4 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp @@ -0,0 +1,35 @@ +#include "../BuildMenu.func.hpp" + +#include "OpenSHC/UI/Enums/BuildMenuTabType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::BuildMenuTabType; + using OpenSHC::UI::Enums::MenuViewType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00434300 + void BuildMenu::MenuItemRenderFunction_BuildMenu_MiniMapInteraction(int param_1, ...) + { + if (DAT_ButtonCurrentlyInteracting::instance != FALSE + && DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU + && (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_SOLDIERS + || (DAT_TileMapState::instance.shiftRelated0or3 == 1))) { + DAT_MinimapViewState::instance.minimapClickEnabled = 1; + return; + } + DAT_MinimapViewState::instance.minimapClickEnabled = 0; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ed989c9a21..b7f013c077 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -11141,7 +11141,7 @@ SHC_3BB0A8C1_0x00434260 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00434270 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00434300 | 0.0% | Pending +SHC_3BB0A8C1_0x00434300 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00434340 | 100.0% | Reimplemented From 713edc4d413f38476a46863491d0fb55a4797358 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:49 +0100 Subject: [PATCH 02/46] reimplement: SHC_3BB0A8C1_0x004393C0 100.0% Reimplemented MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops, gynt's work as it stands on his fork's reimpl/UI-MenuItems at d91f6232e (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 --- ...dler_BuildMenu_CurrentlySelectedTroops.cpp | 47 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp new file mode 100644 index 0000000000..722c513d05 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -0,0 +1,47 @@ +#include "../BuildMenu.func.hpp" + +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitTypeInt.hpp" + +#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + using OpenSHC::Map::Units::UnitTypeInt; + + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004393C0 + void BuildMenu::MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops(int slotID, ...) + { + UnitTypeInt unitType; + int _unitType; + DAT_UnitsState::instance.unitControlsRelated = 1; + if (slotID < 0x14) { + _unitType = DAT_RenderingDefinedData::instance + .field1030_0x54a5c[DAT_UnitsState::instance.selectionSlots[slotID]]; + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueClickNavigateMenuOrEscape, + DAT_UnitsState::ptr)(_unitType); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionForUnitType, + DAT_UnitsState::ptr)(_unitType); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::recountUnitsInSelection, DAT_UnitsState::ptr)(); + return; + } + unitType = DAT_RenderingDefinedData::instance + .field1030_0x54a5c[DAT_UnitsState::instance.selectionSlots[slotID + -0x14]]; + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueUnitTypeCommand, DAT_UnitsState::ptr)( + unitType); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionExcludeUnitType, + DAT_UnitsState::ptr)(unitType); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::recountUnitsInSelection, DAT_UnitsState::ptr)(); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b7f013c077..cde2159a77 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13359,7 +13359,7 @@ SHC_3BB0A8C1_0x00439380 | 0.0% | Pending SHC_3BB0A8C1_0x00439390 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004393C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004393C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00439440 | 100.0% | Reimplemented From 364e8442f242b3d91b703da3fa93f460a59f192b Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:49 +0100 Subject: [PATCH 03/46] reimplement: SHC_3BB0A8C1_0x0043E490 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons, 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 --- ...uildingAndStatusMenu_StatusMenuButtons.cpp | 38 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp new file mode 100644 index 0000000000..8bbfd40033 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp @@ -0,0 +1,38 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/INT_00b96120.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Game::GameMode2; + using Map::Buildings::BuildingType; + using UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0043E490 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons(int param_1, ...) + { + if (param_1 == 0x47 && DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo == 0x4b + && INT_00b96120::instance == 4) { + param_1 = Map::Buildings::BT_OXTETHER; + } + DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = param_1; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); + if ((DAT_GameCore::instance.gameMode_2 == Game::GM_CRUSADER_TUTORIAL) + && (param_1 != Map::Buildings::BT_KEEPDOOR_LEFT)) { + MACRO_CALL(UI::Helpers_Func::SetTutorialBuildingActionState)(0xf, (BuildingType)((int)(param_1))); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index cde2159a77..1199a24d54 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13583,7 +13583,7 @@ SHC_3BB0A8C1_0x0043E280 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043E350 | 100.0% | Reimplemented, identical code; only the /GS cookie symbols differ (CRT) -SHC_3BB0A8C1_0x0043E490 | 0.0% | Pending +SHC_3BB0A8C1_0x0043E490 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043E4E0 | 0.0% | Pending From c7f2e6456ae9c5f2ee88bf6cfd326394504602e3 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:49 +0100 Subject: [PATCH 04/46] reimplement: SHC_3BB0A8C1_0x0043E4E0 100.0% Reimplemented MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 9bea7973e (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 --- ...ingAndStatusMenu_StatusMainMenuButtons.cpp | 59 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp new file mode 100644 index 0000000000..680c4af7c2 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp @@ -0,0 +1,59 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eTextSections; + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Text::TextAlignment; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x0043E4E0 + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons(int param_1, ...) + { + char* textAddress; + int yParam; + TextAlignment alignment; + BGR24 color; + int fontSize; + BOOLEnum keepOffsetX; + int blendStrength; + if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) { + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + blendStrength = 0; + keepOffsetX = FALSE; + fontSize = 0x13; + color = 0; + int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + alignment = OpenSHC::Text::TTA_CENTER; + yParam = DAT_ButtonY::instance + 10; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, param_1 + -0x47), + xParam, yParam, alignment, color, fontSize, keepOffsetX, blendStrength); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1199a24d54..7e3599a00e 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13585,7 +13585,7 @@ SHC_3BB0A8C1_0x0043E350 | 100.0% | Reimplemented, identical code; only the /GS c SHC_3BB0A8C1_0x0043E490 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0043E4E0 | 0.0% | Pending +SHC_3BB0A8C1_0x0043E4E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043E540 | 100.0% | Reimplemented From 2accd6865435fa7914925253a1cd6603748028a6 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:50 +0100 Subject: [PATCH 05/46] reimplement: SHC_3BB0A8C1_0x0043FBF0 100.0% Reimplemented MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType, 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 --- ..._BuildingAndStatusMenu_DisableFoodType.cpp | 53 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp new file mode 100644 index 0000000000..74579581dc --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp @@ -0,0 +1,53 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Game::GameMode; + using OpenSHC::IO::Graphics::GmID; + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0043FBF0 + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType(int foodType, ...) + { + if (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) { + DAT_ButtonCurrentlyInteracting::instance = FALSE; + } + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .isFoodTypeBanned[foodType] + != 0) { + int _xOffset = 8; + int _yOffset = 2; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (foodType == 1) { + _xOffset = 4; + _yOffset = 0; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 0x2d, + DAT_ButtonX::instance + -4 + _xOffset, DAT_ButtonY::instance + -0x2d + _yOffset, 6); + 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 7e3599a00e..778ba757cc 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13609,7 +13609,7 @@ SHC_3BB0A8C1_0x0043FAC0 | 0.0% | Pending SHC_3BB0A8C1_0x0043FBB0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0043FBF0 | 0.0% | Pending +SHC_3BB0A8C1_0x0043FBF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043FC80 | 100.0% | Reimplemented From b060a08330fafe4081f438029ac4fad569a6b3ee Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:50 +0100 Subject: [PATCH 06/46] reimplement: SHC_3BB0A8C1_0x0043FCB0 100.0% Reimplemented MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 48d3995f6 (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 --- ...BuildingAndStatusMenu_ArmyStatusReturn.cpp | 68 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp new file mode 100644 index 0000000000..5175f197c0 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp @@ -0,0 +1,68 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/UI/DisplayElements.func.hpp" +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.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_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Game::GameMode2; + using OpenSHC::Map::MapType2; + using OpenSHC::UI::Enums::DisplayElementID; + 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 0x0043FCB0 + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn(int param_1, ...) + { + int iVar1; + BOOLEnum BVar2; + if (((((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk) + || (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL)) + && (DAT_GameSynchronyState::instance.currentPlayerSlotID == 2)) + || ((((DAT_GameSynchronyState::instance.currentPlayerSlotID == 1 + && (iVar1 = MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, + DAT_GameState::ptr)(), + iVar1 == 0)) + && (iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getArmySize, + DAT_UnitsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID), + iVar1 != 0)) + || ((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk + && (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == OpenSHC::Map::MT_SIEGE)))))) + && (BVar2 = MACRO_CALL(OpenSHC::UI::DisplayElements_Func::GetIfDisplayElementStateNotZero)( + OpenSHC::UI::Enums::DEID_KEEP_AND_GRANERY_PLACEMENT_INFO), + BVar2 == 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 778ba757cc..75c972a50f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13615,7 +13615,7 @@ SHC_3BB0A8C1_0x0043FC80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043FCA0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0043FCB0 | 0.0% | Pending +SHC_3BB0A8C1_0x0043FCB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043FD30 | 100.0% | Reimplemented From 2d712270556cca6e2b2b6165c0f0f9aec59c8766 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:50 +0100 Subject: [PATCH 07/46] reimplement: SHC_3BB0A8C1_0x00440770 100.0% Reimplemented MenuItemActionHandler_CustomScenarios_Main, 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 --- ...ItemActionHandler_CustomScenarios_Main.cpp | 128 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp new file mode 100644 index 0000000000..36ccd349c5 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -0,0 +1,128 @@ +#include "../CustomScenarios.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.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/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/INT_00b95b64.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Game::GameMode2; + using UI::Enums::BuildingsAndStatusMenuTabType; + using UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00440770 + void CustomScenarios::MenuItemActionHandler_CustomScenarios_Main(int param_1, ...) + { + switch (param_1) { + case 1: + DAT_MenuTextInputState::instance.dialogResult = 0; + DAT_MenuTextInputState::instance.field42_0x9c = 1; + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::activateLoadOrSaveMapUI, DAT_MenuTextInputState::ptr)(9); + return; + case 2: + MACRO_CALL(UI::Helpers_Func::InitializeBasicMap)(); + DAT_GameCore::instance.U2_mapType_singleOrMulti = 0; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_NEW_MAP_MAPTYPE, 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: + 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 4: + 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 = 3; + INT_00b95b64::instance = 1; + DAT_GameCore::instance.standaloneFilename[0] = '\0'; + DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty_3; + DAT_GameCore::instance.menuTabToSwitchTo.tabType = UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM; + 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 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 75c972a50f..fe56277e6c 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13647,7 +13647,7 @@ SHC_3BB0A8C1_0x00440600 | 0.0% | Pending SHC_3BB0A8C1_0x004406F0 | 0.0% | Pending -SHC_3BB0A8C1_0x00440770 | 0.0% | Pending +SHC_3BB0A8C1_0x00440770 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004409A4 | 0.0% | Pending From f17673e2eee123d24e05f022fb5a45df86c81335 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:50 +0100 Subject: [PATCH 08/46] reimplement: SHC_3BB0A8C1_0x00465200 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection, 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 --- ...gAndStatusMenu_WorkshopWeaponSelection.cpp | 61 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp new file mode 100644 index 0000000000..4fe80e7785 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp @@ -0,0 +1,61 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Commands::GameCommandType; + using OpenSHC::Game::Resources::ResourceType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00465200 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection( + ResourceType weapon, ...) + { + if (weapon == OpenSHC::Game::Resources::RT_CROSSBOW) { + if (DAT_GameCore::instance.xbowProducible_logic == 0) { + return; + } + } else if (weapon == OpenSHC::Game::Resources::RT_BOW) { + if (DAT_GameCore::instance.bowProducible_logic == 0) { + return; + } + } else if (weapon == OpenSHC::Game::Resources::RT_PIKE) { + if (DAT_GameCore::instance.pikeProducible_logic == 0) { + return; + } + } else if (weapon == OpenSHC::Game::Resources::RT_SPEAR) { + if (DAT_GameCore::instance.spearProducible_logic == 0) { + return; + } + } else if (weapon == OpenSHC::Game::Resources::RT_SWORD) { + if (DAT_GameCore::instance.swordProducible_logic == 0) { + return; + } + } else if (weapon == OpenSHC::Game::Resources::RT_MACE) { + if (DAT_GameCore::instance.maceProducible_logic == 0) { + return; + } + } + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 + = DAT_BuildingsState::instance.menuSelectedBuildingID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = weapon; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + ((GameCommandType)0x21)); + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID].weaponRelated + = weapon; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index fe56277e6c..3fef867538 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19867,7 +19867,7 @@ SHC_3BB0A8C1_0x004650F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465110 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00465200 | 0.0% | Pending +SHC_3BB0A8C1_0x00465200 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004652A0 | 100.0% | Reimplemented From ce1e6c2cdbc50122c8a6c2a0e68e64b390701f31 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:50 +0100 Subject: [PATCH 09/46] reimplement: SHC_3BB0A8C1_0x00465360 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose, 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 --- ...ldingAndStatusMenu_DrawbridgeOpenClose.cpp | 32 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp new file mode 100644 index 0000000000..8fe4df7762 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp @@ -0,0 +1,32 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Commands::GameCommandType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00465360 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose(int param_1, ...) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 + = DAT_BuildingsState::instance.menuSelectedBuildingID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + ((GameCommandType)0x25)); + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .gateOpenOrCloseClick = param_1; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3fef867538..d416998405 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19873,7 +19873,7 @@ SHC_3BB0A8C1_0x004652A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004652D0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00465360 | 0.0% | Pending +SHC_3BB0A8C1_0x00465360 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004653B0 | 0.0% | Pending From fce6d4854ed538a121912a7a76976ca7f6dae638 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:51 +0100 Subject: [PATCH 10/46] reimplement: SHC_3BB0A8C1_0x00465480 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose, 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 --- ...ildingAndStatusMenu_GatehouseOpenClose.cpp | 44 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp new file mode 100644 index 0000000000..9a432b8286 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp @@ -0,0 +1,44 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Audio/SFX/SoundEffectID.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Audio::SFX::SoundEffectID; + using OpenSHC::Commands::GameCommandType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00465480 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose(int param_1, ...) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 + = DAT_BuildingsState::instance.menuSelectedBuildingID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_OPEN_OR_CLOSE_GATE); + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .openOrCloseGateClick = param_1; + if (param_1 == 10) { + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + (OpenSHC::Audio::SFX::SoundEffectID)0x8c); + } + if (param_1 == 0xb) { + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + (OpenSHC::Audio::SFX::SoundEffectID)0x8e); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index d416998405..de5d039d51 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19879,7 +19879,7 @@ SHC_3BB0A8C1_0x004653B0 | 0.0% | Pending SHC_3BB0A8C1_0x004653F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00465480 | 0.0% | Pending +SHC_3BB0A8C1_0x00465480 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004654F0 | 0.0% | Pending From 6f060eb89c39fb951eefe9a20007b9812bd6ca64 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:51 +0100 Subject: [PATCH 11/46] reimplement: SHC_3BB0A8C1_0x00465560 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider, 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 --- ...andler_BuildingAndStatusMenu_TaxSlider.cpp | 57 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp new file mode 100644 index 0000000000..24e5de845f --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp @@ -0,0 +1,57 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00465560 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + int* piVar1; + int iVar2; + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = 11; + case 4: + *currentValue + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + return; + case 2: + case 3: + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI = *currentValue; + return; + case 5: + iVar2 = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + piVar1 = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + if (0 < iVar2) { + *piVar1 = iVar2 + -1; + } + *currentValue = *piVar1; + return; + case 6: + iVar2 = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + piVar1 = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + if (iVar2 < 0xb) { + *piVar1 = iVar2 + 1; + } + *currentValue = *piVar1; + break; + default: + break; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index de5d039d51..a13e92ecbe 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19883,7 +19883,7 @@ SHC_3BB0A8C1_0x00465480 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004654F0 | 0.0% | Pending -SHC_3BB0A8C1_0x00465560 | 0.0% | Pending +SHC_3BB0A8C1_0x00465560 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465610 | 0.0% | Pending From cf4724e36ba6cb3cdc1d5568a54c28598e13bfb5 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:51 +0100 Subject: [PATCH 12/46] reimplement: SHC_3BB0A8C1_0x00465630 100.0% Reimplemented MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider, gynt's work as it stands on his fork's reimpl/UI-MenuItems at b43b87bc9 (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 --- ...BuildingAndStatusMenu_HorizontalSlider.cpp | 44 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp new file mode 100644 index 0000000000..30913a8bc5 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp @@ -0,0 +1,44 @@ +#include "../BuildingAndStatusMenu.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_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eGM; + using OpenSHC::Rendering::Enums::RenderTarget; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00465630 + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider( + int param_1, int thumbYPos, int param_3, int thumbHeight, BOOL isDragged) + { + int iVar1 = 0; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (0 < (int)DAT_ButtonW::instance) { + do { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x119, + DAT_ButtonX::instance + iVar1, (int)(DAT_ButtonY::instance)); + iVar1 = iVar1 + 0x1a; + } while (iVar1 < (int)DAT_ButtonW::instance); + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x118, + DAT_ButtonX::instance + thumbYPos, (int)(DAT_ButtonY::instance + -5)); + 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 a13e92ecbe..ae169e2fbd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19897,7 +19897,7 @@ SHC_3BB0A8C1_0x00465620 | 0.0% | Pending SHC_3BB0A8C1_0x00465624 | 0.0% | Pending -SHC_3BB0A8C1_0x00465630 | 0.0% | Pending +SHC_3BB0A8C1_0x00465630 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004656A0 | 100.0% | Reimplemented From f10b58615caee353992d04ad6427efeae0fa73e9 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:51 +0100 Subject: [PATCH 13/46] reimplement: SHC_3BB0A8C1_0x004657B0 100.0% Reimplemented MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons, 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 --- ..._BuildingAndStatusMenu_TaxArrowButtons.cpp | 43 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp new file mode 100644 index 0000000000..84c2685d81 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp @@ -0,0 +1,43 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eTextSections; + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004657B0 + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons(int param_1, ...) + { + char* textAddress; + int yParam; + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + if (0 <= param_1) { + yParam = DAT_ButtonY::instance + 4; + int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_IN_KEEP, param_1), + xParam, yParam, OpenSHC::Text::TTA_CENTER, 0, 0x11, FALSE, 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ae169e2fbd..ccf57cdccf 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19903,7 +19903,7 @@ SHC_3BB0A8C1_0x004656A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465700 | 0.0% | Pending -SHC_3BB0A8C1_0x004657B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004657B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465800 | 100.0% | Reimplemented From 0659bc0d187ab659fd3ab59ef0189f76c8c20b5d Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:51 +0100 Subject: [PATCH 14/46] reimplement: SHC_3BB0A8C1_0x00465820 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations, gynt's work as it stands on his fork's reimpl/UI-MenuItems at cea5c3a86 (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 --- ...er_BuildingAndStatusMenu_ChangeRations.cpp | 57 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp new file mode 100644 index 0000000000..893bb3d170 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp @@ -0,0 +1,57 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Game.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Commands::GameCommandType; + using OpenSHC::Game::GameMode2; + using OpenSHC::Map::Buildings::BuildingType; + 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 0x00465820 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations(int param_1, ...) + { + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) { + BOOLEnum BVar1 = MACRO_CALL(OpenSHC::Game_Func::Tutorial_IsActionAllowed)(3, param_1); + if (BVar1 == FALSE) { + MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialHintActiveWithTimestamp)(); + return; + } + MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialBuildingActionState)( + 0xc, (BuildingType)((int)(param_1))); + } + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_CHANGE_RATIONS); + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .rationsSetting3 = param_1; + DWORD DVar2 = timeGetTime(); + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .timeTaxesOrRationsChange = DVar2; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ccf57cdccf..d5898f90c6 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19907,7 +19907,7 @@ SHC_3BB0A8C1_0x004657B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465800 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00465820 | 0.0% | Pending +SHC_3BB0A8C1_0x00465820 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465890 | 100.0% | Reimplemented From 2aee7fe83dcadfb257e896703b82d2c78b017aa7 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:52 +0100 Subject: [PATCH 15/46] reimplement: SHC_3BB0A8C1_0x004659E0 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 637c6b0cb (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 --- ...ildingAndStatusMenu_SelectBuySellGoods.cpp | 35 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp new file mode 100644 index 0000000000..1b0576a69f --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp @@ -0,0 +1,35 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuViewType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004659E0 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods(int param_1, ...) + { + BOOLEnum BVar1 = MACRO_CALL_MEMBER(Game::GameStateStructures_Func::isResourceTypeTradeable, + DAT_GameState::ptr)((Game::Resources::ResourceType)param_1); + if (BVar1) { + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .marketSelectedResourceType = param_1; + DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = 0x39; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index d5898f90c6..d0df59bab8 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19917,7 +19917,7 @@ SHC_3BB0A8C1_0x00465920 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465950 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004659E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004659E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465A20 | 100.0% | Reimplemented From ec786651fdfc2671b96b34c8c4817eb044469cec Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:52 +0100 Subject: [PATCH 16/46] reimplement: SHC_3BB0A8C1_0x00466730 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize, 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 --- ...uildingAndStatusMenu_OutpostSliderSize.cpp | 57 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp new file mode 100644 index 0000000000..4406b26378 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp @@ -0,0 +1,57 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00466730 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + short* psVar1; + short sVar2; + int iVar3; + iVar3 = DAT_BuildingsState::instance.menuSelectedBuildingID; + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = 5; + *currentValue = (int)DAT_BuildingsState::instance.buildings[iVar3].outpostRelatedUnk2; + return; + case 2: + case 3: + DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2 = (short)*currentValue; + return; + case 4: + *currentValue + = (int)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + return; + case 5: + sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + if (0 < sVar2) { + *psVar1 = sVar2 + -1; + } + *currentValue = (int)*psVar1; + return; + case 6: + sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + if (sVar2 < 5) { + *psVar1 = sVar2 + 1; + } + *currentValue = (int)*psVar1; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index d0df59bab8..4d9b00e32c 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19947,7 +19947,7 @@ SHC_3BB0A8C1_0x00466620 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00466710 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00466730 | 0.0% | Pending +SHC_3BB0A8C1_0x00466730 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004667F0 | 0.0% | Pending From ea4c2e159e38f4e870929412bfd1346df56d34ab Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:52 +0100 Subject: [PATCH 17/46] reimplement: SHC_3BB0A8C1_0x00466810 100.0% Reimplemented MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay, 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 --- ...ildingAndStatusMenu_OutpostSliderDelay.cpp | 57 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp new file mode 100644 index 0000000000..933bb53a19 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp @@ -0,0 +1,57 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00466810 + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + short* psVar1; + short sVar2; + int _selectedBuildingID; + _selectedBuildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = 24000; + *currentValue = (int)DAT_BuildingsState::instance.buildings[_selectedBuildingID].outpostRelatedUnk3; + return; + case 2: + case 3: + DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3 = (short)*currentValue; + return; + case 4: + *currentValue + = (int)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + return; + case 5: + sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + if (0 < sVar2) { + *psVar1 = sVar2 + -1; + } + *currentValue = (int)*psVar1; + return; + case 6: + sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + if (sVar2 < 24000) { + *psVar1 = sVar2 + 1; + } + *currentValue = (int)*psVar1; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 4d9b00e32c..deea4acf09 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -19961,7 +19961,7 @@ SHC_3BB0A8C1_0x00466800 | 0.0% | Pending SHC_3BB0A8C1_0x00466804 | 0.0% | Pending -SHC_3BB0A8C1_0x00466810 | 0.0% | Pending +SHC_3BB0A8C1_0x00466810 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004668D0 | 0.0% | Pending From 8136f610f245d2a2d8d52642cfc1571c760a60e7 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:52 +0100 Subject: [PATCH 18/46] reimplement: SHC_3BB0A8C1_0x0047CA80 100.0% Reimplemented MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 01ff313fc (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 --- ...rkServiceProvider_ProviderScrollbarUnk.cpp | 58 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp new file mode 100644 index 0000000000..606d8af15a --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp @@ -0,0 +1,58 @@ +#include "../ChooseNetworkServiceProvider.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +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 0x0047CA80 + void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = DAT_GameSynchronyState::instance.scrollBarItemCount + -4; + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + return; + case 2: + case 3: + DAT_GameSynchronyState::instance.scrollBarItemOffset = *currentValue; + return; + case 4: + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + return; + case 5: + if (0 < DAT_GameSynchronyState::instance.scrollBarItemOffset) { + DAT_GameSynchronyState::instance.scrollBarItemOffset + = DAT_GameSynchronyState::instance.scrollBarItemOffset + -1; + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + return; + } + break; + case 6: + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + < DAT_GameSynchronyState::instance.scrollBarItemCount + -4) { + DAT_GameSynchronyState::instance.scrollBarItemOffset + = DAT_GameSynchronyState::instance.scrollBarItemOffset + 1; + } + break; + default: + return; + } + *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index deea4acf09..b9f061c1b1 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22255,7 +22255,7 @@ SHC_3BB0A8C1_0x0047C670 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047C860 | 0.0% | Pending -SHC_3BB0A8C1_0x0047CA80 | 0.0% | Pending +SHC_3BB0A8C1_0x0047CA80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047CB0C | 0.0% | Pending From 06ef01dcc04854182982630ba26d185924fabd87 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:53 +0100 Subject: [PATCH 19/46] reimplement: SHC_3BB0A8C1_0x0047CC10 100.0% Reimplemented MenuItemActionHandler_General_TextInputDisplay, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at c52ccd41b (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 --- ...ActionHandler_General_TextInputDisplay.cpp | 50 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp new file mode 100644 index 0000000000..fca76519a7 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp @@ -0,0 +1,50 @@ +#include "../General.func.hpp" + +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Text::TextArrayIndexType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0047CC10 + void General::MenuItemActionHandler_General_TextInputDisplay(int param_1, ...) + { + switch (param_1) { + case 0: + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_FIVE__NUMERIC_DOT) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); + } + break; + case 1: + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_SIX__NUMERIC_ONLY) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(6); + } + break; + case 2: + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_SEVEN__NUMERIC_ONLY) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(7); + } + break; + case 3: + if ((DAT_GameCore::instance.isNameEntryActive != TRUE) + && (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_ZERO)) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b9f061c1b1..0ec5b4e3c6 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22271,7 +22271,7 @@ SHC_3BB0A8C1_0x0047CB20 | 0.0% | Pending SHC_3BB0A8C1_0x0047CB30 | 100.0% | Reimplemented, Security Cookie mismatches -SHC_3BB0A8C1_0x0047CC10 | 0.0% | Pending +SHC_3BB0A8C1_0x0047CC10 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047CC84 | 0.0% | Pending From c29d8c2941b9bbf1b6dd0b7222015e2322f69835 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:53 +0100 Subject: [PATCH 20/46] reimplement: SHC_3BB0A8C1_0x0047D070 100.0% Reimplemented MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk, 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 --- ...tworkServiceProvider_ModemScrollbarUnk.cpp | 31 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp new file mode 100644 index 0000000000..d197b0d54c --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp @@ -0,0 +1,31 @@ +#include "../ChooseNetworkServiceProvider.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047D070 + void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = DAT_GameSynchronyState::instance.modemScrollbarCount + -4; + *currentValue = DAT_GameSynchronyState::instance.modemScrollBarOffset; + return; + case 2: + case 3: + DAT_GameSynchronyState::instance.modemScrollBarOffset = *currentValue; + return; + case 4: + *currentValue = DAT_GameSynchronyState::instance.modemScrollBarOffset; + *maxValue = DAT_GameSynchronyState::instance.modemScrollbarCount + -4; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 0ec5b4e3c6..e900e53c6d 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22297,7 +22297,7 @@ SHC_3BB0A8C1_0x0047CEE0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047CF50 | 100.0% | Reimplemented, Security Cookie mismatches -SHC_3BB0A8C1_0x0047D070 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D070 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D0D0 | 0.0% | Pending From 7c7aaa8ae27739e1134c9832a44833b4f3db74d0 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:53 +0100 Subject: [PATCH 21/46] reimplement: SHC_3BB0A8C1_0x0047D100 100.0% Reimplemented MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 637c6b0cb (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 --- ...eNetworkServiceProvider_ModemTableRows.cpp | 53 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp new file mode 100644 index 0000000000..514ca734d6 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -0,0 +1,53 @@ +#include "../ChooseNetworkServiceProvider.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0047D100 + void ChooseNetworkServiceProvider::MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows( + int param_1, ...) + { + BGR24 color; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawTableCellBackground, DAT_PencilRenderCore::ptr)( + (uint)(param_1 == DAT_GameSynchronyState::instance.modemScrollbarIndex), param_1, 0); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 + < DAT_GameSynchronyState::instance.modemScrollbarCount) { + if ((param_1 == DAT_GameSynchronyState::instance.modemScrollbarIndex) + || (color = 0xc2f0eb, DAT_ButtonCurrentlyInteracting::instance)) { + color = 0xccfaff; + } + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance + .stringPointerArray[DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1], + (int)((int)(DAT_ButtonX::instance + 8)), (int)((int)(DAT_ButtonY::instance + 4)), + OpenSHC::Text::TTA_LEFT, color, 0x12, FALSE, 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index e900e53c6d..649b7f7cd8 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22309,7 +22309,7 @@ SHC_3BB0A8C1_0x0047D0DC | 0.0% | Pending SHC_3BB0A8C1_0x0047D0E0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047D100 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D100 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D190 | 0.0% | Pending From 06ae92133ec2fa94a95eae321a4fd0c5b287d125 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:53 +0100 Subject: [PATCH 22/46] reimplement: SHC_3BB0A8C1_0x0047D410 100.0% Reimplemented MenuItemRenderFunction_FindingNetworkSessions_TableRows, gynt's work as it stands on his fork's archive/UI-MenuViews-development-second-pass at 637c6b0cb (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 --- ...ction_FindingNetworkSessions_TableRows.cpp | 50 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp new file mode 100644 index 0000000000..b5a40b6918 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp @@ -0,0 +1,50 @@ +#include "../FindingNetworkSessions.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0047D410 + void FindingNetworkSessions::MenuItemRenderFunction_FindingNetworkSessions_TableRows(int param_1, ...) + { + uint color; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawTableCellBackground, DAT_PencilRenderCore::ptr)( + (uint)(param_1 == DAT_GameSynchronyState::instance.scrollBarIndex), param_1, 0); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 + < DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { + if ((param_1 == DAT_GameSynchronyState::instance.scrollBarIndex) + || (color = 0xc2f0eb, DAT_ButtonCurrentlyInteracting::instance)) { + color = 0xccfaff; + } + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderWideText, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance + .DPLAY_SessionNames[DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1], + (int)((int)(DAT_ButtonX::instance + 8)), (int)((int)(DAT_ButtonY::instance + 4)), + OpenSHC::Text::TTA_LEFT, color, 0x12, 0, 0); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 649b7f7cd8..b40e3dfb0a 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22329,7 +22329,7 @@ SHC_3BB0A8C1_0x0047D3E0 | 0.0% | Pending SHC_3BB0A8C1_0x0047D3F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047D410 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D410 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D4A0 | 100.0% | Reimplemented From 0a470ce25595359e4a9fde87af6f50447097332d Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:53 +0100 Subject: [PATCH 23/46] reimplement: SHC_3BB0A8C1_0x0047FFE0 100.0% Reimplemented MenuItemRenderFunction_Chat_TauntButtons, gynt's work as it stands on his fork's reimpl/UI-MenuItems at acd19e62e (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 --- ...nuItemRenderFunction_Chat_TauntButtons.cpp | 54 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp diff --git a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp new file mode 100644 index 0000000000..d8b01e9116 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp @@ -0,0 +1,54 @@ +#include "../Chat.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::Text::TextAlignment; + 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 0x0047FFE0 + void Chat::MenuItemRenderFunction_Chat_TauntButtons(int param_1, ...) + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton, + AlphaAndButtonSurfaceObj::ptr)(0, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); + if (param_1 < 10) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( + param_1, DAT_ButtonX::instance + 0xc, (int)((int)(DAT_ButtonY::instance + 9)), + OpenSHC::Text::TTA_LEFT, 0xccfaff, 0x13, FALSE, 0); + } else { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( + param_1, DAT_ButtonX::instance + 9, (int)((int)(DAT_ButtonY::instance + 9)), + OpenSHC::Text::TTA_LEFT, 0xccfaff, 0x13, FALSE, 0); + } + if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + DAT_GameSynchronyState::instance.DAT_InsultTextIndex = param_1; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b40e3dfb0a..f3e40c5fbd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -22413,7 +22413,7 @@ SHC_3BB0A8C1_0x0047FEA0 | 0.0% | Pending SHC_3BB0A8C1_0x0047FFA0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0047FFE0 | 0.0% | Pending +SHC_3BB0A8C1_0x0047FFE0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00480050 | 100.0% | Reimplemented From d9d95376ff8601a2be9f5f3333dbc97d508ff5ad Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:54 +0100 Subject: [PATCH 24/46] reimplement: SHC_3BB0A8C1_0x00487200 100.0% Reimplemented MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows, gynt's work as it stands on his fork's reimpl/UI-MenuItems at ea82c2122 (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 --- ...tworkServiceProvider_ProviderTableRows.cpp | 56 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp new file mode 100644 index 0000000000..6bb12d631d --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp @@ -0,0 +1,56 @@ +#include "../ChooseNetworkServiceProvider.func.hpp" + +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; + + /* + 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 0x00487200 + void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows( + int param_1, ...) + { + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 + < DAT_GameSynchronyState::instance.scrollBarItemCount) { + DAT_GameSynchronyState::instance.selectedProviderIndex = param_1; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::setMenuTypeBasedOnDirectPlayGUID, + DAT_GameSynchronyState::ptr)(); + /* + the original dispatches with a `sub eax, K; je` chain (0x487228), MSVC's + sparse switch, and the TCPIP arm sits first + */ + switch (DAT_GameCore::instance.activeMenuTab.tabType) { + case OpenSHC::UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP: + MACRO_CALL_MEMBER( + OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); + break; + case OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM: + MACRO_CALL_MEMBER( + OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(7); + break; + default: + break; + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index f3e40c5fbd..bc8c540cdf 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23055,7 +23055,7 @@ SHC_3BB0A8C1_0x00487090 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004870B0 | 100.0% | Reimplemented, requires SHC_3BB0A8C1_0x00487090 to be active -SHC_3BB0A8C1_0x00487200 | 0.0% | Pending +SHC_3BB0A8C1_0x00487200 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00487250 | 100.0% | Reimplemented From e902aab5888ca806f7733348d09e3581d706da6c Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:54 +0100 Subject: [PATCH 25/46] reimplement: SHC_3BB0A8C1_0x00491FD0 100.0% Reimplemented MenuItemActionHandler_GameplayOptions_SpeedSlider, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 456c6b395 (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 --- ...ionHandler_GameplayOptions_SpeedSlider.cpp | 56 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp diff --git a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp new file mode 100644 index 0000000000..2a791aff33 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp @@ -0,0 +1,56 @@ +#include "../GameplayOptions.func.hpp" + +#include "OpenSHC/Game/GameMode.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + 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 + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00491FD0 + void GameplayOptions::MenuItemActionHandler_GameplayOptions_SpeedSlider( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) + && (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { + *minValue = 0x14; + *maxValue = 0x5a; + *currentValue = DAT_GameSynchronyState::instance.skirmishGameSpeedLevel; + return; + } + switch (param_2) { + case 1: + *minValue = 0x14; + *maxValue = 0x5a; + *currentValue = DAT_MenuTextInputState::instance.field12_0x30; + return; + case 2: + case 3: + DAT_MenuTextInputState::instance.field12_0x30 = *currentValue; + return; + case 5: + *currentValue = *currentValue + -1; + DAT_MenuTextInputState::instance.field12_0x30 = *currentValue; + return; + case 6: + *currentValue = *currentValue + 1; + DAT_MenuTextInputState::instance.field12_0x30 = *currentValue; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index bc8c540cdf..5ee23d3e9d 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -23435,7 +23435,7 @@ SHC_3BB0A8C1_0x00491E80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00491EB0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00491FD0 | 0.0% | Pending +SHC_3BB0A8C1_0x00491FD0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0049205C | 0.0% | Pending From 15127df905771d3fdfe6c85afdc8d7bd7f1d9782 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:54 +0100 Subject: [PATCH 26/46] reimplement: SHC_3BB0A8C1_0x004B1990 100.0% Reimplemented MenuItemActionHandler_GreatestLord_Main, 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 --- ...enuItemActionHandler_GreatestLord_Main.cpp | 37 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp new file mode 100644 index 0000000000..08c8e9586e --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp @@ -0,0 +1,37 @@ +#include "../GreatestLord.func.hpp" + +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GreatestLordDefinedData.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B1990 + void GreatestLord::MenuItemActionHandler_GreatestLord_Main(int param_1, ...) + { + if ((param_1 == 1) || (param_1 == 100)) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NONE, FALSE); + } + if (param_1 == 10) { + DAT_GreatestLordDefinedData::instance.tableSortBy = -1; + } + if (param_1 == 0xb) { + DAT_GreatestLordDefinedData::instance.tableSortBy = 1; + } + if (param_1 == 0xc) { + DAT_GreatestLordDefinedData::instance.tableSortBy = 0; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 5ee23d3e9d..efecac3f68 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25985,7 +25985,7 @@ SHC_3BB0A8C1_0x004B18D0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B1900 | 0.0% | Pending -SHC_3BB0A8C1_0x004B1990 | 0.0% | Pending +SHC_3BB0A8C1_0x004B1990 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B19E0 | 0.0% | Pending From 2ac00b2ed29fe45b21880b1b1cf4c2a14e77d5b4 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:54 +0100 Subject: [PATCH 27/46] reimplement: SHC_3BB0A8C1_0x004B8990 100.0% Reimplemented MenuItemActionHandler_EditScenario_DateYearBox, 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 --- ...ActionHandler_EditScenario_DateYearBox.cpp | 65 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp new file mode 100644 index 0000000000..a6ac35ccdc --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp @@ -0,0 +1,65 @@ +#include "../EditScenario.func.hpp" + +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" + +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Text::TextArrayIndexType; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B8990 + void EditScenario::MenuItemActionHandler_EditScenario_DateYearBox(int param_1, ...) + { + switch (param_1) { + case 0: + if (DAT_UserTextHandlerState::instance.textArrayIndex + != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_SEVEN__NUMERIC_ONLY)) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + } + break; + case 1: + if (DAT_UserTextHandlerState::instance.textArrayIndex + != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_TWO__FILTER_A)) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(10); + } + break; + case 2: + if (DAT_UserTextHandlerState::instance.textArrayIndex + != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_THREE__FILTER_A)) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xb); + } + break; + case 3: + case 4: + case 7: + if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TextArrayIndexTypeInt)0xc) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xc); + } + break; + case 5: + if (DAT_UserTextHandlerState::instance.textArrayIndex + != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_FIVE__NUMERIC_DOT)) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xd); + } + break; + case 6: + if (DAT_UserTextHandlerState::instance.textArrayIndex + != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_SIX__NUMERIC_ONLY)) { + MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xe); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index efecac3f68..6b9de7ce9f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -27487,7 +27487,7 @@ SHC_3BB0A8C1_0x004B8987 | 0.0% | Pending SHC_3BB0A8C1_0x004B8988 | 0.0% | Pending -SHC_3BB0A8C1_0x004B8990 | 0.0% | Pending +SHC_3BB0A8C1_0x004B8990 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B8A28 | 0.0% | Pending From a777cedf84e60c99642a470d4a9c13002c64ecdb Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:54 +0100 Subject: [PATCH 28/46] reimplement: SHC_3BB0A8C1_0x004B8A50 100.0% Reimplemented MenuItemActionHandler_EditScenario_Scrollbar, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 1a21a7a2f (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 --- ...emActionHandler_EditScenario_Scrollbar.cpp | 56 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp new file mode 100644 index 0000000000..9f1a7b4978 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -0,0 +1,56 @@ +#include "../EditScenario.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 0x004B8A50 + void EditScenario::MenuItemActionHandler_EditScenario_Scrollbar( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = DAT_MapPropertiesState::instance.eventsCount + -0x14; + *currentValue = 0; + return; + case 2: + case 3: + if (*currentValue < 0) { + *currentValue = 0; + } + DAT_MapPropertiesState::instance.field47_0x1355c = *currentValue; + return; + case 4: + *currentValue = DAT_MapPropertiesState::instance.field47_0x1355c; + *maxValue = DAT_MapPropertiesState::instance.eventsCount + -0x14; + return; + case 5: + if (0 < (int)DAT_MapPropertiesState::instance.field47_0x1355c) { + DAT_MapPropertiesState::instance.field47_0x1355c + = DAT_MapPropertiesState::instance.field47_0x1355c + -1; + *currentValue = DAT_MapPropertiesState::instance.field47_0x1355c; + return; + } + break; + case 6: + if ((int)DAT_MapPropertiesState::instance.field47_0x1355c + < DAT_MapPropertiesState::instance.eventsCount + -0x14) { + DAT_MapPropertiesState::instance.field47_0x1355c + = DAT_MapPropertiesState::instance.field47_0x1355c + 1; + } + break; + default: + return; + } + *currentValue = DAT_MapPropertiesState::instance.field47_0x1355c; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6b9de7ce9f..2a24c8da3f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -27505,7 +27505,7 @@ SHC_3BB0A8C1_0x004B8A40 | 0.0% | Pending SHC_3BB0A8C1_0x004B8A44 | 0.0% | Pending -SHC_3BB0A8C1_0x004B8A50 | 0.0% | Pending +SHC_3BB0A8C1_0x004B8A50 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B8AF8 | 0.0% | Pending From 9f5c17055afc3e0fd2bea5993c5c6d2ae37ae35c Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:55 +0100 Subject: [PATCH 29/46] reimplement: SHC_3BB0A8C1_0x004BAD70 100.0% Reimplemented MenuItemActionHandler_General_MessageScrollbar, gynt's work as it stands on his fork's reimpl/UI-MenuItems at 92974fe35 (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_General_MessageScrollbar.cpp | 51 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp new file mode 100644 index 0000000000..8e27f57cca --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp @@ -0,0 +1,51 @@ +#include "../General.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 0x004BAD70 + void General::MenuItemActionHandler_General_MessageScrollbar( + int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + { + switch (param_2) { + case 1: + *minValue = 0; + *maxValue = DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount; + *currentValue = 0; + return; + case 2: + case 3: + DAT_MapPropertiesState::instance.offset = *currentValue; + return; + case 4: + *currentValue = DAT_MapPropertiesState::instance.offset; + *maxValue = DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount; + return; + case 5: + if (0 < (int)DAT_MapPropertiesState::instance.offset) { + DAT_MapPropertiesState::instance.offset = DAT_MapPropertiesState::instance.offset + -1; + *currentValue = DAT_MapPropertiesState::instance.offset; + return; + } + break; + case 6: + if ((int)DAT_MapPropertiesState::instance.offset + < (int)DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount) { + DAT_MapPropertiesState::instance.offset = DAT_MapPropertiesState::instance.offset + 1; + } + break; + default: + return; + } + *currentValue = DAT_MapPropertiesState::instance.offset; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 2a24c8da3f..d9e79c8d26 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -29097,7 +29097,7 @@ SHC_3BB0A8C1_0x004BAC20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BAC90 | 0.0% | Pending -SHC_3BB0A8C1_0x004BAD70 | 0.0% | Pending +SHC_3BB0A8C1_0x004BAD70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BAE18 | 0.0% | Pending From 289c1b4020db17c014d14b20be88d9f7a553a8ae Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:55 +0100 Subject: [PATCH 30/46] reimplement: SHC_3BB0A8C1_0x004BAE30 100.0% Reimplemented MenuItemRenderFunction_General_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 --- ...nuItemRenderFunction_General_Scrollbar.cpp | 31 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp new file mode 100644 index 0000000000..fa600743de --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp @@ -0,0 +1,31 @@ +#include "../General.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.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 0x004BAE30 + void General::MenuItemRenderFunction_General_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, 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 d9e79c8d26..c5aaad1ffd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -29111,7 +29111,7 @@ SHC_3BB0A8C1_0x004BAE28 | 0.0% | Pending SHC_3BB0A8C1_0x004BAE2C | 0.0% | Pending -SHC_3BB0A8C1_0x004BAE30 | 0.0% | Pending +SHC_3BB0A8C1_0x004BAE30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BAE80 | 0.0% | Pending From 1371f4e7003e1ba409e19a997c89e8b9e20892ce Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:55 +0100 Subject: [PATCH 31/46] reimplement: SHC_3BB0A8C1_0x004BAE80 100.0% Reimplemented MenuItemRenderFunction_General_MessageScrollbarUpDown, 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 --- ...unction_General_MessageScrollbarUpDown.cpp | 32 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp new file mode 100644 index 0000000000..fc10b708cd --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp @@ -0,0 +1,32 @@ +#include "../General.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.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 0x004BAE80 + void General::MenuItemRenderFunction_General_MessageScrollbarUpDown(int param_1, ...) + { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (param_1 == -1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::renderUpDownButtonUnk, + DAT_PencilRenderCore::ptr)(0, 0); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::renderUpDownButtonUnk, DAT_PencilRenderCore::ptr)(1, 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 c5aaad1ffd..7a216736e6 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -29113,7 +29113,7 @@ SHC_3BB0A8C1_0x004BAE2C | 0.0% | Pending SHC_3BB0A8C1_0x004BAE30 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004BAE80 | 0.0% | Pending +SHC_3BB0A8C1_0x004BAE80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BAEC0 | 0.0% | Pending From 0af8ca8b50064c2d39d31015d51f61a8fac80641 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:55 +0100 Subject: [PATCH 32/46] reimplement: SHC_3BB0A8C1_0x004BB740 100.0% Reimplemented MenuItemActionHandler_DisableWeapon_Main, 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 --- ...nuItemActionHandler_DisableWeapon_Main.cpp | 52 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp new file mode 100644 index 0000000000..a09bd985d9 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp @@ -0,0 +1,52 @@ +#include "../DisableWeapon.func.hpp" + +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004BB740 + void DisableWeapon::MenuItemActionHandler_DisableWeapon_Main(int param_1, ...) + { + if (!param_1) { + DAT_MapPropertiesState::instance.SEC_XbowProducible_save + = DAT_MapPropertiesState::instance.SEC_XbowProducible_save ^ 1; + } + if (param_1 == 1) { + DAT_MapPropertiesState::instance.SEC_PikeProducible_save + = DAT_MapPropertiesState::instance.SEC_PikeProducible_save ^ 1; + } + if (param_1 == 2) { + DAT_MapPropertiesState::instance.SEC_SwordProducible_save + = DAT_MapPropertiesState::instance.SEC_SwordProducible_save ^ 1; + } + if (param_1 == 3) { + DAT_MapPropertiesState::instance.SEC_BowProducible_save + = DAT_MapPropertiesState::instance.SEC_BowProducible_save ^ 1; + } + if (param_1 == 4) { + DAT_MapPropertiesState::instance.SEC_SpearProducible_save + = DAT_MapPropertiesState::instance.SEC_SpearProducible_save ^ 1; + } + if (param_1 == 5) { + DAT_MapPropertiesState::instance.SEC_MaceProducible_save + = DAT_MapPropertiesState::instance.SEC_MaceProducible_save ^ 1; + } + if (param_1 == -3) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 7a216736e6..4201827d77 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -29295,7 +29295,7 @@ SHC_3BB0A8C1_0x004BB650 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BB680 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004BB740 | 0.0% | Pending +SHC_3BB0A8C1_0x004BB740 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BB7B0 | 100.0% | Reimplemented From 8a2c76beddb1032972a7f1b850d2a668c4a457f9 Mon Sep 17 00:00:00 2001 From: Gynt Date: Mon, 9 Nov 2026 10:58:55 +0100 Subject: [PATCH 33/46] reimplement: SHC_3BB0A8C1_0x004D9230 100.0% Reimplemented MenuItemActionHandler_CrusadeEndscreen_Main, 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_CrusadeEndscreen_Main.cpp | 37 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp diff --git a/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp b/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp new file mode 100644 index 0000000000..9cd4c38f3d --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp @@ -0,0 +1,37 @@ +#include "../CrusadeEndscreen.func.hpp" + +#include "OpenSHC/UI/MenuItems/SelectCrusade.func.hpp" +#include "OpenSHC/Game/TrailType.hpp" +#include "OpenSHC/Game/TrailTypeInt.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using Game::TrailType; + using Game::TrailTypeInt; + + // FUNCTION: STRONGHOLDCRUSADER 0x004D9230 + void CrusadeEndscreen::MenuItemActionHandler_CrusadeEndscreen_Main(int param_1, ...) + { + if (param_1 != 10) { + return; + } + + TrailTypeInt const trailType = DAT_GameCore::instance.currentTrailType; + if (trailType == Game::TT_EXTREME) { + MACRO_CALL(UI::MenuItems::SelectCrusade_Func::MenuItemActionHandler_SelectCrusade_Main)(4); + return; + } + if (trailType == Game::TT_WARCHEST) { + MACRO_CALL(UI::MenuItems::SelectCrusade_Func::MenuItemActionHandler_SelectCrusade_Main)(3); + return; + } + MACRO_CALL(UI::MenuItems::SelectCrusade_Func::MenuItemActionHandler_SelectCrusade_Main)(1); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 4201827d77..4865cbd4bb 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -36017,7 +36017,7 @@ SHC_3BB0A8C1_0x004D8EC0 | 0.0% | Pending SHC_3BB0A8C1_0x004D91D0 | 0.0% | Pending -SHC_3BB0A8C1_0x004D9230 | 0.0% | Pending +SHC_3BB0A8C1_0x004D9230 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D9270 | 100.0% | Reimplemented From c0a15175cb4676c85bd7218c07951721dd2266bc Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 10:59:57 +0100 Subject: [PATCH 34/46] fix: main's names and types since gynt's base, in 4 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: field1030_0x54a5c -> SelectionSlotUnitTypes, field12_0x30 -> pendingGameSpeedLevel, field42_0x9c -> field_0x9c, field47_0x1355c -> eventListScrollOffset. In CustomScenarios_Main the 9 passed to activateLoadOrSaveMapUI is written as MMT_LOAD_MAP, now that it takes a MenuModalType. No logic changes. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...dler_BuildMenu_CurrentlySelectedTroops.cpp | 4 ++-- ...ItemActionHandler_CustomScenarios_Main.cpp | 4 ++-- ...emActionHandler_EditScenario_Scrollbar.cpp | 20 +++++++++---------- ...ionHandler_GameplayOptions_SpeedSlider.cpp | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp index 722c513d05..9fcca56b9b 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -25,7 +25,7 @@ namespace UI { DAT_UnitsState::instance.unitControlsRelated = 1; if (slotID < 0x14) { _unitType = DAT_RenderingDefinedData::instance - .field1030_0x54a5c[DAT_UnitsState::instance.selectionSlots[slotID]]; + .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID]]; MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueClickNavigateMenuOrEscape, DAT_UnitsState::ptr)(_unitType); MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionForUnitType, @@ -34,7 +34,7 @@ namespace UI { return; } unitType = DAT_RenderingDefinedData::instance - .field1030_0x54a5c[DAT_UnitsState::instance.selectionSlots[slotID + -0x14]]; + .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID + -0x14]]; MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueUnitTypeCommand, DAT_UnitsState::ptr)( unitType); MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionExcludeUnitType, diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index 36ccd349c5..61ee74f4b2 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -29,9 +29,9 @@ namespace UI { switch (param_1) { case 1: DAT_MenuTextInputState::instance.dialogResult = 0; - DAT_MenuTextInputState::instance.field42_0x9c = 1; + DAT_MenuTextInputState::instance.field_0x9c = 1; MACRO_CALL_MEMBER( - UI::MenuTextInputState_Func::activateLoadOrSaveMapUI, DAT_MenuTextInputState::ptr)(9); + UI::MenuTextInputState_Func::activateLoadOrSaveMapUI, DAT_MenuTextInputState::ptr)(UI::Enums::MMT_LOAD_MAP); return; case 2: MACRO_CALL(UI::Helpers_Func::InitializeBasicMap)(); diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp index 9f1a7b4978..7dd2fb847b 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -24,31 +24,31 @@ namespace UI { if (*currentValue < 0) { *currentValue = 0; } - DAT_MapPropertiesState::instance.field47_0x1355c = *currentValue; + DAT_MapPropertiesState::instance.eventListScrollOffset = *currentValue; return; case 4: - *currentValue = DAT_MapPropertiesState::instance.field47_0x1355c; + *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; *maxValue = DAT_MapPropertiesState::instance.eventsCount + -0x14; return; case 5: - if (0 < (int)DAT_MapPropertiesState::instance.field47_0x1355c) { - DAT_MapPropertiesState::instance.field47_0x1355c - = DAT_MapPropertiesState::instance.field47_0x1355c + -1; - *currentValue = DAT_MapPropertiesState::instance.field47_0x1355c; + if (0 < (int)DAT_MapPropertiesState::instance.eventListScrollOffset) { + DAT_MapPropertiesState::instance.eventListScrollOffset + = DAT_MapPropertiesState::instance.eventListScrollOffset + -1; + *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; return; } break; case 6: - if ((int)DAT_MapPropertiesState::instance.field47_0x1355c + if ((int)DAT_MapPropertiesState::instance.eventListScrollOffset < DAT_MapPropertiesState::instance.eventsCount + -0x14) { - DAT_MapPropertiesState::instance.field47_0x1355c - = DAT_MapPropertiesState::instance.field47_0x1355c + 1; + DAT_MapPropertiesState::instance.eventListScrollOffset + = DAT_MapPropertiesState::instance.eventListScrollOffset + 1; } break; default: return; } - *currentValue = DAT_MapPropertiesState::instance.field47_0x1355c; + *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; } } diff --git a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp index 2a791aff33..4a4b17cc6b 100644 --- a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp @@ -35,19 +35,19 @@ namespace UI { case 1: *minValue = 0x14; *maxValue = 0x5a; - *currentValue = DAT_MenuTextInputState::instance.field12_0x30; + *currentValue = DAT_MenuTextInputState::instance.pendingGameSpeedLevel; return; case 2: case 3: - DAT_MenuTextInputState::instance.field12_0x30 = *currentValue; + DAT_MenuTextInputState::instance.pendingGameSpeedLevel = *currentValue; return; case 5: *currentValue = *currentValue + -1; - DAT_MenuTextInputState::instance.field12_0x30 = *currentValue; + DAT_MenuTextInputState::instance.pendingGameSpeedLevel = *currentValue; return; case 6: *currentValue = *currentValue + 1; - DAT_MenuTextInputState::instance.field12_0x30 = *currentValue; + DAT_MenuTextInputState::instance.pendingGameSpeedLevel = *currentValue; } } From fbc704639002a4ed60d5fd1cb3e8a17cad49d793 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:00:46 +0100 Subject: [PATCH 35/46] 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 --- ...dler_BuildMenu_CurrentlySelectedTroops.cpp | 4 ++-- ...rFunction_BuildMenu_MiniMapInteraction.cpp | 6 +---- ...er_BuildingAndStatusMenu_ChangeRations.cpp | 6 ++--- ...ldingAndStatusMenu_DrawbridgeOpenClose.cpp | 2 +- ...ildingAndStatusMenu_GatehouseOpenClose.cpp | 7 +++--- ...ildingAndStatusMenu_OutpostSliderDelay.cpp | 2 +- ...uildingAndStatusMenu_OutpostSliderSize.cpp | 2 +- ...ildingAndStatusMenu_SelectBuySellGoods.cpp | 3 +-- ...uildingAndStatusMenu_StatusMenuButtons.cpp | 4 +--- ...andler_BuildingAndStatusMenu_TaxSlider.cpp | 4 ++-- ...gAndStatusMenu_WorkshopWeaponSelection.cpp | 2 +- ...BuildingAndStatusMenu_ArmyStatusReturn.cpp | 3 --- ..._BuildingAndStatusMenu_DisableFoodType.cpp | 9 ++------ ...BuildingAndStatusMenu_HorizontalSlider.cpp | 11 ++++------ ...ingAndStatusMenu_StatusMainMenuButtons.cpp | 6 ++--- ..._BuildingAndStatusMenu_TaxArrowButtons.cpp | 7 +----- ...nuItemRenderFunction_Chat_TauntButtons.cpp | 12 ++++------ ...tworkServiceProvider_ModemScrollbarUnk.cpp | 4 ++-- ...rkServiceProvider_ProviderScrollbarUnk.cpp | 6 ++--- ...tworkServiceProvider_ProviderTableRows.cpp | 2 -- ...eNetworkServiceProvider_ModemTableRows.cpp | 5 +---- ...temActionHandler_CrusadeEndscreen_Main.cpp | 1 - ...ItemActionHandler_CustomScenarios_Main.cpp | 8 ++----- ...nuItemActionHandler_DisableWeapon_Main.cpp | 7 ++---- ...ActionHandler_EditScenario_DateYearBox.cpp | 22 ++++++------------- ...emActionHandler_EditScenario_Scrollbar.cpp | 8 +++---- ...ction_FindingNetworkSessions_TableRows.cpp | 6 +---- ...ionHandler_GameplayOptions_SpeedSlider.cpp | 14 +++++------- ...ActionHandler_General_MessageScrollbar.cpp | 4 ++-- ...ActionHandler_General_TextInputDisplay.cpp | 15 ++++--------- ...unction_General_MessageScrollbarUpDown.cpp | 2 -- ...nuItemRenderFunction_General_Scrollbar.cpp | 2 -- ...enuItemActionHandler_GreatestLord_Main.cpp | 11 ++++------ 33 files changed, 67 insertions(+), 140 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp index 9fcca56b9b..0246b8b6cd 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -23,7 +23,7 @@ namespace UI { UnitTypeInt unitType; int _unitType; DAT_UnitsState::instance.unitControlsRelated = 1; - if (slotID < 0x14) { + if (slotID < 20) { _unitType = DAT_RenderingDefinedData::instance .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID]]; MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueClickNavigateMenuOrEscape, @@ -34,7 +34,7 @@ namespace UI { return; } unitType = DAT_RenderingDefinedData::instance - .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID + -0x14]]; + .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID - 20]]; MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueUnitTypeCommand, DAT_UnitsState::ptr)( unitType); MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionExcludeUnitType, diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp index aef3ae39b4..64eff61486 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp @@ -13,14 +13,10 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::UI::Enums::BuildMenuTabType; - using OpenSHC::UI::Enums::MenuViewType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x00434300 void BuildMenu::MenuItemRenderFunction_BuildMenu_MiniMapInteraction(int param_1, ...) { - if (DAT_ButtonCurrentlyInteracting::instance != FALSE + if (DAT_ButtonCurrentlyInteracting::instance && DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU && (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_SOLDIERS || (DAT_TileMapState::instance.shiftRelated0or3 == 1))) { diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp index 893bb3d170..3a21ea52b9 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp @@ -16,8 +16,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Commands::GameCommandType; - using OpenSHC::Game::GameMode2; using OpenSHC::Map::Buildings::BuildingType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; @@ -35,12 +33,12 @@ namespace UI { { if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) { BOOLEnum BVar1 = MACRO_CALL(OpenSHC::Game_Func::Tutorial_IsActionAllowed)(3, param_1); - if (BVar1 == FALSE) { + if (!BVar1) { MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialHintActiveWithTimestamp)(); return; } MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialBuildingActionState)( - 0xc, (BuildingType)((int)(param_1))); + 12, (BuildingType)((int)(param_1))); } DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp index 8fe4df7762..de51610480 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp @@ -22,7 +22,7 @@ namespace UI { DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( - ((GameCommandType)0x25)); + ((GameCommandType)37)); DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .gateOpenOrCloseClick = param_1; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp index 9a432b8286..56e4005df3 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp @@ -15,7 +15,6 @@ namespace UI { namespace MenuItems { using OpenSHC::Audio::SFX::SoundEffectID; - using OpenSHC::Commands::GameCommandType; // FUNCTION: STRONGHOLDCRUSADER 0x00465480 void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose(int param_1, ...) @@ -31,11 +30,11 @@ namespace UI { .openOrCloseGateClick = param_1; if (param_1 == 10) { MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - (OpenSHC::Audio::SFX::SoundEffectID)0x8c); + (OpenSHC::Audio::SFX::SoundEffectID)140); } - if (param_1 == 0xb) { + if (param_1 == 11) { MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - (OpenSHC::Audio::SFX::SoundEffectID)0x8e); + (OpenSHC::Audio::SFX::SoundEffectID)142); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp index 933bb53a19..140a13451c 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp @@ -36,7 +36,7 @@ namespace UI { psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk3; if (0 < sVar2) { - *psVar1 = sVar2 + -1; + *psVar1 = sVar2 - 1; } *currentValue = (int)*psVar1; return; diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp index 4406b26378..3c91e4561d 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp @@ -36,7 +36,7 @@ namespace UI { psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; if (0 < sVar2) { - *psVar1 = sVar2 + -1; + *psVar1 = sVar2 - 1; } *currentValue = (int)*psVar1; return; diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp index 1b0576a69f..19a3ba9e11 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp @@ -13,7 +13,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuViewType; using WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x004659E0 @@ -24,7 +23,7 @@ namespace UI { if (BVar1) { DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .marketSelectedResourceType = param_1; - DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = 0x39; + DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = 57; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp index 8bbfd40033..11dca7ec32 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp @@ -13,14 +13,12 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Game::GameMode2; using Map::Buildings::BuildingType; - using UI::Enums::MenuViewType; // FUNCTION: STRONGHOLDCRUSADER 0x0043E490 void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons(int param_1, ...) { - if (param_1 == 0x47 && DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo == 0x4b + if (param_1 == 71 && DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo == 75 && INT_00b96120::instance == 4) { param_1 = Map::Buildings::BT_OXTETHER; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp index 24e5de845f..02c9ee7f2c 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp @@ -33,7 +33,7 @@ namespace UI { piVar1 = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .taxesSliderUI; if (0 < iVar2) { - *piVar1 = iVar2 + -1; + *piVar1 = iVar2 - 1; } *currentValue = *piVar1; return; @@ -42,7 +42,7 @@ namespace UI { .taxesSliderUI; piVar1 = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .taxesSliderUI; - if (iVar2 < 0xb) { + if (iVar2 < 11) { *piVar1 = iVar2 + 1; } *currentValue = *piVar1; diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp index 4fe80e7785..47ea8af598 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp @@ -51,7 +51,7 @@ namespace UI { DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( - ((GameCommandType)0x21)); + ((GameCommandType)33)); DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID].weaponRelated = weapon; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp index 5175f197c0..e7fb9adb93 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp @@ -20,9 +20,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Game::GameMode2; - using OpenSHC::Map::MapType2; - using OpenSHC::UI::Enums::DisplayElementID; using OpenSHC::WindowsHelper::Enums::BOOLEnum; /* diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp index 74579581dc..1724496b6e 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp @@ -18,11 +18,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Game::GameMode; - using OpenSHC::IO::Graphics::GmID; - using OpenSHC::Rendering::Enums::RenderTarget; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x0043FBF0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType(int foodType, ...) { @@ -42,8 +37,8 @@ namespace UI { _yOffset = 0; } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 0x2d, - DAT_ButtonX::instance + -4 + _xOffset, DAT_ButtonY::instance + -0x2d + _yOffset, 6); + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 45, + DAT_ButtonX::instance - 4 + _xOffset, DAT_ButtonY::instance - 45 + _yOffset, 6); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp index 30913a8bc5..be31064474 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp @@ -13,9 +13,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::DE::SHCDE::eGM; - using OpenSHC::Rendering::Enums::RenderTarget; - /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ @@ -28,14 +25,14 @@ namespace UI { if (0 < (int)DAT_ButtonW::instance) { do { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x119, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 281, DAT_ButtonX::instance + iVar1, (int)(DAT_ButtonY::instance)); - iVar1 = iVar1 + 0x1a; + iVar1 += 26; } while (iVar1 < (int)DAT_ButtonW::instance); } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x118, - DAT_ButtonX::instance + thumbYPos, (int)(DAT_ButtonY::instance + -5)); + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 280, + DAT_ButtonX::instance + thumbYPos, (int)(DAT_ButtonY::instance - 5)); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp index 680c4af7c2..b5ca5b5493 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp @@ -18,10 +18,8 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::DE::SHCDE::eTextSections; using OpenSHC::Rendering::Colors::BGR24; using OpenSHC::Text::TextAlignment; - using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; /* @@ -42,14 +40,14 @@ namespace UI { MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); blendStrength = 0; keepOffsetX = FALSE; - fontSize = 0x13; + fontSize = 19; color = 0; int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; alignment = OpenSHC::Text::TTA_CENTER; yParam = DAT_ButtonY::instance + 10; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, param_1 + -0x47), + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, param_1 - 71), xParam, yParam, alignment, color, fontSize, keepOffsetX, blendStrength); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp index 84c2685d81..11e518fafc 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp @@ -16,11 +16,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::DE::SHCDE::eTextSections; - using OpenSHC::Rendering::Colors::BGR24; - using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004657B0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons(int param_1, ...) { @@ -34,7 +29,7 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_IN_KEEP, param_1), - xParam, yParam, OpenSHC::Text::TTA_CENTER, 0, 0x11, FALSE, 0); + xParam, yParam, OpenSHC::Text::TTA_CENTER, 0, 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp index d8b01e9116..6666dc231a 100644 --- a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp @@ -17,10 +17,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names */ @@ -37,14 +33,14 @@ namespace UI { AlphaAndButtonSurfaceObj::ptr)(0, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); if (param_1 < 10) { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( - param_1, DAT_ButtonX::instance + 0xc, (int)((int)(DAT_ButtonY::instance + 9)), - OpenSHC::Text::TTA_LEFT, 0xccfaff, 0x13, FALSE, 0); + param_1, DAT_ButtonX::instance + 12, (int)((int)(DAT_ButtonY::instance + 9)), + OpenSHC::Text::TTA_LEFT, 0xccfaff, 19, FALSE, 0); } else { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( param_1, DAT_ButtonX::instance + 9, (int)((int)(DAT_ButtonY::instance + 9)), - OpenSHC::Text::TTA_LEFT, 0xccfaff, 0x13, FALSE, 0); + OpenSHC::Text::TTA_LEFT, 0xccfaff, 19, FALSE, 0); } - if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + if (DAT_ButtonCurrentlyInteracting::instance) { DAT_GameSynchronyState::instance.DAT_InsultTextIndex = param_1; } } diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp index d197b0d54c..ccfe6b0d1a 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp @@ -13,7 +13,7 @@ namespace UI { switch (param_2) { case 1: *minValue = 0; - *maxValue = DAT_GameSynchronyState::instance.modemScrollbarCount + -4; + *maxValue = DAT_GameSynchronyState::instance.modemScrollbarCount - 4; *currentValue = DAT_GameSynchronyState::instance.modemScrollBarOffset; return; case 2: @@ -22,7 +22,7 @@ namespace UI { return; case 4: *currentValue = DAT_GameSynchronyState::instance.modemScrollBarOffset; - *maxValue = DAT_GameSynchronyState::instance.modemScrollbarCount + -4; + *maxValue = DAT_GameSynchronyState::instance.modemScrollbarCount - 4; } } diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp index 606d8af15a..cf0b79e20d 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp @@ -22,7 +22,7 @@ namespace UI { switch (param_2) { case 1: *minValue = 0; - *maxValue = DAT_GameSynchronyState::instance.scrollBarItemCount + -4; + *maxValue = DAT_GameSynchronyState::instance.scrollBarItemCount - 4; *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; return; case 2: @@ -35,14 +35,14 @@ namespace UI { case 5: if (0 < DAT_GameSynchronyState::instance.scrollBarItemOffset) { DAT_GameSynchronyState::instance.scrollBarItemOffset - = DAT_GameSynchronyState::instance.scrollBarItemOffset + -1; + = DAT_GameSynchronyState::instance.scrollBarItemOffset - 1; *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; return; } break; case 6: if (DAT_GameSynchronyState::instance.scrollBarItemOffset - < DAT_GameSynchronyState::instance.scrollBarItemCount + -4) { + < DAT_GameSynchronyState::instance.scrollBarItemCount - 4) { DAT_GameSynchronyState::instance.scrollBarItemOffset = DAT_GameSynchronyState::instance.scrollBarItemOffset + 1; } diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp index 6bb12d631d..5aec5c8e33 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp @@ -12,8 +12,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; - /* WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names */ diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp index 514ca734d6..abc6cabb7f 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -20,9 +20,6 @@ namespace UI { namespace MenuItems { using OpenSHC::Rendering::Colors::BGR24; - using OpenSHC::Rendering::Enums::RenderTarget; - using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x0047D100 void ChooseNetworkServiceProvider::MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows( @@ -44,7 +41,7 @@ namespace UI { DAT_GameSynchronyState::instance .stringPointerArray[DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1], (int)((int)(DAT_ButtonX::instance + 8)), (int)((int)(DAT_ButtonY::instance + 4)), - OpenSHC::Text::TTA_LEFT, color, 0x12, FALSE, 0); + OpenSHC::Text::TTA_LEFT, color, 18, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp b/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp index 9cd4c38f3d..8f39831a4c 100644 --- a/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp @@ -10,7 +10,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Game::TrailType; using Game::TrailTypeInt; // FUNCTION: STRONGHOLDCRUSADER 0x004D9230 diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index 61ee74f4b2..1db087ba43 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -19,10 +19,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Game::GameMode2; - using UI::Enums::BuildingsAndStatusMenuTabType; - using UI::Enums::MenuViewType; - // FUNCTION: STRONGHOLDCRUSADER 0x00440770 void CustomScenarios::MenuItemActionHandler_CustomScenarios_Main(int param_1, ...) { @@ -30,8 +26,8 @@ namespace UI { case 1: DAT_MenuTextInputState::instance.dialogResult = 0; DAT_MenuTextInputState::instance.field_0x9c = 1; - MACRO_CALL_MEMBER( - UI::MenuTextInputState_Func::activateLoadOrSaveMapUI, DAT_MenuTextInputState::ptr)(UI::Enums::MMT_LOAD_MAP); + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::activateLoadOrSaveMapUI, DAT_MenuTextInputState::ptr)( + UI::Enums::MMT_LOAD_MAP); return; case 2: MACRO_CALL(UI::Helpers_Func::InitializeBasicMap)(); diff --git a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp index a09bd985d9..039444bb2c 100644 --- a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp @@ -11,9 +11,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuModalType; - using WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004BB740 void DisableWeapon::MenuItemActionHandler_DisableWeapon_Main(int param_1, ...) { @@ -42,8 +39,8 @@ namespace UI { = DAT_MapPropertiesState::instance.SEC_MaceProducible_save ^ 1; } if (param_1 == -3) { - MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, - DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); } } diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp index a6ac35ccdc..5defd4ca78 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp @@ -9,8 +9,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Text::TextArrayIndexType; - // FUNCTION: STRONGHOLDCRUSADER 0x004B8990 void EditScenario::MenuItemActionHandler_EditScenario_DateYearBox(int param_1, ...) { @@ -18,44 +16,38 @@ namespace UI { case 0: if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_SEVEN__NUMERIC_ONLY)) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); } break; case 1: if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_TWO__FILTER_A)) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(10); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(10); } break; case 2: if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_THREE__FILTER_A)) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xb); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(11); } break; case 3: case 4: case 7: - if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TextArrayIndexTypeInt)0xc) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xc); + if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TextArrayIndexTypeInt)12) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(12); } break; case 5: if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_FIVE__NUMERIC_DOT)) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xd); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(13); } break; case 6: if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_SIX__NUMERIC_ONLY)) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xe); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(14); } } } diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp index 7dd2fb847b..e4d018e108 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -16,7 +16,7 @@ namespace UI { switch (param_2) { case 1: *minValue = 0; - *maxValue = DAT_MapPropertiesState::instance.eventsCount + -0x14; + *maxValue = DAT_MapPropertiesState::instance.eventsCount - 20; *currentValue = 0; return; case 2: @@ -28,19 +28,19 @@ namespace UI { return; case 4: *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; - *maxValue = DAT_MapPropertiesState::instance.eventsCount + -0x14; + *maxValue = DAT_MapPropertiesState::instance.eventsCount - 20; return; case 5: if (0 < (int)DAT_MapPropertiesState::instance.eventListScrollOffset) { DAT_MapPropertiesState::instance.eventListScrollOffset - = DAT_MapPropertiesState::instance.eventListScrollOffset + -1; + = DAT_MapPropertiesState::instance.eventListScrollOffset - 1; *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; return; } break; case 6: if ((int)DAT_MapPropertiesState::instance.eventListScrollOffset - < DAT_MapPropertiesState::instance.eventsCount + -0x14) { + < DAT_MapPropertiesState::instance.eventsCount - 20) { DAT_MapPropertiesState::instance.eventListScrollOffset = DAT_MapPropertiesState::instance.eventListScrollOffset + 1; } diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp index b5a40b6918..5431fc51a6 100644 --- a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp @@ -18,10 +18,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x0047D410 void FindingNetworkSessions::MenuItemRenderFunction_FindingNetworkSessions_TableRows(int param_1, ...) { @@ -41,7 +37,7 @@ namespace UI { DAT_GameSynchronyState::instance .DPLAY_SessionNames[DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1], (int)((int)(DAT_ButtonX::instance + 8)), (int)((int)(DAT_ButtonY::instance + 4)), - OpenSHC::Text::TTA_LEFT, color, 0x12, 0, 0); + OpenSHC::Text::TTA_LEFT, color, 18, 0, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp index 4a4b17cc6b..adf2edc2b2 100644 --- a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp @@ -9,8 +9,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Game::GameMode; - /* WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names */ @@ -26,15 +24,15 @@ namespace UI { { if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) && (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { - *minValue = 0x14; - *maxValue = 0x5a; + *minValue = 20; + *maxValue = 90; *currentValue = DAT_GameSynchronyState::instance.skirmishGameSpeedLevel; return; } switch (param_2) { case 1: - *minValue = 0x14; - *maxValue = 0x5a; + *minValue = 20; + *maxValue = 90; *currentValue = DAT_MenuTextInputState::instance.pendingGameSpeedLevel; return; case 2: @@ -42,11 +40,11 @@ namespace UI { DAT_MenuTextInputState::instance.pendingGameSpeedLevel = *currentValue; return; case 5: - *currentValue = *currentValue + -1; + --*currentValue; DAT_MenuTextInputState::instance.pendingGameSpeedLevel = *currentValue; return; case 6: - *currentValue = *currentValue + 1; + ++*currentValue; DAT_MenuTextInputState::instance.pendingGameSpeedLevel = *currentValue; } } diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp index 8e27f57cca..4690bb717d 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp @@ -29,7 +29,7 @@ namespace UI { return; case 5: if (0 < (int)DAT_MapPropertiesState::instance.offset) { - DAT_MapPropertiesState::instance.offset = DAT_MapPropertiesState::instance.offset + -1; + --DAT_MapPropertiesState::instance.offset; *currentValue = DAT_MapPropertiesState::instance.offset; return; } @@ -37,7 +37,7 @@ namespace UI { case 6: if ((int)DAT_MapPropertiesState::instance.offset < (int)DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount) { - DAT_MapPropertiesState::instance.offset = DAT_MapPropertiesState::instance.offset + 1; + ++DAT_MapPropertiesState::instance.offset; } break; default: diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp index fca76519a7..b813b43c5a 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp @@ -11,36 +11,29 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using Text::TextArrayIndexType; - using WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x0047CC10 void General::MenuItemActionHandler_General_TextInputDisplay(int param_1, ...) { switch (param_1) { case 0: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_FIVE__NUMERIC_DOT) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); } break; case 1: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_SIX__NUMERIC_ONLY) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(6); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(6); } break; case 2: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_SEVEN__NUMERIC_ONLY) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(7); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(7); } break; case 3: if ((DAT_GameCore::instance.isNameEntryActive != TRUE) && (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_ZERO)) { - MACRO_CALL_MEMBER( - Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0); } } } diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp index fc10b708cd..c9198e936e 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp @@ -10,8 +10,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - // FUNCTION: STRONGHOLDCRUSADER 0x004BAE80 void General::MenuItemRenderFunction_General_MessageScrollbarUpDown(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp index fa600743de..687f33ed34 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp @@ -13,8 +13,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Enums::RenderTarget; - // FUNCTION: STRONGHOLDCRUSADER 0x004BAE30 void General::MenuItemRenderFunction_General_Scrollbar( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) diff --git a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp index 08c8e9586e..4042783d28 100644 --- a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp @@ -11,23 +11,20 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using UI::Enums::MenuModalType; - using WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004B1990 void GreatestLord::MenuItemActionHandler_GreatestLord_Main(int param_1, ...) { if ((param_1 == 1) || (param_1 == 100)) { - MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, - DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_NONE, FALSE); } if (param_1 == 10) { DAT_GreatestLordDefinedData::instance.tableSortBy = -1; } - if (param_1 == 0xb) { + if (param_1 == 11) { DAT_GreatestLordDefinedData::instance.tableSortBy = 1; } - if (param_1 == 0xc) { + if (param_1 == 12) { DAT_GreatestLordDefinedData::instance.tableSortBy = 0; } } From 1398d9026579d5238cec3cd5c96f55d3e8850a8c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:06:14 +0100 Subject: [PATCH 36/46] style: no imported plate comments tools/reimplementation-helper/batch/strip_noise_comments.py drops the decompiler's block comments above each // FUNCTION: line (the WARNING: Enum and decompilerscript plates). 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 --- ...emActionHandler_BuildMenu_CurrentlySelectedTroops.cpp | 6 ------ ...ActionHandler_BuildingAndStatusMenu_ChangeRations.cpp | 9 --------- ...erFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp | 9 --------- ...erFunction_BuildingAndStatusMenu_HorizontalSlider.cpp | 3 --- ...ction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp | 3 --- .../Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp | 9 --------- ...ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp | 9 --------- ...er_ChooseNetworkServiceProvider_ProviderTableRows.cpp | 9 --------- .../MenuItemActionHandler_EditScenario_Scrollbar.cpp | 3 --- ...MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp | 9 --------- .../MenuItemActionHandler_General_MessageScrollbar.cpp | 3 --- 11 files changed, 72 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp index 0246b8b6cd..3627af74e2 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -11,12 +11,6 @@ namespace UI { namespace MenuItems { using OpenSHC::Map::Units::UnitTypeInt; - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004393C0 void BuildMenu::MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops(int slotID, ...) { diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp index 3a21ea52b9..4ff08dc2fb 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp @@ -19,15 +19,6 @@ namespace UI { using OpenSHC::Map::Buildings::BuildingType; 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 0x00465820 void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp index e7fb9adb93..571b4c7bc1 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp @@ -22,15 +22,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 0x0043FCB0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp index be31064474..a0afd5b06f 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp @@ -13,9 +13,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x00465630 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOL isDragged) diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp index b5ca5b5493..ac26279a85 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp @@ -22,9 +22,6 @@ namespace UI { using OpenSHC::Text::TextAlignment; using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x0043E4E0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp index 6666dc231a..845bef21e8 100644 --- a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp @@ -17,15 +17,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 0x0047FFE0 void Chat::MenuItemRenderFunction_Chat_TauntButtons(int param_1, ...) { diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp index cf0b79e20d..18b97c6092 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp @@ -6,15 +6,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 0x0047CA80 void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp index 5aec5c8e33..e712a87aa6 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.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 0x00487200 void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows( int param_1, ...) diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp index e4d018e108..3b7ec072ea 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -6,9 +6,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004B8A50 void EditScenario::MenuItemActionHandler_EditScenario_Scrollbar( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) diff --git a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp index adf2edc2b2..728954f900 100644 --- a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp @@ -9,15 +9,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 0x00491FD0 void GameplayOptions::MenuItemActionHandler_GameplayOptions_SpeedSlider( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp index 4690bb717d..6c18921ccd 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp @@ -6,9 +6,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ // FUNCTION: STRONGHOLDCRUSADER 0x004BAD70 void General::MenuItemActionHandler_General_MessageScrollbar( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) From 5df90c61d738ecef2804e6a2a8e2fce4a21d3003 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:18:02 +0100 Subject: [PATCH 37/46] style: names for the decompiler's locals, // comments, colours by name, loops The rest of the checker's ERRORs on the batch, file by file: the decompiler's iVar / sVar / psVar / piVar / BVar locals get names that say what they hold and are declared where first assigned; the block comment in ProviderTableRows becomes // lines; text colours are written by their ColorsEnum names (COL_CCFAFF, COL_C2F0EB); ArmyStatusReturn's BOOLEnum stores are TRUE / FALSE; the nine copies of one statement in CustomScenarios_Main and HorizontalSlider'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 CustomScenarios_Main's listing, whose loops add labels (its .text and .rdata compare identical). Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- ...dler_BuildMenu_CurrentlySelectedTroops.cpp | 16 ++--- ...ildingAndStatusMenu_OutpostSliderDelay.cpp | 45 +++++++------ ...uildingAndStatusMenu_OutpostSliderSize.cpp | 45 +++++++------ ...andler_BuildingAndStatusMenu_TaxSlider.cpp | 40 ++++++----- ...BuildingAndStatusMenu_ArmyStatusReturn.cpp | 26 +++----- ...BuildingAndStatusMenu_HorizontalSlider.cpp | 12 ++-- ...ingAndStatusMenu_StatusMainMenuButtons.cpp | 19 ++---- ..._BuildingAndStatusMenu_TaxArrowButtons.cpp | 4 +- ...nuItemRenderFunction_Chat_TauntButtons.cpp | 5 +- ...tworkServiceProvider_ProviderTableRows.cpp | 6 +- ...eNetworkServiceProvider_ModemTableRows.cpp | 5 +- ...ItemActionHandler_CustomScenarios_Main.cpp | 66 ++++--------------- ...ction_FindingNetworkSessions_TableRows.cpp | 5 +- 13 files changed, 122 insertions(+), 172 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp index 3627af74e2..1189e2f8d6 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -14,21 +14,21 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004393C0 void BuildMenu::MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops(int slotID, ...) { - UnitTypeInt unitType; - int _unitType; DAT_UnitsState::instance.unitControlsRelated = 1; if (slotID < 20) { - _unitType = DAT_RenderingDefinedData::instance - .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID]]; + UnitTypeInt const unitType + = DAT_RenderingDefinedData::instance + .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID]]; MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueClickNavigateMenuOrEscape, - DAT_UnitsState::ptr)(_unitType); + DAT_UnitsState::ptr)(unitType); MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionForUnitType, - DAT_UnitsState::ptr)(_unitType); + DAT_UnitsState::ptr)(unitType); MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::recountUnitsInSelection, DAT_UnitsState::ptr)(); return; } - unitType = DAT_RenderingDefinedData::instance - .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID - 20]]; + UnitTypeInt const unitType + = DAT_RenderingDefinedData::instance + .SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID - 20]]; MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueUnitTypeCommand, DAT_UnitsState::ptr)( unitType); MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionExcludeUnitType, diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp index 140a13451c..0e3ec8301f 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp @@ -10,15 +10,12 @@ namespace UI { void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) { - short* psVar1; - short sVar2; - int _selectedBuildingID; - _selectedBuildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; + int const selectedBuildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; switch (param_2) { case 1: *minValue = 0; *maxValue = 24000; - *currentValue = (int)DAT_BuildingsState::instance.buildings[_selectedBuildingID].outpostRelatedUnk3; + *currentValue = (int)DAT_BuildingsState::instance.buildings[selectedBuildingID].outpostRelatedUnk3; return; case 2: case 3: @@ -30,25 +27,31 @@ namespace UI { = (int)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk3; return; - case 5: - sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk3; - psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk3; - if (0 < sVar2) { - *psVar1 = sVar2 - 1; + case 5: { + short const delay + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + short* const delayField + = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + if (0 < delay) { + *delayField = delay - 1; } - *currentValue = (int)*psVar1; + *currentValue = (int)*delayField; return; - case 6: - sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk3; - psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk3; - if (sVar2 < 24000) { - *psVar1 = sVar2 + 1; + } + case 6: { + short const delay + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + short* const delayField + = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk3; + if (delay < 24000) { + *delayField = delay + 1; } - *currentValue = (int)*psVar1; + *currentValue = (int)*delayField; + } } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp index 3c91e4561d..df14f4612a 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp @@ -10,15 +10,12 @@ namespace UI { void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) { - short* psVar1; - short sVar2; - int iVar3; - iVar3 = DAT_BuildingsState::instance.menuSelectedBuildingID; + int const buildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; switch (param_2) { case 1: *minValue = 0; *maxValue = 5; - *currentValue = (int)DAT_BuildingsState::instance.buildings[iVar3].outpostRelatedUnk2; + *currentValue = (int)DAT_BuildingsState::instance.buildings[buildingID].outpostRelatedUnk2; return; case 2: case 3: @@ -30,25 +27,31 @@ namespace UI { = (int)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; return; - case 5: - sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk2; - psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk2; - if (0 < sVar2) { - *psVar1 = sVar2 - 1; + case 5: { + short const oldSize + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + short* const sizeField + = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + if (0 < oldSize) { + *sizeField = oldSize - 1; } - *currentValue = (int)*psVar1; + *currentValue = (int)*sizeField; return; - case 6: - sVar2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk2; - psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk2; - if (sVar2 < 5) { - *psVar1 = sVar2 + 1; + } + case 6: { + short const oldSize + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + short* const sizeField + = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk2; + if (oldSize < 5) { + *sizeField = oldSize + 1; } - *currentValue = (int)*psVar1; + *currentValue = (int)*sizeField; + } } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp index 02c9ee7f2c..c42e47576a 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp @@ -11,8 +11,6 @@ namespace UI { void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider( int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) { - int* piVar1; - int iVar2; switch (param_2) { case 1: *minValue = 0; @@ -27,26 +25,32 @@ namespace UI { DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .taxesSliderUI = *currentValue; return; - case 5: - iVar2 = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .taxesSliderUI; - piVar1 = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .taxesSliderUI; - if (0 < iVar2) { - *piVar1 = iVar2 - 1; + case 5: { + int const taxesSliderValue + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + int* const taxesSlider + = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + if (0 < taxesSliderValue) { + *taxesSlider = taxesSliderValue - 1; } - *currentValue = *piVar1; + *currentValue = *taxesSlider; return; - case 6: - iVar2 = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .taxesSliderUI; - piVar1 = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .taxesSliderUI; - if (iVar2 < 11) { - *piVar1 = iVar2 + 1; + } + case 6: { + int const taxesSliderValue + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + int* const taxesSlider + = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + if (taxesSliderValue < 11) { + *taxesSlider = taxesSliderValue + 1; } - *currentValue = *piVar1; + *currentValue = *taxesSlider; break; + } default: break; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp index 571b4c7bc1..f20d854eae 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp @@ -7,7 +7,6 @@ #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/Map/MapType2.hpp" #include "OpenSHC/UI/Enums/DisplayElementID.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -20,33 +19,28 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x0043FCB0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn(int param_1, ...) { - int iVar1; - BOOLEnum BVar2; if (((((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk) || (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL)) && (DAT_GameSynchronyState::instance.currentPlayerSlotID == 2)) || ((((DAT_GameSynchronyState::instance.currentPlayerSlotID == 1 - && (iVar1 = MACRO_CALL_MEMBER( + && (MACRO_CALL_MEMBER( OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, - DAT_GameState::ptr)(), - iVar1 == 0)) - && (iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getArmySize, - DAT_UnitsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID), - iVar1 != 0)) + DAT_GameState::ptr)() + == 0)) + && (MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getArmySize, + DAT_UnitsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID) + != 0)) || ((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk && (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == OpenSHC::Map::MT_SIEGE)))))) - && (BVar2 = MACRO_CALL(OpenSHC::UI::DisplayElements_Func::GetIfDisplayElementStateNotZero)( - OpenSHC::UI::Enums::DEID_KEEP_AND_GRANERY_PLACEMENT_INFO), - BVar2 == FALSE)) { - DAT_ButtonUnknownZero::instance = 1; + && !MACRO_CALL(OpenSHC::UI::DisplayElements_Func::GetIfDisplayElementStateNotZero)( + OpenSHC::UI::Enums::DEID_KEEP_AND_GRANERY_PLACEMENT_INFO)) { + 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/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp index a0afd5b06f..509b6d0d39 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp @@ -17,15 +17,11 @@ namespace UI { void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider( int param_1, int thumbYPos, int param_3, int thumbHeight, BOOL isDragged) { - int iVar1 = 0; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - if (0 < (int)DAT_ButtonW::instance) { - do { - MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, - DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 281, - DAT_ButtonX::instance + iVar1, (int)(DAT_ButtonY::instance)); - iVar1 += 26; - } while (iVar1 < (int)DAT_ButtonW::instance); + for (int trackOffset = 0; trackOffset < (int)DAT_ButtonW::instance; trackOffset += 26) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 281, + DAT_ButtonX::instance + trackOffset, (int)(DAT_ButtonY::instance)); } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 280, diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp index ac26279a85..17f08960c5 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp @@ -25,23 +25,16 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0043E4E0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons(int param_1, ...) { - char* textAddress; - int yParam; - TextAlignment alignment; - BGR24 color; - int fontSize; - BOOLEnum keepOffsetX; - int blendStrength; if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) { MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - blendStrength = 0; - keepOffsetX = FALSE; - fontSize = 19; - color = 0; + int blendStrength = 0; + BOOLEnum keepOffsetX = FALSE; + int fontSize = 19; + BGR24 color = 0; int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; - alignment = OpenSHC::Text::TTA_CENTER; - yParam = DAT_ButtonY::instance + 10; + TextAlignment alignment = OpenSHC::Text::TTA_CENTER; + int yParam = DAT_ButtonY::instance + 10; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, param_1 - 71), diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp index 11e518fafc..90ee213322 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp @@ -19,12 +19,10 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004657B0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons(int param_1, ...) { - char* textAddress; - int yParam; MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); if (0 <= param_1) { - yParam = DAT_ButtonY::instance + 4; + int yParam = DAT_ButtonY::instance + 4; int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, diff --git a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp index 845bef21e8..5835196ef6 100644 --- a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp @@ -2,6 +2,7 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -25,11 +26,11 @@ namespace UI { if (param_1 < 10) { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( param_1, DAT_ButtonX::instance + 12, (int)((int)(DAT_ButtonY::instance + 9)), - OpenSHC::Text::TTA_LEFT, 0xccfaff, 19, FALSE, 0); + OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_CCFAFF, 19, FALSE, 0); } else { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( param_1, DAT_ButtonX::instance + 9, (int)((int)(DAT_ButtonY::instance + 9)), - OpenSHC::Text::TTA_LEFT, 0xccfaff, 19, FALSE, 0); + OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_CCFAFF, 19, FALSE, 0); } if (DAT_ButtonCurrentlyInteracting::instance) { DAT_GameSynchronyState::instance.DAT_InsultTextIndex = param_1; diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp index e712a87aa6..83be745afa 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp @@ -21,10 +21,8 @@ namespace UI { DAT_GameSynchronyState::instance.selectedProviderIndex = param_1; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::setMenuTypeBasedOnDirectPlayGUID, DAT_GameSynchronyState::ptr)(); - /* - the original dispatches with a `sub eax, K; je` chain (0x487228), MSVC's - sparse switch, and the TCPIP arm sits first - */ + // the original dispatches with a `sub eax, K; je` chain (0x487228), MSVC's + // sparse switch, and the TCPIP arm sits first switch (DAT_GameCore::instance.activeMenuTab.tabType) { case OpenSHC::UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP: MACRO_CALL_MEMBER( diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp index abc6cabb7f..bf9639b63f 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -3,6 +3,7 @@ #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/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -34,8 +35,8 @@ namespace UI { if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 < DAT_GameSynchronyState::instance.modemScrollbarCount) { if ((param_1 == DAT_GameSynchronyState::instance.modemScrollbarIndex) - || (color = 0xc2f0eb, DAT_ButtonCurrentlyInteracting::instance)) { - color = 0xccfaff; + || (color = OpenSHC::Rendering::Colors::COL_C2F0EB, DAT_ButtonCurrentlyInteracting::instance)) { + color = OpenSHC::Rendering::Colors::COL_CCFAFF; } MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( DAT_GameSynchronyState::instance diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index 1db087ba43..58ec8ffbe4 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -34,48 +34,20 @@ namespace UI { DAT_GameCore::instance.U2_mapType_singleOrMulti = 0; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_NEW_MAP_MAPTYPE, 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: 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]; + for (int i = 0; i < 9; i++) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } return; case 4: DAT_GameCore::instance.missionNumber1to20 = 0; @@ -94,24 +66,10 @@ namespace UI { DAT_GameCore::instance.menuTabToSwitchTo.tabType = UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM; 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 5: MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp index 5431fc51a6..c899c124d1 100644 --- a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp @@ -2,6 +2,7 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -30,8 +31,8 @@ namespace UI { if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 < DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { if ((param_1 == DAT_GameSynchronyState::instance.scrollBarIndex) - || (color = 0xc2f0eb, DAT_ButtonCurrentlyInteracting::instance)) { - color = 0xccfaff; + || (color = OpenSHC::Rendering::Colors::COL_C2F0EB, DAT_ButtonCurrentlyInteracting::instance)) { + color = OpenSHC::Rendering::Colors::COL_CCFAFF; } MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderWideText, DAT_TextManagerObject::ptr)( DAT_GameSynchronyState::instance From 806bf5e8f30432440772c4d20921393891cfdde5 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 11:20:17 +0100 Subject: [PATCH 38/46] style: the new loops step with ++i up to countof The for loops of the previous commit in CustomScenarios_Main count to countof(the array) instead of 9 and step with ++i, as main's other loops do. 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_CustomScenarios_Main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index 58ec8ffbe4..9bd7c13716 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -34,7 +34,7 @@ namespace UI { DAT_GameCore::instance.U2_mapType_singleOrMulti = 0; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_NEW_MAP_MAPTYPE, 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]; } @@ -44,7 +44,7 @@ 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 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_GameCore::instance.menuTabToSwitchTo.tabType = UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM; 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 b3917f13c032f8f002afb36e20a211cbfd934f54 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:38:00 +0100 Subject: [PATCH 39/46] headers: GameCommandType values 33 and 37 as GCT_UNKNOWN_33 and GCT_UNKNOWN_37 MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection (0x00465200) queues command 33 (push 0x21; call 0x489100, queueCommand) with the selected workshop's building ID, the weapon and the building's uid, and MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose (0x00465360) queues command 37 (push 0x25) with the selected drawbridge's building ID, open or close, and its uid. The enum had 31, 34, 36 and 38 but not 33 or 37; they get the placeholder name form of GCT_UNKNOWN_40. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Commands/GameCommandType.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenSHC/Commands/GameCommandType.hpp b/src/OpenSHC/Commands/GameCommandType.hpp index d5f01b51d2..1105ddab32 100644 --- a/src/OpenSHC/Commands/GameCommandType.hpp +++ b/src/OpenSHC/Commands/GameCommandType.hpp @@ -40,9 +40,11 @@ namespace Commands { GCT_PLACE_BUILDING = 28, // 0x0000001C GCT_DESTROY_BUILDING = 29, // 0x0000001D GCT_RECRUIT_UNIT = 31, // 0x0000001F + GCT_UNKNOWN_33 = 33, // 0x00000021 GCT_CHANGE_TAXES = 34, // 0x00000022 GCT_CHANGE_RATIONS = 35, // 0x00000023 GCT_DISBAND_AND_ATTACK_UNITS = 36, // 0x00000024 + GCT_UNKNOWN_37 = 37, // 0x00000025 GCT_BUY_OR_SELL = 38, // 0x00000026 GCT_SAVE = 39, // 0x00000027 GCT_UNKNOWN_40 = 40, // 0x00000028 From 191ff079e1f558f499b20efbf3b15079c2cfc7ce Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:38:00 +0100 Subject: [PATCH 40/46] headers: SoundEffectID values 140 and 142 as SEID_UNKNOWN_0x8C and SEID_UNKNOWN_0x8E MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose (0x00465480) plays sound effect 140 (push 0x8c; call 0x449c40, setUpSFXToPlayUnk) when the gatehouse button passes 10, and 142 (push 0x8e) when it passes 11. The enum had 137, 141 and 143 but not 140 or 142; they get the same placeholder name form as their neighbours. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Audio/SFX/SoundEffectID.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenSHC/Audio/SFX/SoundEffectID.hpp b/src/OpenSHC/Audio/SFX/SoundEffectID.hpp index 79f4314fdb..ef00f0be40 100644 --- a/src/OpenSHC/Audio/SFX/SoundEffectID.hpp +++ b/src/OpenSHC/Audio/SFX/SoundEffectID.hpp @@ -106,7 +106,9 @@ namespace Audio { SEID_UNKNOWN_0x80 = 128, // 0x00000080 SEID_UNKNOWN_0x87 = 135, // 0x00000087 SEID_CHICKEN1 = 137, // 0x00000089 + SEID_UNKNOWN_0x8C = 140, // 0x0000008C SEID_GATEHOUSE_CLOSE = 141, // 0x0000008D + SEID_UNKNOWN_0x8E = 142, // 0x0000008E SEID_GATEHOUSE_OPEN = 143, // 0x0000008F SEID_CHILDREN_PLAY_MAYPOLE = 144, // 0x00000090 SEID_SWORDSMAN_SWORD_SWING = 145, // 0x00000091 From d21f2afb41c69f9e27bc637a7ccbed05852658c6 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:38:01 +0100 Subject: [PATCH 41/46] headers: TextArrayIndexType value 13 as TAIT_UNKNOWN_13 MenuItemActionHandler_EditScenario_DateYearBox (0x004B8990) compares UserTextHandler::textArrayIndex with 13 (cmp dword ptr [0x1652740], 0xd) for its sixth box and, when it differs, passes 13 to resetToTextIndex (push 0xd; call 0x469790), as it does with 10, 11, 12, 14 and 15 for the other boxes. The enum had 12 and 14 but not 13; it gets the placeholder name form of TAIT_UNKNOWN_12. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Text/TextArrayIndexType.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenSHC/Text/TextArrayIndexType.hpp b/src/OpenSHC/Text/TextArrayIndexType.hpp index 23170757f8..4c1c6a568f 100644 --- a/src/OpenSHC/Text/TextArrayIndexType.hpp +++ b/src/OpenSHC/Text/TextArrayIndexType.hpp @@ -24,6 +24,7 @@ namespace Text { TAIT_UNKNOWN_10 = 10, // 0x0000000A TAIT_UNKNOWN_11 = 11, // 0x0000000B TAIT_UNKNOWN_12 = 12, // 0x0000000C + TAIT_UNKNOWN_13 = 13, // 0x0000000D TAIT_UNKNOWN_14 = 14, // 0x0000000E TAIT_UNKNOWN_15 = 15 // 0x0000000F From e77e69afb1a490c9a28d96e1360751fffa656da5 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 15:39:32 +0100 Subject: [PATCH 42/46] style: the review's names, enum 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: - StatusMenuButtons compares and stores menu tabs, not buildings: BT_OXTETHER and BT_KEEPDOOR_LEFT (4 and 71) are BASMTT_GRANARY_OR_MPMENU_TCPIP and BASMTT_STATUS_OVERVIEW, the 71 and 75 it tests are BASMTT_STATUS_OVERVIEW and BASMTT_STATUS_FOOD, and the 4 in INT_00b96120 is the granary tab, the only value main's RenderBuildingMenu_Granary writes there. StatusMainMenuButtons' tabType - 71 is tabType - BASMTT_STATUS_OVERVIEW, and SelectBuySellGoods' tab 57 is BASMTT_MARKETPLACE_TRADE. - DateYearBox's TAIT_EIGHT | TAIT_SEVEN style ORs were Ghidra splitting a plain index into flags: they are TAIT_UNKNOWN_15, 10, 11, 13 and 14, the (TextArrayIndexTypeInt)12 cast is TAIT_UNKNOWN_12, and the same names go into its resetToTextIndex calls, as main's TextBoxLike writes them. - Number casts become enum names: GCT_UNKNOWN_33, GCT_UNKNOWN_37, SEID_UNKNOWN_0x8C and SEID_UNKNOWN_0x8E, and their using lines go. - The last decompiler locals go: ChangeRations tests Tutorial_IsActionAllowed directly and stores timeGetTime() straight into timeTaxesOrRationsChange, and SelectBuySellGoods tests isResourceTypeTradeable directly, so their BOOLEnum includes and using lines go too. - param_N gets main's names: button for the menu buttons, row for the table rows, unused where the parameter is not read, unused and scrollbarEvent for the scrollbar and slider handlers, unused and sliderValue for the scrollbar renders, and rations, openOrClose, resourceType, tabType, action, taunt, box and field where the value says what it is. HorizontalSlider's thumb position is added to DAT_ButtonX, so it is thumbXPos. - ModemTableRows and FindingNetworkSessions_TableRows lose Ghidra's comma operator in the colour test: they return early for rows past the end and set the colour in both arms of an if / else, as main's ProviderTableRows render does. - Casts that restated a field's own type go: DAT_ButtonX/Y/W/H, MapPropertiesState::offset, eventListScrollOffset, the (int) on the short outpost fields and the (uint) on the row == index argument, and the inner (int) of (BuildingType)((int)x). (int)total in MessageScrollbar stays: total is undefined4, so the compare would be unsigned without it. - The colour 0 in StatusMainMenuButtons and TaxArrowButtons is COL_000000, minimapClickEnabled and FindingNetworkSessions' keepXOffset get TRUE / FALSE, and BOOLEnum.hpp is dropped from the 9 files that never name BOOLEnum (TaxArrowButtons' unused BGR24.hpp too). - ProviderTableRows' two-line sparse-switch comment is one line. 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 --- ...rFunction_BuildMenu_MiniMapInteraction.cpp | 7 ++-- ...er_BuildingAndStatusMenu_ChangeRations.cpp | 17 +++----- ...ldingAndStatusMenu_DrawbridgeOpenClose.cpp | 11 +++--- ...ildingAndStatusMenu_GatehouseOpenClose.cpp | 16 ++++---- ...ildingAndStatusMenu_OutpostSliderDelay.cpp | 12 +++--- ...uildingAndStatusMenu_OutpostSliderSize.cpp | 12 +++--- ...ildingAndStatusMenu_SelectBuySellGoods.cpp | 16 ++++---- ...uildingAndStatusMenu_StatusMenuButtons.cpp | 16 ++++---- ...andler_BuildingAndStatusMenu_TaxSlider.cpp | 4 +- ...gAndStatusMenu_WorkshopWeaponSelection.cpp | 3 +- ...BuildingAndStatusMenu_ArmyStatusReturn.cpp | 2 +- ..._BuildingAndStatusMenu_DisableFoodType.cpp | 1 - ...BuildingAndStatusMenu_HorizontalSlider.cpp | 8 ++-- ...ingAndStatusMenu_StatusMainMenuButtons.cpp | 13 ++++--- ..._BuildingAndStatusMenu_TaxArrowButtons.cpp | 13 +++---- ...nuItemRenderFunction_Chat_TauntButtons.cpp | 15 ++++--- ...tworkServiceProvider_ModemScrollbarUnk.cpp | 4 +- ...rkServiceProvider_ProviderScrollbarUnk.cpp | 4 +- ...tworkServiceProvider_ProviderTableRows.cpp | 9 ++--- ...eNetworkServiceProvider_ModemTableRows.cpp | 34 ++++++++-------- ...temActionHandler_CrusadeEndscreen_Main.cpp | 4 +- ...ItemActionHandler_CustomScenarios_Main.cpp | 4 +- ...nuItemActionHandler_DisableWeapon_Main.cpp | 17 ++++---- ...ActionHandler_EditScenario_DateYearBox.cpp | 39 ++++++++++--------- ...emActionHandler_EditScenario_Scrollbar.cpp | 8 ++-- ...ction_FindingNetworkSessions_TableRows.cpp | 33 ++++++++-------- ...ionHandler_GameplayOptions_SpeedSlider.cpp | 4 +- ...ActionHandler_General_MessageScrollbar.cpp | 8 ++-- ...ActionHandler_General_TextInputDisplay.cpp | 5 +-- ...unction_General_MessageScrollbarUpDown.cpp | 4 +- ...nuItemRenderFunction_General_Scrollbar.cpp | 6 +-- ...enuItemActionHandler_GreatestLord_Main.cpp | 11 +++--- 32 files changed, 173 insertions(+), 187 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp index 64eff61486..7324924dae 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp @@ -2,7 +2,6 @@ #include "OpenSHC/UI/Enums/BuildMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -14,16 +13,16 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00434300 - void BuildMenu::MenuItemRenderFunction_BuildMenu_MiniMapInteraction(int param_1, ...) + void BuildMenu::MenuItemRenderFunction_BuildMenu_MiniMapInteraction(int unused, ...) { if (DAT_ButtonCurrentlyInteracting::instance && DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU && (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_SOLDIERS || (DAT_TileMapState::instance.shiftRelated0or3 == 1))) { - DAT_MinimapViewState::instance.minimapClickEnabled = 1; + DAT_MinimapViewState::instance.minimapClickEnabled = TRUE; return; } - DAT_MinimapViewState::instance.minimapClickEnabled = 0; + DAT_MinimapViewState::instance.minimapClickEnabled = FALSE; } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp index 4ff08dc2fb..657ed62e7b 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations.cpp @@ -6,7 +6,6 @@ #include "OpenSHC/Commands/GameCommandType.hpp" #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" @@ -17,28 +16,24 @@ namespace UI { namespace MenuItems { using OpenSHC::Map::Buildings::BuildingType; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x00465820 - void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations(int param_1, ...) + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations(int rations, ...) { if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) { - BOOLEnum BVar1 = MACRO_CALL(OpenSHC::Game_Func::Tutorial_IsActionAllowed)(3, param_1); - if (!BVar1) { + if (!MACRO_CALL(OpenSHC::Game_Func::Tutorial_IsActionAllowed)(3, rations)) { MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialHintActiveWithTimestamp)(); return; } - MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialBuildingActionState)( - 12, (BuildingType)((int)(param_1))); + MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialBuildingActionState)(12, (BuildingType)rations); } - DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = rations; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( OpenSHC::Commands::GCT_CHANGE_RATIONS); DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .rationsSetting3 = param_1; - DWORD DVar2 = timeGetTime(); + .rationsSetting3 = rations; DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .timeTaxesOrRationsChange = DVar2; + .timeTaxesOrRationsChange = timeGetTime(); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp index de51610480..6b5455604e 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp @@ -11,20 +11,19 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Commands::GameCommandType; - // FUNCTION: STRONGHOLDCRUSADER 0x00465360 - void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose(int param_1, ...) + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose( + int openOrClose, ...) { DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = DAT_BuildingsState::instance.menuSelectedBuildingID; - DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = openOrClose; DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( - ((GameCommandType)37)); + OpenSHC::Commands::GCT_UNKNOWN_37); DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .gateOpenOrCloseClick = param_1; + .gateOpenOrCloseClick = openOrClose; } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp index 56e4005df3..36ab8b8fc4 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose.cpp @@ -14,27 +14,25 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Audio::SFX::SoundEffectID; - // FUNCTION: STRONGHOLDCRUSADER 0x00465480 - void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose(int param_1, ...) + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose(int openOrClose, ...) { DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = DAT_BuildingsState::instance.menuSelectedBuildingID; - DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = openOrClose; DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( OpenSHC::Commands::GCT_OPEN_OR_CLOSE_GATE); DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .openOrCloseGateClick = param_1; - if (param_1 == 10) { + .openOrCloseGateClick = openOrClose; + if (openOrClose == 10) { MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - (OpenSHC::Audio::SFX::SoundEffectID)140); + OpenSHC::Audio::SFX::SEID_UNKNOWN_0x8C); } - if (param_1 == 11) { + if (openOrClose == 11) { MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( - (OpenSHC::Audio::SFX::SoundEffectID)142); + OpenSHC::Audio::SFX::SEID_UNKNOWN_0x8E); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp index 0e3ec8301f..e49eb5659c 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp @@ -8,14 +8,14 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00466810 void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay( - int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { int const selectedBuildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; - switch (param_2) { + switch (scrollbarEvent) { case 1: *minValue = 0; *maxValue = 24000; - *currentValue = (int)DAT_BuildingsState::instance.buildings[selectedBuildingID].outpostRelatedUnk3; + *currentValue = DAT_BuildingsState::instance.buildings[selectedBuildingID].outpostRelatedUnk3; return; case 2: case 3: @@ -24,7 +24,7 @@ namespace UI { return; case 4: *currentValue - = (int)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk3; return; case 5: { @@ -37,7 +37,7 @@ namespace UI { if (0 < delay) { *delayField = delay - 1; } - *currentValue = (int)*delayField; + *currentValue = *delayField; return; } case 6: { @@ -50,7 +50,7 @@ namespace UI { if (delay < 24000) { *delayField = delay + 1; } - *currentValue = (int)*delayField; + *currentValue = *delayField; } } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp index df14f4612a..e13a44420f 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp @@ -8,14 +8,14 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00466730 void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize( - int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { int const buildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; - switch (param_2) { + switch (scrollbarEvent) { case 1: *minValue = 0; *maxValue = 5; - *currentValue = (int)DAT_BuildingsState::instance.buildings[buildingID].outpostRelatedUnk2; + *currentValue = DAT_BuildingsState::instance.buildings[buildingID].outpostRelatedUnk2; return; case 2: case 3: @@ -24,7 +24,7 @@ namespace UI { return; case 4: *currentValue - = (int)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; return; case 5: { @@ -37,7 +37,7 @@ namespace UI { if (0 < oldSize) { *sizeField = oldSize - 1; } - *currentValue = (int)*sizeField; + *currentValue = *sizeField; return; } case 6: { @@ -50,7 +50,7 @@ namespace UI { if (oldSize < 5) { *sizeField = oldSize + 1; } - *currentValue = (int)*sizeField; + *currentValue = *sizeField; } } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp index 19a3ba9e11..92ede2eaaa 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods.cpp @@ -2,8 +2,8 @@ #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" @@ -13,17 +13,15 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004659E0 - void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods(int param_1, ...) + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods( + int resourceType, ...) { - BOOLEnum BVar1 = MACRO_CALL_MEMBER(Game::GameStateStructures_Func::isResourceTypeTradeable, - DAT_GameState::ptr)((Game::Resources::ResourceType)param_1); - if (BVar1) { + if (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::isResourceTypeTradeable, DAT_GameState::ptr)( + (Game::Resources::ResourceType)resourceType)) { DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .marketSelectedResourceType = param_1; - DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = 57; + .marketSelectedResourceType = resourceType; + DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = UI::Enums::BASMTT_MARKETPLACE_TRADE; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp index 11dca7ec32..c6d8bd4e11 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp @@ -4,6 +4,7 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -16,18 +17,19 @@ namespace UI { using Map::Buildings::BuildingType; // FUNCTION: STRONGHOLDCRUSADER 0x0043E490 - void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons(int param_1, ...) + void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons(int tabType, ...) { - if (param_1 == 71 && DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo == 75 - && INT_00b96120::instance == 4) { - param_1 = Map::Buildings::BT_OXTETHER; + if (tabType == UI::Enums::BASMTT_STATUS_OVERVIEW + && DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo == UI::Enums::BASMTT_STATUS_FOOD + && INT_00b96120::instance == UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP) { + tabType = UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP; } - DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = param_1; + DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = tabType; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); if ((DAT_GameCore::instance.gameMode_2 == Game::GM_CRUSADER_TUTORIAL) - && (param_1 != Map::Buildings::BT_KEEPDOOR_LEFT)) { - MACRO_CALL(UI::Helpers_Func::SetTutorialBuildingActionState)(0xf, (BuildingType)((int)(param_1))); + && (tabType != UI::Enums::BASMTT_STATUS_OVERVIEW)) { + MACRO_CALL(UI::Helpers_Func::SetTutorialBuildingActionState)(15, (BuildingType)tabType); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp index c42e47576a..fa58e9ce12 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp @@ -9,9 +9,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00465560 void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider( - 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 = 11; diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp index 47ea8af598..c630c6c570 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp @@ -13,7 +13,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Commands::GameCommandType; using OpenSHC::Game::Resources::ResourceType; // FUNCTION: STRONGHOLDCRUSADER 0x00465200 @@ -51,7 +50,7 @@ namespace UI { DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( - ((GameCommandType)33)); + OpenSHC::Commands::GCT_UNKNOWN_33); DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID].weaponRelated = weapon; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp index f20d854eae..e3b0fe9dc2 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp @@ -20,7 +20,7 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0043FCB0 - void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn(int param_1, ...) + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn(int unused, ...) { if (((((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk) || (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL)) diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp index 1724496b6e..07b76eb5c3 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp @@ -5,7 +5,6 @@ #include "OpenSHC/Game/GameMode.hpp" #include "OpenSHC/IO/Graphics/GmID.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp index 509b6d0d39..2022e5c34f 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp @@ -15,17 +15,17 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00465630 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider( - int param_1, int thumbYPos, int param_3, int thumbHeight, BOOL isDragged) + int unused, int thumbXPos, int sliderValue, int thumbHeight, BOOL isDragged) { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - for (int trackOffset = 0; trackOffset < (int)DAT_ButtonW::instance; trackOffset += 26) { + for (int trackOffset = 0; trackOffset < DAT_ButtonW::instance; trackOffset += 26) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 281, - DAT_ButtonX::instance + trackOffset, (int)(DAT_ButtonY::instance)); + DAT_ButtonX::instance + trackOffset, DAT_ButtonY::instance); } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 280, - DAT_ButtonX::instance + thumbYPos, (int)(DAT_ButtonY::instance - 5)); + DAT_ButtonX::instance + thumbXPos, DAT_ButtonY::instance - 5); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp index 17f08960c5..c97c9a3721 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp @@ -4,7 +4,9 @@ #include "OpenSHC/UI/MenuItems/General.func.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -23,7 +25,7 @@ namespace UI { using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x0043E4E0 - void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons(int param_1, ...) + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons(int tabType, ...) { if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) { MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: @@ -31,13 +33,14 @@ namespace UI { int blendStrength = 0; BOOLEnum keepOffsetX = FALSE; int fontSize = 19; - BGR24 color = 0; - int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + BGR24 color = OpenSHC::Rendering::Colors::COL_000000; + int xParam = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; TextAlignment alignment = OpenSHC::Text::TTA_CENTER; int yParam = DAT_ButtonY::instance + 10; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, param_1 - 71), + MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, tabType - UI::Enums::BASMTT_STATUS_OVERVIEW), xParam, yParam, alignment, color, fontSize, keepOffsetX, blendStrength); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp index 90ee213322..ccea5857b3 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp @@ -3,9 +3,8 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/MenuItems/General.func.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.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/Globals/DAT_ButtonW.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -17,17 +16,17 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004657B0 - void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons(int param_1, ...) + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons(int action, ...) { MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - if (0 <= param_1) { + if (0 <= action) { int yParam = DAT_ButtonY::instance + 4; - int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + int xParam = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_IN_KEEP, param_1), - xParam, yParam, OpenSHC::Text::TTA_CENTER, 0, 17, FALSE, 0); + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_IN_KEEP, action), + xParam, yParam, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_000000, 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp index 5835196ef6..0485901fc9 100644 --- a/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/Chat/MenuItemRenderFunction_Chat_TauntButtons.cpp @@ -5,7 +5,6 @@ #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" #include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" @@ -19,21 +18,21 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0047FFE0 - void Chat::MenuItemRenderFunction_Chat_TauntButtons(int param_1, ...) + void Chat::MenuItemRenderFunction_Chat_TauntButtons(int taunt, ...) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton, AlphaAndButtonSurfaceObj::ptr)(0, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); - if (param_1 < 10) { + if (taunt < 10) { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( - param_1, DAT_ButtonX::instance + 12, (int)((int)(DAT_ButtonY::instance + 9)), - OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_CCFAFF, 19, FALSE, 0); + taunt, DAT_ButtonX::instance + 12, DAT_ButtonY::instance + 9, OpenSHC::Text::TTA_LEFT, + OpenSHC::Rendering::Colors::COL_CCFAFF, 19, FALSE, 0); } else { MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, DAT_TextManagerObject::ptr)( - param_1, DAT_ButtonX::instance + 9, (int)((int)(DAT_ButtonY::instance + 9)), - OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_CCFAFF, 19, FALSE, 0); + taunt, DAT_ButtonX::instance + 9, DAT_ButtonY::instance + 9, OpenSHC::Text::TTA_LEFT, + OpenSHC::Rendering::Colors::COL_CCFAFF, 19, FALSE, 0); } if (DAT_ButtonCurrentlyInteracting::instance) { - DAT_GameSynchronyState::instance.DAT_InsultTextIndex = param_1; + DAT_GameSynchronyState::instance.DAT_InsultTextIndex = taunt; } } diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp index ccfe6b0d1a..3da8250c6c 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp @@ -8,9 +8,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0047D070 void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk( - 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_GameSynchronyState::instance.modemScrollbarCount - 4; diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp index 18b97c6092..1a5fc62747 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp @@ -8,9 +8,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0047CA80 void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk( - 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_GameSynchronyState::instance.scrollBarItemCount - 4; diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp index 83be745afa..b320afbf3b 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp @@ -14,15 +14,14 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00487200 void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows( - int param_1, ...) + int row, ...) { - if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + row < DAT_GameSynchronyState::instance.scrollBarItemCount) { - DAT_GameSynchronyState::instance.selectedProviderIndex = param_1; + DAT_GameSynchronyState::instance.selectedProviderIndex = row; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::setMenuTypeBasedOnDirectPlayGUID, DAT_GameSynchronyState::ptr)(); - // the original dispatches with a `sub eax, K; je` chain (0x487228), MSVC's - // sparse switch, and the TCPIP arm sits first + // a sparse switch; the original tests the TCPIP arm first switch (DAT_GameCore::instance.activeMenuTab.tabType) { case OpenSHC::UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP: MACRO_CALL_MEMBER( diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp index bf9639b63f..4d75c9eb9d 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -6,7 +6,6 @@ #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -24,26 +23,27 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0047D100 void ChooseNetworkServiceProvider::MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows( - int param_1, ...) + int row, ...) { - BGR24 color; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::PencilRenderCore_Func::drawTableCellBackground, DAT_PencilRenderCore::ptr)( - (uint)(param_1 == DAT_GameSynchronyState::instance.modemScrollbarIndex), param_1, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawTableCellBackground, + DAT_PencilRenderCore::ptr)(row == DAT_GameSynchronyState::instance.modemScrollbarIndex, row, 0); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; - if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 - < DAT_GameSynchronyState::instance.modemScrollbarCount) { - if ((param_1 == DAT_GameSynchronyState::instance.modemScrollbarIndex) - || (color = OpenSHC::Rendering::Colors::COL_C2F0EB, DAT_ButtonCurrentlyInteracting::instance)) { - color = OpenSHC::Rendering::Colors::COL_CCFAFF; - } - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( - DAT_GameSynchronyState::instance - .stringPointerArray[DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1], - (int)((int)(DAT_ButtonX::instance + 8)), (int)((int)(DAT_ButtonY::instance + 4)), - OpenSHC::Text::TTA_LEFT, color, 18, FALSE, 0); + if (DAT_GameSynchronyState::instance.modemScrollBarOffset + row + >= DAT_GameSynchronyState::instance.modemScrollbarCount) { + return; + } + BGR24 color; + if (row == DAT_GameSynchronyState::instance.modemScrollbarIndex + || DAT_ButtonCurrentlyInteracting::instance) { + color = OpenSHC::Rendering::Colors::COL_CCFAFF; + } else { + color = OpenSHC::Rendering::Colors::COL_C2F0EB; } + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance + .stringPointerArray[DAT_GameSynchronyState::instance.modemScrollBarOffset + row], + DAT_ButtonX::instance + 8, DAT_ButtonY::instance + 4, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp b/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp index 8f39831a4c..8ac0d3f38c 100644 --- a/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CrusadeEndscreen/MenuItemActionHandler_CrusadeEndscreen_Main.cpp @@ -13,9 +13,9 @@ namespace UI { using Game::TrailTypeInt; // FUNCTION: STRONGHOLDCRUSADER 0x004D9230 - void CrusadeEndscreen::MenuItemActionHandler_CrusadeEndscreen_Main(int param_1, ...) + void CrusadeEndscreen::MenuItemActionHandler_CrusadeEndscreen_Main(int button, ...) { - if (param_1 != 10) { + if (button != 10) { return; } diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index 9bd7c13716..f52fc4a655 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -20,9 +20,9 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x00440770 - void CustomScenarios::MenuItemActionHandler_CustomScenarios_Main(int param_1, ...) + void CustomScenarios::MenuItemActionHandler_CustomScenarios_Main(int button, ...) { - switch (param_1) { + switch (button) { case 1: DAT_MenuTextInputState::instance.dialogResult = 0; DAT_MenuTextInputState::instance.field_0x9c = 1; diff --git a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp index 039444bb2c..6a57190b0a 100644 --- a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.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_MapPropertiesState.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" @@ -12,33 +11,33 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004BB740 - void DisableWeapon::MenuItemActionHandler_DisableWeapon_Main(int param_1, ...) + void DisableWeapon::MenuItemActionHandler_DisableWeapon_Main(int button, ...) { - if (!param_1) { + if (button == 0) { DAT_MapPropertiesState::instance.SEC_XbowProducible_save = DAT_MapPropertiesState::instance.SEC_XbowProducible_save ^ 1; } - if (param_1 == 1) { + if (button == 1) { DAT_MapPropertiesState::instance.SEC_PikeProducible_save = DAT_MapPropertiesState::instance.SEC_PikeProducible_save ^ 1; } - if (param_1 == 2) { + if (button == 2) { DAT_MapPropertiesState::instance.SEC_SwordProducible_save = DAT_MapPropertiesState::instance.SEC_SwordProducible_save ^ 1; } - if (param_1 == 3) { + if (button == 3) { DAT_MapPropertiesState::instance.SEC_BowProducible_save = DAT_MapPropertiesState::instance.SEC_BowProducible_save ^ 1; } - if (param_1 == 4) { + if (button == 4) { DAT_MapPropertiesState::instance.SEC_SpearProducible_save = DAT_MapPropertiesState::instance.SEC_SpearProducible_save ^ 1; } - if (param_1 == 5) { + if (button == 5) { DAT_MapPropertiesState::instance.SEC_MaceProducible_save = DAT_MapPropertiesState::instance.SEC_MaceProducible_save ^ 1; } - if (param_1 == -3) { + if (button == -3) { MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); } diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp index 5defd4ca78..bf1d5e2cd3 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_DateYearBox.cpp @@ -10,44 +10,45 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004B8990 - void EditScenario::MenuItemActionHandler_EditScenario_DateYearBox(int param_1, ...) + void EditScenario::MenuItemActionHandler_EditScenario_DateYearBox(int box, ...) { - switch (param_1) { + switch (box) { case 0: - if (DAT_UserTextHandlerState::instance.textArrayIndex - != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_SEVEN__NUMERIC_ONLY)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_UNKNOWN_15) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_UNKNOWN_15); } break; case 1: - if (DAT_UserTextHandlerState::instance.textArrayIndex - != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_TWO__FILTER_A)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(10); + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_UNKNOWN_10) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_UNKNOWN_10); } break; case 2: - if (DAT_UserTextHandlerState::instance.textArrayIndex - != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_THREE__FILTER_A)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(11); + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_UNKNOWN_11) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_UNKNOWN_11); } break; case 3: case 4: case 7: - if (DAT_UserTextHandlerState::instance.textArrayIndex != (Text::TextArrayIndexTypeInt)12) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(12); + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_UNKNOWN_12) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_UNKNOWN_12); } break; case 5: - if (DAT_UserTextHandlerState::instance.textArrayIndex - != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_FIVE__NUMERIC_DOT)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(13); + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_UNKNOWN_13) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_UNKNOWN_13); } break; case 6: - if (DAT_UserTextHandlerState::instance.textArrayIndex - != (Text::TAIT_EIGHT__FILTER_B | Text::TAIT_SIX__NUMERIC_ONLY)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(14); + if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_UNKNOWN_14) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_UNKNOWN_14); } } } diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp index 3b7ec072ea..d9727bed63 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -8,9 +8,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004B8A50 void EditScenario::MenuItemActionHandler_EditScenario_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_MapPropertiesState::instance.eventsCount - 20; @@ -28,7 +28,7 @@ namespace UI { *maxValue = DAT_MapPropertiesState::instance.eventsCount - 20; return; case 5: - if (0 < (int)DAT_MapPropertiesState::instance.eventListScrollOffset) { + if (0 < DAT_MapPropertiesState::instance.eventListScrollOffset) { DAT_MapPropertiesState::instance.eventListScrollOffset = DAT_MapPropertiesState::instance.eventListScrollOffset - 1; *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; @@ -36,7 +36,7 @@ namespace UI { } break; case 6: - if ((int)DAT_MapPropertiesState::instance.eventListScrollOffset + if (DAT_MapPropertiesState::instance.eventListScrollOffset < DAT_MapPropertiesState::instance.eventsCount - 20) { DAT_MapPropertiesState::instance.eventListScrollOffset = DAT_MapPropertiesState::instance.eventListScrollOffset + 1; diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp index c899c124d1..b06cef7efa 100644 --- a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp @@ -5,7 +5,6 @@ #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -20,26 +19,26 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0047D410 - void FindingNetworkSessions::MenuItemRenderFunction_FindingNetworkSessions_TableRows(int param_1, ...) + void FindingNetworkSessions::MenuItemRenderFunction_FindingNetworkSessions_TableRows(int row, ...) { - uint color; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - MACRO_CALL_MEMBER( - OpenSHC::UI::Rendering::PencilRenderCore_Func::drawTableCellBackground, DAT_PencilRenderCore::ptr)( - (uint)(param_1 == DAT_GameSynchronyState::instance.scrollBarIndex), param_1, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawTableCellBackground, + DAT_PencilRenderCore::ptr)(row == DAT_GameSynchronyState::instance.scrollBarIndex, row, 0); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; - if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 - < DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { - if ((param_1 == DAT_GameSynchronyState::instance.scrollBarIndex) - || (color = OpenSHC::Rendering::Colors::COL_C2F0EB, DAT_ButtonCurrentlyInteracting::instance)) { - color = OpenSHC::Rendering::Colors::COL_CCFAFF; - } - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderWideText, DAT_TextManagerObject::ptr)( - DAT_GameSynchronyState::instance - .DPLAY_SessionNames[DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1], - (int)((int)(DAT_ButtonX::instance + 8)), (int)((int)(DAT_ButtonY::instance + 4)), - OpenSHC::Text::TTA_LEFT, color, 18, 0, 0); + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + row + >= DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { + return; + } + uint color; + if (row == DAT_GameSynchronyState::instance.scrollBarIndex || DAT_ButtonCurrentlyInteracting::instance) { + color = OpenSHC::Rendering::Colors::COL_CCFAFF; + } else { + color = OpenSHC::Rendering::Colors::COL_C2F0EB; } + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderWideText, DAT_TextManagerObject::ptr)( + DAT_GameSynchronyState::instance + .DPLAY_SessionNames[DAT_GameSynchronyState::instance.scrollBarItemOffset + row], + DAT_ButtonX::instance + 8, DAT_ButtonY::instance + 4, OpenSHC::Text::TTA_LEFT, color, 18, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp index 728954f900..5f18452325 100644 --- a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp @@ -11,7 +11,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00491FD0 void GameplayOptions::MenuItemActionHandler_GameplayOptions_SpeedSlider( - int param_1, int param_2, int* minValue, int* maxValue, int* currentValue) + int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) && (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { @@ -20,7 +20,7 @@ namespace UI { *currentValue = DAT_GameSynchronyState::instance.skirmishGameSpeedLevel; return; } - switch (param_2) { + switch (scrollbarEvent) { case 1: *minValue = 20; *maxValue = 90; diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp index 6c18921ccd..842b63b30c 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp @@ -8,9 +8,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004BAD70 void General::MenuItemActionHandler_General_MessageScrollbar( - 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_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount; @@ -25,14 +25,14 @@ namespace UI { *maxValue = DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount; return; case 5: - if (0 < (int)DAT_MapPropertiesState::instance.offset) { + if (0 < DAT_MapPropertiesState::instance.offset) { --DAT_MapPropertiesState::instance.offset; *currentValue = DAT_MapPropertiesState::instance.offset; return; } break; case 6: - if ((int)DAT_MapPropertiesState::instance.offset + if (DAT_MapPropertiesState::instance.offset < (int)DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount) { ++DAT_MapPropertiesState::instance.offset; } diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp index b813b43c5a..a8224b3d40 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp @@ -2,7 +2,6 @@ #include "OpenSHC/Text/UserTextHandler.func.hpp" #include "OpenSHC/Text/TextArrayIndexType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" @@ -12,9 +11,9 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x0047CC10 - void General::MenuItemActionHandler_General_TextInputDisplay(int param_1, ...) + void General::MenuItemActionHandler_General_TextInputDisplay(int field, ...) { - switch (param_1) { + switch (field) { case 0: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_FIVE__NUMERIC_DOT) { MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp index c9198e936e..75c322e699 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_MessageScrollbarUpDown.cpp @@ -11,10 +11,10 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004BAE80 - void General::MenuItemRenderFunction_General_MessageScrollbarUpDown(int param_1, ...) + void General::MenuItemRenderFunction_General_MessageScrollbarUpDown(int button, ...) { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; - if (param_1 == -1) { + if (button == -1) { MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::renderUpDownButtonUnk, DAT_PencilRenderCore::ptr)(0, 0); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp index 687f33ed34..94ab4bf5c3 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_Scrollbar.cpp @@ -15,12 +15,12 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004BAE30 void General::MenuItemRenderFunction_General_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, 0); + 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/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp index 4042783d28..3d448c8006 100644 --- a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.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_GreatestLordDefinedData.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" @@ -12,19 +11,19 @@ namespace UI { namespace MenuItems { // FUNCTION: STRONGHOLDCRUSADER 0x004B1990 - void GreatestLord::MenuItemActionHandler_GreatestLord_Main(int param_1, ...) + void GreatestLord::MenuItemActionHandler_GreatestLord_Main(int button, ...) { - if ((param_1 == 1) || (param_1 == 100)) { + if ((button == 1) || (button == 100)) { MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( UI::Enums::MMT_NONE, FALSE); } - if (param_1 == 10) { + if (button == 10) { DAT_GreatestLordDefinedData::instance.tableSortBy = -1; } - if (param_1 == 11) { + if (button == 11) { DAT_GreatestLordDefinedData::instance.tableSortBy = 1; } - if (param_1 == 12) { + if (button == 12) { DAT_GreatestLordDefinedData::instance.tableSortBy = 0; } } From b2b57811df3eb73a7cb49f40d4d8db53c961d487 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 17:08:48 +0100 Subject: [PATCH 43/46] style: the second review's names, TAIT names, row counts, comments and early returns over the batch These come from the second review of the branch, and none of them changes the generated code: - ProviderTableRows' comment said the original tests the TCPIP arm first. It tests the modem arm first and only lays the TCPIP arm out first, so the comment now says that. The handler returns early for rows past the end, as its two row-render twins do. - resetToTextIndex gets the TAIT names its callers compare with: TAIT_FIVE__NUMERIC_DOT, TAIT_SIX__NUMERIC_ONLY, TAIT_SEVEN__NUMERIC_ONLY and TAIT_ZERO in TextInputDisplay, and the first and third in ProviderTableRows. TextInputDisplay's != TRUE gets the reason its render twin gives. - HorizontalSlider's thumb size is thumbWidth now that the position is thumbXPos, and isDragged is a BOOLEnum, as in main's horizontal sliders. - The modem, provider and event scrollbars say how many rows fit in their list, and the provider and event ones step with --x / ++x, as MessageScrollbar does. - Constants move to the right of their comparisons (x > 0, action >= 0), and the decompiler's parentheses go from ArmyStatusReturn, MiniMapInteraction, SpeedSlider, GreatestLord, StatusMenuButtons and TextInputDisplay. - DisableWeapon toggles with ^= 1. DisableFoodType's render tests isFoodTypeBanned for truth and names its offsets iconOffsetX and iconOffsetY. - StatusMainMenuButtons passes its five constant arguments directly, so its BGR24 and BOOLEnum includes and using lines go. It and TaxArrowButtons name the text position textX and textY. - ModemTableRows and FindingNetworkSessions_TableRows both declare the colour as uint, with main's ProviderTableRows render line on why it is set in both branches. ModemTableRows' BGR24 include and using line go. - TaxSlider writes taxesSliderUI directly instead of through a pointer local, says that case 1 falls through into case 4, and returns from case 6 as from case 5. The outpost sliders keep their pointer and say why: written directly, quick_diff drops from 0.8723 to 0.4719. Both now name buildingID, delay / delayField and size / sizeField alike. - CurrentlySelectedTroops says what its 20 is. - CustomScenarios stores a plain 1 as the map choice's tab, as main's openUnusedHelpTextEditorDialog does: BASMTT_BARRACKS_OR_MPMENU_MODEM names a building menu and multiplayer menu tab, which means nothing there. 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 --- ...dler_BuildMenu_CurrentlySelectedTroops.cpp | 1 + ...rFunction_BuildMenu_MiniMapInteraction.cpp | 2 +- ...ildingAndStatusMenu_OutpostSliderDelay.cpp | 7 ++-- ...uildingAndStatusMenu_OutpostSliderSize.cpp | 13 +++--- ...uildingAndStatusMenu_StatusMenuButtons.cpp | 4 +- ...andler_BuildingAndStatusMenu_TaxSlider.cpp | 41 ++++++++----------- ...BuildingAndStatusMenu_ArmyStatusReturn.cpp | 26 ++++++------ ..._BuildingAndStatusMenu_DisableFoodType.cpp | 13 +++--- ...BuildingAndStatusMenu_HorizontalSlider.cpp | 5 ++- ...ingAndStatusMenu_StatusMainMenuButtons.cpp | 17 ++------ ..._BuildingAndStatusMenu_TaxArrowButtons.cpp | 8 ++-- ...tworkServiceProvider_ModemScrollbarUnk.cpp | 1 + ...rkServiceProvider_ProviderScrollbarUnk.cpp | 9 ++-- ...tworkServiceProvider_ProviderTableRows.cpp | 36 ++++++++-------- ...eNetworkServiceProvider_ModemTableRows.cpp | 6 +-- ...ItemActionHandler_CustomScenarios_Main.cpp | 3 +- ...nuItemActionHandler_DisableWeapon_Main.cpp | 18 +++----- ...emActionHandler_EditScenario_Scrollbar.cpp | 9 ++-- ...ction_FindingNetworkSessions_TableRows.cpp | 1 + ...ionHandler_GameplayOptions_SpeedSlider.cpp | 4 +- ...ActionHandler_General_MessageScrollbar.cpp | 2 +- ...ActionHandler_General_TextInputDisplay.cpp | 17 +++++--- ...enuItemActionHandler_GreatestLord_Main.cpp | 2 +- 23 files changed, 116 insertions(+), 129 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp index 1189e2f8d6..1935de17b1 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -15,6 +15,7 @@ namespace UI { void BuildMenu::MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops(int slotID, ...) { DAT_UnitsState::instance.unitControlsRelated = 1; + // 20 selection slots: buttons 0-19 keep only a slot's unit type selected, 20-39 drop it if (slotID < 20) { UnitTypeInt const unitType = DAT_RenderingDefinedData::instance diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp index 7324924dae..c9c70c1217 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemRenderFunction_BuildMenu_MiniMapInteraction.cpp @@ -18,7 +18,7 @@ namespace UI { if (DAT_ButtonCurrentlyInteracting::instance && DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU && (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_SOLDIERS - || (DAT_TileMapState::instance.shiftRelated0or3 == 1))) { + || DAT_TileMapState::instance.shiftRelated0or3 == 1)) { DAT_MinimapViewState::instance.minimapClickEnabled = TRUE; return; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp index e49eb5659c..cab48dc4e8 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay.cpp @@ -10,12 +10,12 @@ namespace UI { void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay( int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { - int const selectedBuildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; + int const buildingID = DAT_BuildingsState::instance.menuSelectedBuildingID; switch (scrollbarEvent) { case 1: *minValue = 0; *maxValue = 24000; - *currentValue = DAT_BuildingsState::instance.buildings[selectedBuildingID].outpostRelatedUnk3; + *currentValue = DAT_BuildingsState::instance.buildings[buildingID].outpostRelatedUnk3; return; case 2: case 3: @@ -28,13 +28,14 @@ namespace UI { .outpostRelatedUnk3; return; case 5: { + // through a pointer, as the original does (direct field writes: quick_diff 0.8723 -> 0.4719) short const delay = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk3; short* const delayField = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk3; - if (0 < delay) { + if (delay > 0) { *delayField = delay - 1; } *currentValue = *delayField; diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp index e13a44420f..467e4accd7 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize.cpp @@ -28,27 +28,28 @@ namespace UI { .outpostRelatedUnk2; return; case 5: { - short const oldSize + // through a pointer, as the original does (direct field writes: quick_diff 0.8723 -> 0.4719) + short const size = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; short* const sizeField = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; - if (0 < oldSize) { - *sizeField = oldSize - 1; + if (size > 0) { + *sizeField = size - 1; } *currentValue = *sizeField; return; } case 6: { - short const oldSize + short const size = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; short* const sizeField = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] .outpostRelatedUnk2; - if (oldSize < 5) { - *sizeField = oldSize + 1; + if (size < 5) { + *sizeField = size + 1; } *currentValue = *sizeField; } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp index c6d8bd4e11..94d5d4dc42 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons.cpp @@ -27,8 +27,8 @@ namespace UI { DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = tabType; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); - if ((DAT_GameCore::instance.gameMode_2 == Game::GM_CRUSADER_TUTORIAL) - && (tabType != UI::Enums::BASMTT_STATUS_OVERVIEW)) { + if (DAT_GameCore::instance.gameMode_2 == Game::GM_CRUSADER_TUTORIAL + && tabType != UI::Enums::BASMTT_STATUS_OVERVIEW) { MACRO_CALL(UI::Helpers_Func::SetTutorialBuildingActionState)(15, (BuildingType)tabType); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp index fa58e9ce12..b363edb87d 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemActionHandler_BuildingAndStatusMenu_TaxSlider.cpp @@ -15,6 +15,7 @@ namespace UI { case 1: *minValue = 0; *maxValue = 11; + // falls through: the first event also reads the current value case 4: *currentValue = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] @@ -25,34 +26,28 @@ namespace UI { DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .taxesSliderUI = *currentValue; return; - case 5: { - int const taxesSliderValue - = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + case 5: + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI + > 0) { + --DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .taxesSliderUI; - int* const taxesSlider - = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .taxesSliderUI; - if (0 < taxesSliderValue) { - *taxesSlider = taxesSliderValue - 1; } - *currentValue = *taxesSlider; - return; - } - case 6: { - int const taxesSliderValue + *currentValue = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .taxesSliderUI; - int* const taxesSlider - = &DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .taxesSliderUI; - if (taxesSliderValue < 11) { - *taxesSlider = taxesSliderValue + 1; + return; + case 6: + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI + < 11) { + ++DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; } - *currentValue = *taxesSlider; - break; - } - default: - break; + *currentValue + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .taxesSliderUI; + return; } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp index e3b0fe9dc2..8e74641b38 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn.cpp @@ -22,19 +22,19 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0043FCB0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusReturn(int unused, ...) { - if (((((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk) - || (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL)) - && (DAT_GameSynchronyState::instance.currentPlayerSlotID == 2)) - || ((((DAT_GameSynchronyState::instance.currentPlayerSlotID == 1 - && (MACRO_CALL_MEMBER( - OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, - DAT_GameState::ptr)() - == 0)) - && (MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getArmySize, - DAT_UnitsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID) - != 0)) - || ((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk - && (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == OpenSHC::Map::MT_SIEGE)))))) + if ((((DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) + && DAT_GameSynchronyState::instance.currentPlayerSlotID == 2) + || (DAT_GameSynchronyState::instance.currentPlayerSlotID == 1 + && MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, + DAT_GameState::ptr)() + == 0 + && MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getArmySize, DAT_UnitsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID) + != 0) + || (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk + && DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == OpenSHC::Map::MT_SIEGE)) && !MACRO_CALL(OpenSHC::UI::DisplayElements_Func::GetIfDisplayElementStateNotZero)( OpenSHC::UI::Enums::DEID_KEEP_AND_GRANERY_PLACEMENT_INFO)) { DAT_ButtonUnknownZero::instance = TRUE; diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp index 07b76eb5c3..efab58fa7e 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DisableFoodType.cpp @@ -26,18 +26,17 @@ namespace UI { MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] - .isFoodTypeBanned[foodType] - != 0) { - int _xOffset = 8; - int _yOffset = 2; + .isFoodTypeBanned[foodType]) { + int iconOffsetX = 8; + int iconOffsetY = 2; DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; if (foodType == 1) { - _xOffset = 4; - _yOffset = 0; + iconOffsetX = 4; + iconOffsetY = 0; } MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 45, - DAT_ButtonX::instance - 4 + _xOffset, DAT_ButtonY::instance - 45 + _yOffset, 6); + DAT_ButtonX::instance - 4 + iconOffsetX, DAT_ButtonY::instance - 45 + iconOffsetY, 6); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp index 2022e5c34f..35c3ab81f5 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider.cpp @@ -3,6 +3,7 @@ #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" #include "OpenSHC/DE/SHCDE/eGM.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonW.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -13,9 +14,11 @@ namespace OpenSHC { namespace UI { namespace MenuItems { + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00465630 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_HorizontalSlider( - int unused, int thumbXPos, int sliderValue, int thumbHeight, BOOL isDragged) + int unused, int thumbXPos, int sliderValue, int thumbWidth, BOOLEnum isDragged) { DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; for (int trackOffset = 0; trackOffset < DAT_ButtonW::instance; trackOffset += 26) { diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp index c97c9a3721..35e5ce42ee 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons.cpp @@ -3,12 +3,10 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/MenuItems/General.func.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.hpp" -#include "OpenSHC/Rendering/Colors/BGR24.hpp" #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonW.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -20,28 +18,19 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Colors::BGR24; - using OpenSHC::Text::TextAlignment; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x0043E4E0 void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_StatusMainMenuButtons(int tabType, ...) { if (DAT_MenuTextInputState::instance.currentModalDialog == OpenSHC::UI::Enums::MMT_NO_MENU) { MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - int blendStrength = 0; - BOOLEnum keepOffsetX = FALSE; - int fontSize = 19; - BGR24 color = OpenSHC::Rendering::Colors::COL_000000; - int xParam = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; - TextAlignment alignment = OpenSHC::Text::TTA_CENTER; - int yParam = DAT_ButtonY::instance + 10; + int const textX = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + int const textY = DAT_ButtonY::instance + 10; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER( OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( OpenSHC::DE::SHCDE::TEXT_REPORT_BUTTONS, tabType - UI::Enums::BASMTT_STATUS_OVERVIEW), - xParam, yParam, alignment, color, fontSize, keepOffsetX, blendStrength); + textX, textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_000000, 19, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp index ccea5857b3..d6cf391fd2 100644 --- a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_TaxArrowButtons.cpp @@ -20,13 +20,13 @@ namespace UI { { MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - if (0 <= action) { - int yParam = DAT_ButtonY::instance + 4; - int xParam = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + if (action >= 0) { + int const textY = DAT_ButtonY::instance + 4; + int const textX = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_IN_KEEP, action), - xParam, yParam, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_000000, 17, FALSE, 0); + textX, textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_000000, 17, FALSE, 0); } } diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp index 3da8250c6c..adc421c0bb 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk.cpp @@ -10,6 +10,7 @@ namespace UI { void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemScrollbarUnk( int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { + // four modems fit in the list switch (scrollbarEvent) { case 1: *minValue = 0; diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp index 1a5fc62747..72a9fee5e2 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp @@ -10,6 +10,7 @@ namespace UI { void ChooseNetworkServiceProvider::MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk( int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { + // four providers fit in the list switch (scrollbarEvent) { case 1: *minValue = 0; @@ -24,9 +25,8 @@ namespace UI { *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; return; case 5: - if (0 < DAT_GameSynchronyState::instance.scrollBarItemOffset) { - DAT_GameSynchronyState::instance.scrollBarItemOffset - = DAT_GameSynchronyState::instance.scrollBarItemOffset - 1; + if (DAT_GameSynchronyState::instance.scrollBarItemOffset > 0) { + --DAT_GameSynchronyState::instance.scrollBarItemOffset; *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; return; } @@ -34,8 +34,7 @@ namespace UI { case 6: if (DAT_GameSynchronyState::instance.scrollBarItemOffset < DAT_GameSynchronyState::instance.scrollBarItemCount - 4) { - DAT_GameSynchronyState::instance.scrollBarItemOffset - = DAT_GameSynchronyState::instance.scrollBarItemOffset + 1; + ++DAT_GameSynchronyState::instance.scrollBarItemOffset; } break; default: diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp index b320afbf3b..731db0e518 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp @@ -2,6 +2,7 @@ #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" #include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" @@ -17,23 +18,24 @@ namespace UI { int row, ...) { if (DAT_GameSynchronyState::instance.scrollBarItemOffset + row - < DAT_GameSynchronyState::instance.scrollBarItemCount) { - DAT_GameSynchronyState::instance.selectedProviderIndex = row; - MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::setMenuTypeBasedOnDirectPlayGUID, - DAT_GameSynchronyState::ptr)(); - // a sparse switch; the original tests the TCPIP arm first - switch (DAT_GameCore::instance.activeMenuTab.tabType) { - case OpenSHC::UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP: - MACRO_CALL_MEMBER( - OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); - break; - case OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM: - MACRO_CALL_MEMBER( - OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(7); - break; - default: - break; - } + >= DAT_GameSynchronyState::instance.scrollBarItemCount) { + return; + } + DAT_GameSynchronyState::instance.selectedProviderIndex = row; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::setMenuTypeBasedOnDirectPlayGUID, + DAT_GameSynchronyState::ptr)(); + // a sparse switch; the TCPIP arm comes first in the original's layout + switch (DAT_GameCore::instance.activeMenuTab.tabType) { + case OpenSHC::UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP: + MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + OpenSHC::Text::TAIT_FIVE__NUMERIC_DOT); + break; + case OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM: + MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + OpenSHC::Text::TAIT_SEVEN__NUMERIC_ONLY); + break; + default: + break; } } diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp index 4d75c9eb9d..057b35f9b8 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -2,7 +2,6 @@ #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/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/TextAlignment.hpp" @@ -19,8 +18,6 @@ namespace OpenSHC { namespace UI { namespace MenuItems { - using OpenSHC::Rendering::Colors::BGR24; - // FUNCTION: STRONGHOLDCRUSADER 0x0047D100 void ChooseNetworkServiceProvider::MenuItemRenderFunction_ChooseNetworkServiceProvider_ModemTableRows( int row, ...) @@ -33,7 +30,8 @@ namespace UI { >= DAT_GameSynchronyState::instance.modemScrollbarCount) { return; } - BGR24 color; + // set in both branches: a preset colour overridden in one costs two instructions + uint color; if (row == DAT_GameSynchronyState::instance.modemScrollbarIndex || DAT_ButtonCurrentlyInteracting::instance) { color = OpenSHC::Rendering::Colors::COL_CCFAFF; diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index f52fc4a655..af9d95962f 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -5,7 +5,6 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/UI/MenuTextInputState.func.hpp" #include "OpenSHC/Game/GameMode2.hpp" -#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" #include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" @@ -63,7 +62,7 @@ namespace UI { INT_00b95b64::instance = 1; DAT_GameCore::instance.standaloneFilename[0] = '\0'; DAT_GameState::instance.mapAndTime.difficulty = DAT_GameCore::instance.missionDifficulty_3; - DAT_GameCore::instance.menuTabToSwitchTo.tabType = UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM; + DAT_GameCore::instance.menuTabToSwitchTo.tabType = 1; MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { diff --git a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp index 6a57190b0a..1c8a724115 100644 --- a/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/DisableWeapon/MenuItemActionHandler_DisableWeapon_Main.cpp @@ -14,28 +14,22 @@ namespace UI { void DisableWeapon::MenuItemActionHandler_DisableWeapon_Main(int button, ...) { if (button == 0) { - DAT_MapPropertiesState::instance.SEC_XbowProducible_save - = DAT_MapPropertiesState::instance.SEC_XbowProducible_save ^ 1; + DAT_MapPropertiesState::instance.SEC_XbowProducible_save ^= 1; } if (button == 1) { - DAT_MapPropertiesState::instance.SEC_PikeProducible_save - = DAT_MapPropertiesState::instance.SEC_PikeProducible_save ^ 1; + DAT_MapPropertiesState::instance.SEC_PikeProducible_save ^= 1; } if (button == 2) { - DAT_MapPropertiesState::instance.SEC_SwordProducible_save - = DAT_MapPropertiesState::instance.SEC_SwordProducible_save ^ 1; + DAT_MapPropertiesState::instance.SEC_SwordProducible_save ^= 1; } if (button == 3) { - DAT_MapPropertiesState::instance.SEC_BowProducible_save - = DAT_MapPropertiesState::instance.SEC_BowProducible_save ^ 1; + DAT_MapPropertiesState::instance.SEC_BowProducible_save ^= 1; } if (button == 4) { - DAT_MapPropertiesState::instance.SEC_SpearProducible_save - = DAT_MapPropertiesState::instance.SEC_SpearProducible_save ^ 1; + DAT_MapPropertiesState::instance.SEC_SpearProducible_save ^= 1; } if (button == 5) { - DAT_MapPropertiesState::instance.SEC_MaceProducible_save - = DAT_MapPropertiesState::instance.SEC_MaceProducible_save ^ 1; + DAT_MapPropertiesState::instance.SEC_MaceProducible_save ^= 1; } if (button == -3) { MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp index d9727bed63..5faaea56f4 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -10,6 +10,7 @@ namespace UI { void EditScenario::MenuItemActionHandler_EditScenario_Scrollbar( int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { + // twenty events fit in the list switch (scrollbarEvent) { case 1: *minValue = 0; @@ -28,9 +29,8 @@ namespace UI { *maxValue = DAT_MapPropertiesState::instance.eventsCount - 20; return; case 5: - if (0 < DAT_MapPropertiesState::instance.eventListScrollOffset) { - DAT_MapPropertiesState::instance.eventListScrollOffset - = DAT_MapPropertiesState::instance.eventListScrollOffset - 1; + if (DAT_MapPropertiesState::instance.eventListScrollOffset > 0) { + --DAT_MapPropertiesState::instance.eventListScrollOffset; *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; return; } @@ -38,8 +38,7 @@ namespace UI { case 6: if (DAT_MapPropertiesState::instance.eventListScrollOffset < DAT_MapPropertiesState::instance.eventsCount - 20) { - DAT_MapPropertiesState::instance.eventListScrollOffset - = DAT_MapPropertiesState::instance.eventListScrollOffset + 1; + ++DAT_MapPropertiesState::instance.eventListScrollOffset; } break; default: diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp index b06cef7efa..888d0a7935 100644 --- a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemRenderFunction_FindingNetworkSessions_TableRows.cpp @@ -29,6 +29,7 @@ namespace UI { >= DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { return; } + // set in both branches: a preset colour overridden in one costs two instructions uint color; if (row == DAT_GameSynchronyState::instance.scrollBarIndex || DAT_ButtonCurrentlyInteracting::instance) { color = OpenSHC::Rendering::Colors::COL_CCFAFF; diff --git a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp index 5f18452325..d81527648d 100644 --- a/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp +++ b/src/OpenSHC/UI/MenuItems/GameplayOptions/MenuItemActionHandler_GameplayOptions_SpeedSlider.cpp @@ -13,8 +13,8 @@ namespace UI { void GameplayOptions::MenuItemActionHandler_GameplayOptions_SpeedSlider( int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue) { - if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) - && (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { + if (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY + && DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER) { *minValue = 20; *maxValue = 90; *currentValue = DAT_GameSynchronyState::instance.skirmishGameSpeedLevel; diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp index 842b63b30c..36f02cc41b 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp @@ -25,7 +25,7 @@ namespace UI { *maxValue = DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount; return; case 5: - if (0 < DAT_MapPropertiesState::instance.offset) { + if (DAT_MapPropertiesState::instance.offset > 0) { --DAT_MapPropertiesState::instance.offset; *currentValue = DAT_MapPropertiesState::instance.offset; return; diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp index a8224b3d40..ff41a7d99b 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_TextInputDisplay.cpp @@ -16,23 +16,28 @@ namespace UI { switch (field) { case 0: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_FIVE__NUMERIC_DOT) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(5); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_FIVE__NUMERIC_DOT); } break; case 1: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_SIX__NUMERIC_ONLY) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(6); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_SIX__NUMERIC_ONLY); } break; case 2: if (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_SEVEN__NUMERIC_ONLY) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(7); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_SEVEN__NUMERIC_ONLY); } break; case 3: - if ((DAT_GameCore::instance.isNameEntryActive != TRUE) - && (DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_ZERO)) { - MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0); + // != TRUE: the original compares with 1 + if (DAT_GameCore::instance.isNameEntryActive != TRUE + && DAT_UserTextHandlerState::instance.textArrayIndex != Text::TAIT_ZERO) { + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + Text::TAIT_ZERO); } } } diff --git a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp index 3d448c8006..3266404b46 100644 --- a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemActionHandler_GreatestLord_Main.cpp @@ -13,7 +13,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004B1990 void GreatestLord::MenuItemActionHandler_GreatestLord_Main(int button, ...) { - if ((button == 1) || (button == 100)) { + if (button == 1 || button == 100) { MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( UI::Enums::MMT_NONE, FALSE); } From 87254f5252c4624751ba32114ef4d56fb56f65f3 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 17:09:00 +0100 Subject: [PATCH 44/46] status: 0x004393C0 says which tail call target differs CurrentlySelectedTroops keeps 100.0% (reccmp: 96.3% raw, 100% normalized), as main's 0x004C01B0 and 0x004C0860 lines do, and the remark now names what is left. It ends both arms with a tail jump to recountUnitsInSelection (0x00535240), at 0x004393FE for slots below 20 and at 0x0043942D for the rest. That function is still Pending, so reccmp has no name for it and shows both jumps as displacements; ours both read as the second jump's, so only the first one differs. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- status/addresses-SHC-3BB0A8C1.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 4865cbd4bb..128a8e10d2 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13359,7 +13359,7 @@ SHC_3BB0A8C1_0x00439380 | 0.0% | Pending SHC_3BB0A8C1_0x00439390 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004393C0 | 100.0% | Reimplemented +SHC_3BB0A8C1_0x004393C0 | 100.0% | Reimplemented, only the first of the two recountUnitsInSelection tail call targets differs, while that function is pending SHC_3BB0A8C1_0x00439440 | 100.0% | Reimplemented From 4743fd3456712f4ceb1edc92079d05dcb728d546 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 18:37:35 +0100 Subject: [PATCH 45/46] MenuItems backlog: the last comments, one include, one empty default The three scrollbar handlers whose case 5 stores and returns (ProviderScrollbarUnk, EditScenario_Scrollbar, General_MessageScrollbar) get the line main's BuildingAvailability_Scrollbar has for that shape. CustomScenarios_Main includes MenuModalType.hpp for the MMT_LOAD_MAP it passes, as main's other MenuItems files do. ProviderTableRows loses an empty `default: break;` at the end of its switch, and CurrentlySelectedTroops' comment names its parameter. Comments only, apart from the include and the default: quick_diff output is identical for every changed file. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5.5 --- .../MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp | 2 +- ...andler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp | 1 + ...onHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp | 2 -- .../MenuItemActionHandler_CustomScenarios_Main.cpp | 1 + .../MenuItemActionHandler_EditScenario_Scrollbar.cpp | 1 + .../General/MenuItemActionHandler_General_MessageScrollbar.cpp | 1 + 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp index 1935de17b1..064459c841 100644 --- a/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp +++ b/src/OpenSHC/UI/MenuItems/BuildMenu/MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops.cpp @@ -15,7 +15,7 @@ namespace UI { void BuildMenu::MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops(int slotID, ...) { DAT_UnitsState::instance.unitControlsRelated = 1; - // 20 selection slots: buttons 0-19 keep only a slot's unit type selected, 20-39 drop it + // 20 selection slots: slotID 0-19 keeps only a slot's unit type selected, 20-39 drops it if (slotID < 20) { UnitTypeInt const unitType = DAT_RenderingDefinedData::instance diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp index 72a9fee5e2..dbf56cda75 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderScrollbarUnk.cpp @@ -25,6 +25,7 @@ namespace UI { *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; return; case 5: + // Stores and returns here rather than through the shared store below, as the original does. if (DAT_GameSynchronyState::instance.scrollBarItemOffset > 0) { --DAT_GameSynchronyState::instance.scrollBarItemOffset; *currentValue = DAT_GameSynchronyState::instance.scrollBarItemOffset; diff --git a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp index 731db0e518..0a0bbbf228 100644 --- a/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp +++ b/src/OpenSHC/UI/MenuItems/ChooseNetworkServiceProvider/MenuItemActionHandler_ChooseNetworkServiceProvider_ProviderTableRows.cpp @@ -34,8 +34,6 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( OpenSHC::Text::TAIT_SEVEN__NUMERIC_ONLY); break; - default: - break; } } diff --git a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp index af9d95962f..9b7af20b23 100644 --- a/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/CustomScenarios/MenuItemActionHandler_CustomScenarios_Main.cpp @@ -5,6 +5,7 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/UI/MenuTextInputState.func.hpp" #include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" #include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" diff --git a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp index 5faaea56f4..5d29ea8a4a 100644 --- a/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/EditScenario/MenuItemActionHandler_EditScenario_Scrollbar.cpp @@ -29,6 +29,7 @@ namespace UI { *maxValue = DAT_MapPropertiesState::instance.eventsCount - 20; return; case 5: + // Stores and returns here rather than through the shared store below, as the original does. if (DAT_MapPropertiesState::instance.eventListScrollOffset > 0) { --DAT_MapPropertiesState::instance.eventListScrollOffset; *currentValue = DAT_MapPropertiesState::instance.eventListScrollOffset; diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp index 36f02cc41b..ddcd363968 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_MessageScrollbar.cpp @@ -25,6 +25,7 @@ namespace UI { *maxValue = DAT_MapPropertiesState::instance.total - DAT_MapPropertiesState::instance.visibleRowCount; return; case 5: + // Stores and returns here rather than through the shared store below, as the original does. if (DAT_MapPropertiesState::instance.offset > 0) { --DAT_MapPropertiesState::instance.offset; *currentValue = DAT_MapPropertiesState::instance.offset; From d3b8b6bcf4b13e0771f4489a473e20ff4ba0fb5b Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 9 Nov 2026 18:37:35 +0100 Subject: [PATCH 46/46] status: 0x004393C0's remark in main's wording "while its resolver is off", as main's 0x004C01B0 and 0x004C0860 lines say it: recountUnitsInSelection (0x00535240) is pending and its function resolver is false on main. Co-Authored-By: Claude Opus 5.5 --- status/addresses-SHC-3BB0A8C1.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 128a8e10d2..39df0dbf03 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -13359,7 +13359,7 @@ SHC_3BB0A8C1_0x00439380 | 0.0% | Pending SHC_3BB0A8C1_0x00439390 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004393C0 | 100.0% | Reimplemented, only the first of the two recountUnitsInSelection tail call targets differs, while that function is pending +SHC_3BB0A8C1_0x004393C0 | 100.0% | Reimplemented, only the first of the two recountUnitsInSelection tail call targets differs, while its resolver is off SHC_3BB0A8C1_0x00439440 | 100.0% | Reimplemented