From a6e01115a0fce789b1b5bc4072c7daff53fc125a Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:21:28 +0200 Subject: [PATCH 01/61] reimplement: SHC_3BB0A8C1_0x00408EB0 100% --- .../BinkControlClass/stopAllBinkPlayback.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp new file mode 100644 index 00000000..d3953e52 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" + +namespace OpenSHC { +namespace Rendering { + namespace Bink { + + // FUNCTION: STRONGHOLDCRUSADER 0x00408EB0 + void BinkControlClass::stopAllBinkPlayback() + { + int binkObjIndex = 0; + do { + MACRO_CALL_MEMBER(BinkControlClass_Func::stopBinkPlayback, this)(binkObjIndex); + binkObjIndex = binkObjIndex + 1; + } while (binkObjIndex < 2); + } + + } // namespace Bink +} // namespace Rendering +} // namespace OpenSHC From 10c442d257b44e35a5097d00443bc66e6f3790c6 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:21:50 +0200 Subject: [PATCH 02/61] reimplement: SHC_3BB0A8C1_0x004092B0 100% --- .../BinkControlClass/stopAllBinkPlaybackThunk.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp new file mode 100644 index 00000000..fe5c0ce5 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" + +namespace OpenSHC { +namespace Rendering { + namespace Bink { + + // FUNCTION: STRONGHOLDCRUSADER 0x004092B0 + void BinkControlClass::stopAllBinkPlaybackThunk() + { + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::stopAllBinkPlayback, this)(); + } + + } +} +} From 910c6a7343d34cdae605bbdcce037fbddb8cadfc Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:24:54 +0200 Subject: [PATCH 03/61] reimplement: SHC_3BB0A8C1_0x0043FCA0 100% --- ..._BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp new file mode 100644 index 00000000..3f72fa1f --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/UI.func.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0043FCA0 +void __cdecl UI ::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton() +{ + MACRO_CALL( + OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); +} + +} From c7952cab06cdb0f12773f5f9f81ed3bf8437672b Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:27:40 +0200 Subject: [PATCH 04/61] reimplement: SHC_3BB0A8C1_0x004ABD10 100% --- .../MenuModalRenderFunction_TutorialBox_Thunk.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp new file mode 100644 index 00000000..f46ba8c1 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp @@ -0,0 +1,15 @@ + + +#include "OpenSHC/UI.func.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004abd10 + void __cdecl MenuModalRenderFunction_TutorialBox_Thunk(int x, int y, int width, int height) + { + MACRO_CALL(UI_Func::MenuModalRenderFunction_TutorialBox)(x, y, width, height); + } + +} // namespace UI +} // namespace OpenSHC From 70587278decfe5d462992d251eaef689800951f6 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:49:09 +0200 Subject: [PATCH 05/61] reimplement: SHC_3BB0A8C1_0x00533090 100% --- .../Map/Units/UnitsState/returnFalseStub.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/OpenSHC/Map/Units/UnitsState/returnFalseStub.cpp diff --git a/src/OpenSHC/Map/Units/UnitsState/returnFalseStub.cpp b/src/OpenSHC/Map/Units/UnitsState/returnFalseStub.cpp new file mode 100644 index 00000000..06a3245d --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/returnFalseStub.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00533090 + BOOLEnum UnitsState::returnFalseStub() { return FALSE; } + + } +} +} From bfe598604fcd63f783f332464a89aa117954947e Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:53:02 +0200 Subject: [PATCH 06/61] reimplement: SHC_3BB0A8C1_0x004BC620 100% --- src/OpenSHC/Input/getCurrentTutorialStep.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/OpenSHC/Input/getCurrentTutorialStep.cpp diff --git a/src/OpenSHC/Input/getCurrentTutorialStep.cpp b/src/OpenSHC/Input/getCurrentTutorialStep.cpp new file mode 100644 index 00000000..564f6f7b --- /dev/null +++ b/src/OpenSHC/Input/getCurrentTutorialStep.cpp @@ -0,0 +1,11 @@ +#include "OpenSHC/Input.func.hpp" + +#include "OpenSHC/Globals/DAT_TutorialCurrentStep.hpp" + +namespace OpenSHC { +namespace Input { + + // FUNCTION: STRONGHOLDCRUSADER 0x004BC620 + undefined4 __cdecl OpenSHC::Input::GetCurrentTutorialStep(void) { return DAT_TutorialCurrentStep::instance; } +} +} From 0dcfd17fb84edae2ac79128b9972e3f6f0039b0e Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:55:44 +0200 Subject: [PATCH 07/61] reimplement: SHC_3BB0A8C1_0x00469860 100% --- .../Text/UserTextHandler/getCurrentFontSize.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/OpenSHC/Text/UserTextHandler/getCurrentFontSize.cpp diff --git a/src/OpenSHC/Text/UserTextHandler/getCurrentFontSize.cpp b/src/OpenSHC/Text/UserTextHandler/getCurrentFontSize.cpp new file mode 100644 index 00000000..c713f3da --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/getCurrentFontSize.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00469860 + int UserTextHandler::getCurrentFontSize() { return this->textArrayFontSizes[this->textArrayIndex]; } + +} +} From 63755c21839144deff15ac303dd4ce8a92ff1e7f Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 01:57:22 +0200 Subject: [PATCH 08/61] reimplement: SHC_3BB0A8C1_0x00480570 100% --- .../GameSynchronyState/getGameCommandArrayIndex.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/getGameCommandArrayIndex.cpp diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/getGameCommandArrayIndex.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/getGameCommandArrayIndex.cpp new file mode 100644 index 00000000..fb01abc8 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/getGameCommandArrayIndex.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + +namespace OpenSHC { +namespace Synchrony { + + // FUNCTION: STRONGHOLDCRUSADER 0x00480570 + undefined4 GameSynchronyState::getGameCommandArrayIndex() { return this->DAT_GameCommandArrayIndex; } + +} +} From 2f8d55526948743c8c059d67ff8941b4edde89fc Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 02:00:48 +0200 Subject: [PATCH 09/61] reimplement: SHC_3BB0A8C1_0x00496E20 100% --- .../PathFindingState/getComputationalTileIndex.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/getComputationalTileIndex.cpp diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/getComputationalTileIndex.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/getComputationalTileIndex.cpp new file mode 100644 index 00000000..b5329ac1 --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/getComputationalTileIndex.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x00496E20 + undefined4 PathFindingState::getComputationalTileIndex() { return this->searchQueue.writeIndex; } + + } // namespace Navigation +} // namespace Map +} // namespace OpenSHC From 9f02adcfec4312e11bdae254f6809913385d733a Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 02:02:32 +0200 Subject: [PATCH 10/61] reimplement: SHC_3BB0A8C1_0x00424310 100% --- ...lyVersionUpgradeAccessibilityRecompute.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp new file mode 100644 index 00000000..e223c865 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/IO/PackagedFileMagicNum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Buildings { + + using OpenSHC::IO::PackagedFileMagicNum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00424310 + void BuildingsState::applyVersionUpgradeAccessibilityRecompute( + PackagedFileMagicNum receivedMapVersion, PackagedFileMagicNum packagerMapVersion) + { + MACRO_CALL_MEMBER( + OpenSHC::Map::Buildings::BuildingsState_Func::recomputeAccessibilityForAllBuildings, this)(); + } + + } +} +} From c4541256e1de6ad4b1e34fddf4347ef8f259bc5c Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 02:24:20 +0200 Subject: [PATCH 11/61] reimplement: SHC_3BB0A8C1_0x0043F2B0 100% --- ...gAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp new file mode 100644 index 00000000..2b53b168 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0043F2B0 +void __cdecl UI::MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk() +{ + DAT_GameCore::instance.field80_0x144 = DAT_GameCore::instance.field80_0x144 ^ 1; +} + +} From f2e3ccce3d32b45da6ed129d9065edf305cf8f1d Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 03:16:59 +0200 Subject: [PATCH 12/61] reimplement: SHC_3BB0A8C1_0x004038A0 100% --- .../Map/Version/UpgradeSetCurrentEntityID3000.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp diff --git a/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp b/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp new file mode 100644 index 00000000..67f464e0 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Version.func.hpp" + +#include "OpenSHC/Globals/DAT_CurrentEntityID.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004038A0 + void Version ::UpgradeSetCurrentEntityID3000() { DAT_CurrentEntityID::instance = 3000; } + +} +} From 6b8084eaffa119d79ee85106157242eb1f3be25a Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 03:17:49 +0200 Subject: [PATCH 13/61] reimplement: SHC_3BB0A8C1_0x0040BFD0 100% --- .../getBuildingStorageTypeForResourceType.cpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp new file mode 100644 index 00000000..a37a1c7d --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + +#include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + namespace Buildings { + + using OpenSHC::Game::Resources::ResourceType; + using OpenSHC::Map::Buildings::BuildingType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0040BFD0 + BuildingType BuildingsState ::getBuildingStorageTypeForResourceType(ResourceType resourceType) + { + return (BuildingType)(DAT_BuildingDefinedData::instance.StorageBuildingTypeArray[resourceType]); + } + + } +} +} From 5abdb7cbe75b2b836c9279e62a524b79627955b2 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 03:18:26 +0200 Subject: [PATCH 14/61] reimplement: SHC_3BB0A8C1_0x00434260 100% --- .../UI/MenuItemActionHandler_General_Unknown2.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp new file mode 100644 index 00000000..5c219a56 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00434260 +void __cdecl UI::MenuItemActionHandler_General_Unknown2(int param_1, ...) +{ + DAT_GameCore::instance.field12_0x30 = param_1; +} + +} From d9795fda867ceda8ea6f089aebec53ead740ee65 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 13:53:34 +0200 Subject: [PATCH 15/61] many 100% --- .../SoundSystem/markMusicChangePending.cpp | 2 +- .../mss/SoundSystem/setSection1079_28_4_.cpp | 4 +- .../Game/GameCore/setViewOnExitUnk.cpp | 13 ++++ .../GameStateStructures/getBatchBuyPrice.cpp | 13 ++++ .../getBuildingStorageTypeForResourceType.cpp | 2 +- .../getRandomRockImageOffset.cpp | 15 ++++ .../PathFindingState/getTileInSearchQueue.cpp | 12 +++ .../getYSmallerThanYLimit.cpp | 15 ++++ .../Map/TileMapState/setMapRotation.cpp | 10 +++ .../constructTroopValueState.cpp | 18 +++++ .../UnitsState/relayTribeInstruction.cpp | 22 ++++++ .../UnitsState/selectionHasEngineers.cpp | 15 ++++ .../UpdateDestroyedBuildingCountData.cpp | 15 ++++ .../Version/UpgradeSetCurrentEntityID3000.cpp | 2 +- .../resetupViewportThunk.cpp | 14 ++++ .../ViewportRenderState/restoreFocusTile.cpp | 13 ++++ .../Synchrony/Commands/_REMOVED_COMMAND1_.cpp | 12 +++ .../Text/UserTextHandler/handleReturnKey.cpp | 10 +++ .../UserTextHandler/resetCursorToStart.cpp | 10 +++ .../UI/CaptureCurrentTimeToUnknownTime01.cpp | 10 +++ src/OpenSHC/UI/DisableMercPostPortraits.cpp | 10 +++ ...SetEnoughGoldForRequestedUnitToTrueUnk.cpp | 15 ++++ src/OpenSHC/UI/Helpers/SumUnitPoints.cpp | 16 ++++ ...r_BuildingAndStatusMenu_UnknownMin1Unk.cpp | 10 +++ ...uildingAndStatusMenu_Unknown_Countdown.cpp | 10 +++ ...ler_BuildingAndStatusMenu_Unknown_Min1.cpp | 10 +++ ...RemoveConditionalTextOrReleaseHoverUnk.cpp | 15 ++++ ...MenuItemActionHandler_General_Unknown2.cpp | 5 +- ...tionHandler_UnusedOldTitleMenu_General.cpp | 13 ++++ .../UI/MenuItemFunction_General_Unknown.cpp | 10 +++ .../UI/MenuModalRenderFunction_TextEditor.cpp | 14 ++++ ...View_UnusedHelpTextEditor_DoEveryFrame.cpp | 14 ++++ .../AlphaAndButtonSurface/freeMemory.cpp | 18 +++++ .../RenderBuildingMenu_RecruitingBuilding.cpp | 17 +++++ .../setActiveMenuTabIndexToZero.cpp | 12 +++ .../TextureRenderCore/setMenuTabIndexUnk.cpp | 15 ++++ .../finalizeDirectDrawShutdown.cpp | 20 +++++ src/OpenSHC/UI/RestoreScenarioGold.cpp | 14 ++++ status/addresses-SHC-3BB0A8C1.txt | 74 +++++++++---------- 39 files changed, 493 insertions(+), 46 deletions(-) create mode 100644 src/OpenSHC/Game/GameCore/setViewOnExitUnk.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp create mode 100644 src/OpenSHC/Map/LandscapeState/getRandomRockImageOffset.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/getTileInSearchQueue.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/getYSmallerThanYLimit.cpp create mode 100644 src/OpenSHC/Map/TileMapState/setMapRotation.cpp create mode 100644 src/OpenSHC/Map/Units/TroopValueState/constructTroopValueState.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/relayTribeInstruction.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionHasEngineers.cpp create mode 100644 src/OpenSHC/Map/Version/UpdateDestroyedBuildingCountData.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp create mode 100644 src/OpenSHC/Synchrony/Commands/_REMOVED_COMMAND1_.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/handleReturnKey.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/resetCursorToStart.cpp create mode 100644 src/OpenSHC/UI/CaptureCurrentTimeToUnknownTime01.cpp create mode 100644 src/OpenSHC/UI/DisableMercPostPortraits.cpp create mode 100644 src/OpenSHC/UI/Helpers/SetEnoughGoldForRequestedUnitToTrueUnk.cpp create mode 100644 src/OpenSHC/UI/Helpers/SumUnitPoints.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_UnknownMin1Unk.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Countdown.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Min1.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp create mode 100644 src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_TextEditor.cpp create mode 100644 src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_DoEveryFrame.cpp create mode 100644 src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/freeMemory.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderBuildingMenu_RecruitingBuilding.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp create mode 100644 src/OpenSHC/UI/Rendering/WindowAndDirectDraw/finalizeDirectDrawShutdown.cpp create mode 100644 src/OpenSHC/UI/RestoreScenarioGold.cpp diff --git a/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp b/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp index b626e2db..16c08d09 100644 --- a/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp +++ b/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp @@ -1,4 +1,4 @@ -#include "../SoundSystem.func.hpp" +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" namespace OpenSHC { namespace Audio { diff --git a/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp b/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp index 5723e377..e03a04b2 100644 --- a/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp +++ b/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp @@ -1,4 +1,4 @@ -#include "../SoundSystem.func.hpp" +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" #include "OpenSHC/Globals/DAT_SoundEffectsHelperData1.hpp" @@ -9,7 +9,7 @@ namespace Audio { // FUNCTION: STRONGHOLDCRUSADER 0x0047A570 void SoundSystem::setSection1079_28_4_(int param_1) { - DAT_SoundEffectsHelperData1::ptr->SEC_Section1079.field7_0x1c = param_1; + DAT_SoundEffectsHelperData1::instance.SEC_Section1079.field7_0x1c = param_1; } } diff --git a/src/OpenSHC/Game/GameCore/setViewOnExitUnk.cpp b/src/OpenSHC/Game/GameCore/setViewOnExitUnk.cpp new file mode 100644 index 00000000..15441316 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/setViewOnExitUnk.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::UI::Enums::MenuViewType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0046B2F0 + void GameCore::setViewOnExitUnk() { this->currentMenuViewType = ((MenuViewType)2); } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp new file mode 100644 index 00000000..dc456d60 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + +namespace OpenSHC { +namespace Game { + + // FUNCTION: STRONGHOLDCRUSADER 0x00458890 + int GameStateStructures::getBatchBuyPrice(undefined4 playerID, int resourceType) + { + return this->mapAndTime.buyAndSalesPriceArray[resourceType].buyPrice; + } + +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp index a37a1c7d..f938cfd7 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp @@ -12,7 +12,7 @@ namespace Map { using OpenSHC::Map::Buildings::BuildingType; // FUNCTION: STRONGHOLDCRUSADER 0x0040BFD0 - BuildingType BuildingsState ::getBuildingStorageTypeForResourceType(ResourceType resourceType) + BuildingType BuildingsState::getBuildingStorageTypeForResourceType(ResourceType resourceType) { return (BuildingType)(DAT_BuildingDefinedData::instance.StorageBuildingTypeArray[resourceType]); } diff --git a/src/OpenSHC/Map/LandscapeState/getRandomRockImageOffset.cpp b/src/OpenSHC/Map/LandscapeState/getRandomRockImageOffset.cpp new file mode 100644 index 00000000..e223377e --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/getRandomRockImageOffset.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" + +#include "OpenSHC/Globals/DAT_OrganismDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004F2A10 + int LandscapeState::getRandomRockImageOffset(int param_1) + { + return DAT_OrganismDefinedData::instance.RandomRockImageGMImageOffsets[param_1]; + } + +} +} diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/getTileInSearchQueue.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/getTileInSearchQueue.cpp new file mode 100644 index 00000000..1b76cae8 --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/getTileInSearchQueue.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x00496E30 + int PathFindingState::getTileInSearchQueue(int index) { return this->searchQueue.tilesQueue[index]; } + + } +} +} diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/getYSmallerThanYLimit.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/getYSmallerThanYLimit.cpp new file mode 100644 index 00000000..7e1e89c5 --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/getYSmallerThanYLimit.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Navigation { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0049B1C0 + BOOLEnum PathFindingState::getYSmallerThanYLimit() { return this->mappingYRelated <= this->yLimit; } + + } +} +} diff --git a/src/OpenSHC/Map/TileMapState/setMapRotation.cpp b/src/OpenSHC/Map/TileMapState/setMapRotation.cpp new file mode 100644 index 00000000..fb91f8b3 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/setMapRotation.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004F70E0 + void TileMapState::setMapRotation(undefined4 newRotation) { this->DAT_FutureMapOrientation = newRotation; } + +} +} diff --git a/src/OpenSHC/Map/Units/TroopValueState/constructTroopValueState.cpp b/src/OpenSHC/Map/Units/TroopValueState/constructTroopValueState.cpp new file mode 100644 index 00000000..acfc2761 --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/constructTroopValueState.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::TroopValueState; + + // FUNCTION: STRONGHOLDCRUSADER 0x0051D680 + TroopValueState* TroopValueState::constructTroopValueState() + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TroopValueState_Func::clearAttackInfo, this)(); + return this; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/relayTribeInstruction.cpp b/src/OpenSHC/Map/Units/UnitsState/relayTribeInstruction.cpp new file mode 100644 index 00000000..30028e08 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/relayTribeInstruction.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitInstructionType.hpp" + +#include "OpenSHC/Globals/DAT_TribesState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitInstructionType; + + // FUNCTION: STRONGHOLDCRUSADER 0x005371E0 + void UnitsState::relayTribeInstruction( + int tribeID, UnitInstructionType instructionType, int targetID_1, int targetID_2, int param_5) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::giveTribeAnInstruction, DAT_TribesState::ptr)( + tribeID, instructionType, targetID_1, targetID_2, param_5); + } + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionHasEngineers.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionHasEngineers.cpp new file mode 100644 index 00000000..c4755947 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionHasEngineers.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00535550 + BOOLEnum UnitsState::selectionHasEngineers() { return this->selectionEngineers != 0; } + + } +} +} diff --git a/src/OpenSHC/Map/Version/UpdateDestroyedBuildingCountData.cpp b/src/OpenSHC/Map/Version/UpdateDestroyedBuildingCountData.cpp new file mode 100644 index 00000000..85a59922 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpdateDestroyedBuildingCountData.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Map/Version.func.hpp" + +#include "OpenSHC/Globals/DAT_DestroyedBuildingsCountHistory.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044AAA0 + void Version::UpdateDestroyedBuildingCountData(int param_1) + { + DAT_DestroyedBuildingsCountHistory::instance[0] = DAT_DestroyedBuildingsCountHistory::instance[0] + param_1; + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp b/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp index 67f464e0..97b23d68 100644 --- a/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp +++ b/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { namespace Map { // FUNCTION: STRONGHOLDCRUSADER 0x004038A0 - void Version ::UpgradeSetCurrentEntityID3000() { DAT_CurrentEntityID::instance = 3000; } + void Version::UpgradeSetCurrentEntityID3000() { DAT_CurrentEntityID::instance = 3000; } } } diff --git a/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp new file mode 100644 index 00000000..d3eb6027 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +namespace OpenSHC { +namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x004E7800 + void ViewportRenderState::resetupViewportThunk() + { + MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::resetupViewport, this)( + this->viewportState.isZoomedOutUnk); + } + +} +} diff --git a/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp b/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp new file mode 100644 index 00000000..41736049 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +namespace OpenSHC { +namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x004E8C90 + void ViewportRenderState::restoreFocusTile() + { + MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::focusOnTile, this)(this->field44_0x18b738); + } + +} +} diff --git a/src/OpenSHC/Synchrony/Commands/_REMOVED_COMMAND1_.cpp b/src/OpenSHC/Synchrony/Commands/_REMOVED_COMMAND1_.cpp new file mode 100644 index 00000000..3336d85a --- /dev/null +++ b/src/OpenSHC/Synchrony/Commands/_REMOVED_COMMAND1_.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Synchrony/Commands.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + // FUNCTION: STRONGHOLDCRUSADER 0x00482280 + void Commands::_REMOVED_COMMAND1_() { DAT_GameSynchronyState::instance.DAT_CommandSize = 0; } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/handleReturnKey.cpp b/src/OpenSHC/Text/UserTextHandler/handleReturnKey.cpp new file mode 100644 index 00000000..52a58801 --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/handleReturnKey.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00469870 + void UserTextHandler::handleReturnKey() { this->returnPressed = 1; } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/resetCursorToStart.cpp b/src/OpenSHC/Text/UserTextHandler/resetCursorToStart.cpp new file mode 100644 index 00000000..1b1ca3d2 --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/resetCursorToStart.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x004698C0 + void UserTextHandler::resetCursorToStart() { this->textCursorIndexArray[this->textArrayIndex] = 0; } + +} +} diff --git a/src/OpenSHC/UI/CaptureCurrentTimeToUnknownTime01.cpp b/src/OpenSHC/UI/CaptureCurrentTimeToUnknownTime01.cpp new file mode 100644 index 00000000..2dec9bba --- /dev/null +++ b/src/OpenSHC/UI/CaptureCurrentTimeToUnknownTime01.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_UnknownTime_01.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004B9610 +void UI::CaptureCurrentTimeToUnknownTime01() { DAT_UnknownTime_01::instance = timeGetTime(); } + +} diff --git a/src/OpenSHC/UI/DisableMercPostPortraits.cpp b/src/OpenSHC/UI/DisableMercPostPortraits.cpp new file mode 100644 index 00000000..a29b6169 --- /dev/null +++ b/src/OpenSHC/UI/DisableMercPostPortraits.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_DisableMercPostPortraits.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00466E10 +void UI::DisableMercPostPortraits() { DAT_DisableMercPostPortraits::instance = 1; } + +} diff --git a/src/OpenSHC/UI/Helpers/SetEnoughGoldForRequestedUnitToTrueUnk.cpp b/src/OpenSHC/UI/Helpers/SetEnoughGoldForRequestedUnitToTrueUnk.cpp new file mode 100644 index 00000000..22b974ab --- /dev/null +++ b/src/OpenSHC/UI/Helpers/SetEnoughGoldForRequestedUnitToTrueUnk.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00466E00 + void Helpers::SetEnoughGoldForRequestedUnitToTrueUnk() { DAT_EnoughGoldForRequestedUnit::instance = TRUE; } + +} +} diff --git a/src/OpenSHC/UI/Helpers/SumUnitPoints.cpp b/src/OpenSHC/UI/Helpers/SumUnitPoints.cpp new file mode 100644 index 00000000..3dfb0682 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/SumUnitPoints.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" + +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B8200 + void Helpers::SumUnitPoints() + { + MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::sumUnitPoints, DAT_MapPropertiesState::ptr)(); + } + +} +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_UnknownMin1Unk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_UnknownMin1Unk.cpp new file mode 100644 index 00000000..9b89280d --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_UnknownMin1Unk.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/INT_00df335c.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00464D90 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_UnknownMin1Unk() { INT_00df335c::instance = -1; } + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Countdown.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Countdown.cpp new file mode 100644 index 00000000..27ee080d --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Countdown.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0043A850 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Countdown() { DAT_GameCore::instance.countdown = 1; } + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Min1.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Min1.cpp new file mode 100644 index 00000000..cdd10b3d --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Min1.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_00df3350.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004649C0 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_Unknown_Min1() { DAT_00df3350::instance = 0xffffffff; } + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp new file mode 100644 index 00000000..34bce71c --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" + +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004F6A70 +void UI::MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk(int param_1, ...) +{ + MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::hasPassedCountdownOrDuration, + DAT_BottomLeftTextDisplayState::ptr)(); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp index 5c219a56..32f61b0e 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp @@ -5,9 +5,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00434260 -void __cdecl UI::MenuItemActionHandler_General_Unknown2(int param_1, ...) -{ - DAT_GameCore::instance.field12_0x30 = param_1; -} +void UI::MenuItemActionHandler_General_Unknown2(int param_1, ...) { DAT_GameCore::instance.field12_0x30 = param_1; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp b/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp new file mode 100644 index 00000000..33e1ff0f --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00440420 +void UI::MenuItemActionHandler_UnusedOldTitleMenu_General(int param_1, ...) +{ + DAT_WindowAndDirectDraw::instance.postWindowCloseMessage = 1; +} + +} diff --git a/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp b/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp new file mode 100644 index 00000000..101381b3 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_StopHandlingMenuItems.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00440410 +void UI::MenuItemFunction_General_Unknown(int param_1, ...) { DAT_StopHandlingMenuItems::instance = 0; } + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TextEditor.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TextEditor.cpp new file mode 100644 index 00000000..ee70d322 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TextEditor.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAB40 +void UI::MenuModalRenderFunction_TextEditor(int x, int y, int width, int height) +{ + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::setTextRenderingLogic, DAT_TextEditorState::ptr)(); +} + +} diff --git a/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_DoEveryFrame.cpp new file mode 100644 index 00000000..49307f81 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_DoEveryFrame.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00440400 +void UI::MenuView_UnusedHelpTextEditor_DoEveryFrame() +{ + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::renderHelpDialogIfOpen, DAT_TextEditorState::ptr)(); +} + +} diff --git a/src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/freeMemory.cpp b/src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/freeMemory.cpp new file mode 100644 index 00000000..6b4777c8 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/freeMemory.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0045D0B0 + void AlphaAndButtonSurface::freeMemory() + { + if (this->surfacePtr != (ushort*)0x0) { + MACRO_CALL(OpenSHC::OS_Func::_free_base)(this->surfacePtr); + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderBuildingMenu_RecruitingBuilding.cpp b/src/OpenSHC/UI/Rendering/RenderBuildingMenu_RecruitingBuilding.cpp new file mode 100644 index 00000000..dbf86c5a --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderBuildingMenu_RecruitingBuilding.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x0043A8D0 + void Rendering::RenderBuildingMenu_RecruitingBuilding() + { + MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::createEntityForAssemblyPointsForActiveTabType, + DAT_BuildingsState::ptr)(); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp new file mode 100644 index 00000000..3ef586ac --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00454EF0 + void TextureRenderCore::setActiveMenuTabIndexToZero() { this->activeMenuTabIndex = 0; } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp new file mode 100644 index 00000000..dbfdfea9 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00454EE0 + void TextureRenderCore::setMenuTabIndexUnk(int indexToSetToMinusOne) + { + this->activeMenuTabIndex = indexToSetToMinusOne + 1; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/WindowAndDirectDraw/finalizeDirectDrawShutdown.cpp b/src/OpenSHC/UI/Rendering/WindowAndDirectDraw/finalizeDirectDrawShutdown.cpp new file mode 100644 index 00000000..4dfd6600 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/WindowAndDirectDraw/finalizeDirectDrawShutdown.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00467E40 + void WindowAndDirectDraw::finalizeDirectDrawShutdown() + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::WindowAndDirectDraw_Func::releaseSurfacesAndDirectDraw, this)( + TRUE); + CoUninitialize(); + } + + } +} +} diff --git a/src/OpenSHC/UI/RestoreScenarioGold.cpp b/src/OpenSHC/UI/RestoreScenarioGold.cpp new file mode 100644 index 00000000..f1b24f8f --- /dev/null +++ b/src/OpenSHC/UI/RestoreScenarioGold.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_CopyOfScenarioGold.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004B8210 +void UI::RestoreScenarioGold() +{ + DAT_GameState::instance.mapAndTime.scenarioGold = (short)DAT_CopyOfScenarioGold::instance; +} + +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 10a0c2b0..374ac41f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -531,7 +531,7 @@ SHC_3BB0A8C1_0x004036F0 | 0.0% | Pending SHC_3BB0A8C1_0x00403790 | 0.0% | Pending -SHC_3BB0A8C1_0x004038A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004038A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004038B0 | 0.0% | Pending @@ -4331,7 +4331,7 @@ SHC_3BB0A8C1_0x0040BF40 | 0.0% | Pending SHC_3BB0A8C1_0x0040BFA0 | 0.0% | Pending -SHC_3BB0A8C1_0x0040BFD0 | 0.0% | Pending +SHC_3BB0A8C1_0x0040BFD0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0040BFE0 | 0.0% | Pending @@ -11137,7 +11137,7 @@ SHC_3BB0A8C1_0x00434228 | 0.0% | Pending SHC_3BB0A8C1_0x00434230 | 0.0% | Pending -SHC_3BB0A8C1_0x00434260 | 0.0% | Pending +SHC_3BB0A8C1_0x00434260 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00434270 | 0.0% | Pending @@ -13393,7 +13393,7 @@ SHC_3BB0A8C1_0x00439890 | 0.0% | Pending SHC_3BB0A8C1_0x004398B0 | 0.0% | Pending -SHC_3BB0A8C1_0x0043A850 | 0.0% | Pending +SHC_3BB0A8C1_0x0043A850 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043A860 | 0.0% | Pending @@ -13401,7 +13401,7 @@ SHC_3BB0A8C1_0x0043A880 | 0.0% | Pending SHC_3BB0A8C1_0x0043A8C0 | 0.0% | Pending -SHC_3BB0A8C1_0x0043A8D0 | 0.0% | Pending +SHC_3BB0A8C1_0x0043A8D0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043A8E0 | 0.0% | Pending @@ -13633,11 +13633,11 @@ SHC_3BB0A8C1_0x00440360 | 0.0% | Pending SHC_3BB0A8C1_0x004403D0 | 0.0% | Pending -SHC_3BB0A8C1_0x00440400 | 0.0% | Pending +SHC_3BB0A8C1_0x00440400 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00440410 | 0.0% | Pending +SHC_3BB0A8C1_0x00440410 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00440420 | 0.0% | Pending +SHC_3BB0A8C1_0x00440420 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00440430 | 0.0% | Pending @@ -16653,7 +16653,7 @@ SHC_3BB0A8C1_0x0044AA70 | 0.0% | Pending SHC_3BB0A8C1_0x0044AA80 | 0.0% | Pending -SHC_3BB0A8C1_0x0044AAA0 | 0.0% | Pending +SHC_3BB0A8C1_0x0044AAA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044AAB0 | 100.0% | Reimplemented @@ -16999,9 +16999,9 @@ SHC_3BB0A8C1_0x00454CE0 | 0.0% | Pending SHC_3BB0A8C1_0x00454D20 | 0.0% | Pending -SHC_3BB0A8C1_0x00454EE0 | 0.0% | Pending +SHC_3BB0A8C1_0x00454EE0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00454EF0 | 0.0% | Pending +SHC_3BB0A8C1_0x00454EF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00454F00 | 0.0% | Pending @@ -17713,7 +17713,7 @@ SHC_3BB0A8C1_0x00458820 | 0.0% | Pending SHC_3BB0A8C1_0x00458840 | 0.0% | Pending -SHC_3BB0A8C1_0x00458890 | 0.0% | Pending +SHC_3BB0A8C1_0x00458890 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004588A0 | 0.0% | Pending @@ -18017,7 +18017,7 @@ SHC_3BB0A8C1_0x0045ACC0 | 0.0% | Pending SHC_3BB0A8C1_0x0045AD10 | 0.0% | Pending -SHC_3BB0A8C1_0x0045AE00 | 0.0% | Pending +SHC_3BB0A8C1_0x0045AE00 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0045AE10 | 0.0% | Pending @@ -18149,7 +18149,7 @@ SHC_3BB0A8C1_0x0045D060 | 0.0% | Pending SHC_3BB0A8C1_0x0045D080 | 0.0% | Pending -SHC_3BB0A8C1_0x0045D0B0 | 0.0% | Pending +SHC_3BB0A8C1_0x0045D0B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0045D0C0 | 0.0% | Pending @@ -19843,11 +19843,11 @@ SHC_3BB0A8C1_0x00464856 | 0.0% | Pending SHC_3BB0A8C1_0x00464860 | 0.0% | Pending -SHC_3BB0A8C1_0x004649C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004649C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004649D0 | 0.0% | Pending -SHC_3BB0A8C1_0x00464D90 | 0.0% | Pending +SHC_3BB0A8C1_0x00464D90 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00464DA0 | 0.0% | Pending @@ -19987,9 +19987,9 @@ SHC_3BB0A8C1_0x00466C20 | 0.0% | Pending SHC_3BB0A8C1_0x00466D10 | 0.0% | Pending -SHC_3BB0A8C1_0x00466E00 | 0.0% | Pending +SHC_3BB0A8C1_0x00466E00 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00466E10 | 0.0% | Pending +SHC_3BB0A8C1_0x00466E10 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00466E20 | 0.0% | Pending @@ -20051,7 +20051,7 @@ SHC_3BB0A8C1_0x00467E04 | 0.0% | Pending SHC_3BB0A8C1_0x00467E26 | 0.0% | Pending -SHC_3BB0A8C1_0x00467E40 | 0.0% | Pending +SHC_3BB0A8C1_0x00467E40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00467E50 | 0.0% | Pending @@ -20131,13 +20131,13 @@ SHC_3BB0A8C1_0x00469800 | 0.0% | Pending SHC_3BB0A8C1_0x00469860 | 0.0% | Pending -SHC_3BB0A8C1_0x00469870 | 0.0% | Pending +SHC_3BB0A8C1_0x00469870 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00469880 | 0.0% | Pending SHC_3BB0A8C1_0x004698A0 | 0.0% | Pending -SHC_3BB0A8C1_0x004698C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004698C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004698D0 | 0.0% | Pending @@ -20743,7 +20743,7 @@ SHC_3BB0A8C1_0x0046B1B0 | 0.0% | Pending SHC_3BB0A8C1_0x0046B1F0 | 0.0% | Pending -SHC_3BB0A8C1_0x0046B2F0 | 0.0% | Pending +SHC_3BB0A8C1_0x0046B2F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0046B300 | 0.0% | Pending @@ -22547,7 +22547,7 @@ SHC_3BB0A8C1_0x004821D5 | 0.0% | Pending SHC_3BB0A8C1_0x004821E0 | 0.0% | Pending -SHC_3BB0A8C1_0x00482280 | 0.0% | Pending +SHC_3BB0A8C1_0x00482280 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00482290 | 0.0% | Pending @@ -24345,7 +24345,7 @@ SHC_3BB0A8C1_0x00496E1A | 0.0% | Pending SHC_3BB0A8C1_0x00496E20 | 0.0% | Pending -SHC_3BB0A8C1_0x00496E30 | 0.0% | Pending +SHC_3BB0A8C1_0x00496E30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00496E40 | 0.0% | Pending @@ -24417,7 +24417,7 @@ SHC_3BB0A8C1_0x0049AF50 | 0.0% | Pending SHC_3BB0A8C1_0x0049B000 | 0.0% | Pending -SHC_3BB0A8C1_0x0049B1C0 | 0.0% | Pending +SHC_3BB0A8C1_0x0049B1C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0049B1D0 | 0.0% | Pending @@ -25535,7 +25535,7 @@ SHC_3BB0A8C1_0x004AAB00 | 0.0% | Pending SHC_3BB0A8C1_0x004AAB20 | 0.0% | Pending -SHC_3BB0A8C1_0x004AAB40 | 0.0% | Pending +SHC_3BB0A8C1_0x004AAB40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AAB50 | 0.0% | Pending @@ -27107,9 +27107,9 @@ SHC_3BB0A8C1_0x004B8050 | 0.0% | Pending SHC_3BB0A8C1_0x004B8080 | 0.0% | Pending -SHC_3BB0A8C1_0x004B8200 | 0.0% | Pending +SHC_3BB0A8C1_0x004B8200 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B8210 | 0.0% | Pending +SHC_3BB0A8C1_0x004B8210 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B8220 | 0.0% | Pending @@ -27639,7 +27639,7 @@ SHC_3BB0A8C1_0x004B9528 | 0.0% | Pending SHC_3BB0A8C1_0x004B9530 | 0.0% | Pending -SHC_3BB0A8C1_0x004B9610 | 0.0% | Pending +SHC_3BB0A8C1_0x004B9610 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B9620 | 0.0% | Pending @@ -36985,7 +36985,7 @@ SHC_3BB0A8C1_0x004E66F0 | 0.0% | Pending SHC_3BB0A8C1_0x004E7770 | 0.0% | Pending -SHC_3BB0A8C1_0x004E7800 | 0.0% | Pending +SHC_3BB0A8C1_0x004E7800 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004E7810 | 0.0% | Pending @@ -37335,7 +37335,7 @@ SHC_3BB0A8C1_0x004E8C4C | 0.0% | Pending SHC_3BB0A8C1_0x004E8C50 | 0.0% | Pending -SHC_3BB0A8C1_0x004E8C90 | 0.0% | Pending +SHC_3BB0A8C1_0x004E8C90 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004E8CA0 | 0.0% | Pending @@ -38471,7 +38471,7 @@ SHC_3BB0A8C1_0x004F2970 | 0.0% | Pending SHC_3BB0A8C1_0x004F29C0 | 0.0% | Pending -SHC_3BB0A8C1_0x004F2A10 | 0.0% | Pending +SHC_3BB0A8C1_0x004F2A10 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F2A20 | 100.0% | Reimplemented @@ -38735,7 +38735,7 @@ SHC_3BB0A8C1_0x004F6A20 | 0.0% | Pending SHC_3BB0A8C1_0x004F6A60 | 0.0% | Pending -SHC_3BB0A8C1_0x004F6A70 | 0.0% | Pending +SHC_3BB0A8C1_0x004F6A70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F6A80 | 0.0% | Pending @@ -38759,7 +38759,7 @@ SHC_3BB0A8C1_0x004F70B0 | 0.0% | Pending SHC_3BB0A8C1_0x004F70D0 | 0.0% | Pending -SHC_3BB0A8C1_0x004F70E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004F70E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F70F0 | 0.0% | Pending @@ -46161,7 +46161,7 @@ SHC_3BB0A8C1_0x0051D5D0 | 0.0% | Pending SHC_3BB0A8C1_0x0051D5E0 | 0.0% | Pending -SHC_3BB0A8C1_0x0051D680 | 0.0% | Pending +SHC_3BB0A8C1_0x0051D680 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0051D690 | 0.0% | Pending @@ -51067,7 +51067,7 @@ SHC_3BB0A8C1_0x00535514 | 0.0% | Pending SHC_3BB0A8C1_0x00535520 | 0.0% | Pending -SHC_3BB0A8C1_0x00535550 | 0.0% | Pending +SHC_3BB0A8C1_0x00535550 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00535560 | 0.0% | Pending @@ -51231,7 +51231,7 @@ SHC_3BB0A8C1_0x00537160 | 0.0% | Pending SHC_3BB0A8C1_0x005371A0 | 0.0% | Pending -SHC_3BB0A8C1_0x005371E0 | 0.0% | Pending +SHC_3BB0A8C1_0x005371E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x005371F0 | 0.0% | Pending From a00566d1c9d05394e383aa66b87fe4c0c98bcbd1 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 13:55:48 +0200 Subject: [PATCH 16/61] remove __cdecl --- .../Audio/ResetGreatestLordGenieSpeechState.cpp | 2 +- .../Audio/SFX/UpdateUnitLossSpeechFeedback.cpp | 4 ++-- src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp | 4 ++-- .../IO/DecoderBuffer/ReadBufferAndComputeHash.cpp | 2 +- .../IO/DecoderBuffer/WriteBufferAndComputeHash.cpp | 2 +- src/OpenSHC/Input/getCurrentTutorialStep.cpp | 2 +- src/OpenSHC/OS/OS.cpp | 14 +++++++------- ...AndStatusMenu_PopularityMenuSwitchButtonUnk.cpp | 2 +- ...uildingAndStatusMenu_ArmyStatusSwitchButton.cpp | 2 +- .../MenuModalRenderFunction_TutorialBox_Thunk.cpp | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp b/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp index 53ff473a..1d16b204 100644 --- a/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp +++ b/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp @@ -21,7 +21,7 @@ namespace OpenSHC { namespace Audio { // FUNCTION: STRONGHOLDCRUSADER 0x0044A720 - void __cdecl ResetGreatestLordGenieSpeechState() + void ResetGreatestLordGenieSpeechState() { DAT_CurrentPlayerRanking::instance = -1; INT_00b98698::instance = -1; diff --git a/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp b/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp index 55eb522b..e5c31a35 100644 --- a/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp +++ b/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp @@ -22,7 +22,7 @@ namespace Audio { namespace SFX { // FUNCTION: STRONGHOLDCRUSADER 0x0044B840 - void __stdcall UpdateUnitLossSpeechFeedback() + void UpdateUnitLossSpeechFeedback() { if (DAT_GameCore::instance.currentMenuViewType != UI::Enums::MVT_BUILD_MENU) { return; @@ -180,7 +180,7 @@ namespace Audio { } // FUNCTION: STRONGHOLDCRUSADER 0x0044AAB0 - int __cdecl UpdateUnitLossSpeechFeedback_RelativeValueForGenie(int larger, int smaller) + int UpdateUnitLossSpeechFeedback_RelativeValueForGenie(int larger, int smaller) { if (larger < 1) { larger = 1; diff --git a/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp b/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp index dfa7378a..b7ec3f26 100644 --- a/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp +++ b/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp @@ -8,10 +8,10 @@ namespace OpenSHC { namespace Audio { namespace MSS { - void __cdecl AIL_shutdown_proxy() { AIL_shutdown(); } + void AIL_shutdown_proxy() { AIL_shutdown(); } // FUNCTION: STRONGHOLDCRUSADER 0x0057E160 - int __cdecl RegisterMilesAILShutdown() + int RegisterMilesAILShutdown() { MACRO_CALL(OS_Func::_atexit)(AIL_shutdown_proxy); return 0; diff --git a/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp b/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp index b093095d..cf37526c 100644 --- a/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp +++ b/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp @@ -9,7 +9,7 @@ namespace IO { namespace DecoderBuffer { // FUNCTION: STRONGHOLDCRUSADER 0x0046D270 - unsigned int __cdecl ReadBufferAndComputeHash(char* buf, unsigned int* size, void* param) + unsigned int ReadBufferAndComputeHash(char* buf, unsigned int* size, void* param) { uint bytesToLoad = *size; BufferHelper* bufferHelper = (BufferHelper*)param; diff --git a/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp b/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp index c0271829..069d5bcc 100644 --- a/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp +++ b/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp @@ -9,7 +9,7 @@ namespace IO { namespace DecoderBuffer { // FUNCTION: STRONGHOLDCRUSADER 0x0046D300 - void __cdecl WriteBufferAndComputeHash(char* buf, unsigned int* size, void* param) + void WriteBufferAndComputeHash(char* buf, unsigned int* size, void* param) { uint bytesToWrite = *size; BufferHelper* bufferHelper = (BufferHelper*)param; diff --git a/src/OpenSHC/Input/getCurrentTutorialStep.cpp b/src/OpenSHC/Input/getCurrentTutorialStep.cpp index 564f6f7b..4f93809a 100644 --- a/src/OpenSHC/Input/getCurrentTutorialStep.cpp +++ b/src/OpenSHC/Input/getCurrentTutorialStep.cpp @@ -6,6 +6,6 @@ namespace OpenSHC { namespace Input { // FUNCTION: STRONGHOLDCRUSADER 0x004BC620 - undefined4 __cdecl OpenSHC::Input::GetCurrentTutorialStep(void) { return DAT_TutorialCurrentStep::instance; } + undefined4 OpenSHC::Input::GetCurrentTutorialStep(void) { return DAT_TutorialCurrentStep::instance; } } } diff --git a/src/OpenSHC/OS/OS.cpp b/src/OpenSHC/OS/OS.cpp index 1200943c..05797263 100644 --- a/src/OpenSHC/OS/OS.cpp +++ b/src/OpenSHC/OS/OS.cpp @@ -46,10 +46,10 @@ namespace OS { // This seems to be the games main free function // STUB: STRONGHOLDCRUSADER 0x0057FA74 - void __cdecl _free_base(void* _Memory) { free(_Memory); } + void _free_base(void* _Memory) { free(_Memory); } // STUB: STRONGHOLDCRUSADER 0x0057FC19 - int __cdecl __tolower(int _C) { return tolower(_C); }; + int __tolower(int _C) { return tolower(_C); }; // STUB: STRONGHOLDCRUSADER 0x0057FCB2 int _fclose(FILE* _File) { return fclose(_File); } @@ -67,7 +67,7 @@ namespace OS { long _ftell(FILE* _File) { return ftell(_File); } // STUB: STRONGHOLDCRUSADER 0x00580384 - int __cdecl _fseek(FILE* _File, long _Offset, DWORD _Origin) { return fseek(_File, _Offset, _Origin); } + int _fseek(FILE* _File, long _Offset, DWORD _Origin) { return fseek(_File, _Offset, _Origin); } // STUB: STRONGHOLDCRUSADER 0x005804CD FILE* _fopen(char const* _Filename, char const* _Mode) { return fopen(_Filename, _Mode); } @@ -89,7 +89,7 @@ namespace OS { // Only jumps to _free in game version // STUB: STRONGHOLDCRUSADER 0x00580DC1 - void __cdecl _free(void* _Memory) { free(_Memory); } + void _free(void* _Memory) { free(_Memory); } // STUB: STRONGHOLDCRUSADER 0x00580DC6 errno_t _memcpy_s(void* _Dst, rsize_t _DstSize, void* _Src, rsize_t _MaxCount) @@ -99,7 +99,7 @@ namespace OS { // Only jumps to _free // STUB: STRONGHOLDCRUSADER 0x00580E9C - void __cdecl _free_cpp(void* _Memory) { free(_Memory); } + void _free_cpp(void* _Memory) { free(_Memory); } // STUB: STRONGHOLDCRUSADER 0x00580F38 int _ucrt_close(int fileDescriptor) { return _close(fileDescriptor); } @@ -126,10 +126,10 @@ namespace OS { void* _memcpy(void* _Dst, void* _Src, size_t _Size) { return memcpy(_Dst, _Src, _Size); } // STUB: STRONGHOLDCRUSADER 0x005824CD - int __cdecl __toupper(int _C) { return toupper(_C); } + int __toupper(int _C) { return toupper(_C); } // STUB: STRONGHOLDCRUSADER 0x005826FB - int __cdecl _ucrt_tell(int handle) { return _tell(handle); } + int _ucrt_tell(int handle) { return _tell(handle); } // STUB: STRONGHOLDCRUSADER 0x0058277E int _ucrt_lseek(int fileDescriptor, long lDistanceToMove, DWORD moveMethod) diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp index 2b53b168..afc23912 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0043F2B0 -void __cdecl UI::MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk() +void UI::MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk() { DAT_GameCore::instance.field80_0x144 = DAT_GameCore::instance.field80_0x144 ^ 1; } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp index 3f72fa1f..6d16c144 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp @@ -3,7 +3,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0043FCA0 -void __cdecl UI ::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton() +void UI::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton() { MACRO_CALL( OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp index f46ba8c1..153d2a1b 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004abd10 - void __cdecl MenuModalRenderFunction_TutorialBox_Thunk(int x, int y, int width, int height) + void MenuModalRenderFunction_TutorialBox_Thunk(int x, int y, int width, int height) { MACRO_CALL(UI_Func::MenuModalRenderFunction_TutorialBox)(x, y, width, height); } From 4f778fe1db2e7ab370a3a264a1cc0d2770e7fc77 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 16:24:25 +0200 Subject: [PATCH 17/61] batch 2 --- .../AI/AICState/shouldNotBuildKillingPits.cpp | 24 +++ src/OpenSHC/AI/AIVState/clearTheHeatmaps.cpp | 17 ++ .../Audio/SFX/ComputeCurrentPlayerRanking.cpp | 16 ++ .../Game/GameCore/setTabToSwitchTo.cpp | 20 +++ .../Game/GameCore/swapBuildMenuTab.cpp | 20 +++ .../activateTraderState.cpp | 14 ++ .../isFullIDEqualsToMinus1.cpp | 18 +++ .../GameStateStructures/resetTraderState.cpp | 29 ++++ src/OpenSHC/Game/UpdateUnitValueLoss.cpp | 15 ++ src/OpenSHC/Global/PrintToDestination.cpp | 14 ++ .../IO/Base64EncodeCharacterLookup.cpp | 16 ++ src/OpenSHC/IO/Base64EncodeInit.cpp | 19 +++ src/OpenSHC/IO/SwapInts.cpp | 19 +-- .../MouseState/updateMouseWheelStatus.cpp | 10 ++ .../BuildingsState/getBuildingFlag1.cpp | 12 ++ .../BuildingsState/getBuildingFlag3.cpp | 12 ++ .../BuildingsState/setBuildingToAppleFarm.cpp | 12 ++ ...dateBadBuildingCessPitOrDancingBearUnk.cpp | 18 +++ .../Map/Buildings/UpdateBuildingShared1.cpp | 16 ++ .../isValueInRangeOneToTwenty.cpp | 13 ++ .../bindPathPlanToAlgorithmStateAndReset.cpp | 16 ++ .../Map/TileMapState/getUnownedMoatCount.cpp | 21 +++ .../Map/TileMapState/toggleFlatView.cpp | 16 ++ .../Map/Units/CheckUnitProductionPaused.cpp | 18 +++ .../TribesState/markTribeAsAnimalTribe.cpp | 12 ++ .../TribesState/playArcherCommandSpeech.cpp | 25 +++ .../TribesState/playTunnelerCommandSpeech.cpp | 22 +++ .../Map/Units/UnitsState/getArmySize.cpp | 16 ++ .../Map/Units/UnitsState/queueStopCommand.cpp | 23 +++ .../Units/UnitsState/selectionHasArchers.cpp | 33 ++++ .../Map/Version/UpdateUnitLossData.cpp | 24 +++ .../Map/WildlifeState/clearWildlifeState.cpp | 17 ++ src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp | 6 +- .../playNextStoredBinkVideo.cpp | 22 +++ .../BinkControlClass/stopAllBinkPlayback.cpp | 5 +- .../computeTileXOffset.cpp | 13 ++ .../ViewportRenderState/focusOnCoordinate.cpp | 14 ++ .../ViewportRenderState/translateXYToTile.cpp | 10 ++ .../Synchrony/Actions/ChangeRations.cpp | 15 ++ src/OpenSHC/Synchrony/Actions/ChangeTaxes.cpp | 15 ++ .../QueueChangeGameIntensityOrBalance.cpp | 23 +++ .../computeSomeHashOnUnitArray.cpp | 18 +++ .../getNextHelpColorEntryIndex.cpp | 19 +++ .../renderHelpDialogIfOpen.cpp | 16 ++ src/OpenSHC/Text/TextManager/getCharWidth.cpp | 17 ++ .../Text/TextManager/resetTextClipRange.cpp | 29 ++++ .../Text/TextManager/setTextClipRange.cpp | 15 ++ .../Text/UserTextHandler/getCurrentText.cpp | 16 ++ .../UserTextHandler/getTextArrayPointer.cpp | 10 ++ .../Text/UserTextHandler/handleLeftKey.cpp | 15 ++ .../Text/UserTextHandler/handleRightKey.cpp | 15 ++ .../Text/UserTextHandler/moveCursorToEnd.cpp | 14 ++ .../UI/HoveredState/clearHoveredState.cpp | 20 +++ src/OpenSHC/UI/LoadTGX_shc_back.cpp | 15 ++ ...ngAndStatusMenu_BuildingHelpTextButton.cpp | 18 +++ ...enuItemActionHandler_Chat_TauntButtons.cpp | 19 +++ ...eNetworkServiceProvider_ModemTableRows.cpp | 17 ++ ...NetworkSessions_EnumerateDPlaySessions.cpp | 15 ++ ...ndler_FindingNetworkSessions_TableRows.cpp | 17 ++ ...Handler_General_DisplayConditionalText.cpp | 15 ++ ...nHandler_NetworkOptions_LeaveButtonUnk.cpp | 16 ++ ...sMenu_BarracksAndMercenaryPostHelpText.cpp | 16 ++ ...splayScenarioHelpText_AnotherButtonUnk.cpp | 16 ++ ...nuItemRenderFunction_LobbyMenu_Unknown.cpp | 21 +++ ...dalRenderFunction_DisplayAiLordMessage.cpp | 15 ++ .../clearModalDialog2to6.cpp | 18 +++ .../renderNonInteractingButtonBackground.cpp | 24 +++ .../ButtonGmData/getPictureNumberInGm.cpp | 21 +++ .../RenderInGameChatDisplayElement.cpp | 17 ++ ...eMapSurfaceHeightRangeFromTemporaryUnk.cpp | 16 ++ .../setMapSurfaceHeightRange.cpp | 15 ++ .../setMapSurfaceHeightRangeUnk.cpp | 16 ++ .../setScreenMenuSurfaceHeightRange.cpp | 16 ++ ...reenMenuSurfaceHeightRangeToResolution.cpp | 18 +++ .../temporarySaveMapSurfaceHeightRangeUnk.cpp | 17 ++ .../WindowAndDirectDraw/cleanDirectDraw.cpp | 20 +++ .../UI/SetActiveCreditsSequenceIndex.cpp | 21 +++ .../UI/SetTutorialHintActiveWithTimestamp.cpp | 15 ++ src/OpenSHC/UI/TacticalPowersFill.cpp | 19 +++ src/OpenSHC/Util/Timing/Stopwatch/start.cpp | 20 +++ status/addresses-SHC-3BB0A8C1.txt | 150 +++++++++--------- 81 files changed, 1434 insertions(+), 93 deletions(-) create mode 100644 src/OpenSHC/AI/AICState/shouldNotBuildKillingPits.cpp create mode 100644 src/OpenSHC/AI/AIVState/clearTheHeatmaps.cpp create mode 100644 src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp create mode 100644 src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp create mode 100644 src/OpenSHC/Game/GameCore/swapBuildMenuTab.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp create mode 100644 src/OpenSHC/Game/UpdateUnitValueLoss.cpp create mode 100644 src/OpenSHC/Global/PrintToDestination.cpp create mode 100644 src/OpenSHC/IO/Base64EncodeCharacterLookup.cpp create mode 100644 src/OpenSHC/Input/MouseState/updateMouseWheelStatus.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateBuildingShared1.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/bindPathPlanToAlgorithmStateAndReset.cpp create mode 100644 src/OpenSHC/Map/TileMapState/getUnownedMoatCount.cpp create mode 100644 src/OpenSHC/Map/TileMapState/toggleFlatView.cpp create mode 100644 src/OpenSHC/Map/Units/CheckUnitProductionPaused.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/playTunnelerCommandSpeech.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp create mode 100644 src/OpenSHC/Map/Version/UpdateUnitLossData.cpp create mode 100644 src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp create mode 100644 src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp create mode 100644 src/OpenSHC/Synchrony/Actions/ChangeRations.cpp create mode 100644 src/OpenSHC/Synchrony/Actions/ChangeTaxes.cpp create mode 100644 src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp create mode 100644 src/OpenSHC/Text/TextManager/getCharWidth.cpp create mode 100644 src/OpenSHC/Text/TextManager/resetTextClipRange.cpp create mode 100644 src/OpenSHC/Text/TextManager/setTextClipRange.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/getCurrentText.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/getTextArrayPointer.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/handleLeftKey.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/handleRightKey.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/moveCursorToEnd.cpp create mode 100644 src/OpenSHC/UI/HoveredState/clearHoveredState.cpp create mode 100644 src/OpenSHC/UI/LoadTGX_shc_back.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingHelpTextButton.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp create mode 100644 src/OpenSHC/UI/MenuTextInputState/clearModalDialog2to6.cpp create mode 100644 src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/renderNonInteractingButtonBackground.cpp create mode 100644 src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRangeUnk.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRange.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRangeToResolution.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp create mode 100644 src/OpenSHC/UI/Rendering/WindowAndDirectDraw/cleanDirectDraw.cpp create mode 100644 src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp create mode 100644 src/OpenSHC/UI/SetTutorialHintActiveWithTimestamp.cpp create mode 100644 src/OpenSHC/UI/TacticalPowersFill.cpp create mode 100644 src/OpenSHC/Util/Timing/Stopwatch/start.cpp diff --git a/src/OpenSHC/AI/AICState/shouldNotBuildKillingPits.cpp b/src/OpenSHC/AI/AICState/shouldNotBuildKillingPits.cpp new file mode 100644 index 00000000..fe582223 --- /dev/null +++ b/src/OpenSHC/AI/AICState/shouldNotBuildKillingPits.cpp @@ -0,0 +1,24 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_AIVState.hpp" + +namespace OpenSHC { +namespace AI { + + using OpenSHC::Commands::MappersEnum; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004ECA90 + BOOLEnum AICState::shouldNotBuildKillingPits(int playerID, MappersEnum commandBuildingType) + { + BOOLEnum _totalAbove99 = FALSE; + if (commandBuildingType == OpenSHC::Commands::M_MAPPER_KILLING_PIT) { + _totalAbove99 = 100 <= DAT_AIVState::instance.mapExtraInfo.playerTotalKillingPits[playerID]; + } + return _totalAbove99; + } + +} +} diff --git a/src/OpenSHC/AI/AIVState/clearTheHeatmaps.cpp b/src/OpenSHC/AI/AIVState/clearTheHeatmaps.cpp new file mode 100644 index 00000000..d35fd06d --- /dev/null +++ b/src/OpenSHC/AI/AIVState/clearTheHeatmaps.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/AI/AIVState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace AI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004EDC90 + void AIVState::clearTheHeatmaps() + { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 307200, '\0', (void*)((int)(this->heatMaps))); + } + +} // namespace AI +} // namespace OpenSHC diff --git a/src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp b/src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp new file mode 100644 index 00000000..5c33b08d --- /dev/null +++ b/src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Audio/SFX.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Audio { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044C400 + int SFX::ComputeCurrentPlayerRanking() + { + return MACRO_CALL(OpenSHC::Audio::SFX_Func::ComputePlayerRanking)( + DAT_GameSynchronyState::instance.currentPlayerSlotID); + } + +} +} diff --git a/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp b/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp new file mode 100644 index 00000000..b1b3fb84 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::UI::Enums::MenuViewType; + // FUNCTION: STRONGHOLDCRUSADER 0x0046B300 + void GameCore::setTabToSwitchTo() + { + if (this->currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU) { + this->secondaryActiveMenuTabToSwitchTo = this->buildmenuMenuTabToSwitchTo; + } + if (this->currentMenuViewType == OpenSHC::UI::Enums::MVT_MAP_EDITOR_LANDSCAPING) { + this->secondaryActiveMenuTabToSwitchTo.tabType = this->landscapingmenuMenuTabToSwitchTo; + } + } + +} +} diff --git a/src/OpenSHC/Game/GameCore/swapBuildMenuTab.cpp b/src/OpenSHC/Game/GameCore/swapBuildMenuTab.cpp new file mode 100644 index 00000000..f3711c65 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/swapBuildMenuTab.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0046B320 + void GameCore::swapBuildMenuTab() + { + if (this->buildmenuMenuTabToSwitchTo.tabType == OpenSHC::UI::Enums::BASMTT_SIEGETENT_SHIELD) { + this->buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_SIEGETENT_BATTERINGRAM; + return; + } + this->buildmenuMenuTabToSwitchTo = this->secondaryActiveMenuTabToSwitchTo; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp b/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp new file mode 100644 index 00000000..73a785d7 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + +namespace OpenSHC { +namespace Game { + + // FUNCTION: STRONGHOLDCRUSADER 0x004586D0 + void GameStateStructures::activateTraderState() + { + this->mapAndTime.traderRelated2 = 2; + this->mapAndTime.traderRelatedCounter1 = 0; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp b/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp new file mode 100644 index 00000000..414a85c0 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004563B0 + BOOLEnum GameStateStructures::isFullIDEqualsToMinus1(int param_1) + { + return DAT_GameSynchronyState::instance.currentPlayerFullIDArray[param_1] == -1; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp b/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp new file mode 100644 index 00000000..2f1e4bad --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004586F0 +void GameStateStructures::resetTraderState() + +{ +this->mapAndTime.traderRelated2 = 0; +this->mapAndTime.traderRelatedCounter1 = 0; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/UpdateUnitValueLoss.cpp b/src/OpenSHC/Game/UpdateUnitValueLoss.cpp new file mode 100644 index 00000000..306f1adc --- /dev/null +++ b/src/OpenSHC/Game/UpdateUnitValueLoss.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Globals/DAT_CurrentPlayerUnitLosses.hpp" + +namespace OpenSHC { +namespace Game { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044aa70 + void UpdateUnitValueLoss(int value) + { + if (0 < value) { + DAT_CurrentPlayerUnitLosses::instance += value; + } + } + +} // namespace Game +} // namespace OpenSHC diff --git a/src/OpenSHC/Global/PrintToDestination.cpp b/src/OpenSHC/Global/PrintToDestination.cpp new file mode 100644 index 00000000..c856f6aa --- /dev/null +++ b/src/OpenSHC/Global/PrintToDestination.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Global.func.hpp" +#include "OpenSHC/OS.func.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0045D060 +void Global::PrintToDestination(wchar_t* destination, wchar_t* format, va_list args) +{ + // fixme: The calls that call PrintToDestination() use 2, 3, or 4 arguments, but the original assembly + // always uses add esp, 0xc suggesting three parameters. Currently this optimizes to a jump directly. + MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, format, args); +} + +} diff --git a/src/OpenSHC/IO/Base64EncodeCharacterLookup.cpp b/src/OpenSHC/IO/Base64EncodeCharacterLookup.cpp new file mode 100644 index 00000000..d4cbc7f7 --- /dev/null +++ b/src/OpenSHC/IO/Base64EncodeCharacterLookup.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/IO.func.hpp" + +#include "OpenSHC/Globals/DAT_ProtocolDefinedData.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00487090 +byte IO::Base64EncodeCharacterLookup(char param_1) +{ + if ('?' < param_1) { + return (byte)(0x3d); + } + return DAT_ProtocolDefinedData::instance.field136_0x4f4[param_1]; +} + +} diff --git a/src/OpenSHC/IO/Base64EncodeInit.cpp b/src/OpenSHC/IO/Base64EncodeInit.cpp index c2783dee..2a301ffc 100644 --- a/src/OpenSHC/IO/Base64EncodeInit.cpp +++ b/src/OpenSHC/IO/Base64EncodeInit.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include "../IO.func.hpp" namespace OpenSHC { @@ -11,3 +12,21 @@ void IO::Base64EncodeInit(Base64State* state) } } +======= + +#include "OpenSHC/IO/Base64State.hpp" + +namespace OpenSHC { +namespace IO { + + // FUNCTION: STRONGHOLDCRUSADER 0x00487080 + void Base64EncodeInit(Base64State* state) + { + state->phase = 0; + *(unsigned char*)&state->carryByte = 0; + state->lineCharacterCounter = 0; + } + +} // namespace IO +} // namespace OpenSHC +>>>>>>> 29a5686e (batch 2) diff --git a/src/OpenSHC/IO/SwapInts.cpp b/src/OpenSHC/IO/SwapInts.cpp index 588ad7fa..4e01811a 100644 --- a/src/OpenSHC/IO/SwapInts.cpp +++ b/src/OpenSHC/IO/SwapInts.cpp @@ -1,14 +1,15 @@ -#include "../IO.func.hpp" +#include "OpenSHC/IO.hpp" namespace OpenSHC { +namespace IO { -// FUNCTION: STRONGHOLDCRUSADER 0x0041A740 -void IO::SwapInts(undefined4* param_1, undefined4* param_2) -{ - undefined4 uVar1; - uVar1 = *param_1; - *param_1 = *param_2; - *param_2 = uVar1; + // FUNCTION: STRONGHOLDCRUSADER 0x0041a740 + void SwapInts(int* param_1, int* param_2) + { + int temp; + temp = *param_1; + *param_1 = *param_2; + *param_2 = temp; + } } - } diff --git a/src/OpenSHC/Input/MouseState/updateMouseWheelStatus.cpp b/src/OpenSHC/Input/MouseState/updateMouseWheelStatus.cpp new file mode 100644 index 00000000..583130b9 --- /dev/null +++ b/src/OpenSHC/Input/MouseState/updateMouseWheelStatus.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Input/MouseState.hpp" + +namespace OpenSHC { +namespace Input { + + // FUNCTION: STRONGHOLDCRUSADER 0x004680b0 + void MouseState::updateMouseWheelStatus(int delta) { this->mouseWheelDelta = (unsigned short)delta; } + +} // namespace Input +} // namespace OpenSHC diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp new file mode 100644 index 00000000..d77078c6 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Buildings { + + // FUNCTION: STRONGHOLDCRUSADER 0x0040F440 + int BuildingsState::getBuildingFlag1(int param_1) { return this->buildings[param_1].flag1; } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp new file mode 100644 index 00000000..0bbd1f2d --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Buildings { + + // FUNCTION: STRONGHOLDCRUSADER 0x0040F420 + int BuildingsState::getBuildingFlag3(int param_1) { return this->buildings[param_1].unknownFlag3; } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp new file mode 100644 index 00000000..ba414ee0 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Buildings { + + // FUNCTION: STRONGHOLDCRUSADER 0x0040F3D0 + void BuildingsState::setBuildingToAppleFarm(int buildingID) { this->buildings[buildingID].field66_0xbe = 0x20; } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp b/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp new file mode 100644 index 00000000..d6984bae --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Buildings.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x00418F70 + void Buildings::UpdateBadBuildingCessPitOrDancingBearUnk() + { + int iVar1 = DAT_CurrentBuildingID::instance; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; + DAT_BuildingsState::instance.buildings[iVar1].displayOwnerFlag = 0; + } + +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdateBuildingShared1.cpp b/src/OpenSHC/Map/Buildings/UpdateBuildingShared1.cpp new file mode 100644 index 00000000..1931c7de --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateBuildingShared1.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/Buildings.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004180E0 + void Buildings::UpdateBuildingShared1() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp b/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp new file mode 100644 index 00000000..68158533 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B77E0 + BOOLEnum MapPropertiesState::isValueInRangeOneToTwenty(int param_1) { return param_1 + -1 < 0x14; } + +} +} diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/bindPathPlanToAlgorithmStateAndReset.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/bindPathPlanToAlgorithmStateAndReset.cpp new file mode 100644 index 00000000..def1d655 --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/bindPathPlanToAlgorithmStateAndReset.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x00496EA0 + void PathFindingState::bindPathPlanToAlgorithmStateAndReset(byte* pPathPlan) + { + this->searchQueue.ptrPathPlan = pPathPlan; + this->searchQueue.pathPlanIndex = 0; + } + + } +} +} diff --git a/src/OpenSHC/Map/TileMapState/getUnownedMoatCount.cpp b/src/OpenSHC/Map/TileMapState/getUnownedMoatCount.cpp new file mode 100644 index 00000000..352e8297 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/getUnownedMoatCount.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/Map/TileMapState.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x00500210 + int TileMapState::getUnownedMoatCount() + { + int unownedMoatCount = 0; + + for (int i = 1; i < 16000; i++) { + if (this->moats[i].owner == 0) { + unownedMoatCount += 1; + } + } + + return unownedMoatCount; + } + +} // namespace Map +} // namespace OpenSHC diff --git a/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp b/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp new file mode 100644 index 00000000..becb2628 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004F70B0 + void TileMapState::toggleFlatView(int param_1) + { + if (param_1 != this->flatViewToggleValue1) { + this->flatViewToggleValue1 = param_1; + this->flatViewToggleValue2 = param_1; + } + } + +} +} diff --git a/src/OpenSHC/Map/Units/CheckUnitProductionPaused.cpp b/src/OpenSHC/Map/Units/CheckUnitProductionPaused.cpp new file mode 100644 index 00000000..5c1b88a5 --- /dev/null +++ b/src/OpenSHC/Map/Units/CheckUnitProductionPaused.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Units.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00530D50 + BOOLEnum Units::CheckUnitProductionPaused(int param_1) + { + return DAT_UnitsState::instance.units[param_1].field166_0x2fe == 1; + } + +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp b/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp new file mode 100644 index 00000000..e6423dbb --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp @@ -0,0 +1,12 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00523730 + void TribesState::markTribeAsAnimalTribe(int param_1) { this->tribes[param_1].unkIsAnimalTribe = 1; } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp new file mode 100644 index 00000000..c2d0d337 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp @@ -0,0 +1,25 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + +#include "OpenSHC/Globals/DAT_SFXState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00525090 + void TribesState::playArcherCommandSpeech(int selectionID) + { + int actionID = 0x1f; + UnitType _majorityUnitType = MACRO_CALL_MEMBER( + OpenSHC::Map::Units::TribesState_Func::getMajorityArcherTypeEuropeanOrArabian, this)(selectionID); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( + _majorityUnitType, actionID); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playTunnelerCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playTunnelerCommandSpeech.cpp new file mode 100644 index 00000000..fe8e7bf9 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playTunnelerCommandSpeech.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + +#include "OpenSHC/Globals/DAT_SFXState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00522150 + void TribesState::playTunnelerCommandSpeech() + { + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( + OpenSHC::Map::Units::UT_TUNNELER, 0x27); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp b/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp new file mode 100644 index 00000000..cb7d8835 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { + +namespace Map { + + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x00532f60 + int UnitsState::getArmySize(int playerID) { return DAT_GameState::ptr->playerDataArray[playerID].armySize; } + } + +} + +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp b/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp new file mode 100644 index 00000000..33cea6a5 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Commands::GameCommandType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00536C70 + void UnitsState::queueStopCommand() + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (GameCommandType)0xf); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp new file mode 100644 index 00000000..03edc06d --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00535560 +BOOLEnum UnitsState::selectionHasArchers() + +{ +if (this->selectionEuropeanArchers != 0) { +return TRUE; +} +return (uint)(this->selectionArabArcher != 0); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp b/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp new file mode 100644 index 00000000..a131fecc --- /dev/null +++ b/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp @@ -0,0 +1,24 @@ +#include "OpenSHC/Map/Version.func.hpp" + +#include "OpenSHC/Globals/DAT_UnitValueLossesPerEnemyPlayer.hpp" + +namespace OpenSHC { +namespace Map { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x0044AA80 + void __cdecl Version::UpdateUnitLossData(int lossValue, int playerID) + + { + if (lossValue < 0) { + DAT_UnitValueLossesPerEnemyPlayer::instance[playerID] + = DAT_UnitValueLossesPerEnemyPlayer::instance[playerID] - lossValue; + } + return; + } + +} +} diff --git a/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp b/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp new file mode 100644 index 00000000..9f810b72 --- /dev/null +++ b/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/WildlifeState.func.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x0052B9F0 + void WildlifeState::clearWildlifeState() + { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 256000, '\0', this); + } + +} +} diff --git a/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp b/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp index 5d469e1c..41dad9fc 100644 --- a/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp +++ b/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp @@ -8,11 +8,7 @@ namespace OpenSHC { namespace Random { // FUNCTION: STRONGHOLDCRUSADER 0x0046A740 - void RNG::setTimeBasedSeed() - { - __time64_t time = MACRO_CALL(OpenSHC::OS_Func::__time64)((__time64_t*)0x0); - this->seed = (int)time; - } + void RNG::setTimeBasedSeed() { this->seed = (__time64_t)MACRO_CALL(OpenSHC::OS_Func::__time64)((__time64_t*)0x0); } } } diff --git a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp new file mode 100644 index 00000000..d1f1154c --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Rendering { + namespace Bink { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004C62A0 + void AIMessageQueue::playNextStoredBinkVideo() + + { + if (this->messagePlaying_0x0 != FALSE) { + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::AIMessageQueue_Func::playNextStoredAIMessage, this)(); + } + this->storedMessages_0x924 = 0; + } + + } +} +} diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp index d3953e52..f7815eb7 100644 --- a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp @@ -7,11 +7,8 @@ namespace Rendering { // FUNCTION: STRONGHOLDCRUSADER 0x00408EB0 void BinkControlClass::stopAllBinkPlayback() { - int binkObjIndex = 0; - do { + for (int binkObjIndex = 0; binkObjIndex < 2; binkObjIndex++) MACRO_CALL_MEMBER(BinkControlClass_Func::stopBinkPlayback, this)(binkObjIndex); - binkObjIndex = binkObjIndex + 1; - } while (binkObjIndex < 2); } } // namespace Bink diff --git a/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp b/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp new file mode 100644 index 00000000..b30fabf6 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp @@ -0,0 +1,13 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +namespace OpenSHC { +namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x004092E0 + int ViewportRenderState::computeTileXOffset(int param_1, int param_2) + { + return param_1 - this->translationMatrix[param_2].addXgetTile; + } + +} +} diff --git a/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp b/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp new file mode 100644 index 00000000..a2a9c1d2 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +namespace OpenSHC { +namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x004E8CA0 + void ViewportRenderState::focusOnCoordinate(int x, int y) + { + MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::focusOnTile, this)( + this->translationMatrix[y].addXgetTile + x); + } + +} +} diff --git a/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp b/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp new file mode 100644 index 00000000..fb37d0e2 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +namespace OpenSHC { +namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00401040 + int ViewportRenderState::translateXYToTile(int x, int y) { return this->translationMatrix[y].addXgetTile + x; } + +} +} diff --git a/src/OpenSHC/Synchrony/Actions/ChangeRations.cpp b/src/OpenSHC/Synchrony/Actions/ChangeRations.cpp new file mode 100644 index 00000000..d627dde8 --- /dev/null +++ b/src/OpenSHC/Synchrony/Actions/ChangeRations.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Synchrony/Actions.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + // FUNCTION: STRONGHOLDCRUSADER 0x00465890 + void Actions::ChangeRations(int playerID, int rationsSetting) + { + DAT_GameState::instance.playerDataArray[playerID].rationsSetting = rationsSetting; + } + +} +} diff --git a/src/OpenSHC/Synchrony/Actions/ChangeTaxes.cpp b/src/OpenSHC/Synchrony/Actions/ChangeTaxes.cpp new file mode 100644 index 00000000..dae8f1c0 --- /dev/null +++ b/src/OpenSHC/Synchrony/Actions/ChangeTaxes.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Synchrony/Actions.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + // FUNCTION: STRONGHOLDCRUSADER 0x00465800 + void Actions::ChangeTaxes(int playerID, int taxesSetting) + { + DAT_GameState::instance.playerDataArray[playerID].taxesSetting = taxesSetting; + } + +} +} diff --git a/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp b/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp new file mode 100644 index 00000000..a285da65 --- /dev/null +++ b/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/Synchrony/Commands.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + using OpenSHC::Commands::GameCommandType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00429630 + void Commands::QueueChangeGameIntensityOrBalance() + + { + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_CHANGE_GAME_INTENSITY_OR_BALANCE); + DAT_GameSynchronyState::instance.field235_0x1072e8 = -1; + DAT_GameSynchronyState::instance.field236_0x1072ec = -1; + } + +} +} diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp new file mode 100644 index 00000000..0ce2b524 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Navigation/DirectionAlgorithmState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + +#include "OpenSHC/Globals/DAT_DirectionAlgorithmState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047EEB0 + int GameSynchronyState::computeSomeHashOnUnitArray() + { + return (int)(MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::DirectionAlgorithmState_Func::computeHash, + DAT_DirectionAlgorithmState::ptr)(2920000, (int*)((int)(DAT_UnitsState::instance.units)))); + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp new file mode 100644 index 00000000..4414ada2 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" + +#include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x0045DA20 + int TextEditorState::getNextHelpColorEntryIndex(int param_1) + { + int iVar1 = param_1 + 1; + if (DAT_UserHelpDefinedData::instance.field6_0x7a16c[iVar1].name_0x0 == (char*)NULL) { + iVar1 = 0; + } + return iVar1; + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp b/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp new file mode 100644 index 00000000..5f5756a5 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00461550 + void TextEditorState::renderHelpDialogIfOpen() + { + if (this->isDialogStateInitialized != 0) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::drawHelpWindowBackground, this)(); + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::setTextRenderingLogic, this)(); + } + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/getCharWidth.cpp b/src/OpenSHC/Text/TextManager/getCharWidth.cpp new file mode 100644 index 00000000..d7a95432 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/getCharWidth.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Text/FontSizeClass.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" + +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x0046A720 + int TextManager::getCharWidth(char character, int fontSize) + { + return MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::getCharWidthUnk, + &DAT_TextManagerObject::instance.fontSizeClassArray[fontSize])(character); + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/resetTextClipRange.cpp b/src/OpenSHC/Text/TextManager/resetTextClipRange.cpp new file mode 100644 index 00000000..d9690eb3 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/resetTextClipRange.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Text/TextManager.func.hpp" + + + + + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00469F40 +void TextManager::resetTextClipRange() + +{ +this->field2_0x8 = 0; +this->field3_0xc = 10000; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/setTextClipRange.cpp b/src/OpenSHC/Text/TextManager/setTextClipRange.cpp new file mode 100644 index 00000000..d08882ca --- /dev/null +++ b/src/OpenSHC/Text/TextManager/setTextClipRange.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Text/TextManager.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00469F20 + void TextManager::setTextClipRange(dword param_1, dword param_2) + + { + this->field2_0x8 = param_1; + this->field3_0xc = param_2; + } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/getCurrentText.cpp b/src/OpenSHC/Text/UserTextHandler/getCurrentText.cpp new file mode 100644 index 00000000..6c088050 --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/getCurrentText.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x004697C0 + char* UserTextHandler::getCurrentText() + { + if (this->unknown01 == 0) { + return (char*)NULL; + } + return this->textArray[this->textArrayIndex]; + } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/getTextArrayPointer.cpp b/src/OpenSHC/Text/UserTextHandler/getTextArrayPointer.cpp new file mode 100644 index 00000000..b95880dd --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/getTextArrayPointer.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x004697E0 + char* UserTextHandler::getTextArrayPointer(int param_1) { return this->textArray[param_1]; } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/handleLeftKey.cpp b/src/OpenSHC/Text/UserTextHandler/handleLeftKey.cpp new file mode 100644 index 00000000..5cb56e28 --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/handleLeftKey.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x004698A0 + void UserTextHandler::handleLeftKey() + { + if (0 < this->textCursorIndexArray[this->textArrayIndex]) { + this->textCursorIndexArray[this->textArrayIndex] -= 1; + } + } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/handleRightKey.cpp b/src/OpenSHC/Text/UserTextHandler/handleRightKey.cpp new file mode 100644 index 00000000..dcf317bd --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/handleRightKey.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00469880 + void UserTextHandler::handleRightKey() + { + if (this->textCursorIndexArray[this->textArrayIndex] < this->textContentLengthArray[this->textArrayIndex]) { + this->textCursorIndexArray[this->textArrayIndex] += 1; + } + } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/moveCursorToEnd.cpp b/src/OpenSHC/Text/UserTextHandler/moveCursorToEnd.cpp new file mode 100644 index 00000000..b884aa34 --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/moveCursorToEnd.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/Text/UserTextHandler.hpp" + +namespace OpenSHC { + +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x004698d0 + void UserTextHandler::moveCursorToEnd() + { + this->textCursorIndexArray[this->textArrayIndex] = this->textContentLengthArray[this->textArrayIndex]; + } + +} +} diff --git a/src/OpenSHC/UI/HoveredState/clearHoveredState.cpp b/src/OpenSHC/UI/HoveredState/clearHoveredState.cpp new file mode 100644 index 00000000..b9664fc1 --- /dev/null +++ b/src/OpenSHC/UI/HoveredState/clearHoveredState.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI/HoveredState.func.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" +#include "OpenSHC/Commands/MappersEnumInt.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::Commands::MappersEnum; + using OpenSHC::Commands::MappersEnumInt; + + // FUNCTION: STRONGHOLDCRUSADER 0x005010C0 + void HoveredState::clearHoveredState() + { + for (int i = 0; i < 20; i++) { + this->elements[i].type = OpenSHC::Commands::M_MAPPER_NULL; + } + } + +} +} diff --git a/src/OpenSHC/UI/LoadTGX_shc_back.cpp b/src/OpenSHC/UI/LoadTGX_shc_back.cpp new file mode 100644 index 00000000..cbaa7741 --- /dev/null +++ b/src/OpenSHC/UI/LoadTGX_shc_back.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00424BD0 +void UI::LoadTGX_shc_back() +{ + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)( + "shc_back.tgx"); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingHelpTextButton.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingHelpTextButton.cpp new file mode 100644 index 00000000..3b6072a8 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingHelpTextButton.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0043A860 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_BuildingHelpTextButton() +{ + if (DAT_BuildingsState::instance.field24_0x18e04c != 0) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::openBuildingHelpDialog, DAT_TextEditorState::ptr)( + DAT_BuildingsState::instance.field25_0x18e050); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp new file mode 100644 index 00000000..bef8efb1 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +using OpenSHC::Commands::GameCommandType; + +// FUNCTION: STRONGHOLDCRUSADER 0x0048F850 +void UI::MenuItemActionHandler_Chat_TauntButtons(int param_1, va_list args) +{ + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = param_1; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_TAUNT_OR_CHAT); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp new file mode 100644 index 00000000..69a9a061 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0047D0E0 +void UI::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows(int param_1, va_list args) + +{ + if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 + < DAT_GameSynchronyState::instance.modemScrollbarCount) { + DAT_GameSynchronyState::instance.modemScrollbarIndex = param_1; + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp new file mode 100644 index 00000000..6334ff74 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0048BF70 +void UI::MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions(int param_1, va_list args) +{ + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::restartDPlaySessionEnumeration, + DAT_GameSynchronyState::ptr)(param_1); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp new file mode 100644 index 00000000..79efd9a2 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0047D3F0 +void UI::MenuItemActionHandler_FindingNetworkSessions_TableRows(int param_1, va_list args) + +{ + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 + < DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { + DAT_GameSynchronyState::instance.scrollBarIndex = param_1; + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp new file mode 100644 index 00000000..fa44a054 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" + +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004F6A60 +void UI::MenuItemActionHandler_General_DisplayConditionalText(int param_1, va_list args) +{ + MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, + DAT_BottomLeftTextDisplayState::ptr)(param_1); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp new file mode 100644 index 00000000..6b2c1281 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" + +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004941F0 +void UI::MenuItemActionHandler_NetworkOptions_LeaveButtonUnk(int param_1, va_list args) +{ + if (param_1 == 0x11) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp new file mode 100644 index 00000000..a8e37d6a --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0043A8C0 +void UI::MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText(int param_1, va_list args) +{ + if (DAT_BuildingsState::instance.field24_0x18e04c != 0) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp new file mode 100644 index 00000000..d42cf149 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0045F120 +void UI::MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk(int param_1, va_list args) +{ + if (DAT_TextEditorState::instance.helpSectionHistoryStack[0] != -1) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp new file mode 100644 index 00000000..3b2cd68a --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; + +// FUNCTION: STRONGHOLDCRUSADER 0x0042AC40 +void UI::MenuItemRenderFunction_LobbyMenu_Unknown(int param_1, va_list args) +{ + if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { + MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, + DAT_BottomLeftTextDisplayState::ptr)(param_1); + } +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp new file mode 100644 index 00000000..52d3ea64 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB440 +void UI::MenuModalRenderFunction_DisplayAiLordMessage(int x, int y, int width, int height) + +{ + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::AIMessageQueue_Func::playAiLordMessage, DAT_VideoBikQueue::ptr)(x, y); +} + +} diff --git a/src/OpenSHC/UI/MenuTextInputState/clearModalDialog2to6.cpp b/src/OpenSHC/UI/MenuTextInputState/clearModalDialog2to6.cpp new file mode 100644 index 00000000..6c4ae6b2 --- /dev/null +++ b/src/OpenSHC/UI/MenuTextInputState/clearModalDialog2to6.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/UI/MenuTextInputState.hpp" + +namespace OpenSHC { + +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x00491730 + void MenuTextInputState::clearModalDialog2to6() + { + this->modalDialog_2 = 0; + this->modalDialog_3 = 0; + this->modalDialog_4 = 0; + this->modalDialog_5 = 0; + this->modalDialog_6 = 0; + } +} + +} diff --git a/src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/renderNonInteractingButtonBackground.cpp b/src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/renderNonInteractingButtonBackground.cpp new file mode 100644 index 00000000..11821b29 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/AlphaAndButtonSurface/renderNonInteractingButtonBackground.cpp @@ -0,0 +1,24 @@ +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004246E0 + void AlphaAndButtonSurface::renderNonInteractingButtonBackground(int blendStrength) + { + DAT_ButtonCurrentlyInteracting::instance = FALSE; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton, this)( + blendStrength, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp b/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp new file mode 100644 index 00000000..591bc1a2 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004630B0 + int ButtonGmData::getPictureNumberInGm(BOOLEnum buttonIsInteracting) + { + if (buttonIsInteracting != FALSE) { + return this->numOfAdditionalIconStates_0x8 + this->pictureInGm_0x4; + } + return this->pictureInGm_0x4; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp new file mode 100644 index 00000000..1b0d4f7f --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004AF800 + void Rendering::RenderInGameChatDisplayElement(int posX, int posY, DWORD elementState) + { + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::renderInGameChat, DAT_GameSynchronyState::ptr)( + posX, posY, (int)((int)(elementState))); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp new file mode 100644 index 00000000..66de7746 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044CCF0 + void TextureRenderCore::restoreMapSurfaceHeightRangeFromTemporaryUnk() + { + this->mapGameSurfaceHeightRange.start = this->mapSurfaceRangeTemporaryUnk_0x16c864.start; + this->mapGameSurfaceHeightRange.end = this->mapSurfaceRangeTemporaryUnk_0x16c864.end; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp new file mode 100644 index 00000000..8fb4c0f5 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044cca0 + void TextureRenderCore::setMapSurfaceHeightRange(int start, int end) + { + this->mapGameSurfaceHeightRange.start = start; + this->mapGameSurfaceHeightRange.end = end; + } + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRangeUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRangeUnk.cpp new file mode 100644 index 00000000..aadc8d8f --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRangeUnk.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044ccc0 + void TextureRenderCore::setMapSurfaceHeightRangeUnk() + { + this->mapGameSurfaceHeightRange.start = 0; + this->mapGameSurfaceHeightRange.end = 0x81b; + } + + } // namespace Rendering +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRange.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRange.cpp new file mode 100644 index 00000000..a85b82b9 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRange.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044cd10 + void TextureRenderCore::setScreenMenuSurfaceHeightRange(int start, int end) + { + this->screenMenuSurfaceHeightRange.start = start; + this->screenMenuSurfaceHeightRange.end = end; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRangeToResolution.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRangeToResolution.cpp new file mode 100644 index 00000000..042ff165 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setScreenMenuSurfaceHeightRangeToResolution.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044cd30 + void TextureRenderCore::setScreenMenuSurfaceHeightRangeToResolution() + { + this->screenMenuSurfaceHeightRange.start = 0; + this->screenMenuSurfaceHeightRange.end = DAT_WindowAndDirectDraw::ptr->resolutionY; + } + + } // namespace Rendering +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp new file mode 100644 index 00000000..fc3fc6e2 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044CCD0 + void TextureRenderCore::temporarySaveMapSurfaceHeightRangeUnk() + + { + this->mapSurfaceRangeTemporaryUnk_0x16c864.start = this->mapGameSurfaceHeightRange.start; + this->mapSurfaceRangeTemporaryUnk_0x16c864.end = this->mapGameSurfaceHeightRange.end; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/WindowAndDirectDraw/cleanDirectDraw.cpp b/src/OpenSHC/UI/Rendering/WindowAndDirectDraw/cleanDirectDraw.cpp new file mode 100644 index 00000000..1ea39b0d --- /dev/null +++ b/src/OpenSHC/UI/Rendering/WindowAndDirectDraw/cleanDirectDraw.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0046F730 + void WindowAndDirectDraw::cleanDirectDraw() + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::WindowAndDirectDraw_Func::releaseSurfacesAndDirectDraw, this)( + TRUE); + this->drawingReady_0x0 = FALSE; + } + + } +} +} diff --git a/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp b/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp new file mode 100644 index 00000000..ac8f3889 --- /dev/null +++ b/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_00ed3120.hpp" +#include "OpenSHC/Globals/DAT_00ed3124.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004D9270 +void __cdecl UI::SetActiveCreditsSequenceIndex(undefined4 param_1) + +{ + DAT_00ed3124::instance = param_1; + DAT_00ed3120::instance = 0; + return; +} + +} diff --git a/src/OpenSHC/UI/SetTutorialHintActiveWithTimestamp.cpp b/src/OpenSHC/UI/SetTutorialHintActiveWithTimestamp.cpp new file mode 100644 index 00000000..3e305229 --- /dev/null +++ b/src/OpenSHC/UI/SetTutorialHintActiveWithTimestamp.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_00df5564.hpp" +#include "OpenSHC/Globals/DWORD_00df5568.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004BC770 +void UI::SetTutorialHintActiveWithTimestamp() +{ + DAT_00df5564::instance = 1; + DWORD_00df5568::instance = timeGetTime(); +} + +} diff --git a/src/OpenSHC/UI/TacticalPowersFill.cpp b/src/OpenSHC/UI/TacticalPowersFill.cpp new file mode 100644 index 00000000..a6599a69 --- /dev/null +++ b/src/OpenSHC/UI/TacticalPowersFill.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_MissionDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TacticalPowersHelpTextDisplayBool.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004D9D90 +void UI::TacticalPowersFill() + +{ + if ((DAT_TacticalPowersHelpTextDisplayBool::instance != '\0') + && (DAT_MissionDefinedData::instance.field39_0x1370 = DAT_MissionDefinedData::instance.field39_0x1370 + -1, + DAT_MissionDefinedData::instance.field39_0x1370 == 0)) { + DAT_TacticalPowersHelpTextDisplayBool::instance = '\0'; + } +} + +} diff --git a/src/OpenSHC/Util/Timing/Stopwatch/start.cpp b/src/OpenSHC/Util/Timing/Stopwatch/start.cpp new file mode 100644 index 00000000..c3a69197 --- /dev/null +++ b/src/OpenSHC/Util/Timing/Stopwatch/start.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/Util/Timing/Stopwatch.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Util { + namespace Timing { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0046CED0 + void Stopwatch::start() + { + DWORD _currentTime = timeGetTime(); + this->startTime_0x8 = _currentTime; + this->running_0x4 = TRUE; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 374ac41f..17dddcd3 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -383,7 +383,7 @@ SHC_3BB0A8C1_0x00400288 | 0.0% | Pending SHC_3BB0A8C1_0x00401000 | 0.0% | Pending -SHC_3BB0A8C1_0x00401040 | 0.0% | Pending +SHC_3BB0A8C1_0x00401040 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00401060 | 0.0% | Pending @@ -2575,7 +2575,7 @@ SHC_3BB0A8C1_0x00408E30 | 0.0% | Pending SHC_3BB0A8C1_0x00408E70 | 0.0% | Pending -SHC_3BB0A8C1_0x00408EB0 | 0.0% | Pending +SHC_3BB0A8C1_0x00408EB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00408ED0 | 0.0% | Pending @@ -2599,7 +2599,7 @@ SHC_3BB0A8C1_0x004092B0 | 0.0% | Pending SHC_3BB0A8C1_0x004092C0 | 0.0% | Pending -SHC_3BB0A8C1_0x004092E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004092E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00409300 | 0.0% | Pending @@ -5029,13 +5029,13 @@ SHC_3BB0A8C1_0x0040F240 | 0.0% | Pending SHC_3BB0A8C1_0x0040F360 | 0.0% | Pending -SHC_3BB0A8C1_0x0040F3D0 | 0.0% | Pending +SHC_3BB0A8C1_0x0040F3D0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0040F3F0 | 0.0% | Pending -SHC_3BB0A8C1_0x0040F420 | 0.0% | Pending +SHC_3BB0A8C1_0x0040F420 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0040F440 | 0.0% | Pending +SHC_3BB0A8C1_0x0040F440 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0040F460 | 0.0% | Pending @@ -5543,7 +5543,7 @@ SHC_3BB0A8C1_0x00417B90 | 0.0% | Pending SHC_3BB0A8C1_0x00417FD0 | 0.0% | Pending -SHC_3BB0A8C1_0x004180E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004180E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00418100 | 0.0% | Pending @@ -5575,7 +5575,7 @@ SHC_3BB0A8C1_0x00418C80 | 0.0% | Pending SHC_3BB0A8C1_0x00418EC0 | 0.0% | Pending -SHC_3BB0A8C1_0x00418F70 | 0.0% | Pending +SHC_3BB0A8C1_0x00418F70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00418F90 | 0.0% | Pending @@ -6657,7 +6657,7 @@ SHC_3BB0A8C1_0x00424680 | 0.0% | Pending SHC_3BB0A8C1_0x004246B0 | 0.0% | Pending -SHC_3BB0A8C1_0x004246E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004246E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00424700 | 100.0% | Reimplemented @@ -6675,7 +6675,7 @@ SHC_3BB0A8C1_0x00424AD0 | 0.0% | Pending SHC_3BB0A8C1_0x00424B10 | 0.0% | Pending -SHC_3BB0A8C1_0x00424BD0 | 0.0% | Pending +SHC_3BB0A8C1_0x00424BD0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00424BE0 | 0.0% | Pending @@ -6891,7 +6891,7 @@ SHC_3BB0A8C1_0x00428A60 | 0.0% | Pending SHC_3BB0A8C1_0x00428AC0 | 0.0% | Pending -SHC_3BB0A8C1_0x00429630 | 0.0% | Pending +SHC_3BB0A8C1_0x00429630 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00429650 | 0.0% | Pending @@ -6973,7 +6973,7 @@ SHC_3BB0A8C1_0x0042AC34 | 0.0% | Pending SHC_3BB0A8C1_0x0042AC38 | 0.0% | Pending -SHC_3BB0A8C1_0x0042AC40 | 0.0% | Pending +SHC_3BB0A8C1_0x0042AC40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042AC60 | 0.0% | Pending @@ -13395,11 +13395,11 @@ SHC_3BB0A8C1_0x004398B0 | 0.0% | Pending SHC_3BB0A8C1_0x0043A850 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0043A860 | 0.0% | Pending +SHC_3BB0A8C1_0x0043A860 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043A880 | 0.0% | Pending -SHC_3BB0A8C1_0x0043A8C0 | 0.0% | Pending +SHC_3BB0A8C1_0x0043A8C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0043A8D0 | 100.0% | Reimplemented @@ -16649,9 +16649,9 @@ SHC_3BB0A8C1_0x0044A720 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044A830 | 0.0% | Pending -SHC_3BB0A8C1_0x0044AA70 | 0.0% | Pending +SHC_3BB0A8C1_0x0044AA70 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044AA80 | 0.0% | Pending +SHC_3BB0A8C1_0x0044AA80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044AAA0 | 100.0% | Reimplemented @@ -16891,7 +16891,7 @@ SHC_3BB0A8C1_0x0044C3F0 | 0.0% | Pending SHC_3BB0A8C1_0x0044C3F4 | 0.0% | Pending -SHC_3BB0A8C1_0x0044C400 | 0.0% | Pending +SHC_3BB0A8C1_0x0044C400 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044C410 | 100.0% | Reimplemented @@ -16915,17 +16915,17 @@ SHC_3BB0A8C1_0x0044CBE0 | 0.0% | Pending SHC_3BB0A8C1_0x0044CC30 | 0.0% | Pending -SHC_3BB0A8C1_0x0044CCA0 | 0.0% | Pending +SHC_3BB0A8C1_0x0044CCA0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044CCC0 | 0.0% | Pending +SHC_3BB0A8C1_0x0044CCC0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044CCD0 | 0.0% | Pending +SHC_3BB0A8C1_0x0044CCD0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044CCF0 | 0.0% | Pending +SHC_3BB0A8C1_0x0044CCF0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044CD10 | 0.0% | Pending +SHC_3BB0A8C1_0x0044CD10 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044CD30 | 0.0% | Pending +SHC_3BB0A8C1_0x0044CD30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044CD40 | 0.0% | Pending @@ -17045,7 +17045,7 @@ SHC_3BB0A8C1_0x00455E40 | 0.0% | Pending SHC_3BB0A8C1_0x004560F0 | 0.0% | Pending -SHC_3BB0A8C1_0x004563B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004563B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004563D0 | 0.0% | Pending @@ -17693,9 +17693,9 @@ SHC_3BB0A8C1_0x004585B0 | 0.0% | Pending SHC_3BB0A8C1_0x004585F0 | 0.0% | Pending -SHC_3BB0A8C1_0x004586D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004586D0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004586F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004586F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00458700 | 0.0% | Pending @@ -18145,7 +18145,7 @@ SHC_3BB0A8C1_0x0045CA20 | 0.0% | Pending SHC_3BB0A8C1_0x0045CD10 | 0.0% | Pending -SHC_3BB0A8C1_0x0045D060 | 0.0% | Pending +SHC_3BB0A8C1_0x0045D060 | 100.0% | Our version optimizes to a jump, while the original re-pushes the args SHC_3BB0A8C1_0x0045D080 | 0.0% | Pending @@ -18351,7 +18351,7 @@ SHC_3BB0A8C1_0x0045D990 | 0.0% | Pending SHC_3BB0A8C1_0x0045D9E0 | 0.0% | Pending -SHC_3BB0A8C1_0x0045DA20 | 0.0% | Pending +SHC_3BB0A8C1_0x0045DA20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0045DA40 | 0.0% | Pending @@ -18747,7 +18747,7 @@ SHC_3BB0A8C1_0x0045F0CD | 0.0% | Pending SHC_3BB0A8C1_0x0045F0D0 | 0.0% | Pending -SHC_3BB0A8C1_0x0045F120 | 0.0% | Pending +SHC_3BB0A8C1_0x0045F120 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0045F130 | 0.0% | Pending @@ -18833,7 +18833,7 @@ SHC_3BB0A8C1_0x004614F0 | 0.0% | Pending SHC_3BB0A8C1_0x00461520 | 0.0% | Pending -SHC_3BB0A8C1_0x00461550 | 0.0% | Pending +SHC_3BB0A8C1_0x00461550 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00461570 | 0.0% | Pending @@ -19153,7 +19153,7 @@ SHC_3BB0A8C1_0x00462FE0 | 0.0% | Pending SHC_3BB0A8C1_0x00462FF0 | 0.0% | Pending -SHC_3BB0A8C1_0x004630B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004630B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004630D0 | 0.0% | Pending @@ -19905,11 +19905,11 @@ SHC_3BB0A8C1_0x00465700 | 0.0% | Pending SHC_3BB0A8C1_0x004657B0 | 0.0% | Pending -SHC_3BB0A8C1_0x00465800 | 0.0% | Pending +SHC_3BB0A8C1_0x00465800 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00465820 | 0.0% | Pending -SHC_3BB0A8C1_0x00465890 | 0.0% | Pending +SHC_3BB0A8C1_0x00465890 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004658B0 | 0.0% | Pending @@ -20065,7 +20065,7 @@ SHC_3BB0A8C1_0x00467F80 | 0.0% | Pending SHC_3BB0A8C1_0x00468030 | 0.0% | Pending -SHC_3BB0A8C1_0x004680B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004680B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004680C0 | 0.0% | Pending @@ -20123,9 +20123,9 @@ SHC_3BB0A8C1_0x004694A0 | 0.0% | Pending SHC_3BB0A8C1_0x00469790 | 0.0% | Pending -SHC_3BB0A8C1_0x004697C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004697C0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004697E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004697E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00469800 | 0.0% | Pending @@ -20133,13 +20133,13 @@ SHC_3BB0A8C1_0x00469860 | 0.0% | Pending SHC_3BB0A8C1_0x00469870 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00469880 | 0.0% | Pending +SHC_3BB0A8C1_0x00469880 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004698A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004698A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004698C0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004698D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004698D0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004698F0 | 0.0% | Pending @@ -20167,9 +20167,9 @@ SHC_3BB0A8C1_0x00469E70 | 0.0% | Pending SHC_3BB0A8C1_0x00469F10 | 0.0% | Pending -SHC_3BB0A8C1_0x00469F20 | 0.0% | Pending +SHC_3BB0A8C1_0x00469F20 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00469F40 | 0.0% | Pending +SHC_3BB0A8C1_0x00469F40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00469F50 | 0.0% | Pending @@ -20695,7 +20695,7 @@ SHC_3BB0A8C1_0x0046A4C8 | 0.0% | Pending SHC_3BB0A8C1_0x0046A4D0 | 0.0% | Pending -SHC_3BB0A8C1_0x0046A720 | 0.0% | Pending +SHC_3BB0A8C1_0x0046A720 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0046A740 | 100.0% | Reimplemented @@ -20745,9 +20745,9 @@ SHC_3BB0A8C1_0x0046B1F0 | 0.0% | Pending SHC_3BB0A8C1_0x0046B2F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0046B300 | 0.0% | Pending +SHC_3BB0A8C1_0x0046B300 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0046B320 | 0.0% | Pending +SHC_3BB0A8C1_0x0046B320 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0046B340 | 0.0% | Pending @@ -20969,7 +20969,7 @@ SHC_3BB0A8C1_0x0046CEB0 | 0.0% | Pending SHC_3BB0A8C1_0x0046CEC0 | 0.0% | Pending -SHC_3BB0A8C1_0x0046CED0 | 0.0% | Pending +SHC_3BB0A8C1_0x0046CED0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0046CEF0 | 0.0% | Pending @@ -21201,7 +21201,7 @@ SHC_3BB0A8C1_0x0046F690 | 0.0% | Pending SHC_3BB0A8C1_0x0046F6B0 | 0.0% | Pending -SHC_3BB0A8C1_0x0046F730 | 0.0% | Pending +SHC_3BB0A8C1_0x0046F730 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0046F750 | 0.0% | Pending @@ -22307,7 +22307,7 @@ SHC_3BB0A8C1_0x0047D0D8 | 0.0% | Pending SHC_3BB0A8C1_0x0047D0DC | 0.0% | Pending -SHC_3BB0A8C1_0x0047D0E0 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D0E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D100 | 0.0% | Pending @@ -22327,7 +22327,7 @@ SHC_3BB0A8C1_0x0047D3DC | 0.0% | Pending SHC_3BB0A8C1_0x0047D3E0 | 0.0% | Pending -SHC_3BB0A8C1_0x0047D3F0 | 0.0% | Pending +SHC_3BB0A8C1_0x0047D3F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047D410 | 0.0% | Pending @@ -22393,7 +22393,7 @@ SHC_3BB0A8C1_0x0047EC10 | 0.0% | Pending SHC_3BB0A8C1_0x0047EDE0 | 0.0% | Pending -SHC_3BB0A8C1_0x0047EEB0 | 0.0% | Pending +SHC_3BB0A8C1_0x0047EEB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047EED0 | 0.0% | Pending @@ -23167,7 +23167,7 @@ SHC_3BB0A8C1_0x0048BD40 | 0.0% | Pending SHC_3BB0A8C1_0x0048BD80 | 0.0% | Pending -SHC_3BB0A8C1_0x0048BF70 | 0.0% | Pending +SHC_3BB0A8C1_0x0048BF70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0048BF80 | 0.0% | Pending @@ -23357,7 +23357,7 @@ SHC_3BB0A8C1_0x0048F841 | 0.0% | Pending SHC_3BB0A8C1_0x0048F842 | 0.0% | Pending -SHC_3BB0A8C1_0x0048F850 | 0.0% | Pending +SHC_3BB0A8C1_0x0048F850 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0048F870 | 0.0% | Pending @@ -23407,7 +23407,7 @@ SHC_3BB0A8C1_0x00491680 | 0.0% | Pending SHC_3BB0A8C1_0x004916C0 | 0.0% | Pending -SHC_3BB0A8C1_0x00491730 | 0.0% | Pending +SHC_3BB0A8C1_0x00491730 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00491750 | 0.0% | Pending @@ -24041,7 +24041,7 @@ SHC_3BB0A8C1_0x004941E7 | 0.0% | Pending SHC_3BB0A8C1_0x004941E8 | 0.0% | Pending -SHC_3BB0A8C1_0x004941F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004941F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00494210 | 0.0% | Pending @@ -24349,7 +24349,7 @@ SHC_3BB0A8C1_0x00496E30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00496E40 | 0.0% | Pending -SHC_3BB0A8C1_0x00496EA0 | 0.0% | Pending +SHC_3BB0A8C1_0x00496EA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00496EC0 | 0.0% | Pending @@ -25539,7 +25539,7 @@ SHC_3BB0A8C1_0x004AAB40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AAB50 | 0.0% | Pending -SHC_3BB0A8C1_0x004AB440 | 0.0% | Pending +SHC_3BB0A8C1_0x004AB440 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AB460 | 0.0% | Pending @@ -25915,7 +25915,7 @@ SHC_3BB0A8C1_0x004AF6E0 | 0.0% | Pending SHC_3BB0A8C1_0x004AF700 | 0.0% | Pending -SHC_3BB0A8C1_0x004AF800 | 0.0% | Pending +SHC_3BB0A8C1_0x004AF800 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AF820 | 0.0% | Pending @@ -27077,7 +27077,7 @@ SHC_3BB0A8C1_0x004B7730 | 0.0% | Pending SHC_3BB0A8C1_0x004B77A0 | 0.0% | Pending -SHC_3BB0A8C1_0x004B77E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B77E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B7800 | 0.0% | Pending @@ -30095,7 +30095,7 @@ SHC_3BB0A8C1_0x004BC6C0 | 0.0% | Pending SHC_3BB0A8C1_0x004BC6F0 | 0.0% | Pending -SHC_3BB0A8C1_0x004BC770 | 0.0% | Pending +SHC_3BB0A8C1_0x004BC770 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004BC790 | 0.0% | Pending @@ -34139,7 +34139,7 @@ SHC_3BB0A8C1_0x004C6294 | 0.0% | Pending SHC_3BB0A8C1_0x004C6298 | 0.0% | Pending -SHC_3BB0A8C1_0x004C62A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004C62A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004C62C0 | 0.0% | Pending @@ -36019,7 +36019,7 @@ SHC_3BB0A8C1_0x004D91D0 | 0.0% | Pending SHC_3BB0A8C1_0x004D9230 | 0.0% | Pending -SHC_3BB0A8C1_0x004D9270 | 0.0% | Pending +SHC_3BB0A8C1_0x004D9270 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D9290 | 0.0% | Pending @@ -36055,7 +36055,7 @@ SHC_3BB0A8C1_0x004D9CC0 | 0.0% | Pending SHC_3BB0A8C1_0x004D9D60 | 0.0% | Pending -SHC_3BB0A8C1_0x004D9D90 | 0.0% | Pending +SHC_3BB0A8C1_0x004D9D90 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D9DB0 | 0.0% | Pending @@ -37337,7 +37337,7 @@ SHC_3BB0A8C1_0x004E8C50 | 0.0% | Pending SHC_3BB0A8C1_0x004E8C90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004E8CA0 | 0.0% | Pending +SHC_3BB0A8C1_0x004E8CA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004E8CC0 | 0.0% | Pending @@ -37933,7 +37933,7 @@ SHC_3BB0A8C1_0x004ED3B0 | 0.0% | Pending SHC_3BB0A8C1_0x004ED410 | 0.0% | Pending -SHC_3BB0A8C1_0x004EDC90 | 0.0% | Pending +SHC_3BB0A8C1_0x004EDC90 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004EDCB0 | 0.0% | Pending @@ -38733,7 +38733,7 @@ SHC_3BB0A8C1_0x004F69D0 | 0.0% | Pending SHC_3BB0A8C1_0x004F6A20 | 0.0% | Pending -SHC_3BB0A8C1_0x004F6A60 | 0.0% | Pending +SHC_3BB0A8C1_0x004F6A60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F6A70 | 100.0% | Reimplemented @@ -38755,7 +38755,7 @@ SHC_3BB0A8C1_0x004F6F90 | 0.0% | Pending SHC_3BB0A8C1_0x004F6FD0 | 0.0% | Pending -SHC_3BB0A8C1_0x004F70B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004F70B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F70D0 | 0.0% | Pending @@ -41425,7 +41425,7 @@ SHC_3BB0A8C1_0x005000E0 | 0.0% | Pending SHC_3BB0A8C1_0x00500180 | 0.0% | Pending -SHC_3BB0A8C1_0x00500210 | 0.0% | Pending +SHC_3BB0A8C1_0x00500210 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00500250 | 0.0% | Pending @@ -41503,7 +41503,7 @@ SHC_3BB0A8C1_0x005010B8 | 0.0% | Pending SHC_3BB0A8C1_0x005010BC | 0.0% | Pending -SHC_3BB0A8C1_0x005010C0 | 0.0% | Pending +SHC_3BB0A8C1_0x005010C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x005010D0 | 0.0% | Pending @@ -46767,7 +46767,7 @@ SHC_3BB0A8C1_0x00522090 | 0.0% | Pending SHC_3BB0A8C1_0x00522110 | 0.0% | Pending -SHC_3BB0A8C1_0x00522150 | 0.0% | Pending +SHC_3BB0A8C1_0x00522150 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00522160 | 0.0% | Pending @@ -46851,7 +46851,7 @@ SHC_3BB0A8C1_0x00523630 | 0.0% | Pending SHC_3BB0A8C1_0x005236A0 | 0.0% | Pending -SHC_3BB0A8C1_0x00523730 | 0.0% | Pending +SHC_3BB0A8C1_0x00523730 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00523750 | 0.0% | Pending @@ -46917,7 +46917,7 @@ SHC_3BB0A8C1_0x00524EF0 | 0.0% | Pending SHC_3BB0A8C1_0x00525060 | 0.0% | Pending -SHC_3BB0A8C1_0x00525090 | 0.0% | Pending +SHC_3BB0A8C1_0x00525090 | 100.0% | Reimplemented SHC_3BB0A8C1_0x005250B0 | 0.0% | Pending @@ -49233,7 +49233,7 @@ SHC_3BB0A8C1_0x0052B9E4 | 0.0% | Pending SHC_3BB0A8C1_0x0052B9E8 | 0.0% | Pending -SHC_3BB0A8C1_0x0052B9F0 | 0.0% | Pending +SHC_3BB0A8C1_0x0052B9F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0052BA10 | 0.0% | Pending @@ -49649,7 +49649,7 @@ SHC_3BB0A8C1_0x00530C40 | 0.0% | Pending SHC_3BB0A8C1_0x00530CF0 | 0.0% | Pending -SHC_3BB0A8C1_0x00530D50 | 0.0% | Pending +SHC_3BB0A8C1_0x00530D50 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00530D70 | 0.0% | Pending @@ -50643,7 +50643,7 @@ SHC_3BB0A8C1_0x00532F5D | 0.0% | Pending SHC_3BB0A8C1_0x00532F5E | 0.0% | Pending -SHC_3BB0A8C1_0x00532F60 | 0.0% | Pending +SHC_3BB0A8C1_0x00532F60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00532F80 | 0.0% | Pending @@ -51069,7 +51069,7 @@ SHC_3BB0A8C1_0x00535520 | 0.0% | Pending SHC_3BB0A8C1_0x00535550 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00535560 | 0.0% | Pending +SHC_3BB0A8C1_0x00535560 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00535580 | 0.0% | Pending @@ -51203,7 +51203,7 @@ SHC_3BB0A8C1_0x00536A51 | 0.0% | Pending SHC_3BB0A8C1_0x00536A60 | 0.0% | Pending -SHC_3BB0A8C1_0x00536C70 | 0.0% | Pending +SHC_3BB0A8C1_0x00536C70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00536C90 | 0.0% | Pending From 7e31945cc60e17b8e5ab25a95592a5844dc5d585 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 16:26:36 +0200 Subject: [PATCH 18/61] repair vararg --- ...andler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp | 2 +- src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp | 5 ++++- .../UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp | 2 +- src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp index 34bce71c..7583ea82 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004F6A70 -void UI::MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk(int param_1, ...) +void UI::MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk(int param_1, va_list args) { MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::hasPassedCountdownOrDuration, DAT_BottomLeftTextDisplayState::ptr)(); diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp index 32f61b0e..13db7b5a 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp @@ -5,6 +5,9 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00434260 -void UI::MenuItemActionHandler_General_Unknown2(int param_1, ...) { DAT_GameCore::instance.field12_0x30 = param_1; } +void UI::MenuItemActionHandler_General_Unknown2(int param_1, va_list args) +{ + DAT_GameCore::instance.field12_0x30 = param_1; +} } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp b/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp index 33e1ff0f..9f9b8a66 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00440420 -void UI::MenuItemActionHandler_UnusedOldTitleMenu_General(int param_1, ...) +void UI::MenuItemActionHandler_UnusedOldTitleMenu_General(int param_1, va_list args) { DAT_WindowAndDirectDraw::instance.postWindowCloseMessage = 1; } diff --git a/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp b/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp index 101381b3..943a02e3 100644 --- a/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp @@ -5,6 +5,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00440410 -void UI::MenuItemFunction_General_Unknown(int param_1, ...) { DAT_StopHandlingMenuItems::instance = 0; } +void UI::MenuItemFunction_General_Unknown(int param_1, va_list args) { DAT_StopHandlingMenuItems::instance = 0; } } From 7d5e7f6c6573a5e3b2e6adf29ae3310c07e4693e Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 23 Aug 2026 22:41:26 +0200 Subject: [PATCH 19/61] revert va_list --- src/OpenSHC/Global/PrintToDestination.cpp | 4 +++- src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp | 2 +- ...onHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp | 2 +- ...Handler_FindingNetworkSessions_EnumerateDPlaySessions.cpp | 2 +- ...enuItemActionHandler_FindingNetworkSessions_TableRows.cpp | 2 +- .../MenuItemActionHandler_General_DisplayConditionalText.cpp | 2 +- ...andler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp | 2 +- src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp | 5 +---- .../MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp | 2 +- .../UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp | 2 +- src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp | 2 +- ...uildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp | 2 +- ...nderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp | 2 +- src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp | 2 +- 14 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/OpenSHC/Global/PrintToDestination.cpp b/src/OpenSHC/Global/PrintToDestination.cpp index c856f6aa..005ab6a1 100644 --- a/src/OpenSHC/Global/PrintToDestination.cpp +++ b/src/OpenSHC/Global/PrintToDestination.cpp @@ -4,10 +4,12 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0045D060 -void Global::PrintToDestination(wchar_t* destination, wchar_t* format, va_list args) +void Global::PrintToDestination(wchar_t* destination, wchar_t* format, ...) { // fixme: The calls that call PrintToDestination() use 2, 3, or 4 arguments, but the original assembly // always uses add esp, 0xc suggesting three parameters. Currently this optimizes to a jump directly. + va_list args; + va_start(args, format); MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, format, args); } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp index bef8efb1..caed3023 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp @@ -9,7 +9,7 @@ namespace OpenSHC { using OpenSHC::Commands::GameCommandType; // FUNCTION: STRONGHOLDCRUSADER 0x0048F850 -void UI::MenuItemActionHandler_Chat_TauntButtons(int param_1, va_list args) +void UI::MenuItemActionHandler_Chat_TauntButtons(int param_1, ...) { DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = param_1; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( diff --git a/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp index 69a9a061..1d46e798 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0047D0E0 -void UI::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows(int param_1, va_list args) +void UI::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows(int param_1, ...) { if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 diff --git a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp index 6334ff74..77918da0 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0048BF70 -void UI::MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions(int param_1, va_list args) +void UI::MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions(int param_1, ...) { MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::restartDPlaySessionEnumeration, DAT_GameSynchronyState::ptr)(param_1); diff --git a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp index 79efd9a2..0cac54c2 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0047D3F0 -void UI::MenuItemActionHandler_FindingNetworkSessions_TableRows(int param_1, va_list args) +void UI::MenuItemActionHandler_FindingNetworkSessions_TableRows(int param_1, ...) { if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp index fa44a054..51354f3c 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_DisplayConditionalText.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004F6A60 -void UI::MenuItemActionHandler_General_DisplayConditionalText(int param_1, va_list args) +void UI::MenuItemActionHandler_General_DisplayConditionalText(int param_1, ...) { MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, DAT_BottomLeftTextDisplayState::ptr)(param_1); diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp index 7583ea82..34bce71c 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004F6A70 -void UI::MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk(int param_1, va_list args) +void UI::MenuItemActionHandler_General_RemoveConditionalTextOrReleaseHoverUnk(int param_1, ...) { MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::hasPassedCountdownOrDuration, DAT_BottomLeftTextDisplayState::ptr)(); diff --git a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp index 13db7b5a..32f61b0e 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp @@ -5,9 +5,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00434260 -void UI::MenuItemActionHandler_General_Unknown2(int param_1, va_list args) -{ - DAT_GameCore::instance.field12_0x30 = param_1; -} +void UI::MenuItemActionHandler_General_Unknown2(int param_1, ...) { DAT_GameCore::instance.field12_0x30 = param_1; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp index 6b2c1281..2912f089 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp @@ -6,7 +6,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004941F0 -void UI::MenuItemActionHandler_NetworkOptions_LeaveButtonUnk(int param_1, va_list args) +void UI::MenuItemActionHandler_NetworkOptions_LeaveButtonUnk(int param_1, ...) { if (param_1 == 0x11) { MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); diff --git a/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp b/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp index 9f9b8a66..33e1ff0f 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_UnusedOldTitleMenu_General.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00440420 -void UI::MenuItemActionHandler_UnusedOldTitleMenu_General(int param_1, va_list args) +void UI::MenuItemActionHandler_UnusedOldTitleMenu_General(int param_1, ...) { DAT_WindowAndDirectDraw::instance.postWindowCloseMessage = 1; } diff --git a/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp b/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp index 943a02e3..101381b3 100644 --- a/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItemFunction_General_Unknown.cpp @@ -5,6 +5,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x00440410 -void UI::MenuItemFunction_General_Unknown(int param_1, va_list args) { DAT_StopHandlingMenuItems::instance = 0; } +void UI::MenuItemFunction_General_Unknown(int param_1, ...) { DAT_StopHandlingMenuItems::instance = 0; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp index a8e37d6a..32e73fbe 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0043A8C0 -void UI::MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText(int param_1, va_list args) +void UI::MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText(int param_1, ...) { if (DAT_BuildingsState::instance.field24_0x18e04c != 0) { MACRO_CALL(OpenSHC::UI_Func:: diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp index d42cf149..67c927cb 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp @@ -5,7 +5,7 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0045F120 -void UI::MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk(int param_1, va_list args) +void UI::MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk(int param_1, ...) { if (DAT_TextEditorState::instance.helpSectionHistoryStack[0] != -1) { MACRO_CALL(OpenSHC::UI_Func:: diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp index 3b2cd68a..e6f4b8ec 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp @@ -10,7 +10,7 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; // FUNCTION: STRONGHOLDCRUSADER 0x0042AC40 -void UI::MenuItemRenderFunction_LobbyMenu_Unknown(int param_1, va_list args) +void UI::MenuItemRenderFunction_LobbyMenu_Unknown(int param_1, ...) { if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, From 3e2209b97041cb803526d7890bf59865058edb53 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Mon, 24 Aug 2026 21:50:45 +0200 Subject: [PATCH 20/61] batch 2: percentage not yet checked, but compiling --- src/OpenSHC/AI/AICState/aiFarmChoice.cpp | 44 ++++++ .../AI/AICState/getResourceRebuildDelay.cpp | 41 +++++ ...erIsWoodCuttersHutWhileNoWoodAvailable.cpp | 41 +++++ .../AI/AICState/playJokeBikFromAIToHuman.cpp | 37 +++++ .../AICState/setTriggerForAITauntResponse.cpp | 35 +++++ .../AICState/shouldNotBeBuildingArmoury.cpp | 39 +++++ .../AICState/shouldNotBeBuildingGranary.cpp | 37 +++++ .../AI/AICState/unitIDIsRangedOrArmored.cpp | 42 +++++ src/OpenSHC/AI/AICState/wipeAICMemory.cpp | 39 +++++ .../exitToScenarioDescriptionMenu.cpp | 36 +++++ .../Game/GameCore/isGameHaltingMenuOpen.cpp | 49 ++++++ .../switchToScenarioDescriptionMenuView.cpp | 31 ++++ .../calculateTaxBribeExpenseForPlayer.cpp | 33 ++++ .../GameStateStructures/clearTribeHotKey.cpp | 39 +++++ .../destroyPlayerCompletely.cpp | 42 +++++ .../Game/GameStateStructures/fillWith0xFF.cpp | 44 ++++++ .../findNextPlayerWithMarketplace.cpp | 35 +++++ .../Game/GameStateStructures/getBuyPrice.cpp | 27 ++++ .../getBuyPriceForOneUnit.cpp | 27 ++++ .../getNumberToDisplayBribeIncome.cpp | 34 +++++ .../getNumberToDisplayPlayerTaxIncome.cpp | 34 +++++ .../getSalePriceOfGood.cpp | 28 ++++ .../GameStateStructures/getSalesPrice.cpp | 36 +++++ .../Game/GameStateStructures/getSellPrice.cpp | 27 ++++ .../GameStateStructures/getTeamsDifferent.cpp | 32 ++++ .../isResourceTypeTradeable.cpp | 33 ++++ .../Game/GameStateStructures/isSameTeam.cpp | 29 ++++ ...tSomethingBuildingRelatedForAllPlayers.cpp | 39 +++++ .../switchPlayerOwnership.cpp | 38 +++++ .../LowLevelMemory/fillMemory_ByteValue.cpp | 33 ++++ .../fillMemory_IntegerValue.cpp | 33 ++++ .../LowLevelMemory/fillMemory_ShortValue.cpp | 33 ++++ .../mapNames_getLoadedMapNameForIndex.cpp | 30 ++++ .../MouseState/resetMouseCursorState.cpp | 37 +++++ .../clearBuildingValueWhenStateIsTwo.cpp | 46 ++++++ .../BuildingsState/getArmoryWithSpaceLeft.cpp | 60 ++++++++ .../getBuildingResourceAmountByUid.cpp | 33 ++++ .../getResourceCountThatCanBeDeposited.cpp | 35 +++++ .../Buildings/BuildingsState/getSpriteID2.cpp | 44 ++++++ .../BuildingsState/isReligiousBuilding.cpp | 38 +++++ .../updatePathLinkageLayerForAllBuildings.cpp | 49 ++++++ .../UpdateBadBuildingRackFlogging.cpp | 36 +++++ .../Buildings/UpdateGoodBuildingGarden.cpp | 38 +++++ .../Map/Buildings/UpdateParadeGround2.cpp | 34 +++++ .../Map/Buildings/UpdateParadeGround3.cpp | 34 +++++ .../Map/Buildings/UpdateParadeGround4.cpp | 34 +++++ .../Map/Buildings/UpdatePlacedSiegeTower.cpp | 38 +++++ .../EntityState/activateProjectileEntity.cpp | 38 +++++ .../Map/Entities/EntityState/deleteEntity.cpp | 32 ++++ .../EntityState/destroyEntitiesPart2.cpp | 42 +++++ .../EntityState/getFireEntityIDAtTile.cpp | 46 ++++++ .../EntityState/markEntityDestroyed.cpp | 33 ++++ .../EntityState/reassignEntitiesOwner.cpp | 41 +++++ .../EntityState/tickEntityDecayCounter.cpp | 37 +++++ .../IgniteFireAtMiniTile_Convenience.cpp | 30 ++++ src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp | 28 ++++ .../Map/Entities/UpdateBrazierEntity.cpp | 31 ++++ .../constructLandscapeState.cpp | 32 ++++ .../Map/LandscapeState/isTreeAdult.cpp | 31 ++++ .../isTreeAliveAndMatchingUID.cpp | 30 ++++ src/OpenSHC/Map/LandscapeState/resetWind.cpp | 32 ++++ .../upgradeTreesAndRocksForMapVersion.cpp | 35 +++++ .../isMercRecruitableForBuildingType.cpp | 38 +++++ .../MapPropertiesState/mapHasCertainEvent.cpp | 41 +++++ .../openEventTriggerMenu.cpp | 32 ++++ .../sumInvasionEventUnitCount.cpp | 39 +++++ .../computeHealthPercentage.cpp | 32 ++++ .../PathFindingState/clearAllClimbData.cpp | 37 +++++ .../PathFindingState/clearClimbData.cpp | 31 ++++ .../retraceAndCommitPathPlan.cpp | 32 ++++ ...hLinkageLayerForEachBuildingAtEachTile.cpp | 38 +++++ .../Map/TileMapState/clearMoatData.cpp | 36 +++++ .../TileMapState/forceFullTileMapRedraw.cpp | 35 +++++ .../processDamageToBuildingThunk.cpp | 36 +++++ ...sEntityDamageToBuildingCollateralThunk.cpp | 32 ++++ .../processMapOrientationChange.cpp | 35 +++++ .../TileMapState/recountTotalOwnedMoats.cpp | 44 ++++++ .../Map/TileMapState/resetMoatArray.cpp | 44 ++++++ .../Map/TileMapState/resetPitchDitchArray.cpp | 44 ++++++ .../setMoatOwnerForAllMatching.cpp | 43 ++++++ .../TileMapState/setMoatVisualStateAtTile.cpp | 37 +++++ .../spreadBrazierPlacementAlgorithm.cpp | 33 ++++ .../spreadFlagPlacementAlgorithm.cpp | 35 +++++ ...updateBuildingPlacementRotationPreview.cpp | 38 +++++ .../updateMoatCountdownTimers.cpp | 55 +++++++ src/OpenSHC/Map/Trees/UpdateTree16.cpp | 35 +++++ .../Units/TribesState/addUnitToSelected.cpp | 42 +++++ .../Map/Units/TribesState/clearTribe.cpp | 31 ++++ .../TribesState/constructTribesState.cpp | 27 ++++ ...SelectionMoveInstructionNoMatchedSpeed.cpp | 26 ++++ .../TribesState/playPatrolCommandSpeech.cpp | 38 +++++ .../TribesState/playUnitSelectSpeech.cpp | 35 +++++ .../TribesState/playWorkCommandSpeech.cpp | 38 +++++ .../Units/TribesState/popUnitFromTribe.cpp | 35 +++++ .../Map/Units/TribesState/queueUnitStance.cpp | 42 +++++ .../reassignOwnerForTribesOfBehaviorType2.cpp | 38 +++++ .../Map/Units/TribesState/setCamelSpawnXY.cpp | 39 +++++ .../Map/Units/TribesState/setUnitStance.cpp | 32 ++++ .../setWhetherTribeContainsAnyUnits.cpp | 42 +++++ .../TribesState/storeDeerXAndYinMapInfo.cpp | 39 +++++ .../TribesState/storeLionXAndYInMapInfo.cpp | 39 +++++ .../TribesState/tribeCorrespondsWithUID.cpp | 32 ++++ .../TribesState/upgradeMapTribesState.cpp | 36 +++++ .../attackInfoHasArch2Building.cpp | 42 +++++ .../attackInfoHasHigh2Building.cpp | 45 ++++++ .../clearAIInfoLayerOutsideStartZone.cpp | 45 ++++++ .../getTileInTargetedBuildingTiles.cpp | 45 ++++++ .../TroopValueState/isAttackWaveComplete.cpp | 43 ++++++ .../ComputeDamageFearFactorBonus.cpp | 29 ++++ .../changeDestinationByLeftover.cpp | 35 +++++ .../checkIfCitizenUnitIsAliveBasedOnState.cpp | 38 +++++ .../checkUnitHasPropertyBasedOnUnitType.cpp | 30 ++++ .../clearHiddenFlagAndUpdatePosition.cpp | 34 +++++ .../Units/UnitsState/constructUnitsState.cpp | 36 +++++ .../Map/Units/UnitsState/deselectUnit.cpp | 33 ++++ .../Map/Units/UnitsState/extendRallyPoint.cpp | 44 ++++++ .../getDestination2EqualsGivenCoordinates.cpp | 33 ++++ .../UnitsState/getFirstSelectedUnitID.cpp | 43 ++++++ .../hasTunnelerNotFinishedDigging.cpp | 30 ++++ .../isComputerManagedNonPeasant.cpp | 40 +++++ ...StopWalkingByClearingPathProgressState.cpp | 33 ++++ .../queueClickNavigateMenuOrEscape.cpp | 38 +++++ .../queueDisbandAndAttackCommand2Params.cpp | 42 +++++ .../queueDisbandAndAttackCommand3Params.cpp | 43 ++++++ .../queueDisbandAndAttackCommand4Params.cpp | 44 ++++++ .../Map/Units/UnitsState/queueStopCommand.cpp | 2 +- .../Units/UnitsState/queueUnitTypeCommand.cpp | 38 +++++ .../saveUnitStateBeforeInterruption.cpp | 35 +++++ .../selectionContainsEngineersOnly.cpp | 41 +++++ .../selectionContainsLadermenOnly.cpp | 29 ++++ .../selectionContainsOnlyArabAssassins.cpp | 32 ++++ .../selectionContainsShieldmenOnly.cpp | 29 ++++ .../selectionContainsTunnelersOnly.cpp | 29 ++++ .../setupUnitSharingCurrentTilePosition.cpp | 30 ++++ .../Units/UnitsState/sitDownIfStanding.cpp | 34 +++++ .../Map/Units/UnitsState/standUpIfSeated.cpp | 34 +++++ .../Map/Units/UnitsState/unitIsInMoat.cpp | 34 +++++ .../UpdateWorker_ConsiderTakingABreakUnk.cpp | 33 ++++ .../SetBuildingsEmployeeCountToValue.cpp | 42 +++++ .../Map/Version/SetDairyCheeseToZero.cpp | 41 +++++ .../SetUndamagedBuildingHealthToValue.cpp | 44 ++++++ .../Map/Version/UpgradeBuildingField1.cpp | 39 +++++ .../Map/Version/UpgradeBuildingField2.cpp | 40 +++++ .../Map/Version/UpgradeBuildingField4.cpp | 39 +++++ .../UpgradeClearBuildings1000AndHigher.cpp | 37 +++++ .../Map/Version/UpgradeFirst9Buildings.cpp | 37 +++++ .../Map/Version/UpgradeKillingPitField.cpp | 41 +++++ .../Version/UpgradeMapLogicToVersion_125.cpp | 43 ++++++ .../Version/UpgradeMapLogicToVersion_147.cpp | 43 ++++++ .../UpgradeMapTribesStateVersionTo_142.cpp | 37 +++++ ...pgradeMapTribesStateVersionTo_Unknown2.cpp | 40 +++++ .../Map/Version/UpgradeMapUnitsTo_112.cpp | 41 +++++ .../Map/Version/UpgradeMapUnitsTo_114.cpp | 41 +++++ .../Map/Version/UpgradeMapUnitsTo_130.cpp | 43 ++++++ .../Map/Version/UpgradeMapUnitsTo_149.cpp | 41 +++++ .../Map/Version/UpgradeMapUnitsTo_155.cpp | 41 +++++ .../Map/Version/UpgradeOutpostField.cpp | 38 +++++ .../Version/UpgradeRemoveRocksBeyond1000.cpp | 37 +++++ .../UpgradeSolitaryMapBuildingField3.cpp | 52 +++++++ .../resetWallAndPitchState.cpp | 39 +++++ .../resetWallPlacementInfo.cpp | 39 +++++ .../setBinkSndStreamAndStartTime.cpp | 44 ++++++ .../zeroBinkPtrAndLoadBinkSoundSystem.cpp | 19 +++ .../createFloatingTextElement.cpp | 29 ++++ .../resetBatchedRender.cpp | 33 ++++ .../ViewportRenderState/xyAreValid.cpp | 32 ++++ .../storeWindowRectangleInfoUnk.cpp | 31 ++++ .../Actions/RemovePositionOfPlayer.cpp | 48 ++++++ .../Actions/SetBuildingProductionType.cpp | 30 ++++ .../clearGameCommandEntry.cpp | 40 +++++ ...ompressOrCreateLengthPrefixedPacketUnk.cpp | 39 +++++ .../decompressTooLongPacketData.cpp | 37 +++++ .../GameSynchronyState/isAIPlayer.cpp | 39 +++++ .../throttledMultiplayerSyncUpdate.cpp | 47 ++++++ src/OpenSHC/Synchrony/GetPlayerPosition.cpp | 44 ++++++ src/OpenSHC/Synchrony/ProgressBarRelated.cpp | 32 ++++ .../Text/FontSizeClass/getWideCharWidth.cpp | 33 ++++ .../Text/FontSizeClass/renderWideChar.cpp | 33 ++++ .../bltTextToScreenIfNeedBe.cpp | 36 +++++ .../TextEditorState/getHelpSectionText.cpp | 43 ++++++ .../getHelpTokenAdvanceLength.cpp | 40 +++++ .../getPrevHelpColorEntryIndex.cpp | 47 ++++++ .../TextEditorState/loadAndParseHelpFile.cpp | 38 +++++ .../TextEditorState/popHelpDialogStack.cpp | 46 ++++++ .../TextEditorState/setHelpWindowBounds.cpp | 31 ++++ .../computeTextWidthForTextGroup.cpp | 33 ++++ .../TextManager/getTextWidthTillCursorUnk.cpp | 26 ++++ .../Text/TextManager/renderInGameText.cpp | 32 ++++ .../renderLeftAlignedNumberToScreen.cpp | 31 ++++ src/OpenSHC/Text/TextManager/renderNumber.cpp | 32 ++++ .../Text/TextManager/renderNumberToScreen.cpp | 31 ++++ .../TextManager/renderSomeSpecificTextUnk.cpp | 16 ++ .../Text/TextManager/renderTextToScreen2.cpp | 34 +++++ src/OpenSHC/Text/TextManager/trimText.cpp | 21 +++ .../getTextWidthUntilCurrentCursor.cpp | 31 ++++ .../Text/UserTextHandler/resetToTextIndex.cpp | 25 +++ ...eSpeedAndResourceLackDisplayElementUnk.cpp | 38 +++++ .../UI/AppendCreditsClearImageCommand.cpp | 23 +++ src/OpenSHC/UI/AppendCreditsCommand.cpp | 23 +++ .../UI/AppendCreditsListTerminator.cpp | 23 +++ src/OpenSHC/UI/AppendCreditsPauseCommand.cpp | 23 +++ .../UI/AppendCreditsSegmentEndCommand.cpp | 23 +++ .../UI/AppendCreditsSoundStreamCommand.cpp | 27 ++++ src/OpenSHC/UI/FindDisplayElementWithID.cpp | 37 +++++ .../IfAiGreatestLordGetAiType.cpp | 44 ++++++ .../AModalDialogIsActiveButIsNotQuitting.cpp | 36 +++++ ...ayElementByIDAndSetForUnlimitedDisplay.cpp | 43 ++++++ src/OpenSHC/UI/Helpers/CheckGoldResource.cpp | 44 ++++++ .../Helpers/CheckIfEnoughGoldForLadderman.cpp | 40 +++++ .../UI/Helpers/CheckIfEnoughGoldForMonk.cpp | 40 +++++ .../Helpers/CheckIfEnoughGoldForTunneler.cpp | 40 +++++ .../GetIfDisplayElementStateNotZero.cpp | 39 +++++ .../UI/Helpers/SetTaxesSetting_unknown.cpp | 34 +++++ .../SetTutorialBuildingActionState.cpp | 38 +++++ .../clearInvalidatedHoverStates.cpp | 60 ++++++++ src/OpenSHC/UI/Menu/updateMenuButtons.cpp | 38 +++++ .../MenuHandlerState/setupBuildMenuState.cpp | 33 ++++ .../UI/MenuItem/resetMenuItemStateUnk.cpp | 30 ++++ ...r_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp | 39 +++++ ...BuildingAndStatusMenu_ArmySwitchButton.cpp | 29 ++++ ...er_BuildingAndStatusMenu_BuildingSleep.cpp | 47 ++++++ ...gAndStatusMenu_MarketMenuChangeButtons.cpp | 26 ++++ ...dingAndStatusMenu_OutpostUnitSelection.cpp | 23 +++ ...Menu_StopBuildingOrPeasantBinkPlayback.cpp | 36 +++++ ...ActionHandler_Chat_SendMessageToPlayer.cpp | 37 +++++ ...temActionHandler_DeleteGameRecord_Main.cpp | 32 ++++ ...emActionHandler_DisableArabTroops_Main.cpp | 34 +++++ ...emActionHandler_DisableEuroTroops_Main.cpp | 34 +++++ ...onHandler_EnterTitleOnGameStart_Button.cpp | 35 +++++ ...nHandler_InGameMenu_UnknownBinkRelated.cpp | 29 ++++ ...temActionHandler_SaveMap_ReturnKeySave.cpp | 26 ++++ ...tionHandler_UnusedWinCondition_Options.cpp | 42 +++++ ...RenderFunction_BuildMenu_BuildingIcons.cpp | 38 +++++ ...uildMenu_BuildingKeepSubcategoryButton.cpp | 30 ++++ ...on_BuildMenu_BuildingSubcategoryButton.cpp | 31 ++++ ..._CurrentlySelectedTroopsDeselectHelper.cpp | 23 +++ ...ngAndStatusMenu_BuildingHelpTextButton.cpp | 32 ++++ ...dStatusMenu_PopularityMenuSwitchButton.cpp | 27 ++++ ...derFunction_InGameMenu_MapEventIconUnk.cpp | 27 ++++ ...emRenderFunction_SaveLoadMap_Scrollbar.cpp | 32 ++++ ...uItemRenderFunction_SelectCrusade_Main.cpp | 30 ++++ .../UI/MenuModalComposition/findModalMenu.cpp | 40 +++++ .../loadAllMenuElementsOfMenuModals.cpp | 34 +++++ ...RenderFunction_CreateOrTriggerInvasion.cpp | 31 ++++ ...enuModalRenderFunction_DebugDataAiInfo.cpp | 27 ++++ ...derFunction_DebugDataCurrentPlayerData.cpp | 27 ++++ ...nuModalRenderFunction_DebugDataMapData.cpp | 27 ++++ ...lRenderFunction_DebugDataMousePointing.cpp | 27 ++++ ...nuModalRenderFunction_DebugDataNetwork.cpp | 35 +++++ ...ModalRenderFunction_DebugDataSplitInfo.cpp | 35 +++++ ...uModalRenderFunction_DebugDataUnitData.cpp | 27 ++++ ...dalRenderFunction_DebugDataZoneDataUnk.cpp | 31 ++++ .../MenuModalRenderFunction_DisableTroops.cpp | 31 ++++ .../MenuModalRenderFunction_DisableWeapon.cpp | 31 ++++ ...alRenderFunction_EnterTitleOnGameStart.cpp | 31 ++++ ...enuModalRenderFunction_GameplayOptions.cpp | 31 ++++ ...MenuModalRenderFunction_NetworkOptions.cpp | 31 ++++ ...MenuModalRenderFunction_OnlineQuitGame.cpp | 31 ++++ .../MenuModalRenderFunction_OptionsMenu.cpp | 31 ++++ ...nderFunction_SkirmishConnectionOptions.cpp | 31 ++++ ...odalRenderFunction_SkirmishPlayOptions.cpp | 31 ++++ .../MenuModalRenderFunction_SoundOptions.cpp | 31 ++++ .../UI/MenuModalRenderFunction_StartGoods.cpp | 31 ++++ ...MenuModalRenderFunction_TraderSettings.cpp | 31 ++++ .../MenuModalRenderFunction_TriggerEvent.cpp | 31 ++++ ...rFunction_UnusedSiegeAttackingForceUnk.cpp | 31 ++++ .../UI/MenuView_CampaignUnk_DoEveryFrame.cpp | 37 +++++ .../MenuView_CrusadeMissionIntro_Prepare.cpp | 33 ++++ .../UI/MenuView_EditScenario_Prepare.cpp | 34 +++++ ..._General_DoEveryFrame_FirstGfxCentered.cpp | 32 ++++ ...nuView_General_DoInitial_OnlySetMenuXY.cpp | 34 +++++ ...w_General_Prepare_SwordShieldAndBorder.cpp | 39 +++++ .../UI/MenuView_IntroLogos_DoInitial.cpp | 31 ++++ .../MenuView_MapEditorLandscaping_Prepare.cpp | 30 ++++ .../UI/MenuView_NewMapMapsize_Prepare.cpp | 29 ++++ .../UI/MenuView_NewMapMaptype_Prepare.cpp | 31 ++++ .../UI/MenuView_RankingGames_Prepare.cpp | 44 ++++++ ...w_Unknown26_CampaignRelatedUnk_Prepare.cpp | 29 ++++ ...iew_UnusedChooseAvailableKeeps_Prepare.cpp | 30 ++++ ...iew_UnusedDemoBuyItScreen_DoEveryFrame.cpp | 33 ++++ .../UI/MenuView_UnusedExtremeAd_Prepare.cpp | 36 +++++ .../MenuView_UnusedHelpTextEditor_Prepare.cpp | 37 +++++ ...View_UnusedSomeMissionStartUnk_Prepare.cpp | 33 ++++ .../setMapPropertyDependingOnMapSize.cpp | 36 +++++ .../setTileColorsDependingOnMapSize.cpp | 36 +++++ .../MinimapViewState/triggerMinimapRedraw.cpp | 33 ++++ src/OpenSHC/UI/PlayAMessageFromAI.cpp | 28 ++++ .../PencilRenderCore/setupPencilSurface.cpp | 39 +++++ .../UI/Rendering/RenderMenuGfxHelper.cpp | 31 ++++ .../RenderNoRushDisplayElementUnk.cpp | 144 ++++++++++++++++++ .../RenderNoTreeGrowthTextDisplayElement.cpp | 32 ++++ .../RenderResourceMissing1DisplayElement.cpp | 29 ++++ .../RenderResourceMissing2DisplayElement.cpp | 29 ++++ .../RenderUnknownDisplayElement7.cpp | 34 +++++ .../CheckGfxResourceExists.cpp | 34 +++++ ...eckIfGfxTgxStartsWithTransparentPixels.cpp | 36 +++++ .../TextureRenderCore/setRenderingRect.cpp | 38 +++++ .../setRenderingRectToGameResolution.cpp | 33 ++++ .../transformTgxCompressedImageToRGB565.cpp | 32 ++++ .../transformUncompressedImageToRGB565.cpp | 28 ++++ ...UncompressedImageWithMarkerUnkToRGB565.cpp | 27 ++++ .../TogglePlayerPingDisplayElementUnk.cpp | 39 +++++ .../UI/ShowProgressBarSaveLoadDialog.cpp | 33 ++++ src/OpenSHC/Util/Timing/Stopwatch/stop.cpp | 38 +++++ .../multiByteToWideCharThunk.cpp | 22 +++ .../multiByteToWideCharThunk2.cpp | 27 ++++ .../wideCharToByteUnk.cpp | 33 ++++ .../wideCharToMultiByteWithSize.cpp | 26 ++++ 308 files changed, 10925 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/AI/AICState/aiFarmChoice.cpp create mode 100644 src/OpenSHC/AI/AICState/getResourceRebuildDelay.cpp create mode 100644 src/OpenSHC/AI/AICState/mapperIsWoodCuttersHutWhileNoWoodAvailable.cpp create mode 100644 src/OpenSHC/AI/AICState/playJokeBikFromAIToHuman.cpp create mode 100644 src/OpenSHC/AI/AICState/setTriggerForAITauntResponse.cpp create mode 100644 src/OpenSHC/AI/AICState/shouldNotBeBuildingArmoury.cpp create mode 100644 src/OpenSHC/AI/AICState/shouldNotBeBuildingGranary.cpp create mode 100644 src/OpenSHC/AI/AICState/unitIDIsRangedOrArmored.cpp create mode 100644 src/OpenSHC/AI/AICState/wipeAICMemory.cpp create mode 100644 src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp create mode 100644 src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp create mode 100644 src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp create mode 100644 src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp create mode 100644 src/OpenSHC/IO/LowLevelMemory/fillMemory_ByteValue.cpp create mode 100644 src/OpenSHC/IO/LowLevelMemory/fillMemory_IntegerValue.cpp create mode 100644 src/OpenSHC/IO/LowLevelMemory/fillMemory_ShortValue.cpp create mode 100644 src/OpenSHC/IO/ResourceManager/mapNames_getLoadedMapNameForIndex.cpp create mode 100644 src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp create mode 100644 src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp create mode 100644 src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp create mode 100644 src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp create mode 100644 src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp create mode 100644 src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp create mode 100644 src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp create mode 100644 src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp create mode 100644 src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp create mode 100644 src/OpenSHC/Map/LandscapeState/resetWind.cpp create mode 100644 src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp create mode 100644 src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp create mode 100644 src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp create mode 100644 src/OpenSHC/Map/TileMapState/clearMoatData.cpp create mode 100644 src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp create mode 100644 src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp create mode 100644 src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp create mode 100644 src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp create mode 100644 src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp create mode 100644 src/OpenSHC/Map/TileMapState/resetMoatArray.cpp create mode 100644 src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp create mode 100644 src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp create mode 100644 src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp create mode 100644 src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp create mode 100644 src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp create mode 100644 src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp create mode 100644 src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp create mode 100644 src/OpenSHC/Map/Trees/UpdateTree16.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/clearTribe.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp create mode 100644 src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp create mode 100644 src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp create mode 100644 src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp create mode 100644 src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp create mode 100644 src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp create mode 100644 src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp create mode 100644 src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp create mode 100644 src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp create mode 100644 src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp create mode 100644 src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp create mode 100644 src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeOutpostField.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp create mode 100644 src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp create mode 100644 src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp create mode 100644 src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp create mode 100644 src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp create mode 100644 src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp create mode 100644 src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp create mode 100644 src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp create mode 100644 src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp create mode 100644 src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp create mode 100644 src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp create mode 100644 src/OpenSHC/Synchrony/GetPlayerPosition.cpp create mode 100644 src/OpenSHC/Synchrony/ProgressBarRelated.cpp create mode 100644 src/OpenSHC/Text/FontSizeClass/getWideCharWidth.cpp create mode 100644 src/OpenSHC/Text/FontSizeClass/renderWideChar.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp create mode 100644 src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp create mode 100644 src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp create mode 100644 src/OpenSHC/Text/TextManager/getTextWidthTillCursorUnk.cpp create mode 100644 src/OpenSHC/Text/TextManager/renderInGameText.cpp create mode 100644 src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp create mode 100644 src/OpenSHC/Text/TextManager/renderNumber.cpp create mode 100644 src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp create mode 100644 src/OpenSHC/Text/TextManager/renderSomeSpecificTextUnk.cpp create mode 100644 src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp create mode 100644 src/OpenSHC/Text/TextManager/trimText.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/getTextWidthUntilCurrentCursor.cpp create mode 100644 src/OpenSHC/Text/UserTextHandler/resetToTextIndex.cpp create mode 100644 src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp create mode 100644 src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp create mode 100644 src/OpenSHC/UI/AppendCreditsCommand.cpp create mode 100644 src/OpenSHC/UI/AppendCreditsListTerminator.cpp create mode 100644 src/OpenSHC/UI/AppendCreditsPauseCommand.cpp create mode 100644 src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp create mode 100644 src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp create mode 100644 src/OpenSHC/UI/FindDisplayElementWithID.cpp create mode 100644 src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp create mode 100644 src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp create mode 100644 src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp create mode 100644 src/OpenSHC/UI/Helpers/CheckGoldResource.cpp create mode 100644 src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp create mode 100644 src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp create mode 100644 src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp create mode 100644 src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp create mode 100644 src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp create mode 100644 src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp create mode 100644 src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp create mode 100644 src/OpenSHC/UI/Menu/updateMenuButtons.cpp create mode 100644 src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp create mode 100644 src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp create mode 100644 src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp create mode 100644 src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp create mode 100644 src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp create mode 100644 src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp create mode 100644 src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp create mode 100644 src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp create mode 100644 src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp create mode 100644 src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp create mode 100644 src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp create mode 100644 src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp create mode 100644 src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp create mode 100644 src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp create mode 100644 src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp create mode 100644 src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp create mode 100644 src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp create mode 100644 src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp create mode 100644 src/OpenSHC/UI/PlayAMessageFromAI.cpp create mode 100644 src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp create mode 100644 src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp create mode 100644 src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp create mode 100644 src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp create mode 100644 src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp create mode 100644 src/OpenSHC/Util/Timing/Stopwatch/stop.cpp create mode 100644 src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp create mode 100644 src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp create mode 100644 src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp create mode 100644 src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp diff --git a/src/OpenSHC/AI/AICState/aiFarmChoice.cpp b/src/OpenSHC/AI/AICState/aiFarmChoice.cpp new file mode 100644 index 00000000..edb187ca --- /dev/null +++ b/src/OpenSHC/AI/AICState/aiFarmChoice.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/Game/Player/PlayerID.hpp" +#include "OpenSHC/AI/AITypeInt.hpp" +#include "OpenSHC/AI/AIType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_EntityState.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::Game::Player::PlayerID; +using OpenSHC::AI::AITypeInt; +using OpenSHC::AI::AIType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004CB180 +int AICState::aiFarmChoice(PlayerID playerID) + +{ +AITypeInt AVar1; + +AVar1 = DAT_GameState::instance.playerDataArray[playerID].aiType; +if (AVar1 == OpenSHC::AI::AIT_NULL) { +return 0; +} +/* + ugly because EAX is always 1 or higher + */ + +return *(int *)((int)DAT_EntityState::instance.seagullArray + +(AVar1 * 0xa9 + DAT_GameState::instance.playerDataArray[playerID].aiFarmIndex) * 4 + 0x24a0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/getResourceRebuildDelay.cpp b/src/OpenSHC/AI/AICState/getResourceRebuildDelay.cpp new file mode 100644 index 00000000..c0e5aee3 --- /dev/null +++ b/src/OpenSHC/AI/AICState/getResourceRebuildDelay.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/AI/AITypeInt.hpp" +#include "OpenSHC/AI/AIType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_EntityState.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::AI::AITypeInt; +using OpenSHC::AI::AIType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004CB150 +int AICState::getResourceRebuildDelay(int param_1) + +{ +AITypeInt AVar1; + +AVar1 = DAT_GameState::instance.playerDataArray[param_1].aiType; +if (AVar1 == OpenSHC::AI::AIT_NULL) { +return 0; +} +/* + access resourceBuildDelay + */ + +return *(int *)((int)DAT_EntityState::instance.seagullArray + AVar1 * 0x2a4 + 0x24ec); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/mapperIsWoodCuttersHutWhileNoWoodAvailable.cpp b/src/OpenSHC/AI/AICState/mapperIsWoodCuttersHutWhileNoWoodAvailable.cpp new file mode 100644 index 00000000..48b7d19f --- /dev/null +++ b/src/OpenSHC/AI/AICState/mapperIsWoodCuttersHutWhileNoWoodAvailable.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_AIVState.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Commands::MappersEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + WARNING: Enum "MappersEnumShort": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ECAB0 +BOOLEnum AICState::mapperIsWoodCuttersHutWhileNoWoodAvailable(undefined4 playerID,MappersEnum param_2) + +{ +if ((param_2 == OpenSHC::Commands::M_MAPPER_WOODSMAN) && (DAT_AIVState::instance.mapExtraInfo.totalWoodAvailable < 1)) { +return TRUE; +} +return FALSE; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/playJokeBikFromAIToHuman.cpp b/src/OpenSHC/AI/AICState/playJokeBikFromAIToHuman.cpp new file mode 100644 index 00000000..490c6988 --- /dev/null +++ b/src/OpenSHC/AI/AICState/playJokeBikFromAIToHuman.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" + + + +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace AI { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004D0F90 +void AICState::playJokeBikFromAIToHuman(int playerID,int aiType) + +{ +int iVar1; + +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getAliveLordForPlayer, DAT_UnitsState::ptr)(playerID); +if (iVar1 != 0) { +MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::AIMessageQueue_Func::playBikVideoFromPlayer, DAT_VideoBikQueue::ptr)(playerID, aiType, 0x14) +; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/setTriggerForAITauntResponse.cpp b/src/OpenSHC/AI/AICState/setTriggerForAITauntResponse.cpp new file mode 100644 index 00000000..ba655907 --- /dev/null +++ b/src/OpenSHC/AI/AICState/setTriggerForAITauntResponse.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004D1090 +void AICState::setTriggerForAITauntResponse() + +{ +BOOLEnum BVar1; + +BVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::getAreWeInAInGameMenu, DAT_GameCore::ptr)(); +if (BVar1 != FALSE) { +this->aiTauntResponseTimeWindow = timeGetTime(); +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/shouldNotBeBuildingArmoury.cpp b/src/OpenSHC/AI/AICState/shouldNotBeBuildingArmoury.cpp new file mode 100644 index 00000000..f9122868 --- /dev/null +++ b/src/OpenSHC/AI/AICState/shouldNotBeBuildingArmoury.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Game/Player/PlayerID.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Game::Player::PlayerID; +using OpenSHC::Commands::MappersEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ECA60 +BOOLEnum AICState::shouldNotBeBuildingArmoury(PlayerID playerID,MappersEnum param_2) + +{ +if (param_2 != OpenSHC::Commands::M_MAPPER_ARMOURY) { +return FALSE; +} +return (uint)(DAT_GameState::instance.playerDataArray[playerID].isArmouryAlmostFilledUp == 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/shouldNotBeBuildingGranary.cpp b/src/OpenSHC/AI/AICState/shouldNotBeBuildingGranary.cpp new file mode 100644 index 00000000..ead0d7e5 --- /dev/null +++ b/src/OpenSHC/AI/AICState/shouldNotBeBuildingGranary.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Commands::MappersEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ECA30 +BOOLEnum AICState::shouldNotBeBuildingGranary(int playerID,MappersEnum param_2) + +{ +if (param_2 != OpenSHC::Commands::M_MAPPER_GRANARY) { +return FALSE; +} +return (uint)(DAT_GameState::instance.playerDataArray[playerID].granaryIsAlmostFilledUp == FALSE); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/unitIDIsRangedOrArmored.cpp b/src/OpenSHC/AI/AICState/unitIDIsRangedOrArmored.cpp new file mode 100644 index 00000000..182291a0 --- /dev/null +++ b/src/OpenSHC/AI/AICState/unitIDIsRangedOrArmored.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/Game/Skirmish/SkirmishDefinedData.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_SkirmishDefinedData.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::Game::Skirmish::SkirmishDefinedData; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004CC8D0 +undefined4 AICState::unitIDIsRangedOrArmored(int unitID) + +{ +SkirmishDefinedData *pSVar1; + +pSVar1 = DAT_SkirmishDefinedData::ptr; +do { +if (pSVar1->RangedAndArmoredUnits[0] == (int)(short)DAT_UnitsState::instance.units[unitID].unitType) { +return(undefined4)( 1); +} +pSVar1 = (SkirmishDefinedData *)(pSVar1->RangedAndArmoredUnits + 1); +} while ((int)pSVar1 < 0xb3eb50); +return(undefined4)( 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/AI/AICState/wipeAICMemory.cpp b/src/OpenSHC/AI/AICState/wipeAICMemory.cpp new file mode 100644 index 00000000..4204a7ce --- /dev/null +++ b/src/OpenSHC/AI/AICState/wipeAICMemory.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/AI/AICState.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace AI { + +using OpenSHC::AI::AICState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004C6D30 +void AICState::wipeAICMemory() + +{ +AICState *destination; +int iVar1; + +destination = this; +iVar1 = 20; +do { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(676, '\0', (void *)((int)(destination))); +destination = (AICState *)(destination->aics + 1); +iVar1 = iVar1 + -1; +} while (iVar1 != 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp b/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp new file mode 100644 index 00000000..f594e089 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::UI::Enums::MenuViewType; + + +/* + Exits the current game view back to the scenario description screen. Calls + Game::GameCore::removeLadyAndJester, clears field25_0x64 on GameCore, then switches to + MVT_SCENARIO_DESCRIPTION via switchToMenuView. Likely triggered by a cancel or back button in a + pre-game UI screen. + + renamed by: Claude Sonnet 4.6 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00471A80 +void GameCore::exitToScenarioDescriptionMenu() + +{ +MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::removeLadyAndJester, this)(); +this->field22_0x64 = 0; +MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, this)(OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp b/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp new file mode 100644 index 00000000..c09a4c47 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp @@ -0,0 +1,49 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + + + +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Game { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Game::GameMode; +using OpenSHC::UI::Enums::MenuModalType; + + +/* + 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 0x0046BD20 +BOOLEnum GameCore::isGameHaltingMenuOpen() + +{ +if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) && +(DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { +return FALSE; +} +if (DAT_MenuTextInputState::instance.currentModalDialog != OpenSHC::UI::Enums::MMT_NO_MENU) { +return TRUE; +} +return (uint)(DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_IN_GAME_HELP_TEXT); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp b/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp new file mode 100644 index 00000000..664b0009 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::UI::Enums::MenuViewType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004719E0 +void GameCore::switchToScenarioDescriptionMenuView() + +{ +MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::removeJesterAndLadyUnitsInCertainMissions, this)(); +MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, this)(OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); +this->field22_0x64 = 0; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp b/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp new file mode 100644 index 00000000..a3e478b3 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00459140 +int GameStateStructures::calculateTaxBribeExpenseForPlayer(int playerIndex,int taxStep,int currentPopulation) + +{ +int _taxIncome; + +_taxIncome = ((5 - taxStep) * currentPopulation) / 2; +if (this->playerDataArray[playerIndex].currentResources[0xf] < 1) { +_taxIncome = 0; +} +return _taxIncome; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp b/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp new file mode 100644 index 00000000..909d8f8d --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Game/State/UnitSelectionHotKeyEntry.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::Game::State::UnitSelectionHotKeyEntry; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00459BB0 +void GameStateStructures::clearTribeHotKey(int hotkeyID) + +{ +UnitSelectionHotKeyEntry *pUVar1; +int iVar2; + +pUVar1 = this->hotkeyTribes + hotkeyID; +iVar2 = 2500; +do { +pUVar1->units[0].id = -1; +pUVar1->units[0].uid = -1; +pUVar1 = (UnitSelectionHotKeyEntry *)(pUVar1->units + 1); +iVar2 = iVar2 + -1; +} while (iVar2 != 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp b/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp new file mode 100644 index 00000000..0a7f3da3 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Entities/EntityState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_EntityState.hpp" + +namespace OpenSHC { +namespace Game { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00457B40 +void GameStateStructures::destroyPlayerCompletely(int playerID) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::killUnits, DAT_UnitsState::ptr)(playerID); +MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::destroyBuildings, DAT_BuildingsState::ptr)(playerID); +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::destroyWallsOfPlayer, DAT_TileMapState::ptr)(playerID); +MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::destroyEntitiesPart2, DAT_EntityState::ptr)(playerID); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp b/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp new file mode 100644 index 00000000..0bfa70ef --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Game/GameStateStructures.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::Game::GameStateStructures; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00459BE0 +void GameStateStructures::fillWith0xFF() + +{ +GameStateStructures *pGVar1; +int iVar2; +int iVar3; + +pGVar1 = this; +iVar3 = 10; +do { +iVar2 = 0x9c4; +do { +pGVar1->hotkeyTribes[0].units[0].id = -1; +pGVar1->hotkeyTribes[0].units[0].uid = -1; +pGVar1 = (GameStateStructures *)(pGVar1->hotkeyTribes[0].units + 1); +iVar2 = iVar2 + -1; +} while (iVar2 != 0); +iVar3 = iVar3 + -1; +} while (iVar3 != 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp b/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp new file mode 100644 index 00000000..6d78973e --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Game/Player/PlayerData.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::Game::Player::PlayerData; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00458700 + int GameStateStructures::findNextPlayerWithMarketplace(int param_1) + + { + int iVar1; + PlayerData* piVar2; + + iVar1 = param_1 + 1; + if (iVar1 < 9) { + piVar2 = &this->playerDataArray[param_1 + 1]; + do { + if (0 < piVar2->marketplace.id) { + return iVar1; + } + iVar1 = iVar1 + 1; + piVar2 = (PlayerData*)((int)(piVar2 + 0x172) + 0x24); + } while (iVar1 < 9); + } + return 0; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp new file mode 100644 index 00000000..cfbdc52a --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004588A0 +int GameStateStructures::getBuyPrice(undefined4 playerID,int resourceType,int amount) + +{ +return (this->mapAndTime.buyAndSalesPriceArray[resourceType].buyPrice / 5) * amount; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp b/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp new file mode 100644 index 00000000..2aeccd7a --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004588D0 +int GameStateStructures::getBuyPriceForOneUnit(int param_1) + +{ +return this->mapAndTime.buyAndSalesPriceArray[param_1].buyPrice / 5; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp new file mode 100644 index 00000000..537e1332 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004591B0 +int GameStateStructures::getNumberToDisplayBribeIncome(int playerIndex,int taxStep,int currentPopulation) + +{ +int iVar1; + +iVar1 = 0; +if (taxStep < 3) { +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::calculateTaxBribeExpenseForPlayer, this)(playerIndex, taxStep, currentPopulation); +iVar1 = iVar1 * 4; +} +return iVar1 / 10; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp new file mode 100644 index 00000000..6d8aef8a --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00459170 +int GameStateStructures::getNumberToDisplayPlayerTaxIncome(int playerIndex,int taxStep,int currentPopulation) + +{ +int iVar1; + +iVar1 = 0; +if (3 < taxStep) { +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::calculateTaxIncomeForPlayer, this)(playerIndex, taxStep, currentPopulation); +iVar1 = iVar1 * 4; +} +return iVar1 / 10; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp b/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp new file mode 100644 index 00000000..45128d71 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp @@ -0,0 +1,28 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::Game::Resources::ResourceType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004588F0 +int GameStateStructures::getSalePriceOfGood(ResourceType param_1) + +{ +return this->mapAndTime.buyAndSalesPriceArray[param_1].salesPrice / 5; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp new file mode 100644 index 00000000..236b2055 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045B7F0 +int GameStateStructures::getSalesPrice(int playerID,int resourceType) + +{ +int _sellAmountUnk; + +_sellAmountUnk = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::getSellResourceAmount, this)(playerID, resourceType); +/* + Actually the same as "this", but the compiler used that EDX is not dirtied. + The decompilation assumes this sadly. --TheRedDaemon + */ + +return (this->mapAndTime.buyAndSalesPriceArray[resourceType].salesPrice / 5) * +_sellAmountUnk; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp new file mode 100644 index 00000000..562e23a0 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00458910 +int GameStateStructures::getSellPrice(int playerID,int resourceType,int amount) + +{ +return (this->mapAndTime.buyAndSalesPriceArray[resourceType].salesPrice / 5) * amount; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp b/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp new file mode 100644 index 00000000..887c06d4 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004596D0 +BOOLEnum GameStateStructures::getTeamsDifferent(int firstPlayerId,int secondPlayerId) + +{ +if ((firstPlayerId != 0) && (secondPlayerId != 0)) { +return (uint)(this->mapAndTime.playerTeams[firstPlayerId] != +this->mapAndTime.playerTeams[secondPlayerId]); +} +return FALSE; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp b/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp new file mode 100644 index 00000000..ff4ed17c --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Game::Resources::ResourceType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00458740 +BOOLEnum GameStateStructures::isResourceTypeTradeable(ResourceType resourceType) + +{ +if (resourceType == OpenSHC::Game::Resources::RT_PITCH) { +resourceType = OpenSHC::Game::Resources::RT_PARTIALPITCH; +} +return (uint)(this->mapAndTime.isResourceTradeable[resourceType] != 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp b/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp new file mode 100644 index 00000000..23bac844 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Game { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401090 +BOOLEnum GameStateStructures::isSameTeam(int playerID1,int playerID2) + +{ +return (uint)(this->mapAndTime.playerTeams[playerID1] == +this->mapAndTime.playerTeams[playerID2]); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp b/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp new file mode 100644 index 00000000..def7a048 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + + + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045AF00 +void GameStateStructures::resetSomethingBuildingRelatedForAllPlayers() + +{ +int iVar1; +int playerID; + +playerID = 1; +do { +iVar1 = 0; +do { +MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::validateBuildingCategoryReference, this)(playerID, iVar1); +iVar1 = iVar1 + 1; +} while (iVar1 < 0x14); +playerID = playerID + 1; +} while (playerID < 9); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp b/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp new file mode 100644 index 00000000..c45857c6 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/AI/AICState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_AICState.hpp" + +namespace OpenSHC { +namespace Game { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045B460 +void GameStateStructures::switchPlayerOwnership(int playerID) + +{ +int fromPlayer; + +fromPlayer = 1; +do { +if (fromPlayer != playerID) { +MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::changePlayerOwnership, this)(fromPlayer, playerID); +} +fromPlayer = fromPlayer + 1; +} while (fromPlayer < 9); +MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::recomputeAIZonerLayer, DAT_AICState::ptr)(); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/IO/LowLevelMemory/fillMemory_ByteValue.cpp b/src/OpenSHC/IO/LowLevelMemory/fillMemory_ByteValue.cpp new file mode 100644 index 00000000..01fd8692 --- /dev/null +++ b/src/OpenSHC/IO/LowLevelMemory/fillMemory_ByteValue.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + + + +namespace OpenSHC { +namespace IO { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004718C0 +void LowLevelMemory::fillMemory_ByteValue(size_t size,uchar value,void *destination) + +{ +this->value = (uint)value * 0x1010101; +this->size = size; +this->destination = destination; +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x100, this)(); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x010, this)(); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x001, this)(); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/IO/LowLevelMemory/fillMemory_IntegerValue.cpp b/src/OpenSHC/IO/LowLevelMemory/fillMemory_IntegerValue.cpp new file mode 100644 index 00000000..e7c29dd9 --- /dev/null +++ b/src/OpenSHC/IO/LowLevelMemory/fillMemory_IntegerValue.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + + + +namespace OpenSHC { +namespace IO { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00471860 +void LowLevelMemory::fillMemory_IntegerValue(size_t size,int value,void *destination) + +{ +this->size = size; +this->value = value; +this->destination = destination; +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x100, this)(); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x010, this)(); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x004, this)(); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/IO/LowLevelMemory/fillMemory_ShortValue.cpp b/src/OpenSHC/IO/LowLevelMemory/fillMemory_ShortValue.cpp new file mode 100644 index 00000000..426dc551 --- /dev/null +++ b/src/OpenSHC/IO/LowLevelMemory/fillMemory_ShortValue.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + + + +namespace OpenSHC { +namespace IO { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00471890 +void LowLevelMemory::fillMemory_ShortValue(size_t size,ushort shortValue,void *dst) + +{ +this->value = (uint)shortValue * 0x10001; +this->size = size; +this->destination = dst; +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x100, this)(); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x010, this)(); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_setMemoryToValue_0x002, this)(); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/IO/ResourceManager/mapNames_getLoadedMapNameForIndex.cpp b/src/OpenSHC/IO/ResourceManager/mapNames_getLoadedMapNameForIndex.cpp new file mode 100644 index 00000000..767e0618 --- /dev/null +++ b/src/OpenSHC/IO/ResourceManager/mapNames_getLoadedMapNameForIndex.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/IO/ResourceManager.func.hpp" + + + + + +namespace OpenSHC { +namespace IO { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0046C2E0 +char * ResourceManager::mapNames_getLoadedMapNameForIndex(int mapIndex) + +{ +if (499 < mapIndex) { +return (char *)0x0; +} +return(char *)( this->loadedMapNames[mapIndex]); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp b/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp new file mode 100644 index 00000000..11fe8794 --- /dev/null +++ b/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Input/MouseState.func.hpp" + + + + + +namespace OpenSHC { +namespace Input { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00468590 +void MouseState::resetMouseCursorState() + +{ +this->selectionBox.left = 0; +this->selectionBox.top = 0; +this->selectionBox.right = 0; +this->selectionBox.bottom = 0; +this->previousSelectionBox.left = 0; +this->previousSelectionBox.top = 0; +this->previousSelectionBox.right = 0; +this->previousSelectionBox.bottom = 0; +this->selectionBoxMode = 0; +this->field31_0x94 = 0; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp new file mode 100644 index 00000000..2501474d --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp @@ -0,0 +1,46 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Buildings { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0040F3F0 +void BuildingsState::clearBuildingValueWhenStateIsTwo() + +{ +Building * piVar1; +int iVar1; + +iVar1 = 1; +if (1 < this->maxBuildingsCount) { +piVar1 = &this->buildings[1]; +do { +if (piVar1->logicalState == OpenSHC::Map::Buildings::BLS_NORMAL) { +piVar1->animStateCounterTracker = 0; +} +iVar1 = iVar1 + 1; +piVar1 = piVar1 + 0xcb; +} while (iVar1 < this->maxBuildingsCount); +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp new file mode 100644 index 00000000..19d66db4 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp @@ -0,0 +1,60 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Buildings { + +using OpenSHC::Map::Buildings::BuildingTypeShort; +using OpenSHC::Map::Buildings::BuildingType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00422370 +uint BuildingsState::getArmoryWithSpaceLeft(uint targetBuildingID,undefined4 producedItemTypeUnk,int playerID,int resourceToDeposit) + +{ +uint uVar1; +int iVar2; +BuildingTypeShort *pBVar3; +uint _buildingID; + +if (targetBuildingID != 0) { +uVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getArmoryIDIfSpaceLeft, this)(targetBuildingID, (undefined4)((int)(producedItemTypeUnk)), playerID, +resourceToDeposit); +return uVar1; +} +_buildingID = 1; +if (1 < this->maxBuildingsCount) { +pBVar3 = &this->buildings[1].buildingType; +do { +if (*pBVar3 == OpenSHC::Map::Buildings::BT_ARMORY) { +iVar2 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::buildingIsAccessible, this)(_buildingID, 0); +if (iVar2 != 0) { +uVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getArmoryIDIfSpaceLeft, this)(_buildingID, (undefined4)((int)(producedItemTypeUnk)), playerID, +resourceToDeposit); +if (uVar1 != 0) { +return _buildingID; +} +} +} +_buildingID = _buildingID + 1; +pBVar3 = pBVar3 + 0x196; +} while ((int)_buildingID < this->maxBuildingsCount); +} +return 0; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp new file mode 100644 index 00000000..c8e24be7 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Buildings { + +using OpenSHC::Game::Resources::ResourceType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00409330 +undefined4 BuildingsState::getBuildingResourceAmountByUid(int buildingID,int param_2,ResourceType param_3) + +{ +if (this->buildings[buildingID].uid != param_2) { +return(undefined4)( 0); +} +return(undefined4)( this->buildings[buildingID].resources[param_3]); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp new file mode 100644 index 00000000..927d01b0 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Buildings { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0040BFA0 +int BuildingsState::getResourceCountThatCanBeDeposited(int buildingID,undefined4 resourceType,int storageLimit) + +{ +uint uVar1; + +uVar1 = this->buildings[buildingID].currentNumberOfResource; +if (storageLimit <= (int)uVar1) { +return 0; +} +return(int)( storageLimit - uVar1); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp new file mode 100644 index 00000000..49a37665 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" + +namespace OpenSHC { +namespace Map { +namespace Buildings { + +using OpenSHC::Commands::MappersEnum; +using OpenSHC::Map::Buildings::BuildingType; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00409FF0 +int BuildingsState::getSpriteID2(MappersEnum commandBuildingType) + +{ +BuildingType BVar1; +int iVar2; + +BVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::convertCommandBuildingTypeToBuildingType, this)(commandBuildingType); +if (DAT_BuildingDefinedData::instance.Building_Sprite_ID_Array_2[BVar1] == 0) { +iVar2 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getSpriteID, this)(commandBuildingType); +return iVar2; +} +return DAT_BuildingDefinedData::instance.Building_Sprite_ID_Array_2[BVar1]; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp new file mode 100644 index 00000000..21f3196b --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Buildings { + +using OpenSHC::Map::Buildings::BuildingTypeShort; +using OpenSHC::Map::Buildings::BuildingType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0040A4A0 +uint BuildingsState::isReligiousBuilding(int buildingID) + +{ +BuildingTypeShort BVar1; + +BVar1 = this->buildings[buildingID].buildingType; +if ((BVar1 != OpenSHC::Map::Buildings::BT_CHAPEL) && (BVar1 != OpenSHC::Map::Buildings::BT_CHURCH)) { +return (uint)(BVar1 == OpenSHC::Map::Buildings::BT_CATHEDRAL); +} +return 1; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp new file mode 100644 index 00000000..b9ab0069 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp @@ -0,0 +1,49 @@ +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalStateShort.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Buildings { + +using OpenSHC::Map::Buildings::BuildingLogicalStateShort; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004197C0 +void BuildingsState::updatePathLinkageLayerForAllBuildings() + +{ +BuildingLogicalStateShort *_ptrLogicalState; +int _buildingID; + +_buildingID = 1; +_ptrLogicalState = &this->buildings[1].logicalState; +do { +if (*_ptrLogicalState != ((BuildingLogicalState)0)) { +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::updatePathLinkagesForBuilding, DAT_TileMapState::ptr)(_buildingID); +} +_ptrLogicalState = _ptrLogicalState + 0x196; +_buildingID = _buildingID + 1; +} while ((int)_ptrLogicalState < 0x1124dc4); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp b/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp new file mode 100644 index 00000000..6d715cec --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Map/Buildings.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00419340 +void Buildings::UpdateBadBuildingRackFlogging() + +{ +int buildingID; + +buildingID = DAT_CurrentBuildingID::instance; +DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; +DAT_BuildingsState::instance.buildings[buildingID].displayOwnerFlag = 0; +MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::addBuildingInRegistry, DAT_GameState::ptr)(buildingID); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp b/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp new file mode 100644 index 00000000..ad3a0a0f --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Buildings.func.hpp" +#include "OpenSHC/AI/AICState.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_AICState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00418880 +void Buildings::UpdateGoodBuildingGarden() + +{ +int buildingID; + +buildingID = DAT_CurrentBuildingID::instance; +DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; +MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::addBuildingToTargetableBuildings, DAT_AICState::ptr)(buildingID); +MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::addBuildingInRegistry, DAT_GameState::ptr)(DAT_CurrentBuildingID::instance); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp new file mode 100644 index 00000000..8ef030ab --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Buildings.func.hpp" + + + +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004184A0 +void Buildings::UpdateParadeGround2() + +{ +int iVar1; + +iVar1 = DAT_CurrentBuildingID::instance; +DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; +DAT_BuildingsState::instance.buildings[iVar1].animationIncrement = 1; +DAT_BuildingsState::instance.buildings[iVar1].animationFrame = 0x20; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp new file mode 100644 index 00000000..b4a4b814 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Buildings.func.hpp" + + + +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004184D0 +void Buildings::UpdateParadeGround3() + +{ +int iVar1; + +iVar1 = DAT_CurrentBuildingID::instance; +DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; +DAT_BuildingsState::instance.buildings[iVar1].animationIncrement = 1; +DAT_BuildingsState::instance.buildings[iVar1].animationFrame = 0x1f; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp new file mode 100644 index 00000000..ac9dd5c5 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Buildings.func.hpp" + + + +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00418500 +void Buildings::UpdateParadeGround4() + +{ +int iVar1; + +iVar1 = DAT_CurrentBuildingID::instance; +DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; +DAT_BuildingsState::instance.buildings[iVar1].animationIncrement = 1; +DAT_BuildingsState::instance.buildings[iVar1].animationFrame = 0x21; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp b/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp new file mode 100644 index 00000000..f66ce210 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Buildings.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004188C0 +void Buildings::UpdatePlacedSiegeTower() + +{ +int iVar1; + +iVar1 = (int)DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].unitRefID; +if ((iVar1 == 0) || +(DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].unitRefUID != +DAT_UnitsState::instance.units[iVar1].uid)) { +DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].logicalState = OpenSHC::Map::Buildings::BLS_REMOVE; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp new file mode 100644 index 00000000..1cd41ce9 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" +#include "OpenSHC/Map/Entities/EntityTypeShort.hpp" +#include "OpenSHC/Map/Entities/EntityType.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Entities { + +using OpenSHC::Map::Entities::EntityTypeShort; +using OpenSHC::Map::Entities::EntityType; + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004039B0 +int EntityState::activateProjectileEntity(int entityID) + +{ +EntityTypeShort EVar1; + +EVar1 = this->entityArray[entityID].entityType2; +this->entityArray[entityID].logicalState = 2; +this->entityArray[entityID].field72_0xa8 = 1; +MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::setProjectileEntityValues2, this)(entityID, (EntityType)((int)((int)(short)EVar1))); +return entityID; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp new file mode 100644 index 00000000..effba8e0 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { +namespace Entities { + + + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004039F0 +void EntityState::deleteEntity(uint entityID) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::doSomethingWithOtherEntitiesOnTile, this)(entityID); +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(232, '\0', (void *)((int)(this->entityArray + entityID))); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp b/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp new file mode 100644 index 00000000..78846392 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" +#include "OpenSHC/Map/Entities/Entity.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Entities { + +using OpenSHC::Map::Entities::Entity; + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401B60 +void EntityState::destroyEntitiesPart2(int param_1) + +{ +Entity * psVar1; +int iVar1; + +psVar1 = &this->entityArray[1]; +iVar1 = 2999; +do { +if ((psVar1->logicalState == 2) && (psVar1->owner == param_1)) { +psVar1->logicalState = 3; +} +psVar1 = psVar1 + 0x74; +iVar1 = iVar1 + -1; +} while (iVar1 != 0); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp b/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp new file mode 100644 index 00000000..b33454d0 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp @@ -0,0 +1,46 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" +#include "OpenSHC/Map/Entities/EntityType.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Entities { + +using OpenSHC::Map::Entities::EntityType; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401540 +int EntityState::getFireEntityIDAtTile(int tile) + +{ +short _entityTileID; +int _entityTileID_2; + +_entityTileID = DAT_TileMapState::instance.EntityLayer[tile]; +while( true ) { +_entityTileID_2 = (int)_entityTileID; +if (_entityTileID_2 == 0) { +return 0; +} +if (this->entityArray[_entityTileID_2].entityType == OpenSHC::Map::Entities::ET_FIRE) break; +_entityTileID = this->entityArray[_entityTileID_2].nextEntityOnThisTileByID; +} +return _entityTileID_2; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp b/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp new file mode 100644 index 00000000..19e2cbcd --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Entities { + + + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401400 +void EntityState::markEntityDestroyed(int param_1) + +{ +if (0 < param_1) { +this->entityArray[param_1].logicalState = 3; +this->entityArray[param_1].someCounter_OR_hitGround = 10; +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp b/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp new file mode 100644 index 00000000..a57b439c --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Entities { + + + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401AE0 +void EntityState::reassignEntitiesOwner(int param_1,undefined4 param_2) + +{ +short *psVar1; +int iVar2; + +psVar1 = &this->entityArray[1].owner; +iVar2 = 2999; +do { +if ((psVar1[-2] == 2) && (*psVar1 == param_1)) { +*psVar1 = (short)param_2; +} +psVar1 = psVar1 + 0x74; +iVar2 = iVar2 + -1; +} while (iVar2 != 0); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp b/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp new file mode 100644 index 00000000..258f5e21 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/Entities/EntityState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Entities { + + + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401430 +void EntityState::tickEntityDecayCounter(int param_1) + +{ +short sVar1; + +sVar1 = this->entityArray[param_1].unkMinusOne; +if (0x1e < sVar1) { +this->entityArray[param_1].logicalState = 3; +return; +} +this->entityArray[param_1].unkMinusOne = sVar1 + 1; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp b/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp new file mode 100644 index 00000000..09f0a610 --- /dev/null +++ b/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Map/Entities.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00407130 +uint Entities::IgniteFireAtMiniTile_Convenience(int playerID,int miniTileX,int miniTileY,int tileHeightMin8,int two) + +{ +uint uVar1; + +uVar1 = MACRO_CALL(OpenSHC::Map::Entities_Func::IgniteFireAtMiniTile)(playerID, miniTileX, miniTileY, tileHeightMin8, two, 0); +return uVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp b/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp new file mode 100644 index 00000000..6dfeee8b --- /dev/null +++ b/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp @@ -0,0 +1,28 @@ +#include "OpenSHC/Map/Entities.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00407160 +void Entities::SetPlaceOnFire(int playerID,int x,int y,int height,int param_5) + +{ +MACRO_CALL(OpenSHC::Map::Entities_Func::AFireSpreadFunction)(playerID, x, y, height, param_5, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp b/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp new file mode 100644 index 00000000..c853dbe2 --- /dev/null +++ b/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Map/Entities.func.hpp" + + + +#include "OpenSHC/Globals/DAT_CurrentEntityID.hpp" +#include "OpenSHC/Globals/DAT_EntityState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00402AB0 +void Entities::UpdateBrazierEntity() + +{ +DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].graphicType2 = +((byte)DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].unknownAnimationFrameRelated &7) + +(int)DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].graphicType2RelatedOffset; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp b/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp new file mode 100644 index 00000000..b7e95a8d --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/Map/LandscapeState.hpp" + + + + + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::LandscapeState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F3930 +LandscapeState * LandscapeState::constructLandscapeState() + +{ +this->creationTime = timeGetTime(); +MACRO_CALL_MEMBER(OpenSHC::Map::LandscapeState_Func::clearRocksAndTrees, this)(); +MACRO_CALL_MEMBER(OpenSHC::Map::LandscapeState_Func::resetWind, this)(); +this->field1_0x4 = 1; +return this; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp b/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp new file mode 100644 index 00000000..e04be0b2 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F2FE0 +BOOLEnum LandscapeState::isTreeAdult(int treeID,int treeUID) + +{ +if (this->trees[treeID].uid != treeUID) { +return FALSE; +} +return (uint)(0 < (short)this->trees[treeID].treeAdultHoodStageRelatedVisual3); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp b/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp new file mode 100644 index 00000000..6d1e9847 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F2FB0 +uint LandscapeState::isTreeAliveAndMatchingUID(int treeID,int param_2) + +{ +if (this->trees[treeID].uid != param_2) { +return 0; +} +return (uint)(this->trees[treeID].zeroUpTo2 == 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/resetWind.cpp b/src/OpenSHC/Map/LandscapeState/resetWind.cpp new file mode 100644 index 00000000..3e16ffef --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/resetWind.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F3700 +void LandscapeState::resetWind() + +{ +this->wind.value = 0; +this->wind.index = 0; +this->wind.countdown = 0; +this->wind.field4_0x10 = 0; +this->wind.counter = 0; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp b/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp new file mode 100644 index 00000000..68a814b3 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/IO/PackagedFileMagicNum.hpp" +#include "OpenSHC/Map/Version.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + +using OpenSHC::IO::PackagedFileMagicNum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F3D30 +void LandscapeState::upgradeTreesAndRocksForMapVersion(PackagedFileMagicNum receivedMapVersion,PackagedFileMagicNum packagerMapVersion) + +{ +MACRO_CALL(OpenSHC::Map::Version_Func::UpdateTreesOfCertainTypes)(); +MACRO_CALL(OpenSHC::Map::Version_Func::UpdateFixTrees2)(); +MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeRemoveCertainRockTypesUnk)(); +if ((receivedMapVersion != packagerMapVersion) && ((int)receivedMapVersion < 0xa5)) { +MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeRemoveRocksBeyond1000)(); +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp b/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp new file mode 100644 index 00000000..d9e86f66 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Game::GameMode2; + + +/* + Returns 1 always in editor mode. Otherwise returns SEC_MercRecruitable[param_1 - 0x38] from + MapPropertiesState, indicating whether the mercenary unit type associated with this building + offset is recruitable in the current map configuration. + + renamed by: Claude Sonnet 4.6 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004BB0B0 +int MapPropertiesState::isMercRecruitableForBuildingType(int param_1) + +{ +int iVar1; + +iVar1 = 1; +if (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_EDITOR) { +iVar1 = (int)this->SEC_MercRecruitable[param_1 + -0x38]; +} +return iVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp b/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp new file mode 100644 index 00000000..27200dae --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004B7890 +undefined4 MapPropertiesState::mapHasCertainEvent() + +{ +int iVar1; +int *piVar2; + +iVar1 = 0; +if (0 < this->eventsCount) { +piVar2 = &this->scenarioEvents[0].header.tl_type; +do { +if (*piVar2 == 1) { +return(undefined4)( 1); +} +iVar1 = iVar1 + 1; +piVar2 = piVar2 + 0x39; +} while (iVar1 < this->eventsCount); +} +return(undefined4)( 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp b/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp new file mode 100644 index 00000000..4ff3a233 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Game/ScenarioEvents/InGameEventUnionVersion.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/Game/ScenarioEvents/InGameEventUnionVersion.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Game::ScenarioEvents::InGameEventUnionVersion; + using OpenSHC::UI::Enums::MenuModalType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x004BB9F0 + void MapPropertiesState::openEventTriggerMenu(undefined4 eventType) + + { + this->eventType = eventType; + MACRO_CALL_MEMBER(OpenSHC::Game::ScenarioEvents::InGameEventUnionVersion_Func::resetEvent, + (InGameEventUnionVersion*)&this->invasionEvent)(); + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_TRIGGER_EVENT_OR_INVASION); + return; + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp b/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp new file mode 100644 index 00000000..3c5dc166 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004BBA20 +void MapPropertiesState::sumInvasionEventUnitCount() + +{ +int *piVar1; +int *piVar2; + +this->DAT_InvasionEventItemUnitCountSum = 0; +piVar1 = this->invasionEventContent.unitCountsPerUnitType + 3; +do { +piVar2 = piVar1 + 5; +this->DAT_InvasionEventItemUnitCountSum = +this->DAT_InvasionEventItemUnitCountSum + +piVar1[-3] + piVar1[-2] + piVar1[-1] + piVar1[1] + *piVar1; +piVar1 = piVar2; +} while ((int)piVar2 < 0x1667ebc); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp b/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp new file mode 100644 index 00000000..4540f11e --- /dev/null +++ b/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/Navigation/DirectionAlgorithmState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Navigation { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004092C0 +int DirectionAlgorithmState::computeHealthPercentage(int param_1,int param_2) + +{ +if (param_2 == 0) { +return 100; +} +return (param_1 * 100) / param_2; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp new file mode 100644 index 00000000..73d91dff --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Navigation { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004A94E0 +void PathFindingState::clearAllClimbData() + +{ +int iVar1; + +iVar1 = 0; +this->numberOfClimbTeleports = 0; +do { +MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::clearClimbData, this)(iVar1); +iVar1 = iVar1 + 1; +} while (iVar1 < 200); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp new file mode 100644 index 00000000..702cb07b --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { +namespace Navigation { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004A4B80 +void PathFindingState::clearClimbData(int param_1) + +{ +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x204, '\0', (void *)((int)(this->climbData + param_1))); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp new file mode 100644 index 00000000..0c836dbd --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Navigation { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004A9DD0 +undefined4 PathFindingState::retraceAndCommitPathPlan() + +{ +this->searchQueue.pathPlanIndex = 0; +MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::traceAndCommitPathPlan, this)(this->unitX, (uint)((int)(this->unitY)), (uint)((int)( +this->destinationX)), (uint)((int)(this->destinationY)), 0); +return this->searchQueue.pathPlanIndex; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp new file mode 100644 index 00000000..2d83068c --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Navigation { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004A5F60 +void PathFindingState::updatePathLinkageLayerForEachBuildingAtEachTile() + +{ +int _tileIndex; + +_tileIndex = 0; +do { +MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::updatePathLinkageLayerBasedOnBuildingsUnk, this)( +(int)DAT_ViewportRenderState::instance.tileTranslationMatrix_YComponent[_tileIndex], _tileIndex) +; +_tileIndex = _tileIndex + 1; +} while (_tileIndex < 80400); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/clearMoatData.cpp b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp new file mode 100644 index 00000000..70ace946 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005002D0 +void TileMapState::clearMoatData(uint moatID) + +{ +if (moatID < 16000) { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x10, '\0', (void *)((int)(this->moats + moatID))); +this->moatTileCount = this->moatTileCount + -1; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp new file mode 100644 index 00000000..a493f76f --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005017A0 +void TileMapState::forceFullTileMapRedraw() + +{ +this->forceUpdateLogicalAndMiscDisplayLayers = 1; +this->forceUpdateTextureTilemap = 1; +this->forceUpdateGFXLayers = 1; +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::setChangedLayerToThreeAndMapping0x40x40, this)(); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp b/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp new file mode 100644 index 00000000..1387de1b --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00409300 +BOOLEnum TileMapState::processDamageToBuildingThunk(int targetedTile,uint targetedTileX,uint targetedTileY,int damage,int param_5,int playerID,BOOLEnum aiBuildDelayRelated) + +{ +BOOLEnum BVar1; + +BVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::processDamageToBuilding, this)(targetedTile, targetedTileX, targetedTileY, damage, param_5, +playerID, aiBuildDelayRelated, 0); +return BVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp b/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp new file mode 100644 index 00000000..d5967dfc --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401060 +void TileMapState::processEntityDamageToBuildingCollateralThunk(int tile,uint x_2,uint y_2,int damage,int playerID,undefined4 unused) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::processEntityDamageToBuildingCollateral, this)(tile, x_2, y_2, damage, playerID, (undefined4)((int)(unused)), 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp new file mode 100644 index 00000000..c27bff28 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00512920 +void TileMapState::processMapOrientationChange() + +{ +if (this->DAT_FutureMapOrientation < 8) { +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::changeMapOrientation, this)(this->DAT_FutureMapOrientation); +this->DAT_FutureMapOrientation = 8; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp new file mode 100644 index 00000000..9cc14699 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005000A0 +void TileMapState::recountTotalOwnedMoats() + +{ +int iVar1; +byte *pbVar2; + +this->currentMoatCount = 0; +iVar1 = 1; +pbVar2 = &this->moats[1].owner; +do { +if (*pbVar2 != 0) { +this->currentMoatCount = iVar1 + 1; +} +iVar1 = iVar1 + 1; +pbVar2 = pbVar2 + 0x10; +} while (iVar1 < 16000); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp new file mode 100644 index 00000000..01ed4260 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Moat.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Moat; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00500680 +void TileMapState::resetMoatArray() + +{ +Moat *destination; +int iVar1; + +destination = this->moats; +iVar1 = 16000; +do { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x10, '\0', (void *)((int)(destination))); +destination = destination + 1; +iVar1 = iVar1 + -1; +} while (iVar1 != 0); +this->moatTileCount = iVar1; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp new file mode 100644 index 00000000..2357e538 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/PitchDitch.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::PitchDitch; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005007D0 +void TileMapState::resetPitchDitchArray() + +{ +PitchDitch *destination; +int iVar1; + +iVar1 = 4000; +this->maxPitchDitchCount = 4000; +destination = this->pitchDitches; +do { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x14, '\0', (void *)((int)(destination))); +destination = destination + 1; +iVar1 = iVar1 + -1; +} while (iVar1 != 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp new file mode 100644 index 00000000..f1b83ebe --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00500750 +void TileMapState::setMoatOwnerForAllMatching(int param_1,undefined4 param_2) + +{ +byte *pbVar1; +int iVar2; + +pbVar1 = &this->moats[1].owner; +iVar2 = 15999; +do { +if ((*pbVar1 != 0) && ((char)*pbVar1 == param_1)) { +*pbVar1 = (byte)param_2; +} +pbVar1 = pbVar1 + 0x10; +iVar2 = iVar2 + -1; +} while (iVar2 != 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp new file mode 100644 index 00000000..e14386dc --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00500720 +void TileMapState::setMoatVisualStateAtTile(int tile,undefined4 zeroOrTwo) + +{ +int iVar1; + +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::returnOwnedMoatAtTile, this)(tile); +if (iVar1 != 0) { +this->moats[iVar1].zeroOrTwo = (short)zeroOrTwo; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp new file mode 100644 index 00000000..ca5e0e13 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PathFindingState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005011A0 +void TileMapState::spreadBrazierPlacementAlgorithm(int playerID,uint x,uint y) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, DAT_PathFindingState::ptr)(playerID, x, y, 4, 1); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp new file mode 100644 index 00000000..511d4fae --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PathFindingState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00501180 +int TileMapState::spreadFlagPlacementAlgorithm(int param_1,uint param_2,uint param_3) + +{ +int iVar1; + +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, DAT_PathFindingState::ptr)(param_1, param_2, param_3, 4, 0); +return iVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp new file mode 100644 index 00000000..e4932f28 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00504EE0 +void TileMapState::updateBuildingPlacementRotationPreview(int param_1,int param_2) + +{ +BOOLEnum BVar1; + +BVar1 = this->buildingPlacementFail; +this->buildingPlacementFail = FALSE; +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::determineBuildingPlacementRotation, this)(param_1, param_2); +this->buildingPlacementFail = BVar1; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp new file mode 100644 index 00000000..87d52e0e --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp @@ -0,0 +1,55 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Moat.hpp" + + + + + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Moat; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00500640 +void TileMapState::updateMoatCountdownTimers() + +{ +Moat * _pMoats; +int iVar1; + +MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::recountTotalOwnedMoats, this)(); +iVar1 = 0; +/* + DAT_TotalOwnedMoats + */ + +if (0 < this->currentMoatCount) { +/* + SEC_MoatArray[0].field11_0xf + */ + +_pMoats = &this->moats[0]; +do { +if ((_pMoats->owner != 0) && ('\0' < (char)_pMoats->someCountDown)) { +_pMoats->someCountDown = _pMoats->someCountDown - 1; +} +iVar1 = iVar1 + 1; +_pMoats = _pMoats + 0x10; +} while (iVar1 < this->currentMoatCount); +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Trees/UpdateTree16.cpp b/src/OpenSHC/Map/Trees/UpdateTree16.cpp new file mode 100644 index 00000000..75a81034 --- /dev/null +++ b/src/OpenSHC/Map/Trees/UpdateTree16.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/Trees.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LandscapeState.hpp" +#include "OpenSHC/Globals/DAT_CurrentTreeID.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F28F0 +void Trees::UpdateTree16() + +{ +int iVar1; +int iVar2; + +iVar1 = DAT_CurrentTreeID::instance; +iVar2 = (DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].rng1 &7U) + 10; +DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].animationFrameUnk = iVar2; +DAT_LandscapeState::instance.trees[iVar1].animationFrame2Unk = iVar2; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp new file mode 100644 index 00000000..a846a614 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitSelectionDefinedData.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00522520 +void TribesState::addUnitToSelected(uint unitID) + +{ +uint uVar1; + +uVar1 = unitID &0x8000000f; +if ((int)uVar1 < 0) { +uVar1 = (uVar1 - 1 | 0xfffffff0) + 1; +} +*(ushort *) +(DAT_UnitsState::instance.selectedUnitsBitFlags + ((int)(unitID + ((int)unitID >> 0x1f &0xfU)) >> 4) * 2) += *(ushort *) +(DAT_UnitsState::instance.selectedUnitsBitFlags + +((int)(unitID + ((int)unitID >> 0x1f &0xfU)) >> 4) * 2) | +DAT_UnitSelectionDefinedData::instance.BitMaskHelper[uVar1]; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp new file mode 100644 index 00000000..31128f24 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00522BC0 +void TribesState::clearTribe(int param_1) + +{ +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(820, '\0', (void *)((int)(this->tribes + param_1))); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp b/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp new file mode 100644 index 00000000..fd3ec8af --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::TribesState; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00521180 + TribesState* TribesState::Constructor_TribesState() + + { + this->constructorTime = timeGetTime(); + this->clans = 0; + this->fcn_mtribe = 0; + this->field2_0x8 = 1; + return this; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp new file mode 100644 index 00000000..bf624ccb --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/Instructions/UnitMatchSpeedEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::Instructions::UnitMatchSpeedEnum; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x004B7700 + void TribesState::giveUnitSelectionMoveInstructionNoMatchedSpeed( + undefined4 tribeID, undefined4 x, undefined4 y, undefined4 rallyBool, undefined4 doRally) + + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::giveTribeMoveInstruction, this)( + tribeID, x, y, rallyBool, doRally, OpenSHC::Map::Units::Instructions::UMSE_0); + return; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp new file mode 100644 index 00000000..8566ec2e --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00522110 + void TribesState::playPatrolCommandSpeech(undefined4 param_1) + + { + UnitType unitType; + int actionID; + + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( + 1); + actionID = 0x29; + unitType = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( + param_1, (int*)¶m_1); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( + unitType, actionID); + return; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp new file mode 100644 index 00000000..56c7299b --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00521EB0 + void TribesState::playUnitSelectSpeech(undefined4 param_1) + + { + UnitType unitType; + + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( + 1); + unitType = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( + param_1, (int*)¶m_1); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)(unitType, 0xb); + return; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp new file mode 100644 index 00000000..0d55b8e9 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00522160 + void TribesState::playWorkCommandSpeech(undefined4 param_1) + + { + UnitType unitType; + int actionID; + + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( + 1); + actionID = 0x24; + unitType = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( + param_1, (int*)¶m_1); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( + unitType, actionID); + return; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp b/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp new file mode 100644 index 00000000..63a96999 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00525B70 +int TribesState::popUnitFromTribe(int tribeID) + +{ +uint _unitID; + +_unitID = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getUnitIDForIndexInTribe, this)(tribeID, 0); +if (_unitID != 0) { +MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::removeUnitFromTribe, this)(_unitID, tribeID); +} +return(int)( _unitID); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp new file mode 100644 index 00000000..3e3c3784 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x00522BF0 +void TribesState::queueUnitStance(undefined4 stanceID,undefined4 param_2) + +{ +DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = stanceID; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_UNIT_STANCE); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp new file mode 100644 index 00000000..bad249b1 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00521210 +void TribesState::reassignOwnerForTribesOfBehaviorType2(int param_1,int param_2) + +{ +int *piVar1; + +piVar1 = &this->tribes[1].owner; +do { +if ((*(short *)(piVar1 + 5) == 2) && (*piVar1 == param_1)) { +*piVar1 = param_2; +} +piVar1 = piVar1 + 0xcd; +} while ((int)piVar1 < 0x176238c); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp new file mode 100644 index 00000000..516695d0 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005233E0 +void TribesState::setCamelSpawnXY(undefined4 x,undefined4 y) + +{ +short (*pasVar1) [2]; + +pasVar1 = DAT_GameState::instance.mapAndTime.camelSpawnXY; +do { +if ((*pasVar1)[0] == 0) { +(*pasVar1)[0] = (short)x; +(*pasVar1)[1] = (short)y; +} +pasVar1 = pasVar1 + 1; +} while ((int)pasVar1 < 0x117ef30); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp new file mode 100644 index 00000000..2ade4fe8 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/Behavior/UnitStanceEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Map::Units::Behavior::UnitStanceEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00522C20 +void TribesState::setUnitStance(int tribeID,UnitStanceEnum unitStance) + +{ +this->tribes[tribeID].unitStance = (undefined2)unitStance; +DAT_GameCore::instance.countdown = 1; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp new file mode 100644 index 00000000..3ee4e147 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005224E0 +int TribesState::setWhetherTribeContainsAnyUnits(int tribeID) + +{ +int iVar1; +short *psVar2; + +iVar1 = 0; +psVar2 = this->tribes[tribeID].unitSelectionBitMasked; +do { +if (*psVar2 != 0) { +this->tribes[tribeID].highestID = (short)iVar1; +return iVar1; +} +iVar1 = iVar1 + 1; +psVar2 = psVar2 + 1; +} while (iVar1 < 200); +return iVar1; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp new file mode 100644 index 00000000..fd9346fd --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00523340 +void TribesState::storeDeerXAndYinMapInfo(undefined4 x,undefined4 y) + +{ +short (*pasVar1) [2]; + +pasVar1 = DAT_GameState::instance.mapAndTime.deerSpawnLocationsXY; +do { +if ((*pasVar1)[0] == 0) { +(*pasVar1)[0] = (short)x; +(*pasVar1)[1] = (short)y; +} +pasVar1 = pasVar1 + 1; +} while ((int)pasVar1 < 0x117d1dc); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp new file mode 100644 index 00000000..a4b52d42 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00523370 +void TribesState::storeLionXAndYInMapInfo(undefined4 x,undefined4 y) + +{ +short (*pasVar1) [2]; + +pasVar1 = DAT_GameState::instance.mapAndTime.field2270_0xdf0; +do { +if ((*pasVar1)[0] == 0) { +(*pasVar1)[0] = (short)x; +(*pasVar1)[1] = (short)y; +} +pasVar1 = pasVar1 + 1; +} while ((int)pasVar1 < 0x117d58c); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp new file mode 100644 index 00000000..ddcb5c10 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00522360 +uint TribesState::tribeCorrespondsWithUID(int tribeID,uint tribeUID) + +{ +if (tribeUID == 0) { +return 0; +} +return (uint)(this->tribes[tribeID].uid == tribeUID); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp b/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp new file mode 100644 index 00000000..573294d3 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/IO/PackagedFileMagicNum.hpp" +#include "OpenSHC/Map/Version.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::IO::PackagedFileMagicNum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00526370 +void TribesState::upgradeMapTribesState(PackagedFileMagicNum receivedMapVersion,PackagedFileMagicNum packagerMapVersion) + +{ +MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_Unknown1)(); +MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_Unknown2)(); +if ((receivedMapVersion != packagerMapVersion) && ((int)receivedMapVersion < 0x8e)) { +MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_142)(); +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp new file mode 100644 index 00000000..c90efce6 --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0051ACB0 +undefined4 TroopValueState::attackInfoHasArch2Building(int buildingID) + +{ +int *piVar1; + +piVar1 = &this->attackInfo.arch2ValuesArray[0].buildingID; +do { +if (buildingID == *piVar1) { +return(undefined4)( 1); +} +piVar1 = piVar1 + 4; +} while ((int)piVar1 < 0x177e994); +return(undefined4)( 0); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp new file mode 100644 index 00000000..4d3ead85 --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp @@ -0,0 +1,45 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" +#include "OpenSHC/Map/AttackInfoSubArrayElement1.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Map::AttackInfoSubArrayElement1; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0051AC80 +BOOLEnum TroopValueState::attackInfoHasHigh2Building(int buildingID) + +{ +AttackInfoSubArrayElement1 * piVar1; + +piVar1 = &this->attackInfo.high2ValuesArray[0]; +do { +if (buildingID == piVar1->buildingID) { +return TRUE; +} +piVar1 = piVar1 + 4; +} while ((int)piVar1 < 0x177aaf8); +return FALSE; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp b/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp new file mode 100644 index 00000000..4fd4950b --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp @@ -0,0 +1,45 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0051B680 +void TroopValueState::clearAIInfoLayerOutsideStartZone() + +{ +int iVar1; +int iVar2; + +iVar1 = this->attackInfo.startCon; +iVar2 = 0; +do { +if ((DAT_TileMapState::instance.AIInfoLayer[iVar2] != '\0') && +((short)DAT_TileMapState::instance.PathConnectionLayer[iVar2] != iVar1)) { +DAT_TileMapState::instance.AIInfoLayer[iVar2] = '\0'; +} +iVar2 = iVar2 + 1; +} while (iVar2 < 0x13a10); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp b/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp new file mode 100644 index 00000000..c83528f9 --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp @@ -0,0 +1,45 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00519960 +BOOLEnum TroopValueState::getTileInTargetedBuildingTiles(int tile) + +{ +int _index; + +_index = 0; +if (0 < this->attackInfo.targetedBuildingTilesArraySize) { +do { +if (this->attackInfo.targetedBuildingTilesArray[_index] == tile) { +return TRUE; +} +_index = _index + 1; +} while (_index < this->attackInfo.targetedBuildingTilesArraySize); +} +return FALSE; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp b/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp new file mode 100644 index 00000000..551cae7d --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00518350 +undefined4 TroopValueState::isAttackWaveComplete() + +{ +int iVar1; + +iVar1 = 0; +while ((this->attackInfo.nof_tribes[iVar1] == 0 || +(this->attackInfo.value3Array01[iVar1] == 6))) { +iVar1 = iVar1 + 1; +if (0x31 < iVar1) { +return(undefined4)( 1); +} +} +return(undefined4)( 0); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp b/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp new file mode 100644 index 00000000..f4c40e4c --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005311F0 +int UnitsState::ComputeDamageFearFactorBonus(int damage,int playerID) + +{ +return ((DAT_GameState::instance.playerDataArray[playerID].fearFactorLevel + 0x14) * damage * 5) / 100; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp b/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp new file mode 100644 index 00000000..fec089ce --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00533C70 +void UnitsState::changeDestinationByLeftover(int unitID) + +{ +short _leftover; + +_leftover = this->units[unitID].leftover; +if (0 < _leftover) { +MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::changeDestinationByAmount, this)(unitID, (int)((int)(_leftover))); +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp b/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp new file mode 100644 index 00000000..9e902615 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Map/Units/States/UnitStateShort.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Map::Units::States::UnitStateShort; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00530FD0 +BOOLEnum UnitsState::checkIfCitizenUnitIsAliveBasedOnState(int param_1) + +{ +UnitStateShort _state; + +_state = this->units[param_1].state.generic; +if ((0x6e < (short)_state) && ((short)_state < 0x75)) { +return TRUE; +} +return FALSE; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp b/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp new file mode 100644 index 00000000..9effceeb --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitPropertiesDefinedData.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0052F0A0 +int UnitsState::checkUnitHasPropertyBasedOnUnitType(int unitID,int property) + +{ +return DAT_UnitPropertiesDefinedData::instance.UnitClimbStateFlags[property] +[(short)this->units[unitID].unitType]; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp b/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp new file mode 100644 index 00000000..767fe545 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053E8D0 +void UnitsState::clearHiddenFlagAndUpdatePosition(int unitID) + +{ +if (this->units[unitID].unknownTestAgainst0_2 != 0) { +this->units[unitID].unknownTestAgainst0_2 = 0; +MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::commitPendingUnitPosition, this)(unitID); +return; +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp b/src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp new file mode 100644 index 00000000..259d2147 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Map::Units::UnitsState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053B8B0 +UnitsState * UnitsState::constructUnitsState() + +{ +this->creationTime = timeGetTime(); +MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::clearAllUnits, this)(); +this->lastSelectedUnitID = 0; +this->unknownInitially0_01 = 0; +this->lostChimps = 0; +this->maxUnitCount = 2500; +return this; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp new file mode 100644 index 00000000..3c54a78d --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00535190 +void UnitsState::deselectUnit(int unitID) + +{ +if (this->units[unitID].isSelected != 0) { +this->units[unitID].isSelected = 0; +this->totalUnitsInSelection = this->totalUnitsInSelection + -1; +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp b/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp new file mode 100644 index 00000000..9292bee7 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x005370C0 +void UnitsState::extendRallyPoint(int tribeID,int mouseX,int mouseY,int rallyCount) + +{ +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = tribeID; +DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = mouseX; +DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = mouseY; +DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = rallyCount; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_UNIT_EXTEND_RALLY_POINT); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp b/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp new file mode 100644 index 00000000..6858c7fd --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00533920 +BOOLEnum UnitsState::getDestination2EqualsGivenCoordinates(int unitID,int x,int y) + +{ +if (this->units[unitID].destinationX_2Unk != x) { +return TRUE; +} +return (uint)(this->units[unitID].destinationY_2Unk != y); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp b/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp new file mode 100644 index 00000000..f921e931 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_TribesState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x00535DF0 +void UnitsState::getFirstSelectedUnitID(undefined4 param_1) + +{ +DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = DAT_TribesState::instance.DAT_CurrentTribeID; +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(((GameCommandType)0x48)); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp b/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp new file mode 100644 index 00000000..faa72c7d --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005339F0 +BOOLEnum UnitsState::hasTunnelerNotFinishedDigging(int param_1) + +{ +return (uint)(this->units[param_1].tunnelerFinishedDigging == 0); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp b/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp new file mode 100644 index 00000000..d93f7531 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Map/Units/UnitTypeShort.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitPropertiesDefinedData.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Map::Units::UnitTypeShort; +using OpenSHC::Map::Units::UnitType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00530080 +BOOLEnum UnitsState::isComputerManagedNonPeasant(int param_1) + +{ +UnitTypeShort UVar1; + +UVar1 = this->units[param_1].unitType; +if (UVar1 == OpenSHC::Map::Units::UT_PEASANT) { +return FALSE; +} +return (uint)(DAT_UnitPropertiesDefinedData::instance.COMPUTER_MANAGED[(short)UVar1] != 0); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp b/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp new file mode 100644 index 00000000..e411f1cc --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0052F070 +void UnitsState::makeUnitStopWalkingByClearingPathProgressState(int unitID) + +{ +this->units[unitID].currentIndexInPathPlan = 0; +this->units[unitID].totalSizeOfPathPlan = 0; +this->units[unitID].unknownMovementRelated_0x2d2 = 0; +this->units[unitID].climbDataID = 0; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp b/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp new file mode 100644 index 00000000..8db3336d --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Commands::GameCommandType; + + /* + 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 0x00536CC0 + void UnitsState::queueClickNavigateMenuOrEscape(undefined4 param_1) + + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0xfffffffe; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_1; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_ESCAPE); + return; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp new file mode 100644 index 00000000..11255e1e --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x00537100 +void UnitsState::queueDisbandAndAttackCommand2Params(undefined4 param_1,undefined4 param_2) + +{ +DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp new file mode 100644 index 00000000..5d833060 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x00537130 +void UnitsState::queueDisbandAndAttackCommand3Params(undefined4 param_1,undefined4 param_2,undefined4 param_3) + +{ +DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; +DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = param_3; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp new file mode 100644 index 00000000..1628026b --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x00537160 +void UnitsState::queueDisbandAndAttackCommand4Params(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4) + +{ +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; +DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; +DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = param_3; +DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = param_4; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp b/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp index 33cea6a5..47152546 100644 --- a/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp @@ -11,7 +11,7 @@ namespace Map { using OpenSHC::Commands::GameCommandType; // FUNCTION: STRONGHOLDCRUSADER 0x00536C70 - void UnitsState::queueStopCommand() + void UnitsState::queueEscapeCommand() { DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( diff --git a/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp b/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp new file mode 100644 index 00000000..3b147118 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Commands::GameCommandType; + + /* + 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 0x00536C90 + void UnitsState::queueUnitTypeCommand(undefined4 unitType) + + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0xffffffff; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = unitType; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_ESCAPE); + return; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp b/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp new file mode 100644 index 00000000..03fb3b01 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/States/UnitStateUnion.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::Map::Units::States::UnitStateUnion; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00533F90 +void UnitsState::saveUnitStateBeforeInterruption(int param_1) + +{ +UnitStateUnion UVar1; + +UVar1 = this->units[param_1].state; +this->units[param_1].tunnelerFinishedDigging = 5; +this->units[param_1].state_3 = UVar1; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp new file mode 100644 index 00000000..8354489e --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitsState; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00535520 + int UnitsState::selectionContainsEngineersOnly() + { + + if (this->selectionEngineers != 0) { + int* piVar2 = (int*)&this->selectionEuropeanArchers; + for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { + if ((iVar1 != 7) && (piVar2[iVar1] != 0)) { + return FALSE; + } + } + // piVar2 = &this->selectionEuropeanArchers; + // do { + // if ((iVar1 != 7) && (piVar2->selectionEuropeanArchers != 0)) { + // return 0; + // } + // iVar1 = iVar1 + 1; + // piVar2 = &piVar2->selectionSpearmen; + // } while (iVar1 < 0x1b); + // iVar1 = 1; + return TRUE; + } + return FALSE; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp new file mode 100644 index 00000000..647972a5 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x005357E0 + int UnitsState::selectionContainsLadermenOnly() + + { + if (this->selectionLaddermen != 0) { + int* piVar2 = (int*)&this->selectionEuropeanArchers; + for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { + if ((iVar1 != 8) && (piVar2[iVar1] != 0)) { + return FALSE; + } + } + return TRUE; + } + return FALSE; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp new file mode 100644 index 00000000..f9cc63bf --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00535810 + BOOLEnum UnitsState::selectionContainsOnlyArabAssassins() + + { + if (this->selectionArabAssassin != 0) { + int* piVar2 = (int*)&this->selectionEuropeanArchers; + for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { + if ((iVar1 != 0x16) && (piVar2[iVar1] != 0)) { + return FALSE; + } + } + return TRUE; + } + return FALSE; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp new file mode 100644 index 00000000..1130befb --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00535840 + int UnitsState::selectionContainsShieldmenOnly() + + { + if (this->selectionShield != 0) { + int* piVar2 = (int*)&this->selectionEuropeanArchers; + for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { + if ((iVar1 != 0xf) && (piVar2[iVar1] != 0)) { + return FALSE; + } + } + return TRUE; + } + return FALSE; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp new file mode 100644 index 00000000..ed1c3714 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00535700 + int UnitsState::selectionContainsTunnelersOnly() + + { + if (this->selectionTunnelers != 0) { + int* piVar2 = (int*)&this->selectionEuropeanArchers; + for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { + if ((iVar1 != 9) && (piVar2[iVar1] != 0)) { + return FALSE; + } + } + return TRUE; + } + return FALSE; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp b/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp new file mode 100644 index 00000000..4f9117cc --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053BB70 +void UnitsState::setupUnitSharingCurrentTilePosition(int unitID) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::setupUnitSharingTileIDs, this)(unitID, this->units[unitID].tile); +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp b/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp new file mode 100644 index 00000000..51dfb876 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0052FBF0 +undefined4 UnitsState::sitDownIfStanding(int param_1) + +{ +if (this->units[param_1].seated != 0) { +return(undefined4)( 0); +} +this->units[param_1].substate = 0x65; +this->units[param_1].animationCycleNumber = 0; +return(undefined4)( 1); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp b/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp new file mode 100644 index 00000000..b17dc65e --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + + + +namespace OpenSHC { +namespace Map { +namespace Units { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0052FBB0 +undefined4 UnitsState::standUpIfSeated(int param_1) + +{ +if (this->units[param_1].seated == 0) { +return(undefined4)( 0); +} +this->units[param_1].substate = 100; +this->units[param_1].animationCycleNumber = 0; +return(undefined4)( 1); +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp new file mode 100644 index 00000000..0c4bee9e --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { +namespace Units { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00534460 +BOOLEnum UnitsState::unitIsInMoat(int unitID) + +{ +return (uint)DAT_TileMapState::instance.LogicLayer[this->units[unitID].tile] >> 0x1e &TRUE; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp b/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp new file mode 100644 index 00000000..91ae9583 --- /dev/null +++ b/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Map/Units.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Map/Units/States/UnitState.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Map::Units::States::UnitState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053CAC0 +BOOLEnum Units::UpdateWorker_ConsiderTakingABreakUnk(int unitID) + +{ +BOOLEnum BVar1; + +BVar1 = MACRO_CALL(OpenSHC::Map::Units_Func::ConsiderHavingABreakNowUnk)(unitID, (UnitState)((int)((int)(short)DAT_UnitsState::instance.units[unitID].state.generic))); +return BVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp b/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp new file mode 100644 index 00000000..80c1e7a6 --- /dev/null +++ b/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A390 +void Version::SetBuildingsEmployeeCountToValue() + +{ +Building * pBVar1; + +pBVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if (pBVar1->logicalState != ((BuildingLogicalState)0)) { +pBVar1->buildingTypeBasedEmployeeCount = +DAT_BuildingDefinedData::instance.EmployeeCountPerBuildingType[(short)pBVar1->buildingType]. +shortValue; +} +pBVar1 = pBVar1 + 0x196; +} while ((int)pBVar1 < 0x1124dc6); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp b/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp new file mode 100644 index 00000000..79dfe0fe --- /dev/null +++ b/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; +using OpenSHC::Map::Buildings::BuildingType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A2B0 +void Version::SetDairyCheeseToZero() + +{ +Building * pBVar1; + +pBVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if ((pBVar1->logicalState != ((BuildingLogicalState)0)) && (pBVar1->buildingType == OpenSHC::Map::Buildings::BT_DAIRYFARM)) { +pBVar1->flagonsOfAleOrCheeseOrReleaseDogs = 0; +} +pBVar1 = pBVar1 + 0x196; +} while ((int)pBVar1 < 0x1124dc6); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp b/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp new file mode 100644 index 00000000..1b457bb0 --- /dev/null +++ b/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A060 +void Version::SetUndamagedBuildingHealthToValue() + +{ +short sVar1; +Building * psVar2; + +psVar2 = &DAT_BuildingsState::instance.buildings[1]; +do { +if ((psVar2->logicalState != ((BuildingLogicalState)0)) && (psVar2->currentHealth == psVar2->maxHealth)) +{ +sVar1 = DAT_BuildingDefinedData::instance.BuildingHP[(short)psVar2->buildingType].shortValue; +psVar2->maxHealth = sVar1; +psVar2->currentHealth = sVar1; +} +psVar2 = psVar2 + 0x196; +} while ((int)psVar2 < 0x1124e02); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp new file mode 100644 index 00000000..92460f02 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A0D0 +void Version::UpgradeBuildingField1() + +{ +Building * psVar1; + +psVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if (psVar1->logicalState != ((BuildingLogicalState)0)) { +psVar1->uidWhenPlaced = (int)*(short *)psVar1; +} +psVar1 = psVar1 + 0x32c; +} while ((int)psVar1 < 0x1124e82); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp new file mode 100644 index 00000000..5022bb7c --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A3C0 +void Version::UpgradeBuildingField2() + +{ +Building * psVar1; + +psVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if (psVar1->logicalState != ((BuildingLogicalState)0)) { +psVar1->field207_0x288 = 0; +psVar1->field189_0x264 = 0; +} +psVar1 = psVar1 + 0x196; +} while ((int)psVar1 < 0x1124f7c); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp new file mode 100644 index 00000000..38d5c29b --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A5F0 +void Version::UpgradeBuildingField4() + +{ +Building * psVar1; + +psVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if (psVar1->logicalState != ((BuildingLogicalState)0)) { +psVar1->field245_0x2c6 = 0; +} +psVar1 = psVar1 + 0x196; +} while ((int)psVar1 < 0x1124fba); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp b/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp new file mode 100644 index 00000000..8b5f7e72 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A620 +void Version::UpgradeClearBuildings1000AndHigher() + +{ +Building *destination; + +destination = DAT_BuildingsState::instance.buildings + 1000; +do { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x32c, '\0', (void *)((int)(destination))); +destination = destination + 1; +} while ((int)destination < 0x1124cf4); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp b/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp new file mode 100644 index 00000000..cdb6da4d --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A0A0 +void Version::UpgradeFirst9Buildings() + +{ +int buildingID; + +buildingID = 1; +do { +MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::setupBarracksCampgroundPositions, DAT_BuildingsState::ptr)(buildingID); +MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::setupMercenaryPostCampgroundPositions, DAT_BuildingsState::ptr)(buildingID) +; +buildingID = buildingID + 1; +} while (buildingID < 9); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp b/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp new file mode 100644 index 00000000..251cdb2f --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Map::Buildings::BuildingLogicalState; +using OpenSHC::Map::Buildings::BuildingType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0041A5C0 +void Version::UpgradeKillingPitField() + +{ +Building * pBVar1; + +pBVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if ((pBVar1->logicalState != ((BuildingLogicalState)0)) && (pBVar1->buildingType == OpenSHC::Map::Buildings::BT_KILLINGPIT)) { +pBVar1->killingPitField = 0; +} +pBVar1 = pBVar1 + 0x196; +} while ((int)pBVar1 < 0x1124dc6); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp new file mode 100644 index 00000000..3ffaae5e --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/Version.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x005011C0 +void Version::UpgradeMapLogicToVersion_125() + +{ +int iVar1; + +iVar1 = 0; +do { +if (DAT_TileMapState::instance.HeightLayer[iVar1] == 80) { +DAT_TileMapState::instance.Logic2Layer[iVar1] = 4; +} +else if (DAT_TileMapState::instance.HeightLayer[iVar1] == 130) { +DAT_TileMapState::instance.Logic2Layer[iVar1] = 8; +} +iVar1 = iVar1 + 1; +} while (iVar1 < 0x13a10); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp new file mode 100644 index 00000000..6cbc1ef1 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/Version.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00501730 +void Version::UpgradeMapLogicToVersion_147() + +{ +int _tile; + +_tile = 0; +do { +if (156 < DAT_TileMapState::instance.DefaultHeightLayer[_tile]) { +DAT_TileMapState::instance.HeightLayer[_tile] = +DAT_TileMapState::instance.HeightLayer[_tile] + (156 - DAT_TileMapState::instance.DefaultHeightLayer[_tile]) +; +DAT_TileMapState::instance.DefaultHeightLayer[_tile] = 156; +} +_tile = _tile + 1; +} while (_tile < 80400); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp new file mode 100644 index 00000000..cf75dd96 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/SomeTribeBehaviorType.hpp" + + + +#include "OpenSHC/Globals/DAT_TribesState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Units::SomeTribeBehaviorType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00523E00 +void Version::UpgradeMapTribesStateVersionTo_142() + +{ +short *psVar1; + +psVar1 = &DAT_TribesState::instance.tribes[1].attackWave; +do { +if ((psVar1[-0x13e] != 0) && (*psVar1 < 1)) { +psVar1[-0x136] = ((SomeTribeBehaviorType)0); +} +psVar1 = psVar1 + 0x19a; +} while ((int)psVar1 < 0x176261c); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp new file mode 100644 index 00000000..824f785e --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TribesState.hpp" + +namespace OpenSHC { +namespace Map { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00523EB0 +void Version::UpgradeMapTribesStateVersionTo_Unknown2() + +{ +short *psVar1; +int tribeID; + +tribeID = 1; +psVar1 = &DAT_TribesState::instance.tribes[1].tribeState; +do { +if (*psVar1 != 0) { +MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::setWhetherTribeContainsAnyUnits, DAT_TribesState::ptr)(tribeID); +} +psVar1 = psVar1 + 0x19a; +tribeID = tribeID + 1; +} while ((int)psVar1 < 0x17623a0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp new file mode 100644 index 00000000..fd1a9633 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/Unit.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Units::Unit; +using OpenSHC::Map::Units::UnitLogicState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053B340 +void Version::UpgradeMapUnitsTo_112() + +{ +Unit * psVar1; + +psVar1 = &DAT_UnitsState::instance.units[1]; +DAT_CurrentUnitSlotID::instance = 2500; +do { +if (psVar1->logicalState == OpenSHC::Map::Units::ULS_NORMAL) { +psVar1->buildingID = psVar1->workplaceBuildingID_1; +} +psVar1 = psVar1 + 0x248; +} while ((int)psVar1 < 0x16516c4); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp new file mode 100644 index 00000000..b5b092e2 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/UnitLogicStateShort.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Units::UnitLogicStateShort; +using OpenSHC::Map::Units::UnitLogicState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053B310 +void Version::UpgradeMapUnitsTo_114() + +{ +int *piVar1; + +piVar1 = &DAT_UnitsState::instance.units[1].calculatedOwnerPlayerIndex; +DAT_CurrentUnitSlotID::instance = 2500; +do { +if (*(UnitLogicStateShort *)(piVar1 + 0x1f) == OpenSHC::Map::Units::ULS_NORMAL) { +*piVar1 = 0; +} +piVar1 = piVar1 + 0x124; +} while ((int)piVar1 < 0x165139c); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp new file mode 100644 index 00000000..b4641ad1 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/UnitTypeShort.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Units::UnitTypeShort; +using OpenSHC::Map::Units::UnitLogicState; +using OpenSHC::Map::Units::UnitType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053B530 +void Version::UpgradeMapUnitsTo_130() + +{ +UnitTypeShort *pUVar1; + +pUVar1 = &DAT_UnitsState::instance.units[1].unitType; +DAT_CurrentUnitSlotID::instance = 0x9c4; +do { +if ((pUVar1[-1] == OpenSHC::Map::Units::ULS_NORMAL) && (*pUVar1 == OpenSHC::Map::Units::UT_COW)) { +pUVar1[0x193] = 0; +} +pUVar1 = pUVar1 + 0x248; +} while ((int)pUVar1 < 0x165141a); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp new file mode 100644 index 00000000..f548e937 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/Unit.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Units::Unit; +using OpenSHC::Map::Units::UnitLogicState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053B570 +void Version::UpgradeMapUnitsTo_149() + +{ +Unit * psVar1; + +psVar1 = &DAT_UnitsState::instance.units[1]; +DAT_CurrentUnitSlotID::instance = 0x9c4; +do { +if (psVar1->logicalState == OpenSHC::Map::Units::ULS_NORMAL) { +psVar1->shootBeforeStop = 0; +} +psVar1 = psVar1 + 0x248; +} while ((int)psVar1 < 0x1651764); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp new file mode 100644 index 00000000..61e5ff1a --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp @@ -0,0 +1,41 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/Unit.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Units::Unit; +using OpenSHC::Map::Units::UnitLogicState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0053B5E0 +void Version::UpgradeMapUnitsTo_155() + +{ +Unit * psVar1; + +psVar1 = &DAT_UnitsState::instance.units[1]; +DAT_CurrentUnitSlotID::instance = 2500; +do { +if (psVar1->logicalState != OpenSHC::Map::Units::ULS_INVISIBLE) { +psVar1->killedFlagUnk = 0; +} +psVar1 = psVar1 + 0x248; +} while ((int)psVar1 < 0x165177c); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp b/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp new file mode 100644 index 00000000..565f893c --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; + using OpenSHC::Map::Buildings::BuildingType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A710 + void Version::UpgradeOutpostField() + + { + Building* pBVar1; + + pBVar1 = &DAT_BuildingsState::instance.buildings[1]; + do { + if ((pBVar1->logicalState != ((BuildingLogicalState)0)) + && ((pBVar1->buildingType == OpenSHC::Map::Buildings::BT_OUTPOST_EUROPEAN + || (pBVar1->buildingType == OpenSHC::Map::Buildings::BT_OUTPOST_ARABIAN)))) { + pBVar1->randomOutpostField = '\0'; + } + pBVar1 = pBVar1 + 0x196; + } while ((int)pBVar1 < 0x1124dc6); + return; + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp b/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp new file mode 100644 index 00000000..8b907c81 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Rocks/Rock.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LandscapeState.hpp" +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Rocks::Rock; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F3900 +void Version::UpgradeRemoveRocksBeyond1000() + +{ +Rock *destination; + +destination = DAT_LandscapeState::instance.rocks + 2000; +do { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(32, '\0', (void *)((int)(destination))); +destination = destination + 1; +} while ((int)destination < 0xf98330); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp b/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp new file mode 100644 index 00000000..5f50a864 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp @@ -0,0 +1,52 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Map::Buildings::Building; +using OpenSHC::Game::GameMode; +using OpenSHC::Map::Buildings::BuildingLogicalState; + + +/* + 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 0x0041A3F0 +void Version::UpgradeSolitaryMapBuildingField3() + +{ +Building * piVar1; + +if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) { +piVar1 = &DAT_BuildingsState::instance.buildings[1]; +do { +if (piVar1->logicalState != ((BuildingLogicalState)0)) { +piVar1->playerColorUnk = 0; +} +piVar1 = piVar1 + 0xcb; +} while ((int)piVar1 < 0x1124cfc); +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp b/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp new file mode 100644 index 00000000..cb46a796 --- /dev/null +++ b/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/WallAndPitchState.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_UIDragDropDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Game::GameMode2; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00500C80 +void WallAndPitchState::resetWallAndPitchState() + +{ +if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) && +(DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { +this->state = 4; +this->countdown = 400; +this->index = 0; +this->counter = 0; +DAT_UIDragDropDefinedData::instance.MenuView_TriggerInitial = TRUE; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp b/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp new file mode 100644 index 00000000..61680df7 --- /dev/null +++ b/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Map/WallAndPitchState.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_UIDragDropDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + +using OpenSHC::Game::GameMode2; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00500D30 +void WallAndPitchState::resetWallPlacementInfo() + +{ +if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) && +(DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { +this->state = 3; +this->countdown = 400; +this->index = 0; +this->counter = 0; +DAT_UIDragDropDefinedData::instance.MenuView_TriggerInitial = TRUE; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp new file mode 100644 index 00000000..d437b512 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" + +namespace OpenSHC { +namespace Rendering { +namespace Bink { + +using OpenSHC::Audio::MSS::enums::SHC_SoundStream; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "UnsortedBinkFlagInt": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00408E70 +void BinkControlClass::setBinkSndStreamAndStartTime(int binkObjIndex,SHC_SoundStream soundStreamIndexUnk) + +{ +DWORD _currentSysTime; + +if ((DAT_SoundSystemState::instance.waveOutOpenUnk_0x8 != FALSE) && +(DAT_SoundSystemState::instance.soundActiveUnk_0x0 != 0)) { +this->soundStreamIndex[binkObjIndex] = soundStreamIndexUnk; +_currentSysTime = timeGetTime(); +this->startTime[binkObjIndex] = _currentSysTime; +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp new file mode 100644 index 00000000..4bcf9c26 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" + +namespace OpenSHC { +namespace Rendering { + namespace Bink { + + // FUNCTION: STRONGHOLDCRUSADER 0x00408E10 + void BinkControlClass::zeroBinkPtrAndLoadBinkSoundSystem(HDIGDRIVER drvrPtr) + + { + this->binkObjPtrArray[0] = NULL; + this->binkObjPtrArray[1] = NULL; + BinkSetSoundSystem(BinkOpenMiles, (ulong)drvrPtr); + return; + } + + } +} +} diff --git a/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp new file mode 100644 index 00000000..87cea179 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" + + + + + +namespace OpenSHC { +namespace Rendering { + +using OpenSHC::IO::Graphics::GmID; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004E8CC0 +void ViewportRenderState::createFloatingTextElement(int param_1,int param_2,int param_3,int param_4,int param_5) + +{ +MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, this)(OpenSHC::IO::Graphics::GID_FLOATS, param_1, param_2, param_3, param_4, param_5); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp new file mode 100644 index 00000000..ac76bade --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + + + + + +namespace OpenSHC { +namespace Rendering { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004E2600 +int ViewportRenderState::resetBatchedRender() + +{ +this->unitBatchedRenderCounterUntil6 = 1; +this->unitRender1 = 0; +this->unitRender2 = 0; +this->unitRender3 = 0; +this->unitRender4 = 0; +this->unitRender5 = 0; +return 0; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp new file mode 100644 index 00000000..6cf13cc2 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Rendering { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00401000 +BOOLEnum ViewportRenderState::xyAreValid(uint x,uint y) + +{ +if (((x < 400) && (y < 400)) && +(this->DAT_BinaryTileMap400x400[y * 400 + x] != 0)) { +return TRUE; +} +return FALSE; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp b/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp new file mode 100644 index 00000000..3b1f4d65 --- /dev/null +++ b/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Rendering/WindowInformation.func.hpp" + + + + + +namespace OpenSHC { +namespace Rendering { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00467F60 +void WindowInformation::storeWindowRectangleInfoUnk(LONG param_1,LONG param_2,LONG param_3,LONG param_4) + +{ +this->RECT_SomeGameWindowRectUnk.left = param_1; +this->RECT_SomeGameWindowRectUnk.top = param_3; +this->RECT_SomeGameWindowRectUnk.right = param_2; +this->RECT_SomeGameWindowRectUnk.bottom = param_4; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp b/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp new file mode 100644 index 00000000..f4ffea4f --- /dev/null +++ b/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp @@ -0,0 +1,48 @@ +#include "OpenSHC/Synchrony/Actions.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + + + +/* + 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 0x004285C0 +void Actions::RemovePositionOfPlayer(int playerID) + +{ +int iVar1; + +iVar1 = 0; +do { +if ((char)DAT_GameSynchronyState::instance.playerPositionsArray[iVar1] + 1 == playerID) { +/* + -10, make spot empty + */ + +DAT_GameSynchronyState::instance.playerPositionsArray[iVar1] = 0xf6; +} +iVar1 = iVar1 + 1; +} while (iVar1 < 8); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp b/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp new file mode 100644 index 00000000..cc130e2d --- /dev/null +++ b/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Synchrony/Actions.func.hpp" + + + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004652A0 +void Actions::SetBuildingProductionType(undefined4 playerID,int buildingID,ushort producedItemType,int buildingUID) + +{ +if (DAT_BuildingsState::instance.buildings[buildingID].uid == buildingUID) { +DAT_BuildingsState::instance.buildings[buildingID].producedItemType = producedItemType; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp new file mode 100644 index 00000000..4fdb9dc2 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + + + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Synchrony { + + + + +/* + 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 0x004800B0 +void GameSynchronyState::clearGameCommandEntry(int gameCommandID) + +{ +if (gameCommandID < 200) { +MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x4f8, '\0', (void *)((int)( +this->DAT_GameCommandArray + gameCommandID))); +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp new file mode 100644 index 00000000..2346daf5 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/IO/DecoderState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_DecoderState.hpp" + +namespace OpenSHC { +namespace Synchrony { + + + + +/* + 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 0x0047E7E0 +int GameSynchronyState::compressOrCreateLengthPrefixedPacketUnk(int size,char *src,void *dst) + +{ +int iVar1; + +iVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::DecoderState_Func::compressRLE, DAT_DecoderState::ptr)(src, dst, size); +return iVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp new file mode 100644 index 00000000..57aab2fd --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/IO/DecoderState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + +#include "OpenSHC/Globals/DAT_DecoderState.hpp" +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Synchrony { + + /* + 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 0x0047E800 + void GameSynchronyState::decompressTooLongPacketData(byte* source, byte* destination) + + { + size_t _size; + + _size = MACRO_CALL_MEMBER(OpenSHC::IO::DecoderState_Func::decompressRLE, DAT_DecoderState::ptr)( + (char*)source, (char*)((int)(this->DAT_PacketDecodingDestination))); + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::copyData, DAT_LowLevelMemory::ptr)( + _size, (void*)((int)(this->DAT_PacketDecodingDestination)), destination); + return; + } + +} +} diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp new file mode 100644 index 00000000..f0807e15 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Synchrony { + +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:56:35.138000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004010B0 +BOOLEnum GameSynchronyState::isAIPlayer(int playerID) + +{ +if (this->currentPlayerFullIDArray[playerID] != -1) { +return FALSE; +} +return (uint)(this->currentAIArray[playerID] != 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp new file mode 100644 index 00000000..8a991e05 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp @@ -0,0 +1,47 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Game/GameMode.hpp" + + + + + +namespace OpenSHC { +namespace Synchrony { + +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 0x00490340 +void GameSynchronyState::throttledMultiplayerSyncUpdate() + +{ +DWORD DVar1; + +if ((this->currentGameMode != OpenSHC::Game::GM_SOLITARY) && +(this->currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { +DVar1 = timeGetTime(); +if (10 < DVar1 - this->field309_0x109e94) { +this->field309_0x109e94 = DVar1; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::sendPeriodicSyncMessages, this)(); +return; +} +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GetPlayerPosition.cpp b/src/OpenSHC/Synchrony/GetPlayerPosition.cpp new file mode 100644 index 00000000..7c018a7f --- /dev/null +++ b/src/OpenSHC/Synchrony/GetPlayerPosition.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/Synchrony.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + + + + +/* + 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 0x0042AC60 +int Synchrony::GetPlayerPosition(int playerID) + +{ +byte *pbVar1; +int iVar2; + +iVar2 = 0; +do { +pbVar1 = DAT_GameSynchronyState::instance.playerPositionsArray + iVar2; +iVar2 = iVar2 + 1; +if ((char)*pbVar1 + 1 == playerID) { +return iVar2; +} +} while (iVar2 < 8); +return 0; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/ProgressBarRelated.cpp b/src/OpenSHC/Synchrony/ProgressBarRelated.cpp new file mode 100644 index 00000000..787654d5 --- /dev/null +++ b/src/OpenSHC/Synchrony/ProgressBarRelated.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Synchrony.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI.func.hpp" + + + +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00495840 +void Synchrony::ProgressBarRelated() + +{ +DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 0x1f; +MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog2, DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX); +MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic)(0); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/Text/FontSizeClass/getWideCharWidth.cpp b/src/OpenSHC/Text/FontSizeClass/getWideCharWidth.cpp new file mode 100644 index 00000000..c93210b2 --- /dev/null +++ b/src/OpenSHC/Text/FontSizeClass/getWideCharWidth.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Text/FontSizeClass.func.hpp" +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WideCharMultiByteState.hpp" + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00471670 +dword FontSizeClass::getWideCharWidth(WCHAR wChar) + +{ +char _resChar; +dword dVar1; + +_resChar = MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::wideCharToByteUnk, DAT_WideCharMultiByteState::ptr)(wChar); +dVar1 = MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::getCharWidthUnk, this)(_resChar); +return(dword)( dVar1); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/FontSizeClass/renderWideChar.cpp b/src/OpenSHC/Text/FontSizeClass/renderWideChar.cpp new file mode 100644 index 00000000..d4f48670 --- /dev/null +++ b/src/OpenSHC/Text/FontSizeClass/renderWideChar.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Text/FontSizeClass.func.hpp" +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WideCharMultiByteState.hpp" + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00473830 +int FontSizeClass::renderWideChar(undefined4 param_1,int param_2,int param_3,int param_4,int param_5) + +{ +char charId; +int iVar1; + +charId = MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::wideCharToByteUnk, DAT_WideCharMultiByteState::ptr)((WCHAR)param_1); +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::renderCharUnk, this)(charId, param_2, param_3, param_4, param_5); +return iVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp new file mode 100644 index 00000000..dd587f84 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045D690 +void TextEditorState::bltTextToScreenIfNeedBe() + +{ +if (this->intArray1[0x14] != 0) { +if (((this->savedMenuViewType == 0xc) || +(this->savedMenuViewType == 0xe)) || +(this->savedMenuViewType == 0x10)) { +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::WindowAndDirectDraw_Func::bltMapGameSurfaceToScreenMenuSurfaceComplete, DAT_WindowAndDirectDraw::ptr)(); +} +this->intArray1[0x14] = 0; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp new file mode 100644 index 00000000..68ba0d33 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" + +namespace OpenSHC { +namespace Text { + + + + +/* + Walks the UserHelpDefinedData help section list to find the entry with ID matching param_1. + Returns a pointer to its text_0x0 field if found, or null if param_1 is not present in the list. + + renamed by: Claude Sonnet 4.6 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045D9E0 +char * TextEditorState::getHelpSectionText(int param_1) + +{ +int iVar1; +int iVar2; + +iVar2 = 0; +iVar1 = DAT_UserHelpDefinedData::instance.field5_0x7a124[0].unknown_0x4; +while( true ) { +if (iVar1 == -1) { +return (char *)0x0; +} +if (iVar1 == param_1) break; +iVar1 = DAT_UserHelpDefinedData::instance.field5_0x7a124[iVar2 + 1].unknown_0x4; +iVar2 = iVar2 + 1; +} +return DAT_UserHelpDefinedData::instance.field5_0x7a124[iVar2].text_0x0; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp b/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp new file mode 100644 index 00000000..dc604f93 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" + + + + + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045F080 +undefined4 TextEditorState::getHelpTokenAdvanceLength(undefined4 param_1) + +{ +switch(param_1) { +case 1: +return(undefined4)( 4); +case 2: +case 3: +case 4: +case 10: +case 0xb: +case 0xc: +case 0xe: +return(undefined4)( 3); +default: +return(undefined4)( 1); +} +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp new file mode 100644 index 00000000..fddc4cca --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp @@ -0,0 +1,47 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/Text/HelpTextRelatedColorStruct.hpp" + + + +#include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" + +namespace OpenSHC { +namespace Text { + +using OpenSHC::Text::HelpTextRelatedColorStruct; + + +/* + Returns param_1 - 1 if non-negative. If param_1 - 1 goes below 0, walks the field6_0x7a16c array + forward to find the last entry with a non-null name and returns that index. Simple circular + previous-index for the help colour/style entry array. + + renamed by: Claude Sonnet 4.6 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045DA40 +int TextEditorState::getPrevHelpColorEntryIndex(int param_1) + +{ +int iVar1; +HelpTextRelatedColorStruct *pHVar2; + +iVar1 = param_1 + -1; +if (iVar1 < 0) { +iVar1 = 0; +if (DAT_UserHelpDefinedData::instance.field6_0x7a16c[0].name_0x0 != (char *)0x0) { +pHVar2 = DAT_UserHelpDefinedData::instance.field6_0x7a16c; +do { +pHVar2 = pHVar2 + 1; +iVar1 = iVar1 + 1; +} while (pHVar2->name_0x0 != (char *)0x0); +} +iVar1 = iVar1 + -1; +} +return iVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp new file mode 100644 index 00000000..688639d9 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045F580 +undefined4 TextEditorState::loadAndParseHelpFile(FILE *param_1) + +{ +FILE *_File; + +_File = (FILE *)MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::readCrusaderHelpHlp, this)((CHAR *)param_1); +if (_File != (FILE *)0x0) { +MACRO_CALL(OpenSHC::OS_Func::_fclose)(_File); +if (this->helpSectionParseSucceeded != FALSE) { +return(undefined4)( 1); +} +} +return(undefined4)( 0); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp new file mode 100644 index 00000000..56baec1f --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp @@ -0,0 +1,46 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" + + + + + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00462150 +void TextEditorState::popHelpDialogStack() + +{ +int iVar1; +undefined4 *puVar2; +undefined4 *puVar3; +bool bVar4; + +this->currentHelpSectionID = this->helpSectionHistoryStack[0]; +bVar4 = this->helpSectionHistoryStack[0] == -1; +puVar2 = this->helpSectionHistoryStack; +puVar3 = this->helpSectionHistoryStack; +for (iVar1 = 29; puVar2 = puVar2 + 1, iVar1 != 0; iVar1 = iVar1 + -1) { +*puVar3 = *puVar2; +puVar3 = puVar3 + 1; +} +this->helpSectionHistoryStack[0x1d] = 0xffffffff; +if (bVar4) { +MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::closeHelpDialogAndReturnToMenu, this)(); +return; +} +MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::loadAndLayoutHelpContent, this)(); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp new file mode 100644 index 00000000..3937b14a --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" + + + + + +namespace OpenSHC { +namespace Text { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0045D080 +void TextEditorState::setHelpWindowBounds(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4) + +{ +this->dialogContentX = param_1; +this->dialogContentY = param_2; +this->dialogContentHeight = param_3; +this->dialogContentWidth = param_4; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp b/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp new file mode 100644 index 00000000..09d39171 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::DE::SHCDE::eTextSections; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004246B0 +int TextManager::computeTextWidthForTextGroup(eTextSections textOffsetIndex,int textNumInGroup,int fontSize) + +{ +char *text; +int _width; + +text = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, this)(textOffsetIndex, textNumInGroup); +_width = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::computeTextWidth, this)(text, fontSize); +return _width; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/getTextWidthTillCursorUnk.cpp b/src/OpenSHC/Text/TextManager/getTextWidthTillCursorUnk.cpp new file mode 100644 index 00000000..9582704a --- /dev/null +++ b/src/OpenSHC/Text/TextManager/getTextWidthTillCursorUnk.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Text/FontSizeClass.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" + +namespace OpenSHC { +namespace Text { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00469F70 + int TextManager::getTextWidthTillCursorUnk(char* text, int cursorIndex, int fontSize) + + { + int _widthUnk; + + if (text == (char*)0x0) { + return 0; + } + _widthUnk = MACRO_CALL_MEMBER( + OpenSHC::Text::FontSizeClass_Func::getWidthOfText, &this->fontSizeClassArray[fontSize])(text, cursorIndex); + return _widthUnk; + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/renderInGameText.cpp b/src/OpenSHC/Text/TextManager/renderInGameText.cpp new file mode 100644 index 00000000..7e95ff56 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderInGameText.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00424320 +void TextManager::renderInGameText(char *textAddress,int xParam,int yParam,TextAlignment alignment,uint color1,uint color2,int fontSize,BOOLEnum keepOffsetX) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, this)(textAddress, xParam, yParam, alignment, color1, color2, fontSize, +keepOffsetX, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp b/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp new file mode 100644 index 00000000..2047a7bf --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00424650 +void TextManager::renderLeftAlignedNumberToScreen(int number,int xParam,int yParam,uint color,int fontSize,BOOL keepOffsetX) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, this)(number, xParam, yParam, OpenSHC::Text::TTA_LEFT, color, fontSize, (BOOLEnum)((int)(keepOffsetX)), 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderNumber.cpp b/src/OpenSHC/Text/TextManager/renderNumber.cpp new file mode 100644 index 00000000..dc0f248d --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderNumber.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::Text::TextAlignment; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00424620 +void TextManager::renderNumber(int number,int xPosition,int yPosition,uint color1,uint color2,int fontSize,BOOLEnum keepOffsetX) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, this)(number, xPosition, yPosition, OpenSHC::Text::TTA_LEFT, color1, color2, fontSize, +keepOffsetX, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp b/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp new file mode 100644 index 00000000..0b56783e --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00424680 +void TextManager::renderNumberToScreen(int number,int xParam,int yParam,TextAlignment alignment,uint color,int fontSize,BOOLEnum keepOffsetX) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, this)(number, xParam, yParam, alignment, color, fontSize, keepOffsetX, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderSomeSpecificTextUnk.cpp b/src/OpenSHC/Text/TextManager/renderSomeSpecificTextUnk.cpp new file mode 100644 index 00000000..caec2c77 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderSomeSpecificTextUnk.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Text/FontSizeClass.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00473BE0 + void TextManager::renderSomeSpecificTextUnk( + int lengthUnk, int otherBlendValueUnk, int xPos, int yPos, uint color, int fontSize) + { + MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::renderSomeSpecificTextUnk, + &this->fontSizeClassArray[fontSize])(lengthUnk, otherBlendValueUnk, xPos, yPos, color); + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp b/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp new file mode 100644 index 00000000..c90ec8ab --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Text { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::Rendering::Colors::BGR24; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00424360 +void TextManager::renderTextToScreen2(char *textAddress,int xParam,int yParam,TextAlignment alignment,BGR24 color,int fontSize,BOOLEnum keepOffsetX) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, this)(textAddress, xParam, yParam, alignment, color, fontSize, +keepOffsetX, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/trimText.cpp b/src/OpenSHC/Text/TextManager/trimText.cpp new file mode 100644 index 00000000..c2122ff2 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/trimText.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/Text/FontSizeClass.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" + +namespace OpenSHC { +namespace Text { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00469F50 + void TextManager::trimText(char* text, int allowedWidth, int fontSize) + + { + MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::wrapTextIntoLines, &this->fontSizeClassArray[fontSize])( + text, allowedWidth); + return; + } + +} +} diff --git a/src/OpenSHC/Text/UserTextHandler/getTextWidthUntilCurrentCursor.cpp b/src/OpenSHC/Text/UserTextHandler/getTextWidthUntilCurrentCursor.cpp new file mode 100644 index 00000000..74d684ea --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/getTextWidthUntilCurrentCursor.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace Text { + + + + +// FUNCTION: STRONGHOLDCRUSADER 0x00471570 +int UserTextHandler::getTextWidthUntilCurrentCursor() + +{ +int iVar1; + +iVar1 = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextWidthTillCursorUnk, DAT_TextManagerObject::ptr)( +this->textArray[this->textArrayIndex], (int)((int)( +this->textCursorIndexArray +[this->textArrayIndex])), (int)((int)( +this->textArrayFontSizes +[this->textArrayIndex]))); +return iVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Text/UserTextHandler/resetToTextIndex.cpp b/src/OpenSHC/Text/UserTextHandler/resetToTextIndex.cpp new file mode 100644 index 00000000..d35da1c9 --- /dev/null +++ b/src/OpenSHC/Text/UserTextHandler/resetToTextIndex.cpp @@ -0,0 +1,25 @@ +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" +#include "OpenSHC/Text/TextArrayIndexTypeInt.hpp" + +namespace OpenSHC { +namespace Text { + + using OpenSHC::Text::TextArrayIndexType; + using OpenSHC::Text::TextArrayIndexTypeInt; + + // FUNCTION: STRONGHOLDCRUSADER 0x00469790 + void UserTextHandler::resetToTextIndex(int textIndex) + + { + if ((this->allowUserTextInput == 0) && (textIndex < ((TextArrayIndexType)0x10))) { + this->textArrayIndex = textIndex; + this->textCursorIndexArray[textIndex] = 0; + this->unknown01 = 1; + this->returnPressed = 0; + } + return; + } + +} +} diff --git a/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp b/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp new file mode 100644 index 00000000..72e08258 --- /dev/null +++ b/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" + + + + + +namespace OpenSHC { + +using OpenSHC::UI::Enums::DisplayElementID; +using OpenSHC::UI::DisplayElement; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF680 +void UI::ActivateGameSpeedAndResourceLackDisplayElementUnk(DisplayElementID elementId,dword elementState,int displayDuration) + +{ +DisplayElement *_displayElementPtr; +DWORD _currentTime; + +_displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(elementId); +if (_displayElementPtr != (DisplayElement *)0x0) { +_displayElementPtr->elementStateUnk_0xc = elementState; +_displayElementPtr->displayDuration_0x14 = displayDuration; +_currentTime = timeGetTime(); +_displayElementPtr->activationTime_0x10 = _currentTime; +} +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp b/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp new file mode 100644 index 00000000..0935f3a0 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004DA8A0 +void UI::AppendCreditsClearImageCommand() + +{ + if (DAT_UnknownBinkCount::instance < 0x120) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x28; + DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsCommand.cpp b/src/OpenSHC/UI/AppendCreditsCommand.cpp new file mode 100644 index 00000000..71a87efc --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsCommand.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004DA7E0 +void UI::AppendCreditsCommand(int param_1) + +{ + if (DAT_UnknownBinkCount::instance < 0x120) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = param_1; + DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsListTerminator.cpp b/src/OpenSHC/UI/AppendCreditsListTerminator.cpp new file mode 100644 index 00000000..2b2df0c4 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsListTerminator.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004DA810 +void UI::AppendCreditsListTerminator() + +{ + if (DAT_UnknownBinkCount::instance < 288) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x20; + DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp b/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp new file mode 100644 index 00000000..37f04353 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004DA840 +void UI::AppendCreditsPauseCommand() + +{ + if (DAT_UnknownBinkCount::instance < 0x120) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x1c; + DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp b/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp new file mode 100644 index 00000000..6f60fce6 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004DA870 +void UI::AppendCreditsSegmentEndCommand() + +{ + if (DAT_UnknownBinkCount::instance < 0x120) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x1f; + DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp b/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp new file mode 100644 index 00000000..4806296a --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp @@ -0,0 +1,27 @@ +#include "../UI.func.hpp" + +#include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +using OpenSHC::Audio::MSS::enums::SHC_SoundStream; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004DABF0 +void UI::AppendCreditsSoundStreamCommand(int param_1, SHC_SoundStream param_2) +{ + if (DAT_UnknownBinkCount::instance < 0x120) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = param_1; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = param_2; + DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/FindDisplayElementWithID.cpp b/src/OpenSHC/UI/FindDisplayElementWithID.cpp new file mode 100644 index 00000000..4611351e --- /dev/null +++ b/src/OpenSHC/UI/FindDisplayElementWithID.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" + + + +#include "OpenSHC/Globals/DAT_PointerToDisplayElementStackTop.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::DisplayElement; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF630 +DisplayElement * UI::FindDisplayElementWithID(int elementID) + +{ +DisplayElement *pDVar1; +DisplayElement *_displayElementPtrUnk; + +pDVar1 = DAT_PointerToDisplayElementStackTop::instance; +while( true ) { +if (pDVar1 == (DisplayElement *)0x0) { +return (DisplayElement *)0x0; +} +if (pDVar1->elementID_0x8 == elementID) break; +pDVar1 = pDVar1->nextDisplayElement_0x20; +} +return pDVar1; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp b/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp new file mode 100644 index 00000000..f1b503d4 --- /dev/null +++ b/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/UI/GreatestLord.func.hpp" +#include "OpenSHC/AI/AIType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::AI::AIType; + + +/* + 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 0x0044B7D0 +int GreatestLord::IfAiGreatestLordGetAiType() + +{ +int _highestRankingPlayer; + +_highestRankingPlayer = MACRO_CALL(OpenSHC::UI::GreatestLord_Func::GetPlayerAtRank)(0); +if ((_highestRankingPlayer != 0) && +(DAT_GameSynchronyState::instance.currentAIArray[_highestRankingPlayer] != 0)) { +return(int)( DAT_GameState::instance.playerDataArray[_highestRankingPlayer].aiType + ~OpenSHC::AI::AIT_NULL); +} +return 0; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp b/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp new file mode 100644 index 00000000..ba7ec7e6 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + + + +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::UI::Enums::MenuModalType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00427210 +BOOLEnum Helpers::AModalDialogIsActiveButIsNotQuitting() + +{ +if ((((DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_NONE) && +(DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_BASIC_AI_LORD_SELECT)) && +(DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_EXTENDED_AI_LORD_SELECT)) && +(DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_ROUNDTABLE)) { +return TRUE; +} +return FALSE; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp b/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp new file mode 100644 index 00000000..a8dd3683 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp @@ -0,0 +1,43 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/BOOL_RelatedToInitialGranaryAndKeepPlacement.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::UI::Enums::DisplayElementID; +using OpenSHC::UI::DisplayElement; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF650 +void Helpers::CheckDisplayElementByIDAndSetForUnlimitedDisplay(DisplayElementID displayElementID,dword elementState) + +{ +DisplayElement *_displayElementPtr; + +_displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); +if (_displayElementPtr != (DisplayElement *)0x0) { +if (_displayElementPtr->elementStateUnk_0xc != elementState) { +BOOL_RelatedToInitialGranaryAndKeepPlacement::instance = FALSE; +} +_displayElementPtr->elementStateUnk_0xc = elementState; +_displayElementPtr->displayDuration_0x14 = -1; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp b/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp new file mode 100644 index 00000000..f213a8f6 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +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 0x004650C0 +BOOLEnum Helpers::CheckGoldResource(int param_1) + +{ +int iVar1; + +iVar1 = 0; +if (param_1 == 5) { +iVar1 = 0x1e; +} +return (uint)(iVar1 <= DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. +currentResources[0xf]); +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp new file mode 100644 index 00000000..5cc2aff0 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/UI/Helpers.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + 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 0x00465080 +void Helpers::CheckIfEnoughGoldForLadderman() + +{ +DAT_EnoughGoldForRequestedUnit::instance = +(uint)(3 < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. +currentResources[0xf]); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp new file mode 100644 index 00000000..1fbf6841 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/UI/Helpers.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + 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 0x004650A0 +void Helpers::CheckIfEnoughGoldForMonk() + +{ +DAT_EnoughGoldForRequestedUnit::instance = +(uint)(9 < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. +currentResources[0xf]); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp new file mode 100644 index 00000000..c307dfb3 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/UI/Helpers.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + 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 0x004650F0 +void Helpers::CheckIfEnoughGoldForTunneler() + +{ +DAT_EnoughGoldForRequestedUnit::instance = +(uint)(0x1d < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. +currentResources[0xf]); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp b/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp new file mode 100644 index 00000000..27d402db --- /dev/null +++ b/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" +#include "OpenSHC/UI.func.hpp" + + + + + +namespace OpenSHC { +namespace UI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::UI::Enums::DisplayElementID; +using OpenSHC::UI::DisplayElement; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF6E0 +BOOLEnum Helpers::GetIfDisplayElementStateNotZero(DisplayElementID displayElementID) + +{ +DisplayElement *_displayElementPtr; + +_displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); +if (_displayElementPtr != (DisplayElement *)0x0) { +return (uint)(_displayElementPtr->elementStateUnk_0xc != 0); +} +return FALSE; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp b/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp new file mode 100644 index 00000000..d118e274 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00433560 +void Helpers::SetTaxesSetting_unknown(int taxesSettingUnk) + +{ +if (DAT_GameCore::instance.taxesSettingUnk == 0) { +DAT_GameCore::instance.taxesSettingUnk = taxesSettingUnk; +DAT_GameCore::instance.unknownScribeRelatedFlag_0x130 = TRUE; +DAT_GameCore::instance.taxestimeUnk = timeGetTime(); +DAT_GameCore::instance.scribeAnimationFrame2 = 0; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp b/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp new file mode 100644 index 00000000..43f5c34f --- /dev/null +++ b/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" + + + +#include "OpenSHC/Globals/DAT_00df5588.hpp" +#include "OpenSHC/Globals/DAT_00df558c.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::Map::Buildings::BuildingType; + + +/* + Sets DAT_00df5588 (tutorial action type) and DAT_00df558c (building type) unless param_1 is 0xb + and DAT_00df5588 is already 7 — in which case the update is skipped to avoid overwriting a + pending state. Used to record which building-related action the player last performed for + tutorial step evaluation. + + renamed by: Claude Sonnet 4.6 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004BC690 +void Helpers::SetTutorialBuildingActionState(int param_1,BuildingType buildingType) + +{ +if ((param_1 != 0xb) || (DAT_00df5588::instance != 7)) { +DAT_00df5588::instance = param_1; +DAT_00df558c::instance = buildingType; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp b/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp new file mode 100644 index 00000000..1eeabbe3 --- /dev/null +++ b/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp @@ -0,0 +1,60 @@ +#include "OpenSHC/UI/HoveredState.func.hpp" +#include "OpenSHC/UI/HoveredStateElement.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::UI::HoveredStateElement; +using OpenSHC::Game::GameMode; +using OpenSHC::Commands::MappersEnum; + + +/* + WARNING: Enum "MappersEnumInt": Some values do not have unique names + */ + +/* + 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 0x005010E0 +void HoveredState::clearInvalidatedHoverStates() + +{ +HoveredStateElement * _pElement; +int _index; + +if (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) { +_pElement = &this->elements[0]; +_index = 20; +do { +if ((_pElement->type != OpenSHC::Commands::M_MAPPER_NULL) && +(_pElement->time <= (int)DAT_GameCore::instance.mapTimeInTicks)) { +_pElement->type = OpenSHC::Commands::M_MAPPER_NULL; +} +_pElement = _pElement + 6; +_index = _index + -1; +} while (_index != 0); +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Menu/updateMenuButtons.cpp b/src/OpenSHC/UI/Menu/updateMenuButtons.cpp new file mode 100644 index 00000000..0517cc3d --- /dev/null +++ b/src/OpenSHC/UI/Menu/updateMenuButtons.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/UI/Menu.func.hpp" +#include "OpenSHC/UI/MenuItem.hpp" +#include "OpenSHC/UI/Enums/MenuItemHandleState.hpp" + + + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::UI::MenuItem; +using OpenSHC::UI::Enums::MenuItemHandleState; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F6470 +void Menu::updateMenuButtons() + +{ +if (this->hoveredItem == (MenuItem *)0x0) { +this->someMenuItemPtr_0x3c = (MenuItem *)0x0; +} +this->hoveredItem = (MenuItem *)0x0; +this->field16_0x40 = 0; +DAT_MenuHandlerState::instance.field18_0x3c = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::handleMenuItems, this)(OpenSHC::UI::Enums::MIHS_HANDLE_INPUT_CALLBACKSUnk); +this->one = 0; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp b/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp new file mode 100644 index 00000000..8212f49e --- /dev/null +++ b/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI/MenuHandlerState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace UI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004F4C60 +void MenuHandlerState::setupBuildMenuState(dword param_1,dword param_2) + +{ +this->isBuildMenuTransitioning_0x18 = FALSE; +this->buildMenuBackgroundLeftShift_0x24 = 0; +this->buildMenuTransitionDirection_0x2c = -1; +this->const017 = param_1; +this->const516 = param_2; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp b/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp new file mode 100644 index 00000000..a8b0c398 --- /dev/null +++ b/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/UI/MenuItem.func.hpp" +#include "OpenSHC/UI/Enums/MenuItemType.hpp" +#include "OpenSHC/UI/Enums/MenuItemTypeInt.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::UI::Enums::MenuItemType; + using OpenSHC::UI::Enums::MenuItemTypeInt; + + // FUNCTION: STRONGHOLDCRUSADER 0x004F4C30 + void MenuItem::resetMenuItemStateUnk() + + { + MenuItemTypeInt MVar1; + + this->hovering = 0; + this->clicked = 0; + (this->secondItemTypeData).buttonState.someTimestamp_1_0x0 = 0; + (this->secondItemTypeData).buttonState.clickTimestamp_0x4 = 0; + (this->secondItemTypeData).buttonState.countTo100 = 0; + MVar1 = this->menuItemType & Enums::MIT_MENU_ITEM_TYPE_ID_PARTUnk; + if ((MVar1 == OpenSHC::UI::Enums::MIT_SLIDERUnk) || (MVar1 == OpenSHC::UI::Enums::MIT_SCROLLBARUnk)) { + (this->secondItemTypeData).buttonState.currentButtonPictureInGm_0xc = -1000; + } + return; + } + +} +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp new file mode 100644 index 00000000..520662b3 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Enums/BuildMenuTabType.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; +using OpenSHC::UI::Enums::BuildMenuTabType; +using OpenSHC::UI::Enums::MenuViewType; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00433200 +void UI::MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk(int param_1, ...) + +{ + int iVar1; + + if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == ((BuildMenuTabType)0x31)) { + iVar1 = MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, DAT_GameState::ptr)(); + if (0 < iVar1) { + DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_HUNTERSHUT; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); + } + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp new file mode 100644 index 00000000..3eaff47f --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI.func.hpp" + + + +#include "OpenSHC/Globals/DAT_00b95b68.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0043FC80 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton() + +{ +DAT_00b95b68::instance = DAT_00b95b68::instance + 1; +if (2 < DAT_00b95b68::instance) { +DAT_00b95b68::instance = 0; +} +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp new file mode 100644 index 00000000..0675882e --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp @@ -0,0 +1,47 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +using OpenSHC::Game::GameMode2; +using OpenSHC::Commands::GameCommandType; + + +/* + 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 0x004660B0 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep() + +{ +if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) { +MACRO_CALL(OpenSHC::UI_Func::SetTutorialHintActiveWithTimestamp)(); +return; +} +DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = +(int)(short)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]. +buildingType; +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_BUILDING_SLEEP); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp new file mode 100644 index 00000000..f2096c23 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuViewType; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00465920 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons(int param_1, ...) + +{ + DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = param_1; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); + DAT_GameCore::instance.field61_0x100 = param_1; + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp new file mode 100644 index 00000000..bd443a19 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00466710 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection(int param_1, ...) + +{ + short* psVar1; + + psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk1; + *psVar1 = *psVar1 ^ (ushort)(1 << ((byte)param_1 & 0x1f)); + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp new file mode 100644 index 00000000..050108ef --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" + + + +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + WARNING: Enum "UnsortedBinkFlagInt": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00439890 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback() + +{ +if (DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying != FALSE) { +DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying = FALSE; +MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, DAT_BinkControlState::ptr)(0); +} +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp b/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp new file mode 100644 index 00000000..12d37461 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +/* + 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 0x0047FFA0 +void UI::MenuItemActionHandler_Chat_SendMessageToPlayer(int param_1, ...) + +{ + uint* puVar1; + + if (param_1 < 0) { + puVar1 = (uint*)((int)DAT_GameSynchronyState::ptr + param_1 * -4 + 0x109264); + *puVar1 = *puVar1 ^ 1; + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 1; + return; + } + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + = 1; + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp new file mode 100644 index 00000000..d2a6fe2b --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_00ed2788.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004D9D60 +void UI::MenuItemActionHandler_DeleteGameRecord_Main(int param_1, ...) + +{ + if (param_1 == 0x16) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::SkirmishLeaderboard_DeleteEntry)(DAT_00ed2788::instance); + MACRO_CALL(OpenSHC::Game::Skirmish_Func::Skirmish_PrepareLeaderboardView)(); + } + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_NONE, FALSE); + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp new file mode 100644 index 00000000..8333616b --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI.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 { + +using OpenSHC::UI::Enums::MenuModalType; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004BB650 +void UI::MenuItemActionHandler_DisableArabTroops_Main(int param_1, ...) + +{ + if ((uint)param_1 < 8) { + DAT_MapPropertiesState::instance.SEC_MercRecruitable[param_1] + = DAT_MapPropertiesState::instance.SEC_MercRecruitable[param_1] ^ 1; + return; + } + if (param_1 == -3) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp new file mode 100644 index 00000000..8158b416 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI.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 { + +using OpenSHC::UI::Enums::MenuModalType; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004BB540 +void UI::MenuItemActionHandler_DisableEuroTroops_Main(int param_1, ...) + +{ + if ((uint)param_1 < 8) { + DAT_MapPropertiesState::instance.SEC_MercRecruitable[param_1 + -7] + = DAT_MapPropertiesState::instance.SEC_MercRecruitable[param_1 + -7] ^ 1; + return; + } + if (param_1 == -3) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp b/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp new file mode 100644 index 00000000..47187ca9 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; +using OpenSHC::UI::Enums::MenuViewType; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00491C20 +void UI::MenuItemActionHandler_EnterTitleOnGameStart_Button(int param_1, ...) + +{ + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp b/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp new file mode 100644 index 00000000..fec9d35e --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +/* + WARNING: Enum "UnsortedBinkFlagInt": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00433230 +void UI::MenuItemActionHandler_InGameMenu_UnknownBinkRelated(int param_1, ...) + +{ + if (DAT_GameCore::instance.isBinkVideoPlaying != 0) { + if (DAT_BinkControlState::instance.binkObjPtrArray[1] == NULL) { + DAT_GameCore::instance.isBinkVideoPlaying = 0; + } + DAT_GameCore::instance.countdown = 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp b/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp new file mode 100644 index 00000000..d5a7b22c --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00494920 +void UI::MenuItemActionHandler_SaveMap_ReturnKeySave(int param_1, ...) + +{ + bool bVar1; + + bVar1 = DAT_UserTextHandlerState::instance.returnPressed != 0; + DAT_UserTextHandlerState::instance.returnPressed = 0; + if (bVar1) { + MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(3); + return; + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp b/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp new file mode 100644 index 00000000..bfd813ec --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp @@ -0,0 +1,42 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004B1090 +void UI::MenuItemActionHandler_UnusedWinCondition_Options(int param_1, ...) + +{ + if (param_1 < (int)DAT_MenuModalComposition1::instance.mbr_0x64) { + DAT_MenuModalComposition1::instance.sliderValue = param_1; + *DAT_MenuModalComposition1::instance.destination = param_1; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_NONE, FALSE); + if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != (undefined*)0x0) { + /* + WARNING: Could not recover jumptable at 0x004b10c0. Too many branches + */ + + /* + WARNING: Treating indirect jump as call + */ + + ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); + return; + } + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp new file mode 100644 index 00000000..4b1ca90d --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004668F0 +void UI::MenuItemRenderFunction_BuildMenu_BuildingIcons(int param_1, ...) + +{ + BOOLEnum BVar1; + + BVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::isMapperAvailable, DAT_MapPropertiesState::ptr)( + (MappersEnum)param_1); + if (BVar1 != FALSE) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + DAT_ButtonUnknownZero::instance = 0; + return; + } + DAT_ButtonUnknownZero::instance = 1; + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp new file mode 100644 index 00000000..4d4c1665 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Game/GameMode2.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +using OpenSHC::Game::GameMode2; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00434230 +void UI::MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton(int param_1, ...) + +{ + if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_EDITOR) + && (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { + DAT_ButtonUnknownZero::instance = 1; + return; + } + DAT_ButtonUnknownZero::instance = 0; + MACRO_CALL( + OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp new file mode 100644 index 00000000..3c1b6453 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00466920 +void UI::MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton(int param_1, ...) + +{ + int iVar1; + + iVar1 = MACRO_CALL_MEMBER( + OpenSHC::Map::MapPropertiesState_Func::isMercRecruitableForBuildingType, DAT_MapPropertiesState::ptr)(param_1); + if (iVar1 != 0) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + DAT_ButtonUnknownZero::instance = 0; + return; + } + DAT_ButtonUnknownZero::instance = 1; + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp new file mode 100644 index 00000000..aa1185eb --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00439390 +void UI::MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper(int param_1, ...) + +{ + if ((DAT_UnitsState::instance.nHasOwnedUnitInSelection == 0) + || (DAT_ButtonUnknownZero::instance = 0, DAT_UnitsState::instance.selectionSlots[param_1 + -0x14] == -1)) { + DAT_ButtonUnknownZero::instance = 1; + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp new file mode 100644 index 00000000..3aadfe79 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x0043A880 +void UI::MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton(int param_1, ...) + +{ + DAT_ButtonUnknownZero::instance = 0; + if ((DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) + || (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_MERCENARYPOST)) { + DAT_ButtonUnknownZero::instance = 1; + } else if (DAT_BuildingsState::instance.field24_0x18e04c != 0) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + return; + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp new file mode 100644 index 00000000..da59152a --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x0043F2C0 +void UI::MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton(int param_1, ...) + +{ + if (DAT_GameCore::instance.field78_0x148 != 1) { + if (DAT_GameCore::instance.field77_0x144 == 1) { + DAT_CurrentButtonGmDataIndex::instance = 0x73; + } + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + return; + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp new file mode 100644 index 00000000..143b8bca --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" + +namespace OpenSHC { + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004B6500 +void UI::MenuItemRenderFunction_InGameMenu_MapEventIconUnk(int param_1, ...) + +{ + DAT_ButtonUnknownZero::instance = 1; + if ((DAT_MinimapViewState::instance.spawnMomentCount != 0) && (DAT_GameCore::instance.isBinkVideoPlaying == 0)) { + DAT_ButtonUnknownZero::instance = 0; + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + return; + } + return; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp new file mode 100644 index 00000000..eb28e327 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00492C60 +void UI::MenuItemRenderFunction_SaveLoadMap_Scrollbar(int param_1,int thumbYPos,int param_3,int thumbHeight,BOOLEnum isDragged) + +{ +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); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp new file mode 100644 index 00000000..c7acec02 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_HighlightedSkirmishType.hpp" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x0042C060 +void UI::MenuItemRenderFunction_SelectCrusade_Main(int param_1, ...) + +{ + if (param_1 == -1) { + DAT_HighlightedSkirmishType::instance = 0; + } + if (DAT_ButtonCurrentlyInteracting::instance != FALSE) { + DAT_HighlightedSkirmishType::instance = param_1; + } + MACRO_CALL( + OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + return; +} + +} diff --git a/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp b/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp new file mode 100644 index 00000000..b2b68f62 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/MenuModal.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + + + +#include "OpenSHC/Globals/DAT_ModalMenuArrayPointerToStackTop.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::UI::MenuModal; +using OpenSHC::UI::Enums::MenuModalType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004A9EB0 +MenuModal * MenuModalComposition::findModalMenu(MenuModalType menuModalID) + +{ +MenuModal *pMVar1; + +pMVar1 = DAT_ModalMenuArrayPointerToStackTop::instance; +while( true ) { +if (pMVar1 == (MenuModal *)0x0) { +return (MenuModal *)0x0; +} +if (pMVar1->menuModalID == menuModalID) break; +pMVar1 = pMVar1->pointerToNextModalMenu; +} +return pMVar1; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp b/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp new file mode 100644 index 00000000..8354c52d --- /dev/null +++ b/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI/Menu.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Menu.hpp" +#include "OpenSHC/UI/MenuModal.hpp" + +#include "OpenSHC/Globals/DAT_ModalMenuArrayPointerToStackTop.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::UI::Menu; + using OpenSHC::UI::MenuModal; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x004A9E80 + void MenuModalComposition::loadAllMenuElementsOfMenuModals() + + { + MenuModal* pMVar1; + + for (pMVar1 = DAT_ModalMenuArrayPointerToStackTop::instance; pMVar1 != (MenuModal*)0x0; + pMVar1 = pMVar1->pointerToNextModalMenu) { + if (pMVar1->pointerToMenu != (Menu*)0x0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::loadMenuElements, pMVar1->pointerToMenu)(0); + } + } + return; + } + +} +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp new file mode 100644 index 00000000..ed27bc74 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB540 +void UI::MenuModalRenderFunction_CreateOrTriggerInvasion(int x,int y,int width,int height) + +{ +/* + added by script: "Invasion" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x2e, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp new file mode 100644 index 00000000..4d47f426 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/AI/AICState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_AICState.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAA60 +void UI::MenuModalRenderFunction_DebugDataAiInfo(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::renderDebugDataAiInfo, DAT_AICState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp new file mode 100644 index 00000000..0408b549 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAA40 +void UI::MenuModalRenderFunction_DebugDataCurrentPlayerData(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::renderDebugDataCurrentPlayerData, DAT_GameState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp new file mode 100644 index 00000000..b9951931 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Map/WildlifeState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WildlifeState.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAB20 +void UI::MenuModalRenderFunction_DebugDataMapData(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::WildlifeState_Func::renderDebugDataMapData, DAT_WildlifeState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp new file mode 100644 index 00000000..9f85da9b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAAC0 +void UI::MenuModalRenderFunction_DebugDataMousePointing(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::renderDebugDataMousePointing, DAT_ViewportRenderState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp new file mode 100644 index 00000000..159480f0 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + + + + +/* + 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 0x004AAAE0 +void UI::MenuModalRenderFunction_DebugDataNetwork(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::renderDebugDataNetwork, DAT_GameSynchronyState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp new file mode 100644 index 00000000..9fa6001c --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp @@ -0,0 +1,35 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + + + + +/* + 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 0x004AAB00 +void UI::MenuModalRenderFunction_DebugDataSplitInfo(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::renderDebugDataSplitInfo, DAT_GameSynchronyState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp new file mode 100644 index 00000000..9017bdfa --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAA80 +void UI::MenuModalRenderFunction_DebugDataUnitData(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::renderDebugDataUnitData, DAT_UnitsState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp new file mode 100644 index 00000000..d491005b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" + +namespace OpenSHC { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AAAA0 +void UI::MenuModalRenderFunction_DebugDataZoneDataUnk(int x,int y,int width,int height) + +{ +MACRO_CALL_MEMBER(OpenSHC::Map::Units::TroopValueState_Func::renderAttackInfoDebugOverlay, DAT_TroopValueState::ptr)(x, y, width, height); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp new file mode 100644 index 00000000..0a0d96d8 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABCB0 +void UI::MenuModalRenderFunction_DisableTroops(int x,int y,int width,int height) + +{ +/* + added by script: "Troops" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xbc, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp new file mode 100644 index 00000000..d183046b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABCE0 +void UI::MenuModalRenderFunction_DisableWeapon(int x,int y,int width,int height) + +{ +/* + added by script: "Weapons" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xbd, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp new file mode 100644 index 00000000..d1dbfeda --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00491BF0 +void UI::MenuModalRenderFunction_EnterTitleOnGameStart(int x,int y,int width,int height) + +{ +/* + added by script: "Enter Your Title" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(5, 6, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp new file mode 100644 index 00000000..ba513c93 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00491E80 +void UI::MenuModalRenderFunction_GameplayOptions(int x,int y,int width,int height) + +{ +/* + added by script: "Game Play Options" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 0x19, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp new file mode 100644 index 00000000..d797d0fe --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00492A60 +void UI::MenuModalRenderFunction_NetworkOptions(int x,int y,int width,int height) + +{ +/* + added by script: "Network Options" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 6, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp new file mode 100644 index 00000000..82058ae6 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004937B0 +void UI::MenuModalRenderFunction_OnlineQuitGame(int x,int y,int width,int height) + +{ +/* + added by script: "Quit Mission" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 7, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp new file mode 100644 index 00000000..8055fd85 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00491810 +void UI::MenuModalRenderFunction_OptionsMenu(int x,int y,int width,int height) + +{ +/* + added by script: "Game Options" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 1, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp new file mode 100644 index 00000000..405cbd23 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABE50 +void UI::MenuModalRenderFunction_SkirmishConnectionOptions(int x,int y,int width,int height) + +{ +/* + added by script: "Connection options" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4f, 0x5d, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp new file mode 100644 index 00000000..d0091b4b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABE80 +void UI::MenuModalRenderFunction_SkirmishPlayOptions(int x,int y,int width,int height) + +{ +/* + added by script: "Play Options" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4f, 0x67, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp new file mode 100644 index 00000000..440be5fd --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00492660 +void UI::MenuModalRenderFunction_SoundOptions(int x,int y,int width,int height) + +{ +/* + added by script: "Sound Options" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 5, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp new file mode 100644 index 00000000..ae462643 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB4E0 +void UI::MenuModalRenderFunction_StartGoods(int x,int y,int width,int height) + +{ +/* + added by script: "Start Goods" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x29, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp new file mode 100644 index 00000000..e4c1f596 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB4B0 +void UI::MenuModalRenderFunction_TraderSettings(int x,int y,int width,int height) + +{ +/* + added by script: "Trader" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x26, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp new file mode 100644 index 00000000..c3b22bc3 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AC250 +void UI::MenuModalRenderFunction_TriggerEvent(int x,int y,int width,int height) + +{ +/* + added by script: "Events" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x17, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp new file mode 100644 index 00000000..a58e8e0a --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB510 +void UI::MenuModalRenderFunction_UnusedSiegeAttackingForceUnk(int x,int y,int width,int height) + +{ +/* + added by script: "Attacking Force" + */ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xa4, x, y, width); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp new file mode 100644 index 00000000..b9507be4 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuViewType; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004D6EF0 +void UI::MenuView_CampaignUnk_DoEveryFrame() + +{ +int iVar1; + +iVar1 = MACRO_CALL(OpenSHC::UI_Func::TicksSinceCounterStart)(); +if (iVar1 != 0) { +if (DAT_GameCore::instance.missionNumber1to20 == 1) { +MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); +return; +} +MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(OpenSHC::UI::Enums::MVT_UNKNOWN_26_CAMPAIGN_RELATEDUnk, 0); +} +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp b/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp new file mode 100644 index 00000000..2b11ee12 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/INT_00eb9ae8.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_MissionDefinedData.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004D8AB0 +void UI::MenuView_CrusadeMissionIntro_Prepare() + +{ +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("skirmish_background.tgx"); +MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +INT_00eb9ae8::instance = 0; +DAT_MissionDefinedData::instance.field26_0xaf8 = true; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp b/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp new file mode 100644 index 00000000..4869731b --- /dev/null +++ b/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_CopyOfScenarioGold.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004BEC10 +void UI::MenuView_EditScenario_Prepare() + +{ +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_builder2.tgx"); +MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::updateEventYearsAndCommitBuildingAvailability, DAT_MapPropertiesState::ptr)(); +DAT_CopyOfScenarioGold::instance = (int)DAT_GameState::instance.mapAndTime.scenarioGold; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp b/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp new file mode 100644 index 00000000..1c194134 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004271E0 +void UI::MenuView_General_DoEveryFrame_FirstGfxCentered() + +{ +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, DAT_TextureRenderCoreObject::ptr)(0, +(DAT_WindowAndDirectDraw::instance.resolutionX - +DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) / 2, +(DAT_WindowAndDirectDraw::instance.resolutionY - +DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) / 2); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp b/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp new file mode 100644 index 00000000..f3ee2c37 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Menu.hpp" + + + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Menu; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004B8050 +void UI::MenuView_General_DoInitial_OnlySetMenuXY() + +{ +Menu *pMVar1; + +DAT_MenuHandlerState::instance.y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; +DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; +pMVar1 = DAT_MenuHandlerState::instance.currentMenu; +(DAT_MenuHandlerState::instance.currentMenu)->xPosition = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; +pMVar1->yPosition = DAT_MenuHandlerState::instance.y; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp b/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp new file mode 100644 index 00000000..8e715899 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + + + + +/* + 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 0x0042BB70 +void UI::MenuView_General_Prepare_SwordShieldAndBorder() + +{ +DAT_GameSynchronyState::instance.field225_0x106ee4 = 0; +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_combat3.tgx"); +MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp new file mode 100644 index 00000000..c99dac0a --- /dev/null +++ b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Menu.hpp" + +#include "OpenSHC/Globals/DAT_IntroTimestamp.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Menu; + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00424770 +void UI::MenuView_IntroLogos_DoInitial() + +{ + Menu* _menuPtr; + + DAT_MenuHandlerState::instance.y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + _menuPtr = DAT_MenuHandlerState::instance.currentMenu; + (DAT_MenuHandlerState::instance.currentMenu)->xPosition = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + _menuPtr->yPosition = DAT_MenuHandlerState::instance.y; + DAT_IntroTimestamp::instance = timeGetTime(); + return; +} + +} diff --git a/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp b/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp new file mode 100644 index 00000000..82160d5c --- /dev/null +++ b/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" + + + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::DisplayElementID; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00430CC0 +void UI::MenuView_MapEditorLandscaping_Prepare() + +{ +DAT_WindowAndDirectDraw::instance.field37_0xdc = 1; +MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)(OpenSHC::UI::Enums::DEID_PEOPLE_LEFT_TO_PLACE, 0); +MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)(OpenSHC::UI::Enums::DEID_PLAYER_INFO_ON_HOVER, 1); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp b/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp new file mode 100644 index 00000000..ca4f531c --- /dev/null +++ b/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0042F3D0 +void UI::MenuView_NewMapMapsize_Prepare() + +{ +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_builder2.tgx"); +MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp b/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp new file mode 100644 index 00000000..67cfeaa4 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0042EFE0 +void UI::MenuView_NewMapMaptype_Prepare() + +{ +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_builder.tgx"); +MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +DAT_GameCore::instance.mapU3EndInt = 0; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp b/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp new file mode 100644 index 00000000..f8997d98 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp @@ -0,0 +1,44 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_00ed27a0.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_StoredGameMode.hpp" + +namespace OpenSHC { + + + + +/* + 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 0x004D9700 +void UI::MenuView_RankingGames_Prepare() + +{ +MACRO_CALL(OpenSHC::Game::Skirmish_Func::Skirmish_PrepareLeaderboardView)(); +DAT_00ed27a0::instance = 0; +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_combat3.tgx"); +MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +DAT_StoredGameMode::instance = DAT_GameSynchronyState::instance.currentGameMode; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp b/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp new file mode 100644 index 00000000..db652234 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Rendering.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004DCC70 +void UI::MenuView_Unknown26_CampaignRelatedUnk_Prepare() + +{ +MACRO_CALL(OpenSHC::UI_Func::ResetCredits)(); +MACRO_CALL(OpenSHC::UI_Func::BuildIntroLogoSequence)(DAT_GameCore::instance.missionNumber1to20, (undefined4)((int)(DAT_GameCore::instance.section1066))); +MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp new file mode 100644 index 00000000..868e1288 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/UI.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0042FAA0 +void UI::MenuView_UnusedChooseAvailableKeeps_Prepare() + +{ +DAT_GameCore::instance.mapU2MiddleBytes[0] = 1; +DAT_GameCore::instance.mapU2MiddleBytes[1] = 1; +DAT_GameCore::instance.mapU2MiddleBytes[2] = 1; +DAT_GameCore::instance.mapU2MiddleBytes[3] = 1; +DAT_GameCore::instance.mapU2MiddleBytes[4] = 1; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp new file mode 100644 index 00000000..b07443cf --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/INT_00b960e0.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004266A0 +void UI::MenuView_UnusedDemoBuyItScreen_DoEveryFrame() + +{ +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, DAT_TextureRenderCoreObject::ptr)(0, +(DAT_WindowAndDirectDraw::instance.resolutionX - +DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) / 2 + INT_00b960e0::instance, +(DAT_WindowAndDirectDraw::instance.resolutionY - +DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) / 2); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp new file mode 100644 index 00000000..1957554f --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Rendering.func.hpp" + + + +#include "OpenSHC/Globals/DAT_00ed278c.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition3.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004E1A20 +void UI::MenuView_UnusedExtremeAd_Prepare() + +{ +MACRO_CALL(OpenSHC::UI_Func::ResetCredits)(); +MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition3::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); +MACRO_CALL(OpenSHC::UI_Func::BuildExtremeDemoIntroScript)(); +MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); +DAT_00ed278c::instance = 0; +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp new file mode 100644 index 00000000..d1e9bdfc --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Menu.hpp" +#include "OpenSHC/Text/TextEditorState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Menu; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004403D0 +void UI::MenuView_UnusedHelpTextEditor_Prepare() + +{ +Menu *pMVar1; + +DAT_MenuHandlerState::instance.y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; +DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; +pMVar1 = DAT_MenuHandlerState::instance.currentMenu; +(DAT_MenuHandlerState::instance.currentMenu)->xPosition = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; +pMVar1->yPosition = DAT_MenuHandlerState::instance.y; +MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::bltTextToScreenIfNeedBe, DAT_TextEditorState::ptr)(); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp new file mode 100644 index 00000000..2caf1aa4 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00426F80 +void UI::MenuView_UnusedSomeMissionStartUnk_Prepare() + +{ +DAT_GameCore::instance.currentlyInGameUnk_0xa4 = FALSE; +DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("multi_background.tgx"); +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("gm_fly.tgx"); +MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +return; +} + + +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp b/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp new file mode 100644 index 00000000..7799b8b0 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/UI/MinimapViewState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004B6640 +void MinimapViewState::setMapPropertyDependingOnMapSize(uint param_1,int param_2) + +{ +if (200 < DAT_TileMapState::instance.mapSize) { +MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileStripWithLuminescence, this)(4, 2, 1, param_1, param_2); +return; +} +MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileStripWithLuminescence, this)(4, 4, 2, param_1, param_2); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp b/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp new file mode 100644 index 00000000..decb5af3 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp @@ -0,0 +1,36 @@ +#include "OpenSHC/UI/MinimapViewState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004B6680 +void MinimapViewState::setTileColorsDependingOnMapSize(int param_1,uint param_2) + +{ +if (200 < DAT_TileMapState::instance.mapSize) { +MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileColors, this)(4, 2, 1, param_1, param_2); +return; +} +MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileColors, this)(4, 4, 2, param_1, param_2); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp b/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp new file mode 100644 index 00000000..849abcfa --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI/MinimapViewState.func.hpp" + + + + + +namespace OpenSHC { +namespace UI { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004B5300 +void MinimapViewState::triggerMinimapRedraw() + +{ +if (this->field14_0x38 == 0) { +this->field13_0x34 = 0; +this->field14_0x38 = 2; +return; +} +this->field14_0x38 = 1; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/PlayAMessageFromAI.cpp b/src/OpenSHC/UI/PlayAMessageFromAI.cpp new file mode 100644 index 00000000..19793823 --- /dev/null +++ b/src/OpenSHC/UI/PlayAMessageFromAI.cpp @@ -0,0 +1,28 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_MissionAestheticsDefinedData.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" + +namespace OpenSHC { + +/* + Plays a WAV sound effect from the mission aesthetics data table. param_1 is the column index + (0-16) and param_2 is the row index (1-33). Bounds-checks both params and calls + SFXState::playWAVSFX with the resolved filename pointer. + + renamed by: Claude Sonnet 4.6 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x004B7F60 +void UI::PlayAMessageFromAI(uint param_1, int param_2) + +{ + if ((param_1 < 0x11) && (param_2 - 1U < 0x21)) { + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playWAVSFX, DAT_SFXState::ptr)( + (char const*)DAT_MissionAestheticsDefinedData::instance.field92_0x170[param_2 * 0x11 + param_1 + -0xc]); + } + return; +} + +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp new file mode 100644 index 00000000..2b47236d --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + + + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { +namespace Rendering { + +using OpenSHC::Rendering::Enums::RenderTarget; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00468C50 +void PencilRenderCore::setupPencilSurface() + +{ +this->surfacePtr = DAT_WindowAndDirectDraw::instance.surfacePointer_mapGame; +if (this->surfaceTarget == OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { +this->surfacePtr = DAT_WindowAndDirectDraw::instance.surfacePointer_screenMenu; +} +if (this->surfaceTarget != OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { +this->horizontalByteSize = 8112; +return; +} +this->horizontalByteSize = DAT_WindowAndDirectDraw::instance.byteSizeOfOneHorizontalLine; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp b/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp new file mode 100644 index 00000000..63e6e499 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004DA640 +void Rendering::RenderMenuGfxHelper(int gfxIndex,int x,int y,int blendStrength) + +{ +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, DAT_TextureRenderCoreObject::ptr)(gfxIndex, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, +DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y, blendStrength); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp b/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp new file mode 100644 index 00000000..eccbf796 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp @@ -0,0 +1,144 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Rendering/ScreenResolutionEnum.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/COL_DARK_LIME.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; +using OpenSHC::UI::Enums::DisplayElementID; +using OpenSHC::DE::SHCDE::eTextSections; +using OpenSHC::Rendering::Enums::RenderTarget; +using OpenSHC::Rendering::ScreenResolutionEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004B20B0 +void Rendering::RenderNoRushDisplayElementUnk(int posX,int posY,DWORD elementState) + +{ +char *pcVar1; +int left; +int iVar2; +int iVar3; +int xParam; +int yParam; +TextAlignment alignment; +uint foregroundColor; +uint backgroundColor; +int fontSize; +BOOLEnum keepOffsetX; +int iVar4; +int blendStrength; + +if (DAT_GameState::instance.mapAndTime.skirmishNoRushTicks == 0) { +/* + Plays pa paam pa pa pa paam + */ + +MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playWAVSFX, DAT_SFXState::ptr)("battlehorn.wav"); +MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)(OpenSHC::UI::Enums::DEID_NO_RUSH, 0); +return; +} +iVar4 = 0x12; +pcVar1 = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 7); +iVar4 = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::computeTextWidth, DAT_TextManagerObject::ptr)(pcVar1, iVar4); +iVar2 = posX + 800; +DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_MAP_GAME; +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x768) { +iVar2 = posX + 0x390; +goto LAB_004b21ab; +} +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { +LAB_004b212c: +iVar2 = posX + 0x230; +} +else { +if (DAT_WindowAndDirectDraw::instance.currentGameResolution != OpenSHC::Rendering::SRE_1600x1200) { +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x720) goto LAB_004b212c; +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1440x900) { +iVar2 = posX + 0x1e0; +goto LAB_004b21ab; +} +if ((DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1080) || +(DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1200)) { +iVar2 = posX + 0xf0; +goto LAB_004b21ab; +} +if ((DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1440) || +(DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1600)) { +iVar2 = posX + -0x50; +goto LAB_004b21ab; +} +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1366x768) { +iVar2 = posX + 0x205; +goto LAB_004b21ab; +} +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1680x1050) { +iVar2 = posX + 0x168; +goto LAB_004b21ab; +} +if (DAT_WindowAndDirectDraw::instance.currentGameResolution != OpenSHC::Rendering::SRE_1600x900) { +if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x600) { +iVar2 = posX + 0x2b0; +} +else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1360x768) { +iVar2 = posX + 0x208; +} +goto LAB_004b21ab; +} +} +iVar2 = posX + 400; +} +LAB_004b21ab: +iVar3 = (iVar4 + 0x32) / 2; +iVar2 = iVar2 + (-0x12 - iVar3); +left = iVar2 - iVar3; +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, DAT_PencilRenderCore::ptr)(left + -7, posY + -5, iVar3 + 5 + iVar2, posY + 0x1e, 0x10); +blendStrength = 0; +keepOffsetX = FALSE; +fontSize = 0x12; +backgroundColor = 0; +foregroundColor = 0xc2f0eb; +alignment = OpenSHC::Text::TTA_CENTER; +xParam = iVar2; +yParam = posY; +pcVar1 = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 7); +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)(pcVar1, xParam, yParam, alignment, foregroundColor, backgroundColor, +fontSize, keepOffsetX, blendStrength); +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)(left + -1, posY + 0x12, iVar3 + 1 + iVar2, posY + 0x18, (ushort)((int)( +COL_BLACK::instance.shortValue))); +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(left, posY + 0x13, +((DAT_GameState::instance.mapAndTime.skirmishNoRushTicks * (iVar4 + 0x32)) / +DAT_GameState::instance.mapAndTime.skirmishNoRushTicksLeft - iVar3) + iVar2, posY + 0x17, (ushort)((int)( +COL_DARK_LIME::instance.shortValue))); +DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp new file mode 100644 index 00000000..0e1cb9aa --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AFB00 +void Rendering::RenderNoTreeGrowthTextDisplayElement(int posX,int posY,DWORD elementState) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)("No tree growth", posX, posY, OpenSHC::Text::TTA_LEFT, 0x80ff, 0, 0x11, FALSE, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp new file mode 100644 index 00000000..e5c9acd7 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Audio/MissingResourceState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_MissingResourceState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF820 +void Rendering::RenderResourceMissing1DisplayElement(int posX,int posY,DWORD elementState) + +{ +MACRO_CALL_MEMBER(OpenSHC::Audio::MissingResourceState_Func::renderResourceMissingText, DAT_MissingResourceState::ptr)(posX, posY, (dword)((int)(elementState)), 1); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp new file mode 100644 index 00000000..190e5f65 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Audio/MissingResourceState.func.hpp" + + + +#include "OpenSHC/Globals/DAT_MissingResourceState.hpp" + +namespace OpenSHC { +namespace UI { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF840 +void Rendering::RenderResourceMissing2DisplayElement(int posX,int posY,DWORD elementState) + +{ +MACRO_CALL_MEMBER(OpenSHC::Audio::MissingResourceState_Func::renderResourceMissingText, DAT_MissingResourceState::ptr)(posX, posY, (dword)((int)(elementState)), 2); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp b/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp new file mode 100644 index 00000000..7bcefa82 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_UnknownStopwatch.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::Text::TextAlignment; +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AFA50 +void Rendering::RenderUnknownDisplayElement7(int posX,int posY,DWORD elementState) + +{ +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(DAT_UnknownStopwatch::instance.duration_0x0, posX, posY + 5, OpenSHC::Text::TTA_RIGHT, 0x80ff +, 0, 0xf, FALSE, 0); +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp new file mode 100644 index 00000000..c19c7a7c --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp @@ -0,0 +1,34 @@ +#include "OpenSHC/IO/ResourceManager.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/FileResourceType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_ResourceManager.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + using OpenSHC::IO::FileResourceType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x004548D0 + BOOLEnum TextureRenderCore::CheckGfxResourceExists(char* param_1) + + { + int iVar1; + + MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::resolveResourceFileName, DAT_ResourceManager::ptr)( + OpenSHC::IO::FRT_GFX, (char const*)((int)(param_1))); + iVar1 = MACRO_CALL_MEMBER( + OpenSHC::IO::ResourceManager_Func::getCurrentResourceSize, DAT_ResourceManager::ptr)(); + return (uint)(iVar1 != 0); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp new file mode 100644 index 00000000..6ac177c7 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp @@ -0,0 +1,36 @@ +// ============================================================================ +// Program : Stronghold Crusader.exe +// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore +// Function : checkIfGfxTgxStartsWithTransparentPixels +// Address : 004549c0 +// Signature : BOOLEnum __thiscall checkIfGfxTgxStartsWithTransparentPixels(TextureRenderCore * this, int gfxIndex) +// ============================================================================ + +#include "OpenSHC/IO/Graphics/GfxRef.hpp" +#include "OpenSHC/IO/Graphics/TgxToken.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ + // FUNCTION: STRONGHOLDCRUSADER 0x004549C0 + BOOLEnum TextureRenderCore::checkIfGfxTgxStartsWithTransparentPixels(int gfxIndex) + + { + // Match: 40% - Best achievable with current compiler + // Differences in register allocation (original uses edx/dl, recomp uses eax/cl) + // Disabling optimizations produces worse match (21.4%) due to frame pointer overhead + int index = gfxIndex; + GfxRef& ref = this->loadedGfxArray[index]; + return (uint)((*(byte*)(ref.offsetInBuffer + 8 + (int)this->gmAndGfxImageDataBuffer) + & OpenSHC::IO::Graphics::TT_TGX_PIXEL_HEADER) + == OpenSHC::IO::Graphics::TT_TRANSPARENT_PIXELS); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp new file mode 100644 index 00000000..322e5744 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + + + +namespace OpenSHC { +namespace UI { +namespace Rendering { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00454990 +void TextureRenderCore::setRenderingRect(int xPos,int yPos,int width,int heigth) + +{ +/* + Could also be, that this does not set the width and height, but the second x + and y positions. From-To, basically. --TheRedDaemon + */ + +this->renderingRect_16c854.left = xPos; +this->renderingRect_16c854.top = yPos; +this->renderingRect_16c854.right = width; +this->renderingRect_16c854.bottom = heigth; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp new file mode 100644 index 00000000..8b1cc5ca --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + + + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { +namespace Rendering { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x00454960 +void TextureRenderCore::setRenderingRectToGameResolution() + +{ +this->renderingRect_16c854.left = 0; +this->renderingRect_16c854.top = 0; +this->renderingRect_16c854.right = DAT_WindowAndDirectDraw::instance.resolutionX; +this->renderingRect_16c854.bottom = DAT_WindowAndDirectDraw::instance.resolutionY; +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp new file mode 100644 index 00000000..b45b277c --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp @@ -0,0 +1,32 @@ +// ============================================================================ +// Program : Stronghold Crusader.exe +// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore +// Function : transformTgxCompressedImageToRGB565 +// Address : 00455270 +// Signature : void __thiscall transformTgxCompressedImageToRGB565(TextureRenderCore * this, int imageIndex) +// ============================================================================ + +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +#include "OpenSHC/Globals/DAT_GMImageOffsets.hpp" +#include "OpenSHC/Globals/DAT_GMImageSizes.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ + // FUNCTION: STRONGHOLDCRUSADER 0x00455270 + void TextureRenderCore::transformTgxCompressedImageToRGB565(int imageIndex) + + { + this->transformTgxFromRGB555ToRGB565( + (ushort*)(DAT_GMImageOffsets::instance[imageIndex] + (int)this->gmProcessedImageData), + DAT_GMImageSizes::instance[imageIndex]); + return; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp new file mode 100644 index 00000000..4a7cc5c4 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp @@ -0,0 +1,28 @@ +// ============================================================================ +// Program : Stronghold Crusader.exe +// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore +// Function : transformUncompressedImageToRGB565 +// Address : 004552e0 +// Signature : void __thiscall transformUncompressedImageToRGB565(TextureRenderCore * this, int imageIndex) +// ============================================================================ + +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +#include "OpenSHC/Globals/DAT_GMImageOffsets.hpp" +#include "OpenSHC/Globals/DAT_GMImageSizes.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x004552e0 + void TextureRenderCore::transformUncompressedImageToRGB565(int imageIndex) + + { + transformRawToRGB555To565(DAT_GMImageOffsets::instance[imageIndex], DAT_GMImageSizes::instance[imageIndex]); + return; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp new file mode 100644 index 00000000..447d9db4 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp @@ -0,0 +1,27 @@ +// ============================================================================ +// Program : Stronghold Crusader.exe +// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore +// Function : transformUncompressedImageWithMarkerUnkToRGB565 +// Address : 00455250 +// Signature : void __thiscall transformUncompressedImageWithMarkerUnkToRGB565(TextureRenderCore * this, int imageIndex) +// ============================================================================ + +#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" + +#include "OpenSHC/Globals/DAT_GMImageOffsets.hpp" +#include "OpenSHC/Globals/DAT_GMImageSizes.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00455250 + void TextureRenderCore::transformUncompressedImageWithMarkerUnkToRGB565(int imageIndex) + { + transformRawWithMarkerUnkToRGB555To565( + DAT_GMImageOffsets::instance[imageIndex], DAT_GMImageSizes::instance[imageIndex]); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp b/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp new file mode 100644 index 00000000..cbd26b1d --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" +#include "OpenSHC/UI.func.hpp" + + + + + +namespace OpenSHC { +namespace UI { + +using OpenSHC::UI::Enums::DisplayElementID; +using OpenSHC::UI::DisplayElement; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF6B0 +void Rendering::TogglePlayerPingDisplayElementUnk(DisplayElementID displayElementID,uint toggleValue) + +{ +DisplayElement *_displayElement; + +_displayElement = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); +if (_displayElement != (DisplayElement *)0x0) { +_displayElement->displayDuration_0x14 = -1; +_displayElement->elementStateUnk_0xc = +~-(uint)(_displayElement->elementStateUnk_0xc != 0) &toggleValue; +} +return; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp b/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp new file mode 100644 index 00000000..2b060622 --- /dev/null +++ b/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Enums::MenuModalType; + +/* + Sets DAT_MenuOptionsActionParameter to a value derived from param_1 (0x20 or 0x2e), activates the + MMT_PROGRESS_BAR_BOX modal dialog and immediately calls + MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic(0). Entry point for triggering + the save/load progress bar UI. + + renamed by: Claude Sonnet 4.6 + */ + +// FUNCTION: STRONGHOLDCRUSADER 0x00495800 +void UI::ShowProgressBarSaveLoadDialog(int param_1) + +{ + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = (-(uint)(param_1 != 0) & 0xe) + 0x20; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog2, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX); + DAT_MenuModalComposition1::instance.activeModalDialogID = OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX; + MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic)(0); + return; +} + +} diff --git a/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp b/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp new file mode 100644 index 00000000..34fa73a3 --- /dev/null +++ b/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/Util/Timing/Stopwatch.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + + + + + +namespace OpenSHC { +namespace Util { +namespace Timing { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0046CEF0 +void Stopwatch::stop() + +{ +DWORD _currentTime; + +if (this->running_0x4 != FALSE) { +_currentTime = timeGetTime(); +this->stopTime_0xc = _currentTime; +this->running_0x4 = FALSE; +this->duration_0x0 = _currentTime - this->startTime_0x8; +} +return; +} + + +} +} +} \ No newline at end of file diff --git a/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp b/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp new file mode 100644 index 00000000..7fdc8e6d --- /dev/null +++ b/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" + +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace Util { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x0046B140 + void WideCharMultiByteState::multiByteToWideCharThunk(LPWSTR param_1, LPCSTR param_2, int param_3) + + { + MultiByteToWideChar(DAT_TextManagerObject::instance.codePage, 1, param_2, param_3, param_1, param_3); + param_1[param_3] = L'\0'; + return; + } + +} +} diff --git a/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp b/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp new file mode 100644 index 00000000..50a98516 --- /dev/null +++ b/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" + +#include "OpenSHC/Globals/MSVC_SecurityCookie.hpp" + +namespace OpenSHC { +namespace Util { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x0046B1B0 + void WideCharMultiByteState::multiByteToWideCharThunk2(char const param_1) + + { + WCHAR local_18[10]; + uint local_4; + + local_4 = MSVC_SecurityCookie::instance ^ (uint)local_18; + MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::multiByteToWideCharThunk, this)( + local_18, ¶m_1, 1); + ; + return; + } + +} +} diff --git a/src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp b/src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp new file mode 100644 index 00000000..6cba9c37 --- /dev/null +++ b/src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp @@ -0,0 +1,33 @@ +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" + + + +#include "OpenSHC/Globals/MSVC_SecurityCookie.hpp" + +namespace OpenSHC { +namespace Util { + + + + +/* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + +// FUNCTION: STRONGHOLDCRUSADER 0x0046B170 +char WideCharMultiByteState::wideCharToByteUnk(WCHAR wideChar) + +{ +uint _securityValue; +char _byteBuffer [12]; + +_securityValue = MSVC_SecurityCookie::instance ^ (uint)_byteBuffer; +MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, this)(_byteBuffer, &wideChar, 1); +; +return _byteBuffer[0]; +} + + +} +} \ No newline at end of file diff --git a/src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp b/src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp new file mode 100644 index 00000000..b3c6bf5c --- /dev/null +++ b/src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" + +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace Util { + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x0046B110 + int WideCharMultiByteState::wideCharToMultiByteWithSize( + LPSTR lpMultiByteStr, LPWSTR lpWideCharStr, int numOfSymbols) + + { + int _numOfBytesWritten; + + _numOfBytesWritten = WideCharToMultiByte(DAT_TextManagerObject::instance.codePage, 0, lpWideCharStr, + numOfSymbols, lpMultiByteStr, numOfSymbols, (CHAR*)0x0, (BOOL*)0x0); + lpMultiByteStr[numOfSymbols] = '\0'; + return _numOfBytesWritten; + } + +} +} From 9af1a6cd258dc25eaacec3635e5298ec83d6fba7 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Tue, 25 Aug 2026 14:21:21 +0200 Subject: [PATCH 21/61] reimplement: SHC_3BB0A8C1_0x00401000 100% --- .../ViewportRenderState/xyAreValid.cpp | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp index 6cf13cc2..4fb6b4a7 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp @@ -1,32 +1,16 @@ #include "OpenSHC/Rendering/ViewportRenderState.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Rendering { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00401000 + BOOLEnum ViewportRenderState::xyAreValid(uint x, uint y) + { + return ((x <= 399) && (y <= 399)) && this->DAT_BinaryTileMap400x400[y * 400 + x] != 0; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00401000 -BOOLEnum ViewportRenderState::xyAreValid(uint x,uint y) - -{ -if (((x < 400) && (y < 400)) && -(this->DAT_BinaryTileMap400x400[y * 400 + x] != 0)) { -return TRUE; -} -return FALSE; } - - } -} \ No newline at end of file From 8455eecd9038f9a4b834d794201fe12a2aa55c3f Mon Sep 17 00:00:00 2001 From: sourcehold Date: Tue, 25 Aug 2026 14:37:25 +0200 Subject: [PATCH 22/61] reimplement: SHC_3BB0A8C1_0x00401B60 100% --- .../EntityState/destroyEntitiesPart2.cpp | 51 +++++-------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp b/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp index 78846392..ff14fd34 100644 --- a/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp @@ -1,42 +1,19 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" -#include "OpenSHC/Map/Entities/Entity.hpp" - - - - +#include "../EntityState.func.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - -using OpenSHC::Map::Entities::Entity; - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401B60 -void EntityState::destroyEntitiesPart2(int param_1) - -{ -Entity * psVar1; -int iVar1; - -psVar1 = &this->entityArray[1]; -iVar1 = 2999; -do { -if ((psVar1->logicalState == 2) && (psVar1->owner == param_1)) { -psVar1->logicalState = 3; -} -psVar1 = psVar1 + 0x74; -iVar1 = iVar1 + -1; -} while (iVar1 != 0); -return; -} - - + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x00401B60 + void EntityState::destroyEntitiesPart2(int param_1) + { + for (int iVar1 = 1; iVar1 < 3000; iVar1++) { + if ((this->entityArray[iVar1].logicalState == 2) && (this->entityArray[iVar1].owner == param_1)) { + this->entityArray[iVar1].logicalState = 3; + } + } + } + + } } } -} \ No newline at end of file From 2f974739a96b378e9673e99ddbb1b4927a28c687 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Tue, 25 Aug 2026 15:08:49 +0200 Subject: [PATCH 23/61] reimplement: SHC_3BB0A8C1_0x0040F3F0 100% --- .../clearBuildingValueWhenStateIsTwo.cpp | 55 +++++-------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp index 2501474d..b0854055 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp @@ -1,46 +1,19 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" -#include "OpenSHC/Map/Buildings/Building.hpp" -#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - - - +#include "../BuildingsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0040F3F0 -void BuildingsState::clearBuildingValueWhenStateIsTwo() - -{ -Building * piVar1; -int iVar1; - -iVar1 = 1; -if (1 < this->maxBuildingsCount) { -piVar1 = &this->buildings[1]; -do { -if (piVar1->logicalState == OpenSHC::Map::Buildings::BLS_NORMAL) { -piVar1->animStateCounterTracker = 0; -} -iVar1 = iVar1 + 1; -piVar1 = piVar1 + 0xcb; -} while (iVar1 < this->maxBuildingsCount); -} -return; -} - - + namespace Buildings { + + // FUNCTION: STRONGHOLDCRUSADER 0x0040F3F0 + void BuildingsState::clearBuildingValueWhenStateIsTwo() + { + for (int iVar1 = 1; iVar1 < (int)this->maxBuildingsCount; iVar1++) { + if (this->buildings[iVar1].logicalState == Buildings::BLS_NORMAL) { + this->buildings[iVar1].animStateCounterTracker = 0; + } + } + } + + } } } -} \ No newline at end of file From e53a36623bcf1a5ca2cb1a84eacc146e92393623 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 19:43:47 +0200 Subject: [PATCH 24/61] reimplement: SHC_3BB0A8C1_0x0041A060 100% --- .../SetUndamagedBuildingHealthToValue.cpp | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp b/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp index 1b457bb0..dc430a67 100644 --- a/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp +++ b/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp @@ -2,43 +2,30 @@ #include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - -#include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A060 + void Version::SetUndamagedBuildingHealthToValue() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID += 1) { + if ((DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) + && (DAT_BuildingsState::instance.buildings[_buildingID].currentHealth + == DAT_BuildingsState::instance.buildings[_buildingID].maxHealth)) { + uint health = DAT_BuildingDefinedData::instance + .BuildingHP[(short)DAT_BuildingsState::instance.buildings[_buildingID].buildingType] + .ushortValue; + DAT_BuildingsState::instance.buildings[_buildingID].maxHealth = health; + DAT_BuildingsState::instance.buildings[_buildingID].currentHealth = health; + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0041A060 -void Version::SetUndamagedBuildingHealthToValue() - -{ -short sVar1; -Building * psVar2; - -psVar2 = &DAT_BuildingsState::instance.buildings[1]; -do { -if ((psVar2->logicalState != ((BuildingLogicalState)0)) && (psVar2->currentHealth == psVar2->maxHealth)) -{ -sVar1 = DAT_BuildingDefinedData::instance.BuildingHP[(short)psVar2->buildingType].shortValue; -psVar2->maxHealth = sVar1; -psVar2->currentHealth = sVar1; } -psVar2 = psVar2 + 0x196; -} while ((int)psVar2 < 0x1124e02); -return; -} - - } -} \ No newline at end of file From 4cd723c07ed6dfd08adbe90d7914663bf30e7f92 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 19:44:13 +0200 Subject: [PATCH 25/61] 100% --- .../Game/GameStateStructures/isSameTeam.cpp | 28 +++------ .../BuildingsState/getBuildingFlag1.cpp | 2 +- .../BuildingsState/getBuildingFlag3.cpp | 2 +- .../getBuildingResourceAmountByUid.cpp | 37 ++++------- .../getResourceCountThatCanBeDeposited.cpp | 45 +++++--------- .../Buildings/BuildingsState/getSpriteID2.cpp | 58 +++++++---------- .../BuildingsState/isReligiousBuilding.cpp | 44 +++++-------- .../BuildingsState/setBuildingToAppleFarm.cpp | 2 +- .../updatePathLinkageLayerForAllBuildings.cpp | 62 +++++++------------ ...dateBadBuildingCessPitOrDancingBearUnk.cpp | 3 +- .../UpdateBadBuildingRackFlogging.cpp | 35 +++-------- .../Buildings/UpdateGoodBuildingGarden.cpp | 38 ++++-------- .../Map/Buildings/UpdateParadeGround2.cpp | 32 +++------- .../Map/Buildings/UpdateParadeGround3.cpp | 32 +++------- .../Map/Buildings/UpdateParadeGround4.cpp | 32 +++------- .../Map/Buildings/UpdatePlacedSiegeTower.cpp | 40 +++++------- .../EntityState/activateProjectileEntity.cpp | 51 ++++++--------- .../Map/Entities/EntityState/deleteEntity.cpp | 38 +++++------- .../EntityState/getFireEntityIDAtTile.cpp | 57 ++++++----------- .../EntityState/markEntityDestroyed.cpp | 41 ++++-------- .../EntityState/reassignEntitiesOwner.cpp | 50 +++++---------- .../EntityState/tickEntityDecayCounter.cpp | 47 +++++--------- .../IgniteFireAtMiniTile_Convenience.cpp | 29 +++------ src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp | 25 ++------ .../Map/Entities/UpdateBrazierEntity.cpp | 28 +++------ .../computeHealthPercentage.cpp | 40 ++++-------- .../processDamageToBuildingThunk.cpp | 37 +++-------- ...sEntityDamageToBuildingCollateralThunk.cpp | 33 +++------- .../setBinkSndStreamAndStartTime.cpp | 50 +++++---------- .../zeroBinkPtrAndLoadBinkSoundSystem.cpp | 3 +- .../computeTileXOffset.cpp | 2 +- .../ViewportRenderState/translateXYToTile.cpp | 2 +- .../ViewportRenderState/xyAreValid.cpp | 3 +- .../GameSynchronyState/isAIPlayer.cpp | 41 ++++-------- 34 files changed, 336 insertions(+), 733 deletions(-) diff --git a/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp b/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp index 23bac844..d93bb754 100644 --- a/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp +++ b/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp @@ -1,29 +1,17 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00401090 + BOOLEnum GameStateStructures::isSameTeam(int playerID1, int playerID2) + { + return this->mapAndTime.playerTeams[playerID1] == this->mapAndTime.playerTeams[playerID2]; + } -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401090 -BOOLEnum GameStateStructures::isSameTeam(int playerID1,int playerID2) - -{ -return (uint)(this->mapAndTime.playerTeams[playerID1] == -this->mapAndTime.playerTeams[playerID2]); } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp index d77078c6..61e1bd26 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "../BuildingsState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp index 0bbd1f2d..ce88669a 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "../BuildingsState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp index c8e24be7..c5b24aea 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp @@ -1,33 +1,22 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" -#include "OpenSHC/Game/Resources/ResourceType.hpp" - - - +#include "../BuildingsState.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - -using OpenSHC::Game::Resources::ResourceType; + namespace Buildings { + using OpenSHC::Game::Resources::ResourceType; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00409330 -undefined4 BuildingsState::getBuildingResourceAmountByUid(int buildingID,int param_2,ResourceType param_3) - -{ -if (this->buildings[buildingID].uid != param_2) { -return(undefined4)( 0); -} -return(undefined4)( this->buildings[buildingID].resources[param_3]); -} - + // FUNCTION: STRONGHOLDCRUSADER 0x00409330 + undefined4 BuildingsState::getBuildingResourceAmountByUid(int buildingID, int param_2, ResourceType param_3) + { + if (this->buildings[buildingID].uid != param_2) { + return 0; + } + return this->buildings[buildingID].resources[param_3]; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp index 927d01b0..95dd7a81 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp @@ -1,35 +1,20 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" - - - - +#include "../BuildingsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0040BFA0 -int BuildingsState::getResourceCountThatCanBeDeposited(int buildingID,undefined4 resourceType,int storageLimit) - -{ -uint uVar1; - -uVar1 = this->buildings[buildingID].currentNumberOfResource; -if (storageLimit <= (int)uVar1) { -return 0; -} -return(int)( storageLimit - uVar1); -} - - + namespace Buildings { + + // FUNCTION: STRONGHOLDCRUSADER 0x0040BFA0 + int BuildingsState::getResourceCountThatCanBeDeposited( + int buildingID, undefined4 resourceType, int storageLimit) + { + int uVar1 = this->buildings[buildingID].currentNumberOfResource; + if (storageLimit <= uVar1) { + return 0; + } + return storageLimit - uVar1; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp index 49a37665..9662bf66 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp @@ -1,44 +1,32 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "../BuildingsState.func.hpp" + #include "OpenSHC/Commands/MappersEnum.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" - - #include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - -using OpenSHC::Commands::MappersEnum; -using OpenSHC::Map::Buildings::BuildingType; - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00409FF0 -int BuildingsState::getSpriteID2(MappersEnum commandBuildingType) - -{ -BuildingType BVar1; -int iVar2; - -BVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::convertCommandBuildingTypeToBuildingType, this)(commandBuildingType); -if (DAT_BuildingDefinedData::instance.Building_Sprite_ID_Array_2[BVar1] == 0) { -iVar2 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getSpriteID, this)(commandBuildingType); -return iVar2; -} -return DAT_BuildingDefinedData::instance.Building_Sprite_ID_Array_2[BVar1]; -} - - + namespace Buildings { + + using OpenSHC::Commands::MappersEnum; + using OpenSHC::Map::Buildings::BuildingType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00409FF0 + int BuildingsState::getSpriteID2(MappersEnum commandBuildingType) + { + int result = DAT_BuildingDefinedData::instance.Building_Sprite_ID_Array_2[MACRO_CALL_MEMBER( + OpenSHC::Map::Buildings::BuildingsState_Func::convertCommandBuildingTypeToBuildingType, this)( + commandBuildingType)]; + if (result != 0) { + return result; + } + + // fixme: this is a tail call optimized situation. Merge getSpriteID into this file too? + return MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getSpriteID, this)( + commandBuildingType); + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp index 21f3196b..87f84d1b 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp @@ -1,38 +1,24 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" -#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" -#include "OpenSHC/Map/Buildings/BuildingType.hpp" - - - +#include "../BuildingsState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - -using OpenSHC::Map::Buildings::BuildingTypeShort; -using OpenSHC::Map::Buildings::BuildingType; + namespace Buildings { + using OpenSHC::Map::Buildings::BuildingType; + using OpenSHC::Map::Buildings::BuildingTypeShort; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0040A4A0 -uint BuildingsState::isReligiousBuilding(int buildingID) - -{ -BuildingTypeShort BVar1; - -BVar1 = this->buildings[buildingID].buildingType; -if ((BVar1 != OpenSHC::Map::Buildings::BT_CHAPEL) && (BVar1 != OpenSHC::Map::Buildings::BT_CHURCH)) { -return (uint)(BVar1 == OpenSHC::Map::Buildings::BT_CATHEDRAL); -} -return 1; -} - + // FUNCTION: STRONGHOLDCRUSADER 0x0040A4A0 + uint BuildingsState::isReligiousBuilding(int buildingID) + { + // fixme: logic is correct but original is written differently apparently. + return this->buildings[buildingID].buildingType == Buildings::BT_CHAPEL + || this->buildings[buildingID].buildingType == Buildings::BT_CHURCH + || this->buildings[buildingID].buildingType == Buildings::BT_CATHEDRAL; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp index ba414ee0..cf8c4194 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "../BuildingsState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp index b9ab0069..d8cfb7db 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp @@ -1,49 +1,29 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" -#include "OpenSHC/Map/Buildings/BuildingLogicalStateShort.hpp" -#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" -#include "OpenSHC/Map/TileMapState.func.hpp" - +#include "../BuildingsState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalStateShort.hpp" #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - -using OpenSHC::Map::Buildings::BuildingLogicalStateShort; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004197C0 -void BuildingsState::updatePathLinkageLayerForAllBuildings() - -{ -BuildingLogicalStateShort *_ptrLogicalState; -int _buildingID; - -_buildingID = 1; -_ptrLogicalState = &this->buildings[1].logicalState; -do { -if (*_ptrLogicalState != ((BuildingLogicalState)0)) { -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::updatePathLinkagesForBuilding, DAT_TileMapState::ptr)(_buildingID); -} -_ptrLogicalState = _ptrLogicalState + 0x196; -_buildingID = _buildingID + 1; -} while ((int)_ptrLogicalState < 0x1124dc4); -return; -} - - + namespace Buildings { + + using OpenSHC::Map::Buildings::BuildingLogicalState; + using OpenSHC::Map::Buildings::BuildingLogicalStateShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x004197C0 + void BuildingsState::updatePathLinkageLayerForAllBuildings() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID += 1) { + if (this->buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::updatePathLinkagesForBuilding, + DAT_TileMapState::ptr)(_buildingID); + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp b/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp index d6984bae..ef4df72b 100644 --- a/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp +++ b/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp @@ -9,9 +9,8 @@ namespace Map { // FUNCTION: STRONGHOLDCRUSADER 0x00418F70 void Buildings::UpdateBadBuildingCessPitOrDancingBearUnk() { - int iVar1 = DAT_CurrentBuildingID::instance; DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; - DAT_BuildingsState::instance.buildings[iVar1].displayOwnerFlag = 0; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].displayOwnerFlag = 0; } } diff --git a/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp b/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp index 6d715cec..42734366 100644 --- a/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp +++ b/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp @@ -1,36 +1,21 @@ -#include "OpenSHC/Map/Buildings.func.hpp" #include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/Buildings.func.hpp" - - +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" -#include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00419340 + void Buildings::UpdateBadBuildingRackFlogging() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].displayOwnerFlag = 0; + MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::addBuildingInRegistry, DAT_GameState::ptr)( + DAT_CurrentBuildingID::instance); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00419340 -void Buildings::UpdateBadBuildingRackFlogging() - -{ -int buildingID; - -buildingID = DAT_CurrentBuildingID::instance; -DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; -DAT_BuildingsState::instance.buildings[buildingID].displayOwnerFlag = 0; -MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::addBuildingInRegistry, DAT_GameState::ptr)(buildingID); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp b/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp index ad3a0a0f..6e7fc0b9 100644 --- a/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp +++ b/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp @@ -1,38 +1,24 @@ -#include "OpenSHC/Map/Buildings.func.hpp" #include "OpenSHC/AI/AICState.func.hpp" #include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/Buildings.func.hpp" - - +#include "OpenSHC/Globals/DAT_AICState.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" -#include "OpenSHC/Globals/DAT_BuildingsState.hpp" -#include "OpenSHC/Globals/DAT_AICState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00418880 + void Buildings::UpdateGoodBuildingGarden() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; + MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::addBuildingToTargetableBuildings, DAT_AICState::ptr)( + DAT_CurrentBuildingID::instance); + MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::addBuildingInRegistry, DAT_GameState::ptr)( + DAT_CurrentBuildingID::instance); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00418880 -void Buildings::UpdateGoodBuildingGarden() - -{ -int buildingID; - -buildingID = DAT_CurrentBuildingID::instance; -DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 0; -MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::addBuildingToTargetableBuildings, DAT_AICState::ptr)(buildingID); -MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::addBuildingInRegistry, DAT_GameState::ptr)(DAT_CurrentBuildingID::instance); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp index 8ef030ab..4ed55305 100644 --- a/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp @@ -1,34 +1,18 @@ #include "OpenSHC/Map/Buildings.func.hpp" - - -#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x004184A0 + void Buildings::UpdateParadeGround2() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].animationIncrement = 1; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].animationFrame = 0x20; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004184A0 -void Buildings::UpdateParadeGround2() - -{ -int iVar1; - -iVar1 = DAT_CurrentBuildingID::instance; -DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; -DAT_BuildingsState::instance.buildings[iVar1].animationIncrement = 1; -DAT_BuildingsState::instance.buildings[iVar1].animationFrame = 0x20; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp index b4a4b814..e310a565 100644 --- a/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp @@ -1,34 +1,18 @@ #include "OpenSHC/Map/Buildings.func.hpp" - - -#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x004184D0 + void Buildings::UpdateParadeGround3() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].animationIncrement = 1; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].animationFrame = 0x1f; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004184D0 -void Buildings::UpdateParadeGround3() - -{ -int iVar1; - -iVar1 = DAT_CurrentBuildingID::instance; -DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; -DAT_BuildingsState::instance.buildings[iVar1].animationIncrement = 1; -DAT_BuildingsState::instance.buildings[iVar1].animationFrame = 0x1f; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp index ac9dd5c5..688d6903 100644 --- a/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp @@ -1,34 +1,18 @@ #include "OpenSHC/Map/Buildings.func.hpp" - - -#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00418500 + void Buildings::UpdateParadeGround4() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].animationIncrement = 1; + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].animationFrame = 0x21; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00418500 -void Buildings::UpdateParadeGround4() - -{ -int iVar1; - -iVar1 = DAT_CurrentBuildingID::instance; -DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 1; -DAT_BuildingsState::instance.buildings[iVar1].animationIncrement = 1; -DAT_BuildingsState::instance.buildings[iVar1].animationFrame = 0x21; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp b/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp index f66ce210..db633589 100644 --- a/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp +++ b/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp @@ -1,38 +1,26 @@ #include "OpenSHC/Map/Buildings.func.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" -#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CurrentBuildingID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::BuildingLogicalState; - + using OpenSHC::Map::Buildings::BuildingLogicalState; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004188C0 + void Buildings::UpdatePlacedSiegeTower() + { + int iVar1 = DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].unitRefID; + if ((iVar1 == 0) + || (DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].unitRefUID + != DAT_UnitsState::instance.units[iVar1].uid)) { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].logicalState + = OpenSHC::Map::Buildings::BLS_REMOVE; + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004188C0 -void Buildings::UpdatePlacedSiegeTower() - -{ -int iVar1; - -iVar1 = (int)DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].unitRefID; -if ((iVar1 == 0) || -(DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].unitRefUID != -DAT_UnitsState::instance.units[iVar1].uid)) { -DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].logicalState = OpenSHC::Map::Buildings::BLS_REMOVE; } -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp index 1cd41ce9..3e3bf341 100644 --- a/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp @@ -1,38 +1,25 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" -#include "OpenSHC/Map/Entities/EntityTypeShort.hpp" -#include "OpenSHC/Map/Entities/EntityType.hpp" - - - +#include "../EntityState.func.hpp" +#include "OpenSHC/Map/Entities/EntityType.hpp" +#include "OpenSHC/Map/Entities/EntityTypeShort.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - -using OpenSHC::Map::Entities::EntityTypeShort; -using OpenSHC::Map::Entities::EntityType; - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004039B0 -int EntityState::activateProjectileEntity(int entityID) - -{ -EntityTypeShort EVar1; - -EVar1 = this->entityArray[entityID].entityType2; -this->entityArray[entityID].logicalState = 2; -this->entityArray[entityID].field72_0xa8 = 1; -MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::setProjectileEntityValues2, this)(entityID, (EntityType)((int)((int)(short)EVar1))); -return entityID; -} - - + namespace Entities { + + using OpenSHC::Map::Entities::EntityType; + using OpenSHC::Map::Entities::EntityTypeShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x004039B0 + int EntityState::activateProjectileEntity(int entityID) + { + this->entityArray[entityID].logicalState = 2; + this->entityArray[entityID].field72_0xa8 = 1; + MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::setProjectileEntityValues2, this)( + entityID, (EntityType)this->entityArray[entityID].entityType2); + return entityID; // fixme: likely void + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp index effba8e0..af2a57c2 100644 --- a/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp @@ -1,32 +1,22 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" -#include "OpenSHC/IO/LowLevelMemory.func.hpp" - +#include "../EntityState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - - - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004039F0 -void EntityState::deleteEntity(uint entityID) - -{ -MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::doSomethingWithOtherEntitiesOnTile, this)(entityID); -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(232, '\0', (void *)((int)(this->entityArray + entityID))); -return; -} - - + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x004039F0 + void EntityState::deleteEntity(uint entityID) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::doSomethingWithOtherEntitiesOnTile, this)( + entityID); + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + sizeof(Entity), 0, (void*)&this->entityArray[entityID]); + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp b/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp index b33454d0..b0f274e7 100644 --- a/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp @@ -1,46 +1,27 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" -#include "OpenSHC/Map/Entities/EntityType.hpp" - +#include "../EntityState.func.hpp" +#include "OpenSHC/Map/Entities/EntityType.hpp" #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - -using OpenSHC::Map::Entities::EntityType; - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401540 -int EntityState::getFireEntityIDAtTile(int tile) - -{ -short _entityTileID; -int _entityTileID_2; - -_entityTileID = DAT_TileMapState::instance.EntityLayer[tile]; -while( true ) { -_entityTileID_2 = (int)_entityTileID; -if (_entityTileID_2 == 0) { -return 0; -} -if (this->entityArray[_entityTileID_2].entityType == OpenSHC::Map::Entities::ET_FIRE) break; -_entityTileID = this->entityArray[_entityTileID_2].nextEntityOnThisTileByID; -} -return _entityTileID_2; -} - - + namespace Entities { + + using OpenSHC::Map::Entities::EntityType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00401540 + int EntityState::getFireEntityIDAtTile(int tile) + { + int _current = DAT_TileMapState::instance.EntityLayer[tile]; + while (_current != 0) { + if (this->entityArray[_current].entityType == OpenSHC::Map::Entities::ET_FIRE) + return _current; + _current = this->entityArray[_current].nextEntityOnThisTileByID; + } + return 0; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp b/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp index 19e2cbcd..dc3e2432 100644 --- a/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp @@ -1,33 +1,18 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" - - - - +#include "../EntityState.func.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - - - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401400 -void EntityState::markEntityDestroyed(int param_1) - -{ -if (0 < param_1) { -this->entityArray[param_1].logicalState = 3; -this->entityArray[param_1].someCounter_OR_hitGround = 10; -} -return; -} - - + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x00401400 + void EntityState::markEntityDestroyed(int param_1) + { + if (0 < param_1) { + this->entityArray[param_1].logicalState = 3; + this->entityArray[param_1].someCounter_OR_hitGround = 10; + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp b/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp index a57b439c..b2a5e3ce 100644 --- a/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp @@ -1,41 +1,19 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" - - - - +#include "../EntityState.func.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - - - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401AE0 -void EntityState::reassignEntitiesOwner(int param_1,undefined4 param_2) - -{ -short *psVar1; -int iVar2; - -psVar1 = &this->entityArray[1].owner; -iVar2 = 2999; -do { -if ((psVar1[-2] == 2) && (*psVar1 == param_1)) { -*psVar1 = (short)param_2; -} -psVar1 = psVar1 + 0x74; -iVar2 = iVar2 + -1; -} while (iVar2 != 0); -return; -} - - + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x00401AE0 + void EntityState::reassignEntitiesOwner(int param_1, undefined4 param_2) + { + for (int index = 1; index < 3000; index++) { + if ((this->entityArray[index].logicalState == 2) && (this->entityArray[index].owner == param_1)) { + this->entityArray[index].owner = param_2; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp b/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp index 258f5e21..883d41da 100644 --- a/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp @@ -1,37 +1,20 @@ -#include "OpenSHC/Map/Entities/EntityState.func.hpp" - - - - +#include "../EntityState.func.hpp" namespace OpenSHC { namespace Map { -namespace Entities { - - - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401430 -void EntityState::tickEntityDecayCounter(int param_1) - -{ -short sVar1; - -sVar1 = this->entityArray[param_1].unkMinusOne; -if (0x1e < sVar1) { -this->entityArray[param_1].logicalState = 3; -return; -} -this->entityArray[param_1].unkMinusOne = sVar1 + 1; -return; -} - - + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x00401430 + void EntityState::tickEntityDecayCounter(int param_1) + { + short sVar1 = this->entityArray[param_1].unkMinusOne; + if (0x1f <= sVar1) { + this->entityArray[param_1].logicalState = 3; + return; + } + this->entityArray[param_1].unkMinusOne = sVar1 + 1; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp b/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp index 09f0a610..6083bfd2 100644 --- a/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp +++ b/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp @@ -1,30 +1,15 @@ #include "OpenSHC/Map/Entities.func.hpp" - - - - namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00407130 + uint Entities::IgniteFireAtMiniTile_Convenience( + int playerID, int miniTileX, int miniTileY, int tileHeightMin8, int two) + { + return MACRO_CALL(OpenSHC::Map::Entities_Func::IgniteFireAtMiniTile)( + playerID, miniTileX, miniTileY, tileHeightMin8, two, 0); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00407130 -uint Entities::IgniteFireAtMiniTile_Convenience(int playerID,int miniTileX,int miniTileY,int tileHeightMin8,int two) - -{ -uint uVar1; - -uVar1 = MACRO_CALL(OpenSHC::Map::Entities_Func::IgniteFireAtMiniTile)(playerID, miniTileX, miniTileY, tileHeightMin8, two, 0); -return uVar1; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp b/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp index 6dfeee8b..60ebf70f 100644 --- a/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp +++ b/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp @@ -1,28 +1,13 @@ #include "OpenSHC/Map/Entities.func.hpp" - - - - namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00407160 + void Entities::SetPlaceOnFire(int playerID, int x, int y, int height, int param_5) + { + MACRO_CALL(OpenSHC::Map::Entities_Func::AFireSpreadFunction)(playerID, x, y, height, param_5, 0); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00407160 -void Entities::SetPlaceOnFire(int playerID,int x,int y,int height,int param_5) - -{ -MACRO_CALL(OpenSHC::Map::Entities_Func::AFireSpreadFunction)(playerID, x, y, height, param_5, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp b/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp index c853dbe2..985a7a94 100644 --- a/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp +++ b/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp @@ -1,31 +1,19 @@ #include "OpenSHC/Map/Entities.func.hpp" - - #include "OpenSHC/Globals/DAT_CurrentEntityID.hpp" #include "OpenSHC/Globals/DAT_EntityState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00402AB0 + void Entities::UpdateBrazierEntity() + { + DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].graphicType2 + = ((byte)DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].unknownAnimationFrameRelated + & 7) + + DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].graphicType2RelatedOffset; + } - - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00402AB0 -void Entities::UpdateBrazierEntity() - -{ -DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].graphicType2 = -((byte)DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].unknownAnimationFrameRelated &7) + -(int)DAT_EntityState::instance.entityArray[DAT_CurrentEntityID::instance].graphicType2RelatedOffset; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp b/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp index 4540f11e..62f5b13e 100644 --- a/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp +++ b/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp @@ -1,32 +1,18 @@ -#include "OpenSHC/Map/Navigation/DirectionAlgorithmState.func.hpp" - - - - +#include "../DirectionAlgorithmState.func.hpp" namespace OpenSHC { namespace Map { -namespace Navigation { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004092C0 -int DirectionAlgorithmState::computeHealthPercentage(int param_1,int param_2) - -{ -if (param_2 == 0) { -return 100; -} -return (param_1 * 100) / param_2; -} - - + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x004092C0 + int DirectionAlgorithmState::computeHealthPercentage(int param_1, int param_2) + { + if (param_2 == 0) { + return 100; + } + return (param_1 * 100) / param_2; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp b/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp index 1387de1b..9a0c3244 100644 --- a/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp +++ b/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp @@ -1,36 +1,19 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../TileMapState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00409300 + BOOLEnum TileMapState::processDamageToBuildingThunk(int targetedTile, uint targetedTileX, uint targetedTileY, + int damage, int param_5, int playerID, BOOLEnum aiBuildDelayRelated) + { + return MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::processDamageToBuilding, this)( + targetedTile, targetedTileX, targetedTileY, damage, param_5, playerID, aiBuildDelayRelated, 0); + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00409300 -BOOLEnum TileMapState::processDamageToBuildingThunk(int targetedTile,uint targetedTileX,uint targetedTileY,int damage,int param_5,int playerID,BOOLEnum aiBuildDelayRelated) - -{ -BOOLEnum BVar1; - -BVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::processDamageToBuilding, this)(targetedTile, targetedTileX, targetedTileY, damage, param_5, -playerID, aiBuildDelayRelated, 0); -return BVar1; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp b/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp index d5967dfc..1f8d85fe 100644 --- a/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp +++ b/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp @@ -1,32 +1,15 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" - - - - +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00401060 + void TileMapState::processEntityDamageToBuildingCollateralThunk( + int tile, uint x_2, uint y_2, int damage, int playerID, undefined4 unused) + { + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::processEntityDamageToBuildingCollateral, this)( + tile, x_2, y_2, damage, playerID, unused, 0); + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00401060 -void TileMapState::processEntityDamageToBuildingCollateralThunk(int tile,uint x_2,uint y_2,int damage,int playerID,undefined4 unused) - -{ -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::processEntityDamageToBuildingCollateral, this)(tile, x_2, y_2, damage, playerID, (undefined4)((int)(unused)), 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp index d437b512..665bc117 100644 --- a/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp @@ -2,43 +2,25 @@ #include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_SoundSystemState.hpp" namespace OpenSHC { namespace Rendering { -namespace Bink { - -using OpenSHC::Audio::MSS::enums::SHC_SoundStream; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - WARNING: Enum "UnsortedBinkFlagInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00408E70 -void BinkControlClass::setBinkSndStreamAndStartTime(int binkObjIndex,SHC_SoundStream soundStreamIndexUnk) - -{ -DWORD _currentSysTime; - -if ((DAT_SoundSystemState::instance.waveOutOpenUnk_0x8 != FALSE) && -(DAT_SoundSystemState::instance.soundActiveUnk_0x0 != 0)) { -this->soundStreamIndex[binkObjIndex] = soundStreamIndexUnk; -_currentSysTime = timeGetTime(); -this->startTime[binkObjIndex] = _currentSysTime; -} -return; -} - - + namespace Bink { + + using OpenSHC::Audio::MSS::enums::SHC_SoundStream; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00408E70 + void BinkControlClass::setBinkSndStreamAndStartTime(int binkObjIndex, SHC_SoundStream soundStreamIndexUnk) + { + if ((DAT_SoundSystemState::instance.waveOutOpenUnk_0x8 != FALSE) + && (DAT_SoundSystemState::instance.soundActiveUnk_0x0 != 0)) { + this->soundStreamIndex[binkObjIndex] = soundStreamIndexUnk; + this->startTime[binkObjIndex] = timeGetTime(); + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp index 4bcf9c26..ec551067 100644 --- a/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "../BinkControlClass.func.hpp" namespace OpenSHC { namespace Rendering { @@ -6,7 +6,6 @@ namespace Rendering { // FUNCTION: STRONGHOLDCRUSADER 0x00408E10 void BinkControlClass::zeroBinkPtrAndLoadBinkSoundSystem(HDIGDRIVER drvrPtr) - { this->binkObjPtrArray[0] = NULL; this->binkObjPtrArray[1] = NULL; diff --git a/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp b/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp index b30fabf6..91e7004d 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "../ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp b/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp index fb37d0e2..437a8147 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "../ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp index 4fb6b4a7..7e538608 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "../ViewportRenderState.func.hpp" + #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp index f0807e15..6c6f8ec9 100644 --- a/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp +++ b/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp @@ -1,39 +1,20 @@ -#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../GameSynchronyState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Synchrony { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004010B0 + BOOLEnum GameSynchronyState::isAIPlayer(int playerID) + { + if (this->currentPlayerFullIDArray[playerID] != -1) { + return FALSE; + } + return this->currentAIArray[playerID] != 0; + } -/* - decompilerscript: committed: 2025-01-30 21:56:35.138000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004010B0 -BOOLEnum GameSynchronyState::isAIPlayer(int playerID) - -{ -if (this->currentPlayerFullIDArray[playerID] != -1) { -return FALSE; } -return (uint)(this->currentAIArray[playerID] != 0); -} - - } -} \ No newline at end of file From 06eff4b1415299527e2edd7c7dd3f18ea572959e Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 20:33:26 +0200 Subject: [PATCH 26/61] reimplement: SHC_3BB0A8C1_0x0041A0D0 100% --- .../Map/Version/UpgradeBuildingField1.cpp | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp index 92460f02..46961cb5 100644 --- a/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp @@ -2,38 +2,24 @@ #include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; -// FUNCTION: STRONGHOLDCRUSADER 0x0041A0D0 -void Version::UpgradeBuildingField1() + // FUNCTION: STRONGHOLDCRUSADER 0x0041A0D0 + void Version::UpgradeBuildingField1() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { + DAT_BuildingsState::instance.buildings[_buildingID].uidWhenPlaced + = DAT_BuildingsState::instance.buildings[_buildingID].someUID; + } + } + } -{ -Building * psVar1; - -psVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if (psVar1->logicalState != ((BuildingLogicalState)0)) { -psVar1->uidWhenPlaced = (int)*(short *)psVar1; -} -psVar1 = psVar1 + 0x32c; -} while ((int)psVar1 < 0x1124e82); -return; } - - } -} \ No newline at end of file From 7d152710e9938438ee4f4df7c08e32bca5827842 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 20:35:49 +0200 Subject: [PATCH 27/61] reimplement: SHC_3BB0A8C1_0x0041A2B0 100% --- .../Map/Version/SetDairyCheeseToZero.cpp | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp b/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp index 79dfe0fe..8f5dc46b 100644 --- a/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp +++ b/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp @@ -3,39 +3,30 @@ #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; -using OpenSHC::Map::Buildings::BuildingType; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; + using OpenSHC::Map::Buildings::BuildingType; + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A2B0 + void Version::SetDairyCheeseToZero() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if ((DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) + && (DAT_BuildingsState::instance.buildings[_buildingID].buildingType + == OpenSHC::Map::Buildings::BT_DAIRYFARM)) { + DAT_BuildingsState::instance.buildings[_buildingID].flagonsOfAleOrCheeseOrReleaseDogs = 0; + } + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x0041A2B0 -void Version::SetDairyCheeseToZero() - -{ -Building * pBVar1; - -pBVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if ((pBVar1->logicalState != ((BuildingLogicalState)0)) && (pBVar1->buildingType == OpenSHC::Map::Buildings::BT_DAIRYFARM)) { -pBVar1->flagonsOfAleOrCheeseOrReleaseDogs = 0; -} -pBVar1 = pBVar1 + 0x196; -} while ((int)pBVar1 < 0x1124dc6); -return; } - - } -} \ No newline at end of file From 9f2447e15a0a6c87a17155ffaa4a5acee0547430 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 20:38:27 +0200 Subject: [PATCH 28/61] reimplement: SHC_3BB0A8C1_0x0041A390 100% --- .../SetBuildingsEmployeeCountToValue.cpp | 47 +++++++------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp b/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp index 80c1e7a6..7954d6e4 100644 --- a/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp +++ b/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp @@ -2,41 +2,28 @@ #include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - -#include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_BuildingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A390 + void Version::SetBuildingsEmployeeCountToValue() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { + DAT_BuildingsState::instance.buildings[_buildingID].buildingTypeBasedEmployeeCount + = DAT_BuildingDefinedData::instance + .EmployeeCountPerBuildingType[DAT_BuildingsState::instance.buildings[_buildingID] + .buildingType] + .shortValue; + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0041A390 -void Version::SetBuildingsEmployeeCountToValue() - -{ -Building * pBVar1; - -pBVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if (pBVar1->logicalState != ((BuildingLogicalState)0)) { -pBVar1->buildingTypeBasedEmployeeCount = -DAT_BuildingDefinedData::instance.EmployeeCountPerBuildingType[(short)pBVar1->buildingType]. -shortValue; } -pBVar1 = pBVar1 + 0x196; -} while ((int)pBVar1 < 0x1124dc6); -return; -} - - } -} \ No newline at end of file From 34663a365254a75b926eb19ebffbb6ce9d0528cf Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 20:40:30 +0200 Subject: [PATCH 29/61] reimplement: SHC_3BB0A8C1_0x0041A3C0 100% --- .../Map/Version/UpgradeBuildingField2.cpp | 39 ++++++------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp index 5022bb7c..0aff6e2a 100644 --- a/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp @@ -2,39 +2,24 @@ #include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; -// FUNCTION: STRONGHOLDCRUSADER 0x0041A3C0 -void Version::UpgradeBuildingField2() + // FUNCTION: STRONGHOLDCRUSADER 0x0041A3C0 + void Version::UpgradeBuildingField2() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { + DAT_BuildingsState::instance.buildings[_buildingID].field207_0x288 = 0; + DAT_BuildingsState::instance.buildings[_buildingID].field189_0x264 = 0; + } + } + } -{ -Building * psVar1; - -psVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if (psVar1->logicalState != ((BuildingLogicalState)0)) { -psVar1->field207_0x288 = 0; -psVar1->field189_0x264 = 0; -} -psVar1 = psVar1 + 0x196; -} while ((int)psVar1 < 0x1124f7c); -return; } - - } -} \ No newline at end of file From bee1a24187268152e35f58efb5d3c3f94968e504 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 20:43:19 +0200 Subject: [PATCH 30/61] progress --- .../Map/Version/UpgradeFirst9Buildings.cpp | 38 ++++--------- .../Map/Version/UpgradeKillingPitField.cpp | 43 +++++---------- .../UpgradeSolitaryMapBuildingField3.cpp | 55 ++++++------------- 3 files changed, 42 insertions(+), 94 deletions(-) diff --git a/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp b/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp index cdb6da4d..aad5b09e 100644 --- a/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp +++ b/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp @@ -1,37 +1,21 @@ -#include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" - - +#include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x0041A0A0 + void Version::UpgradeFirst9Buildings() + { + for (int buildingID = 1; buildingID < 9; buildingID++) { + MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::setupBarracksCampgroundPositions, + DAT_BuildingsState::ptr)(buildingID); + MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::setupMercenaryPostCampgroundPositions, + DAT_BuildingsState::ptr)(buildingID); + } + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0041A0A0 -void Version::UpgradeFirst9Buildings() - -{ -int buildingID; - -buildingID = 1; -do { -MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::setupBarracksCampgroundPositions, DAT_BuildingsState::ptr)(buildingID); -MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::setupMercenaryPostCampgroundPositions, DAT_BuildingsState::ptr)(buildingID) -; -buildingID = buildingID + 1; -} while (buildingID < 9); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp b/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp index 251cdb2f..24ee46f3 100644 --- a/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp +++ b/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp @@ -3,39 +3,26 @@ #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; -using OpenSHC::Map::Buildings::BuildingType; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; + using OpenSHC::Map::Buildings::BuildingType; + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A5C0 + void Version::UpgradeKillingPitField() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if ((DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) + && (DAT_BuildingsState::instance.buildings[_buildingID].buildingType + == OpenSHC::Map::Buildings::BT_KILLINGPIT)) { + DAT_BuildingsState::instance.buildings[_buildingID].killingPitField = 0; + } + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x0041A5C0 -void Version::UpgradeKillingPitField() - -{ -Building * pBVar1; - -pBVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if ((pBVar1->logicalState != ((BuildingLogicalState)0)) && (pBVar1->buildingType == OpenSHC::Map::Buildings::BT_KILLINGPIT)) { -pBVar1->killingPitField = 0; -} -pBVar1 = pBVar1 + 0x196; -} while ((int)pBVar1 < 0x1124dc6); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp b/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp index 5f50a864..974015a3 100644 --- a/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp +++ b/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp @@ -1,52 +1,29 @@ #include "OpenSHC/Map/Version.func.hpp" -#include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Game::GameMode; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - 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 - */ + using OpenSHC::Game::GameMode; + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A3F0 + void Version::UpgradeSolitaryMapBuildingField3() + { + if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { + DAT_BuildingsState::instance.buildings[_buildingID].playerColorUnk = 0; + } + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0041A3F0 -void Version::UpgradeSolitaryMapBuildingField3() - -{ -Building * piVar1; - -if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SOLITARY) { -piVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if (piVar1->logicalState != ((BuildingLogicalState)0)) { -piVar1->playerColorUnk = 0; -} -piVar1 = piVar1 + 0xcb; -} while ((int)piVar1 < 0x1124cfc); } -return; -} - - } -} \ No newline at end of file From b683b6d7fccacc0bdf6ab1a4822f4d56b131bbca Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 23:09:52 +0200 Subject: [PATCH 31/61] reimplement: SHC_3BB0A8C1_0x0041A3C0 72% stuck --- src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp index c99dac0a..b60fee46 100644 --- a/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp +++ b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp @@ -9,23 +9,15 @@ namespace OpenSHC { using OpenSHC::UI::Menu; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00424770 void UI::MenuView_IntroLogos_DoInitial() - { - Menu* _menuPtr; - DAT_MenuHandlerState::instance.y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; - _menuPtr = DAT_MenuHandlerState::instance.currentMenu; - (DAT_MenuHandlerState::instance.currentMenu)->xPosition = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; - _menuPtr->yPosition = DAT_MenuHandlerState::instance.y; + DAT_MenuHandlerState::instance.currentMenu->yPosition = DAT_MenuHandlerState::instance.y; + DAT_MenuHandlerState::instance.currentMenu->xPosition = DAT_MenuHandlerState::instance.x; + DAT_IntroTimestamp::instance = timeGetTime(); - return; } } From 122f0a2728c5ce4f8ff24bad537746c480976aa2 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 23:34:42 +0200 Subject: [PATCH 32/61] reimplement: SHC_3BB0A8C1_0x0042AC60 100% --- src/OpenSHC/Synchrony/GetPlayerPosition.cpp | 40 ++++----------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/src/OpenSHC/Synchrony/GetPlayerPosition.cpp b/src/OpenSHC/Synchrony/GetPlayerPosition.cpp index 7c018a7f..3036cbf4 100644 --- a/src/OpenSHC/Synchrony/GetPlayerPosition.cpp +++ b/src/OpenSHC/Synchrony/GetPlayerPosition.cpp @@ -1,44 +1,18 @@ #include "OpenSHC/Synchrony.func.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { - - - -/* - 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 0x0042AC60 int Synchrony::GetPlayerPosition(int playerID) - { -byte *pbVar1; -int iVar2; - -iVar2 = 0; -do { -pbVar1 = DAT_GameSynchronyState::instance.playerPositionsArray + iVar2; -iVar2 = iVar2 + 1; -if ((char)*pbVar1 + 1 == playerID) { -return iVar2; + for (int _position = 0; _position < 8; _position++) { + if (DAT_GameSynchronyState::instance.playerPositionsArray[_position] + 1 == playerID) { + return _position + 1; + } + } + return 0; } -} while (iVar2 < 8); -return 0; -} - -} \ No newline at end of file +} From 66c6b97af033ac90a084a9bcfbd1d4525e3533fa Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 26 Aug 2026 23:39:59 +0200 Subject: [PATCH 33/61] reimplement: 100% --- .../BuildingsState/getArmoryWithSpaceLeft.cpp | 86 +++++++------------ .../Map/Version/UpgradeBuildingField4.cpp | 37 +++----- .../UpgradeClearBuildings1000AndHigher.cpp | 34 +++----- .../Map/Version/UpgradeOutpostField.cpp | 24 ++---- .../Actions/RemovePositionOfPlayer.cpp | 47 ++-------- .../QueueChangeGameIntensityOrBalance.cpp | 1 - .../computeTextWidthForTextGroup.cpp | 32 ++----- .../Text/TextManager/renderInGameText.cpp | 30 ++----- .../renderLeftAlignedNumberToScreen.cpp | 29 ++----- src/OpenSHC/Text/TextManager/renderNumber.cpp | 32 +++---- .../Text/TextManager/renderNumberToScreen.cpp | 29 ++----- .../Text/TextManager/renderTextToScreen2.cpp | 34 +++----- .../AModalDialogIsActiveButIsNotQuitting.cpp | 42 ++++----- ...uItemRenderFunction_SelectCrusade_Main.cpp | 6 -- ..._General_DoEveryFrame_FirstGfxCentered.cpp | 28 ++---- ...w_General_Prepare_SwordShieldAndBorder.cpp | 35 ++------ .../UI/MenuView_NewMapMapsize_Prepare.cpp | 23 ++--- .../UI/MenuView_NewMapMaptype_Prepare.cpp | 25 ++---- ...iew_UnusedChooseAvailableKeeps_Prepare.cpp | 25 ++---- ...iew_UnusedDemoBuyItScreen_DoEveryFrame.cpp | 31 +++---- ...View_UnusedSomeMissionStartUnk_Prepare.cpp | 28 +++--- 21 files changed, 199 insertions(+), 459 deletions(-) diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp index 19d66db4..fd941425 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp @@ -1,60 +1,38 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" -#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" -#include "OpenSHC/Map/Buildings/BuildingType.hpp" - - - +#include "../BuildingsState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" namespace OpenSHC { namespace Map { -namespace Buildings { - -using OpenSHC::Map::Buildings::BuildingTypeShort; -using OpenSHC::Map::Buildings::BuildingType; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00422370 -uint BuildingsState::getArmoryWithSpaceLeft(uint targetBuildingID,undefined4 producedItemTypeUnk,int playerID,int resourceToDeposit) - -{ -uint uVar1; -int iVar2; -BuildingTypeShort *pBVar3; -uint _buildingID; - -if (targetBuildingID != 0) { -uVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getArmoryIDIfSpaceLeft, this)(targetBuildingID, (undefined4)((int)(producedItemTypeUnk)), playerID, -resourceToDeposit); -return uVar1; -} -_buildingID = 1; -if (1 < this->maxBuildingsCount) { -pBVar3 = &this->buildings[1].buildingType; -do { -if (*pBVar3 == OpenSHC::Map::Buildings::BT_ARMORY) { -iVar2 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::buildingIsAccessible, this)(_buildingID, 0); -if (iVar2 != 0) { -uVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getArmoryIDIfSpaceLeft, this)(_buildingID, (undefined4)((int)(producedItemTypeUnk)), playerID, -resourceToDeposit); -if (uVar1 != 0) { -return _buildingID; -} -} -} -_buildingID = _buildingID + 1; -pBVar3 = pBVar3 + 0x196; -} while ((int)_buildingID < this->maxBuildingsCount); -} -return 0; -} - - + namespace Buildings { + + using OpenSHC::Map::Buildings::BuildingType; + using OpenSHC::Map::Buildings::BuildingTypeShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x00422370 + uint BuildingsState::getArmoryWithSpaceLeft( + uint targetBuildingID, undefined4 producedItemTypeUnk, int playerID, int resourceToDeposit) + { + if (targetBuildingID != 0) { + return MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::getArmoryIDIfSpaceLeft, this)( + targetBuildingID, (undefined4)((int)(producedItemTypeUnk)), playerID, resourceToDeposit); + } + for (int _buildingID = 1; _buildingID < (int)this->maxBuildingsCount; _buildingID++) { + if (this->buildings[_buildingID].buildingType == Buildings::BT_ARMORY) { + if (MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::buildingIsAccessible, this)( + _buildingID, 0)) { + if (MACRO_CALL_MEMBER( + OpenSHC::Map::Buildings::BuildingsState_Func::getArmoryIDIfSpaceLeft, this)( + _buildingID, (undefined4)((int)(producedItemTypeUnk)), playerID, resourceToDeposit)) { + return _buildingID; + } + } + } + } + return 0; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp index 38d5c29b..81b58c5e 100644 --- a/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp @@ -2,38 +2,23 @@ #include "OpenSHC/Map/Buildings/Building.hpp" #include "OpenSHC/Map/Buildings/BuildingLogicalState.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; -using OpenSHC::Map::Buildings::BuildingLogicalState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Buildings::Building; + using OpenSHC::Map::Buildings::BuildingLogicalState; -// FUNCTION: STRONGHOLDCRUSADER 0x0041A5F0 -void Version::UpgradeBuildingField4() + // FUNCTION: STRONGHOLDCRUSADER 0x0041A5F0 + void Version::UpgradeBuildingField4() + { + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { + DAT_BuildingsState::instance.buildings[_buildingID].field245_0x2c6 = 0; + } + } + } -{ -Building * psVar1; - -psVar1 = &DAT_BuildingsState::instance.buildings[1]; -do { -if (psVar1->logicalState != ((BuildingLogicalState)0)) { -psVar1->field245_0x2c6 = 0; -} -psVar1 = psVar1 + 0x196; -} while ((int)psVar1 < 0x1124fba); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp b/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp index 8b5f7e72..5f2d93a5 100644 --- a/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp +++ b/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp @@ -1,8 +1,6 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" #include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Map/Buildings/Building.hpp" -#include "OpenSHC/IO/LowLevelMemory.func.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" @@ -10,28 +8,16 @@ namespace OpenSHC { namespace Map { -using OpenSHC::Map::Buildings::Building; - + using OpenSHC::Map::Buildings::Building; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x0041A620 + void Version::UpgradeClearBuildings1000AndHigher() + { + for (int _buildingID = 1000; _buildingID < 2000; _buildingID++) { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x32c, '\0', &DAT_BuildingsState::instance.buildings[_buildingID]); + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0041A620 -void Version::UpgradeClearBuildings1000AndHigher() - -{ -Building *destination; - -destination = DAT_BuildingsState::instance.buildings + 1000; -do { -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x32c, '\0', (void *)((int)(destination))); -destination = destination + 1; -} while ((int)destination < 0x1124cf4); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp b/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp index 565f893c..de8cc321 100644 --- a/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp +++ b/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp @@ -12,26 +12,18 @@ namespace Map { using OpenSHC::Map::Buildings::BuildingLogicalState; using OpenSHC::Map::Buildings::BuildingType; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x0041A710 void Version::UpgradeOutpostField() - { - Building* pBVar1; - - pBVar1 = &DAT_BuildingsState::instance.buildings[1]; - do { - if ((pBVar1->logicalState != ((BuildingLogicalState)0)) - && ((pBVar1->buildingType == OpenSHC::Map::Buildings::BT_OUTPOST_EUROPEAN - || (pBVar1->buildingType == OpenSHC::Map::Buildings::BT_OUTPOST_ARABIAN)))) { - pBVar1->randomOutpostField = '\0'; + for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { + if ((DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) + && ((DAT_BuildingsState::instance.buildings[_buildingID].buildingType + == OpenSHC::Map::Buildings::BT_OUTPOST_EUROPEAN) + || (DAT_BuildingsState::instance.buildings[_buildingID].buildingType + == OpenSHC::Map::Buildings::BT_OUTPOST_ARABIAN))) { + DAT_BuildingsState::instance.buildings[_buildingID].randomOutpostField = 0; } - pBVar1 = pBVar1 + 0x196; - } while ((int)pBVar1 < 0x1124dc6); - return; + } } } diff --git a/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp b/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp index f4ffea4f..503542eb 100644 --- a/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp +++ b/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp @@ -1,48 +1,19 @@ #include "OpenSHC/Synchrony/Actions.func.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Synchrony { + // FUNCTION: STRONGHOLDCRUSADER 0x004285C0 + void Actions::RemovePositionOfPlayer(int playerID) + { + for (int _position = 0; _position < 8; _position++) { + if ((char)DAT_GameSynchronyState::instance.playerPositionsArray[_position] + 1 == playerID) { + DAT_GameSynchronyState::instance.playerPositionsArray[_position] = 0xf6; + } + } + } - - -/* - 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 0x004285C0 -void Actions::RemovePositionOfPlayer(int playerID) - -{ -int iVar1; - -iVar1 = 0; -do { -if ((char)DAT_GameSynchronyState::instance.playerPositionsArray[iVar1] + 1 == playerID) { -/* - -10, make spot empty - */ - -DAT_GameSynchronyState::instance.playerPositionsArray[iVar1] = 0xf6; } -iVar1 = iVar1 + 1; -} while (iVar1 < 8); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp b/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp index a285da65..b7a00609 100644 --- a/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp +++ b/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp @@ -11,7 +11,6 @@ namespace Synchrony { // FUNCTION: STRONGHOLDCRUSADER 0x00429630 void Commands::QueueChangeGameIntensityOrBalance() - { MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( OpenSHC::Commands::GCT_CHANGE_GAME_INTENSITY_OR_BALANCE); diff --git a/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp b/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp index 09d39171..b01bbc8e 100644 --- a/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp +++ b/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp @@ -1,33 +1,19 @@ #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.hpp" - - - - namespace OpenSHC { namespace Text { -using OpenSHC::DE::SHCDE::eTextSections; - + using OpenSHC::DE::SHCDE::eTextSections; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004246B0 + int TextManager::computeTextWidthForTextGroup(eTextSections textOffsetIndex, int textNumInGroup, int fontSize) + { + return MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::computeTextWidth, this)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, this)( + textOffsetIndex, textNumInGroup), + fontSize); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004246B0 -int TextManager::computeTextWidthForTextGroup(eTextSections textOffsetIndex,int textNumInGroup,int fontSize) - -{ -char *text; -int _width; - -text = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, this)(textOffsetIndex, textNumInGroup); -_width = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::computeTextWidth, this)(text, fontSize); -return _width; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderInGameText.cpp b/src/OpenSHC/Text/TextManager/renderInGameText.cpp index 7e95ff56..ca79f008 100644 --- a/src/OpenSHC/Text/TextManager/renderInGameText.cpp +++ b/src/OpenSHC/Text/TextManager/renderInGameText.cpp @@ -2,31 +2,19 @@ #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Text { -using OpenSHC::Text::TextAlignment; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00424320 + void TextManager::renderInGameText(char* textAddress, int xParam, int yParam, TextAlignment alignment, uint color1, + uint color2, int fontSize, BOOLEnum keepOffsetX) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, this)( + textAddress, xParam, yParam, alignment, color1, color2, fontSize, keepOffsetX, 0); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00424320 -void TextManager::renderInGameText(char *textAddress,int xParam,int yParam,TextAlignment alignment,uint color1,uint color2,int fontSize,BOOLEnum keepOffsetX) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, this)(textAddress, xParam, yParam, alignment, color1, color2, fontSize, -keepOffsetX, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp b/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp index 2047a7bf..254beec1 100644 --- a/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp +++ b/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp @@ -2,30 +2,19 @@ #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Text { -using OpenSHC::Text::TextAlignment; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00424650 + void TextManager::renderLeftAlignedNumberToScreen( + int number, int xParam, int yParam, uint color, int fontSize, BOOL keepOffsetX) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, this)( + number, xParam, yParam, OpenSHC::Text::TTA_LEFT, color, fontSize, (BOOLEnum)((int)(keepOffsetX)), 0); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00424650 -void TextManager::renderLeftAlignedNumberToScreen(int number,int xParam,int yParam,uint color,int fontSize,BOOL keepOffsetX) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, this)(number, xParam, yParam, OpenSHC::Text::TTA_LEFT, color, fontSize, (BOOLEnum)((int)(keepOffsetX)), 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderNumber.cpp b/src/OpenSHC/Text/TextManager/renderNumber.cpp index dc0f248d..79f7e475 100644 --- a/src/OpenSHC/Text/TextManager/renderNumber.cpp +++ b/src/OpenSHC/Text/TextManager/renderNumber.cpp @@ -1,32 +1,20 @@ #include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Text/TextAlignment.hpp" - - - - +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Text { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::Text::TextAlignment; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00424620 + void TextManager::renderNumber( + int number, int xPosition, int yPosition, uint color1, uint color2, int fontSize, BOOLEnum keepOffsetX) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, this)( + number, xPosition, yPosition, OpenSHC::Text::TTA_LEFT, color1, color2, fontSize, keepOffsetX, 0); + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00424620 -void TextManager::renderNumber(int number,int xPosition,int yPosition,uint color1,uint color2,int fontSize,BOOLEnum keepOffsetX) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, this)(number, xPosition, yPosition, OpenSHC::Text::TTA_LEFT, color1, color2, fontSize, -keepOffsetX, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp b/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp index 0b56783e..1549229c 100644 --- a/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp +++ b/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp @@ -2,30 +2,19 @@ #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Text { -using OpenSHC::Text::TextAlignment; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00424680 + void TextManager::renderNumberToScreen( + int number, int xParam, int yParam, TextAlignment alignment, uint color, int fontSize, BOOLEnum keepOffsetX) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, this)( + number, xParam, yParam, alignment, color, fontSize, keepOffsetX, 0); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00424680 -void TextManager::renderNumberToScreen(int number,int xParam,int yParam,TextAlignment alignment,uint color,int fontSize,BOOLEnum keepOffsetX) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumberToScreen2, this)(number, xParam, yParam, alignment, color, fontSize, keepOffsetX, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp b/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp index c90ec8ab..8ca4e4e2 100644 --- a/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp +++ b/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp @@ -1,34 +1,22 @@ #include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Text { -using OpenSHC::Text::TextAlignment; -using OpenSHC::Rendering::Colors::BGR24; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00424360 + void TextManager::renderTextToScreen2(char* textAddress, int xParam, int yParam, TextAlignment alignment, + BGR24 color, int fontSize, BOOLEnum keepOffsetX) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, this)( + textAddress, xParam, yParam, alignment, color, fontSize, keepOffsetX, 0); + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00424360 -void TextManager::renderTextToScreen2(char *textAddress,int xParam,int yParam,TextAlignment alignment,BGR24 color,int fontSize,BOOLEnum keepOffsetX) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, this)(textAddress, xParam, yParam, alignment, color, fontSize, -keepOffsetX, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp b/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp index ba7ec7e6..ea6078cc 100644 --- a/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp +++ b/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp @@ -1,36 +1,28 @@ #include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" - - +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::UI::Enums::MenuModalType; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00427210 + BOOLEnum Helpers::AModalDialogIsActiveButIsNotQuitting() + { + if ((((DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_NONE) + && (DAT_MenuModalComposition1::instance.activeModalDialogID + != OpenSHC::UI::Enums::MMT_BASIC_AI_LORD_SELECT)) + && (DAT_MenuModalComposition1::instance.activeModalDialogID + != OpenSHC::UI::Enums::MMT_EXTENDED_AI_LORD_SELECT)) + && (DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_ROUNDTABLE)) { + return TRUE; + } + return FALSE; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00427210 -BOOLEnum Helpers::AModalDialogIsActiveButIsNotQuitting() - -{ -if ((((DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_NONE) && -(DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_BASIC_AI_LORD_SELECT)) && -(DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_EXTENDED_AI_LORD_SELECT)) && -(DAT_MenuModalComposition1::instance.activeModalDialogID != OpenSHC::UI::Enums::MMT_ROUNDTABLE)) { -return TRUE; -} -return FALSE; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp index c7acec02..4f343b3f 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp @@ -8,13 +8,8 @@ namespace OpenSHC { using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x0042C060 void UI::MenuItemRenderFunction_SelectCrusade_Main(int param_1, ...) - { if (param_1 == -1) { DAT_HighlightedSkirmishType::instance = 0; @@ -24,7 +19,6 @@ void UI::MenuItemRenderFunction_SelectCrusade_Main(int param_1, ...) } MACRO_CALL( OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - return; } } diff --git a/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp b/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp index 1c194134..de2b0011 100644 --- a/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp +++ b/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp @@ -1,32 +1,20 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - -#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004271E0 void UI::MenuView_General_DoEveryFrame_FirstGfxCentered() - { -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, DAT_TextureRenderCoreObject::ptr)(0, -(DAT_WindowAndDirectDraw::instance.resolutionX - -DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) / 2, -(DAT_WindowAndDirectDraw::instance.resolutionY - -DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) / 2); -return; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, DAT_TextureRenderCoreObject::ptr)(0, + (DAT_WindowAndDirectDraw::instance.resolutionX - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2, + (DAT_WindowAndDirectDraw::instance.resolutionY - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp b/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp index 8e715899..e379d80b 100644 --- a/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp +++ b/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp @@ -1,39 +1,20 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/string-literals.hpp" - - -#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" namespace OpenSHC { - - - -/* - 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 0x0042BB70 void UI::MenuView_General_Prepare_SwordShieldAndBorder() - { -DAT_GameSynchronyState::instance.field225_0x106ee4 = 0; -DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_combat3.tgx"); -MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); -return; + DAT_GameSynchronyState::instance.field225_0x106ee4 = 0; + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)( + s_frontend_combat3_tgx_005a2134); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp b/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp index ca4f531c..32bd5156 100644 --- a/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp @@ -1,29 +1,18 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0042F3D0 void UI::MenuView_NewMapMapsize_Prepare() - { -DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_builder2.tgx"); -MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); -return; + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)( + s_frontend_builder2_tgx_005a206c); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp b/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp index 67cfeaa4..dd262f73 100644 --- a/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp @@ -1,31 +1,20 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0042EFE0 void UI::MenuView_NewMapMaptype_Prepare() - { -DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_builder.tgx"); -MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); -DAT_GameCore::instance.mapU3EndInt = 0; -return; + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)( + s_frontend_builder_tgx_005a2084); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); + DAT_GameCore::instance.mapU3EndInt = 0; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp index 868e1288..3291b8dd 100644 --- a/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp @@ -1,30 +1,17 @@ #include "OpenSHC/UI.func.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0042FAA0 void UI::MenuView_UnusedChooseAvailableKeeps_Prepare() - { -DAT_GameCore::instance.mapU2MiddleBytes[0] = 1; -DAT_GameCore::instance.mapU2MiddleBytes[1] = 1; -DAT_GameCore::instance.mapU2MiddleBytes[2] = 1; -DAT_GameCore::instance.mapU2MiddleBytes[3] = 1; -DAT_GameCore::instance.mapU2MiddleBytes[4] = 1; -return; + DAT_GameCore::instance.mapU2MiddleBytes[0] = 1; + DAT_GameCore::instance.mapU2MiddleBytes[1] = 1; + DAT_GameCore::instance.mapU2MiddleBytes[2] = 1; + DAT_GameCore::instance.mapU2MiddleBytes[3] = 1; + DAT_GameCore::instance.mapU2MiddleBytes[4] = 1; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp index b07443cf..1b5b5c72 100644 --- a/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp +++ b/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp @@ -1,33 +1,22 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - -#include "OpenSHC/Globals/INT_00b960e0.hpp" -#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/INT_00b960e0.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004266A0 void UI::MenuView_UnusedDemoBuyItScreen_DoEveryFrame() - { -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, DAT_TextureRenderCoreObject::ptr)(0, -(DAT_WindowAndDirectDraw::instance.resolutionX - -DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) / 2 + INT_00b960e0::instance, -(DAT_WindowAndDirectDraw::instance.resolutionY - -DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) / 2); -return; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, DAT_TextureRenderCoreObject::ptr)(0, + (DAT_WindowAndDirectDraw::instance.resolutionX - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2 + + INT_00b960e0::instance, + (DAT_WindowAndDirectDraw::instance.resolutionY - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp index 2caf1aa4..61fd61ee 100644 --- a/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp @@ -1,8 +1,7 @@ #include "OpenSHC/UI.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" @@ -11,23 +10,16 @@ namespace OpenSHC { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00426F80 void UI::MenuView_UnusedSomeMissionStartUnk_Prepare() - { -DAT_GameCore::instance.currentlyInGameUnk_0xa4 = FALSE; -DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("multi_background.tgx"); -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("gm_fly.tgx"); -MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); -return; + DAT_GameCore::instance.currentlyInGameUnk_0xa4 = FALSE; + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)( + s_multi_background_tgx_005a211c); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)( + s_gm_fly_tgx_005a2110); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); } - -} \ No newline at end of file +} From 6a5bead070b0391b4be8b51b66ce06abe4d7c58b Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 17:43:35 +0200 Subject: [PATCH 34/61] reimplement: SHC_3BB0A8C1_0x00439390 100% --- ...n_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp index aa1185eb..b88c8c51 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp @@ -5,19 +5,14 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00439390 void UI::MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper(int param_1, ...) - { if ((DAT_UnitsState::instance.nHasOwnedUnitInSelection == 0) - || (DAT_ButtonUnknownZero::instance = 0, DAT_UnitsState::instance.selectionSlots[param_1 + -0x14] == -1)) { + || (DAT_ButtonUnknownZero::instance = 0, + ((int*)(&DAT_UnitsState::instance.selectionEngineers))[param_1] == -1)) { DAT_ButtonUnknownZero::instance = 1; } - return; } } From c280e0d69c46dbd709249f67bfeae976ab7b1f0a Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 17:51:49 +0200 Subject: [PATCH 35/61] reimplement: SHC_3BB0A8C1_0x00424770 100% --- .../UI/MenuView_IntroLogos_DoInitial.cpp | 11 ++++--- .../MenuView_UnusedHelpTextEditor_Prepare.cpp | 33 +++++++------------ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp index b60fee46..9c3d7902 100644 --- a/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp +++ b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp @@ -12,10 +12,13 @@ using OpenSHC::UI::Menu; // FUNCTION: STRONGHOLDCRUSADER 0x00424770 void UI::MenuView_IntroLogos_DoInitial() { - DAT_MenuHandlerState::instance.y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; - DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; - DAT_MenuHandlerState::instance.currentMenu->yPosition = DAT_MenuHandlerState::instance.y; - DAT_MenuHandlerState::instance.currentMenu->xPosition = DAT_MenuHandlerState::instance.x; + int y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + int x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + Menu* pMVar1 = DAT_MenuHandlerState::instance.currentMenu; + pMVar1->xPosition = x; + pMVar1->yPosition = y; + DAT_MenuHandlerState::instance.x = x; + DAT_MenuHandlerState::instance.y = y; DAT_IntroTimestamp::instance = timeGetTime(); } diff --git a/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp index d1e9bdfc..0bb3c633 100644 --- a/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp @@ -1,37 +1,26 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Menu.hpp" -#include "OpenSHC/Text/TextEditorState.func.hpp" - - #include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" -#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" #include "OpenSHC/Globals/DAT_TextEditorState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" namespace OpenSHC { using OpenSHC::UI::Menu; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004403D0 void UI::MenuView_UnusedHelpTextEditor_Prepare() - { -Menu *pMVar1; - -DAT_MenuHandlerState::instance.y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; -DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; -pMVar1 = DAT_MenuHandlerState::instance.currentMenu; -(DAT_MenuHandlerState::instance.currentMenu)->xPosition = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; -pMVar1->yPosition = DAT_MenuHandlerState::instance.y; -MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::bltTextToScreenIfNeedBe, DAT_TextEditorState::ptr)(); -return; + int y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + int x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + Menu* pMVar1 = DAT_MenuHandlerState::instance.currentMenu; + pMVar1->xPosition = x; + pMVar1->yPosition = y; + DAT_MenuHandlerState::instance.y = y; + DAT_MenuHandlerState::instance.x = x; + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::bltTextToScreenIfNeedBe, DAT_TextEditorState::ptr)(); } - -} \ No newline at end of file +} From 1f1e7d2bf5339f925d70c9e5c643d0765ba95891 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 18:06:48 +0200 Subject: [PATCH 36/61] reimplement: SHC_3BB0A8C1_0x004549C0 100% different register allocation --- ...eckIfGfxTgxStartsWithTransparentPixels.cpp | 21 ++++--------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp index 6ac177c7..12eaed2c 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp @@ -1,10 +1,3 @@ -// ============================================================================ -// Program : Stronghold Crusader.exe -// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore -// Function : checkIfGfxTgxStartsWithTransparentPixels -// Address : 004549c0 -// Signature : BOOLEnum __thiscall checkIfGfxTgxStartsWithTransparentPixels(TextureRenderCore * this, int gfxIndex) -// ============================================================================ #include "OpenSHC/IO/Graphics/GfxRef.hpp" #include "OpenSHC/IO/Graphics/TgxToken.hpp" @@ -16,19 +9,13 @@ namespace OpenSHC { namespace UI { namespace Rendering { - /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ // FUNCTION: STRONGHOLDCRUSADER 0x004549C0 BOOLEnum TextureRenderCore::checkIfGfxTgxStartsWithTransparentPixels(int gfxIndex) - { - // Match: 40% - Best achievable with current compiler - // Differences in register allocation (original uses edx/dl, recomp uses eax/cl) - // Disabling optimizations produces worse match (21.4%) due to frame pointer overhead - int index = gfxIndex; - GfxRef& ref = this->loadedGfxArray[index]; - return (uint)((*(byte*)(ref.offsetInBuffer + 8 + (int)this->gmAndGfxImageDataBuffer) - & OpenSHC::IO::Graphics::TT_TGX_PIXEL_HEADER) - == OpenSHC::IO::Graphics::TT_TRANSPARENT_PIXELS); + // fixme: compiler picks different registers + return (*(byte*)(this->loadedGfxArray[gfxIndex].offsetInBuffer + 8 + (int)this->gmAndGfxImageDataBuffer) + & OpenSHC::IO::Graphics::TT_TGX_PIXEL_HEADER) + == OpenSHC::IO::Graphics::TT_TRANSPARENT_PIXELS; } } diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 17dddcd3..45dadcfd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -16987,7 +16987,7 @@ SHC_3BB0A8C1_0x00454960 | 0.0% | Pending SHC_3BB0A8C1_0x00454990 | 0.0% | Pending -SHC_3BB0A8C1_0x004549C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004549C0 | 100.0% | Different register allocation SHC_3BB0A8C1_0x004549F0 | 0.0% | Pending From c4d42cf0e53d6ada2ded825159c2c203f9cbcf2c Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 18:37:59 +0200 Subject: [PATCH 37/61] progress --- .../activateTraderState.cpp | 2 +- .../calculateTaxBribeExpenseForPlayer.cpp | 36 ++++---------- .../GameStateStructures/clearTribeHotKey.cpp | 41 +++++----------- .../destroyPlayerCompletely.cpp | 46 ++++++----------- .../Game/GameStateStructures/fillWith0xFF.cpp | 49 ++++++------------- .../findNextPlayerWithMarketplace.cpp | 25 +++------- .../Game/GameStateStructures/getBuyPrice.cpp | 26 +++------- .../getBuyPriceForOneUnit.cpp | 26 +++------- .../getNumberToDisplayBribeIncome.cpp | 39 +++++---------- .../getNumberToDisplayPlayerTaxIncome.cpp | 39 +++++---------- .../getSalePriceOfGood.cpp | 27 +++------- .../GameStateStructures/getSalesPrice.cpp | 37 +++----------- .../Game/GameStateStructures/getSellPrice.cpp | 26 +++------- .../GameStateStructures/getTeamsDifferent.cpp | 34 +++++-------- .../isFullIDEqualsToMinus1.cpp | 3 +- .../isResourceTypeTradeable.cpp | 37 +++++--------- ...tSomethingBuildingRelatedForAllPlayers.cpp | 43 +++++----------- .../switchPlayerOwnership.cpp | 41 +++++----------- .../Map/Version/UpdateUnitLossData.cpp | 11 +---- .../IfAiGreatestLordGetAiType.cpp | 42 +++++----------- .../UI/Helpers/SetTaxesSetting_unknown.cpp | 33 +++++-------- ...r_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp | 13 +---- ...BuildingAndStatusMenu_ArmySwitchButton.cpp | 23 ++------- ...Menu_StopBuildingOrPeasantBinkPlayback.cpp | 28 +++-------- ...nHandler_InGameMenu_UnknownBinkRelated.cpp | 10 ---- ...uildMenu_BuildingKeepSubcategoryButton.cpp | 6 --- ...ngAndStatusMenu_BuildingHelpTextButton.cpp | 7 --- ...dStatusMenu_PopularityMenuSwitchButton.cpp | 6 --- .../MenuView_MapEditorLandscaping_Prepare.cpp | 21 +++----- .../CheckGfxResourceExists.cpp | 18 +++---- ...eMapSurfaceHeightRangeFromTemporaryUnk.cpp | 2 +- .../setMapSurfaceHeightRange.cpp | 2 +- .../TextureRenderCore/setRenderingRect.cpp | 46 +++++------------ .../setRenderingRectToGameResolution.cpp | 39 +++++---------- .../temporarySaveMapSurfaceHeightRangeUnk.cpp | 3 +- .../transformTgxCompressedImageToRGB565.cpp | 16 ++---- .../transformUncompressedImageToRGB565.cpp | 14 ++---- ...UncompressedImageWithMarkerUnkToRGB565.cpp | 12 +---- 38 files changed, 253 insertions(+), 676 deletions(-) diff --git a/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp b/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp index 73a785d7..b5d60d31 100644 --- a/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp +++ b/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { diff --git a/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp b/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp index a3e478b3..2c0b4bd8 100644 --- a/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp +++ b/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp @@ -1,33 +1,17 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x00459140 + int GameStateStructures::calculateTaxBribeExpenseForPlayer(int playerIndex, int taxStep, int currentPopulation) + { + int _taxIncome = ((5 - taxStep) * currentPopulation) / 2; + if (this->playerDataArray[playerIndex].currentResources[0xf] <= 0) { + _taxIncome = 0; + } + return _taxIncome; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00459140 -int GameStateStructures::calculateTaxBribeExpenseForPlayer(int playerIndex,int taxStep,int currentPopulation) - -{ -int _taxIncome; - -_taxIncome = ((5 - taxStep) * currentPopulation) / 2; -if (this->playerDataArray[playerIndex].currentResources[0xf] < 1) { -_taxIncome = 0; } -return _taxIncome; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp b/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp index 909d8f8d..88683c04 100644 --- a/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp +++ b/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp @@ -1,39 +1,20 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/Game/State/UnitSelectionHotKeyEntry.hpp" - - - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/Game/State/UnitSelectionHotKeyEntry.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::Game::State::UnitSelectionHotKeyEntry; - + using OpenSHC::Game::State::UnitSelectionHotKeyEntry; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00459BB0 + void GameStateStructures::clearTribeHotKey(int hotkeyID) + { + for (int iVar2 = 0; iVar2 < 2500; iVar2++) { + this->hotkeyTribes[hotkeyID].units[iVar2].id = -1; + this->hotkeyTribes[hotkeyID].units[iVar2].uid = -1; + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00459BB0 -void GameStateStructures::clearTribeHotKey(int hotkeyID) - -{ -UnitSelectionHotKeyEntry *pUVar1; -int iVar2; - -pUVar1 = this->hotkeyTribes + hotkeyID; -iVar2 = 2500; -do { -pUVar1->units[0].id = -1; -pUVar1->units[0].uid = -1; -pUVar1 = (UnitSelectionHotKeyEntry *)(pUVar1->units + 1); -iVar2 = iVar2 + -1; -} while (iVar2 != 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp b/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp index 0a7f3da3..2087fbaa 100644 --- a/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp +++ b/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp @@ -1,42 +1,28 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../GameStateStructures.func.hpp" + #include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" -#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Map/Entities/EntityState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" -#include "OpenSHC/Globals/DAT_TileMapState.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_EntityState.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x00457B40 + void GameStateStructures::destroyPlayerCompletely(int playerID) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::killUnits, DAT_UnitsState::ptr)(playerID); + MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::destroyBuildings, DAT_BuildingsState::ptr)( + playerID); + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::destroyWallsOfPlayer, DAT_TileMapState::ptr)(playerID); + MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::destroyEntitiesPart2, DAT_EntityState::ptr)( + playerID); + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00457B40 -void GameStateStructures::destroyPlayerCompletely(int playerID) - -{ -MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::killUnits, DAT_UnitsState::ptr)(playerID); -MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::destroyBuildings, DAT_BuildingsState::ptr)(playerID); -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::destroyWallsOfPlayer, DAT_TileMapState::ptr)(playerID); -MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::destroyEntitiesPart2, DAT_EntityState::ptr)(playerID); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp b/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp index 0bfa70ef..2948e601 100644 --- a/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp +++ b/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp @@ -1,44 +1,23 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/Game/GameStateStructures.hpp" - - - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/Game/GameStateStructures.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::Game::GameStateStructures; - + using OpenSHC::Game::GameStateStructures; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00459BE0 + void GameStateStructures::fillWith0xFF() + { + // fixme: This could have just been a memset(-1) to the whole region + for (int hotkeyEntry = 0; hotkeyEntry < 10; hotkeyEntry++) { + for (int iVar2 = 0; iVar2 < 2500; iVar2++) { + this->hotkeyTribes[hotkeyEntry].units[iVar2].id = -1; + this->hotkeyTribes[hotkeyEntry].units[iVar2].uid = -1; + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00459BE0 -void GameStateStructures::fillWith0xFF() - -{ -GameStateStructures *pGVar1; -int iVar2; -int iVar3; - -pGVar1 = this; -iVar3 = 10; -do { -iVar2 = 0x9c4; -do { -pGVar1->hotkeyTribes[0].units[0].id = -1; -pGVar1->hotkeyTribes[0].units[0].uid = -1; -pGVar1 = (GameStateStructures *)(pGVar1->hotkeyTribes[0].units + 1); -iVar2 = iVar2 + -1; -} while (iVar2 != 0); -iVar3 = iVar3 + -1; -} while (iVar3 != 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp b/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp index 6d78973e..dc163282 100644 --- a/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp +++ b/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "../GameStateStructures.func.hpp" + #include "OpenSHC/Game/Player/PlayerData.hpp" namespace OpenSHC { @@ -6,27 +7,13 @@ namespace Game { using OpenSHC::Game::Player::PlayerData; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00458700 int GameStateStructures::findNextPlayerWithMarketplace(int param_1) - { - int iVar1; - PlayerData* piVar2; - - iVar1 = param_1 + 1; - if (iVar1 < 9) { - piVar2 = &this->playerDataArray[param_1 + 1]; - do { - if (0 < piVar2->marketplace.id) { - return iVar1; - } - iVar1 = iVar1 + 1; - piVar2 = (PlayerData*)((int)(piVar2 + 0x172) + 0x24); - } while (iVar1 < 9); + for (int iVar1 = param_1 + 1; iVar1 < 9; iVar1++) { + if (0 < this->playerDataArray[iVar1].marketplace.id) { + return iVar1; + } } return 0; } diff --git a/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp index cfbdc52a..4fc13374 100644 --- a/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp @@ -1,27 +1,13 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x004588A0 + int GameStateStructures::getBuyPrice(undefined4 playerID, int resourceType, int amount) + { + return (this->mapAndTime.buyAndSalesPriceArray[resourceType].buyPrice / 5) * amount; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004588A0 -int GameStateStructures::getBuyPrice(undefined4 playerID,int resourceType,int amount) - -{ -return (this->mapAndTime.buyAndSalesPriceArray[resourceType].buyPrice / 5) * amount; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp b/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp index 2aeccd7a..1b141009 100644 --- a/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp @@ -1,27 +1,13 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x004588D0 + int GameStateStructures::getBuyPriceForOneUnit(int param_1) + { + return this->mapAndTime.buyAndSalesPriceArray[param_1].buyPrice / 5; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004588D0 -int GameStateStructures::getBuyPriceForOneUnit(int param_1) - -{ -return this->mapAndTime.buyAndSalesPriceArray[param_1].buyPrice / 5; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp index 537e1332..93c881c5 100644 --- a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp @@ -1,34 +1,19 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x004591B0 + int GameStateStructures::getNumberToDisplayBribeIncome(int playerIndex, int taxStep, int currentPopulation) + { + int iVar1 = 0; + if (taxStep < 3) { + iVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::calculateTaxBribeExpenseForPlayer, this)( + playerIndex, taxStep, currentPopulation); + iVar1 = iVar1 * 4; + } + return iVar1 / 10; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004591B0 -int GameStateStructures::getNumberToDisplayBribeIncome(int playerIndex,int taxStep,int currentPopulation) - -{ -int iVar1; - -iVar1 = 0; -if (taxStep < 3) { -iVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::calculateTaxBribeExpenseForPlayer, this)(playerIndex, taxStep, currentPopulation); -iVar1 = iVar1 * 4; } -return iVar1 / 10; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp index 6d8aef8a..2fffb57e 100644 --- a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp @@ -1,34 +1,19 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x00459170 + int GameStateStructures::getNumberToDisplayPlayerTaxIncome(int playerIndex, int taxStep, int currentPopulation) + { + int iVar1 = 0; + if (3 < taxStep) { + iVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::calculateTaxIncomeForPlayer, this)( + playerIndex, taxStep, currentPopulation); + iVar1 = iVar1 * 4; + } + return iVar1 / 10; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00459170 -int GameStateStructures::getNumberToDisplayPlayerTaxIncome(int playerIndex,int taxStep,int currentPopulation) - -{ -int iVar1; - -iVar1 = 0; -if (3 < taxStep) { -iVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::calculateTaxIncomeForPlayer, this)(playerIndex, taxStep, currentPopulation); -iVar1 = iVar1 * 4; } -return iVar1 / 10; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp b/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp index 45128d71..3d06ffbb 100644 --- a/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp @@ -1,28 +1,17 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/Game/Resources/ResourceType.hpp" - - - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::Game::Resources::ResourceType; + using OpenSHC::Game::Resources::ResourceType; + // FUNCTION: STRONGHOLDCRUSADER 0x004588F0 + int GameStateStructures::getSalePriceOfGood(ResourceType param_1) + { + return this->mapAndTime.buyAndSalesPriceArray[param_1].salesPrice / 5; + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004588F0 -int GameStateStructures::getSalePriceOfGood(ResourceType param_1) - -{ -return this->mapAndTime.buyAndSalesPriceArray[param_1].salesPrice / 5; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp index 236b2055..9ffd6215 100644 --- a/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp @@ -1,36 +1,15 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x0045B7F0 + int GameStateStructures::getSalesPrice(int playerID, int resourceType) + { + return (this->mapAndTime.buyAndSalesPriceArray[resourceType].salesPrice / 5) + * MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::getSellResourceAmount, this)( + playerID, resourceType); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045B7F0 -int GameStateStructures::getSalesPrice(int playerID,int resourceType) - -{ -int _sellAmountUnk; - -_sellAmountUnk = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::getSellResourceAmount, this)(playerID, resourceType); -/* - Actually the same as "this", but the compiler used that EDX is not dirtied. - The decompilation assumes this sadly. --TheRedDaemon - */ - -return (this->mapAndTime.buyAndSalesPriceArray[resourceType].salesPrice / 5) * -_sellAmountUnk; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp index 562e23a0..c823f1ed 100644 --- a/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp @@ -1,27 +1,13 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x00458910 + int GameStateStructures::getSellPrice(int playerID, int resourceType, int amount) + { + return (this->mapAndTime.buyAndSalesPriceArray[resourceType].salesPrice / 5) * amount; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00458910 -int GameStateStructures::getSellPrice(int playerID,int resourceType,int amount) - -{ -return (this->mapAndTime.buyAndSalesPriceArray[resourceType].salesPrice / 5) * amount; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp b/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp index 887c06d4..e7d0eac3 100644 --- a/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp @@ -1,32 +1,20 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004596D0 + BOOLEnum GameStateStructures::getTeamsDifferent(int firstPlayerId, int secondPlayerId) + { + if ((firstPlayerId != 0) && (secondPlayerId != 0)) { + return this->mapAndTime.playerTeams[firstPlayerId] != this->mapAndTime.playerTeams[secondPlayerId]; + } + return FALSE; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004596D0 -BOOLEnum GameStateStructures::getTeamsDifferent(int firstPlayerId,int secondPlayerId) - -{ -if ((firstPlayerId != 0) && (secondPlayerId != 0)) { -return (uint)(this->mapAndTime.playerTeams[firstPlayerId] != -this->mapAndTime.playerTeams[secondPlayerId]); -} -return FALSE; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp b/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp index 414a85c0..967b56e2 100644 --- a/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp +++ b/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "../GameStateStructures.func.hpp" + #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" diff --git a/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp b/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp index ff4ed17c..606cd3d2 100644 --- a/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp +++ b/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp @@ -1,33 +1,22 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" -#include "OpenSHC/Game/Resources/ResourceType.hpp" - - - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::Game::Resources::ResourceType; + using OpenSHC::Game::Resources::ResourceType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00458740 + BOOLEnum GameStateStructures::isResourceTypeTradeable(ResourceType resourceType) + { + if (resourceType == OpenSHC::Game::Resources::RT_PITCH) { + resourceType = OpenSHC::Game::Resources::RT_PARTIALPITCH; + } + return this->mapAndTime.isResourceTradeable[resourceType] != 0; + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00458740 -BOOLEnum GameStateStructures::isResourceTypeTradeable(ResourceType resourceType) - -{ -if (resourceType == OpenSHC::Game::Resources::RT_PITCH) { -resourceType = OpenSHC::Game::Resources::RT_PARTIALPITCH; } -return (uint)(this->mapAndTime.isResourceTradeable[resourceType] != 0); -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp b/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp index def7a048..84106d9c 100644 --- a/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp +++ b/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp @@ -1,39 +1,18 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x0045AF00 + void GameStateStructures::resetSomethingBuildingRelatedForAllPlayers() + { + for (int playerID = 1; playerID < 9; playerID++) { + for (int iVar1 = 0; iVar1 < 20; iVar1++) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::validateBuildingCategoryReference, this)( + playerID, iVar1); + } + } + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045AF00 -void GameStateStructures::resetSomethingBuildingRelatedForAllPlayers() - -{ -int iVar1; -int playerID; - -playerID = 1; -do { -iVar1 = 0; -do { -MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::validateBuildingCategoryReference, this)(playerID, iVar1); -iVar1 = iVar1 + 1; -} while (iVar1 < 0x14); -playerID = playerID + 1; -} while (playerID < 9); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp b/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp index c45857c6..5f57f695 100644 --- a/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp +++ b/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp @@ -1,38 +1,23 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" -#include "OpenSHC/AI/AICState.func.hpp" - +#include "../GameStateStructures.func.hpp" +#include "OpenSHC/AI/AICState.func.hpp" #include "OpenSHC/Globals/DAT_AICState.hpp" namespace OpenSHC { namespace Game { + // FUNCTION: STRONGHOLDCRUSADER 0x0045B460 + void GameStateStructures::switchPlayerOwnership(int playerID) + { + for (int fromPlayer = 1; fromPlayer < 9; fromPlayer++) { + if (fromPlayer != playerID) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::changePlayerOwnership, this)( + fromPlayer, playerID); + } + } + MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::recomputeAIZonerLayer, DAT_AICState::ptr)(); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045B460 -void GameStateStructures::switchPlayerOwnership(int playerID) - -{ -int fromPlayer; - -fromPlayer = 1; -do { -if (fromPlayer != playerID) { -MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::changePlayerOwnership, this)(fromPlayer, playerID); } -fromPlayer = fromPlayer + 1; -} while (fromPlayer < 9); -MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::recomputeAIZonerLayer, DAT_AICState::ptr)(); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp b/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp index a131fecc..7cc5c29e 100644 --- a/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp +++ b/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp @@ -5,19 +5,12 @@ namespace OpenSHC { namespace Map { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x0044AA80 - void __cdecl Version::UpdateUnitLossData(int lossValue, int playerID) - + void Version::UpdateUnitLossData(int lossValue, int playerID) { if (lossValue < 0) { - DAT_UnitValueLossesPerEnemyPlayer::instance[playerID] - = DAT_UnitValueLossesPerEnemyPlayer::instance[playerID] - lossValue; + DAT_UnitValueLossesPerEnemyPlayer::instance[playerID] -= lossValue; } - return; } } diff --git a/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp b/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp index f1b503d4..0605a841 100644 --- a/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp +++ b/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp @@ -1,44 +1,24 @@ #include "OpenSHC/UI/GreatestLord.func.hpp" #include "OpenSHC/AI/AIType.hpp" - - #include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::AI::AIType; - - -/* - 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 - */ + using OpenSHC::AI::AIType; + // FUNCTION: STRONGHOLDCRUSADER 0x0044B7D0 + int GreatestLord::IfAiGreatestLordGetAiType() + { + int _highestRankingPlayer = MACRO_CALL(OpenSHC::UI::GreatestLord_Func::GetPlayerAtRank)(0); + if ((_highestRankingPlayer != 0) + && (DAT_GameSynchronyState::instance.currentAIArray[_highestRankingPlayer] != 0)) { + return DAT_GameState::instance.playerDataArray[_highestRankingPlayer].aiType - 1; + } + return 0; + } -// FUNCTION: STRONGHOLDCRUSADER 0x0044B7D0 -int GreatestLord::IfAiGreatestLordGetAiType() - -{ -int _highestRankingPlayer; - -_highestRankingPlayer = MACRO_CALL(OpenSHC::UI::GreatestLord_Func::GetPlayerAtRank)(0); -if ((_highestRankingPlayer != 0) && -(DAT_GameSynchronyState::instance.currentAIArray[_highestRankingPlayer] != 0)) { -return(int)( DAT_GameState::instance.playerDataArray[_highestRankingPlayer].aiType + ~OpenSHC::AI::AIT_NULL); -} -return 0; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp b/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp index d118e274..7a510db6 100644 --- a/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp +++ b/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp @@ -1,34 +1,23 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00433560 + void Helpers::SetTaxesSetting_unknown(int taxesSettingUnk) + { + if (DAT_GameCore::instance.taxesSettingUnk == 0) { + DAT_GameCore::instance.taxesSettingUnk = taxesSettingUnk; + DAT_GameCore::instance.unknownScribeRelatedFlag_0x130 = TRUE; + DAT_GameCore::instance.taxestimeUnk = timeGetTime(); + DAT_GameCore::instance.scribeAnimationFrame2 = 0; + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x00433560 -void Helpers::SetTaxesSetting_unknown(int taxesSettingUnk) - -{ -if (DAT_GameCore::instance.taxesSettingUnk == 0) { -DAT_GameCore::instance.taxesSettingUnk = taxesSettingUnk; -DAT_GameCore::instance.unknownScribeRelatedFlag_0x130 = TRUE; -DAT_GameCore::instance.taxestimeUnk = timeGetTime(); -DAT_GameCore::instance.scribeAnimationFrame2 = 0; -} -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp index 520662b3..49038c2b 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp @@ -14,26 +14,17 @@ using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; using OpenSHC::UI::Enums::BuildMenuTabType; using OpenSHC::UI::Enums::MenuViewType; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00433200 void UI::MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk(int param_1, ...) - { - int iVar1; - if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == ((BuildMenuTabType)0x31)) { - iVar1 = MACRO_CALL_MEMBER( - OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, DAT_GameState::ptr)(); - if (0 < iVar1) { + if (0 < MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::singlePlayerHasKeepAndGranaryCheck, DAT_GameState::ptr)()) { DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_HUNTERSHUT; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_BUILD_MENU, 0); } } - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp index 3eaff47f..9aae65b8 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp @@ -1,29 +1,16 @@ #include "OpenSHC/UI.func.hpp" - - #include "OpenSHC/Globals/DAT_00b95b68.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0043FC80 void UI::MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton() - { -DAT_00b95b68::instance = DAT_00b95b68::instance + 1; -if (2 < DAT_00b95b68::instance) { -DAT_00b95b68::instance = 0; -} -return; + DAT_00b95b68::instance = DAT_00b95b68::instance + 1; + if (2 < DAT_00b95b68::instance) { + DAT_00b95b68::instance = 0; + } } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp index 050108ef..44ba9683 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp @@ -1,8 +1,6 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" #include "OpenSHC/UI.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" -#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" - - #include "OpenSHC/Globals/DAT_BinkControlState.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" @@ -11,26 +9,14 @@ namespace OpenSHC { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - -/* - WARNING: Enum "UnsortedBinkFlagInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00439890 void UI::MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback() - { -if (DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying != FALSE) { -DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying = FALSE; -MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, DAT_BinkControlState::ptr)(0); + if (DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying != FALSE) { + DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying = FALSE; + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, DAT_BinkControlState::ptr)( + 0); + } } -return; -} - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp b/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp index fec9d35e..e1d0c092 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp @@ -5,17 +5,8 @@ namespace OpenSHC { -/* - WARNING: Enum "UnsortedBinkFlagInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00433230 void UI::MenuItemActionHandler_InGameMenu_UnknownBinkRelated(int param_1, ...) - { if (DAT_GameCore::instance.isBinkVideoPlaying != 0) { if (DAT_BinkControlState::instance.binkObjPtrArray[1] == NULL) { @@ -23,7 +14,6 @@ void UI::MenuItemActionHandler_InGameMenu_UnknownBinkRelated(int param_1, ...) } DAT_GameCore::instance.countdown = 1; } - return; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp index 4d4c1665..ac5f7efd 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp @@ -8,13 +8,8 @@ namespace OpenSHC { using OpenSHC::Game::GameMode2; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00434230 void UI::MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton(int param_1, ...) - { if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_EDITOR) && (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { @@ -24,7 +19,6 @@ void UI::MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton(int para DAT_ButtonUnknownZero::instance = 0; MACRO_CALL( OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - return; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp index 3aadfe79..cbb1727b 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp @@ -9,13 +9,8 @@ namespace OpenSHC { using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x0043A880 void UI::MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton(int param_1, ...) - { DAT_ButtonUnknownZero::instance = 0; if ((DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) @@ -24,9 +19,7 @@ void UI::MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton(int } else if (DAT_BuildingsState::instance.field24_0x18e04c != 0) { MACRO_CALL(OpenSHC::UI_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - return; } - return; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp index da59152a..90fed05a 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp @@ -5,10 +5,6 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x0043F2C0 void UI::MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton(int param_1, ...) @@ -19,9 +15,7 @@ void UI::MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton } MACRO_CALL(OpenSHC::UI_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); - return; } - return; } } diff --git a/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp b/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp index 82160d5c..783d4eb3 100644 --- a/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp @@ -2,29 +2,20 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/UI/Enums/DisplayElementID.hpp" - - #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" namespace OpenSHC { using OpenSHC::UI::Enums::DisplayElementID; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00430CC0 void UI::MenuView_MapEditorLandscaping_Prepare() - { -DAT_WindowAndDirectDraw::instance.field37_0xdc = 1; -MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)(OpenSHC::UI::Enums::DEID_PEOPLE_LEFT_TO_PLACE, 0); -MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)(OpenSHC::UI::Enums::DEID_PLAYER_INFO_ON_HOVER, 1); -return; + DAT_WindowAndDirectDraw::instance.field37_0xdc = 1; + MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)( + OpenSHC::UI::Enums::DEID_PEOPLE_LEFT_TO_PLACE, 0); + MACRO_CALL(OpenSHC::UI::Helpers_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)( + OpenSHC::UI::Enums::DEID_PLAYER_INFO_ON_HOVER, 1); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp index c19c7a7c..36b666ba 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp @@ -1,5 +1,6 @@ +#include "../TextureRenderCore.func.hpp" + #include "OpenSHC/IO/ResourceManager.func.hpp" -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" #include "OpenSHC/IO/FileResourceType.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -12,21 +13,14 @@ namespace UI { using OpenSHC::IO::FileResourceType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004548D0 - BOOLEnum TextureRenderCore::CheckGfxResourceExists(char* param_1) - + BOOLEnum TextureRenderCore::checkGfxResourceExists(char* param_1) { - int iVar1; - MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::resolveResourceFileName, DAT_ResourceManager::ptr)( OpenSHC::IO::FRT_GFX, (char const*)((int)(param_1))); - iVar1 = MACRO_CALL_MEMBER( - OpenSHC::IO::ResourceManager_Func::getCurrentResourceSize, DAT_ResourceManager::ptr)(); - return (uint)(iVar1 != 0); + return MACRO_CALL_MEMBER( + OpenSHC::IO::ResourceManager_Func::getCurrentResourceSize, DAT_ResourceManager::ptr)() + != 0; } } diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp index 66de7746..c09122bc 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "../TextureRenderCore.func.hpp" namespace OpenSHC { namespace UI { diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp index 8fb4c0f5..323bf36c 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" +#include "../TextureRenderCore.func.hpp" namespace OpenSHC { namespace UI { diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp index 322e5744..fce1d8ae 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp @@ -1,38 +1,18 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - - - +#include "../TextureRenderCore.func.hpp" namespace OpenSHC { namespace UI { -namespace Rendering { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00454990 -void TextureRenderCore::setRenderingRect(int xPos,int yPos,int width,int heigth) - -{ -/* - Could also be, that this does not set the width and height, but the second x - and y positions. From-To, basically. --TheRedDaemon - */ - -this->renderingRect_16c854.left = xPos; -this->renderingRect_16c854.top = yPos; -this->renderingRect_16c854.right = width; -this->renderingRect_16c854.bottom = heigth; -return; -} - - + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00454990 + void TextureRenderCore::setRenderingRect(int xPos, int yPos, int width, int heigth) + { + this->renderingRect_16c854.left = xPos; + this->renderingRect_16c854.top = yPos; + this->renderingRect_16c854.right = width; + this->renderingRect_16c854.bottom = heigth; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp index 8b1cc5ca..10c88807 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp @@ -1,33 +1,20 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - +#include "../TextureRenderCore.func.hpp" #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" namespace OpenSHC { namespace UI { -namespace Rendering { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00454960 -void TextureRenderCore::setRenderingRectToGameResolution() - -{ -this->renderingRect_16c854.left = 0; -this->renderingRect_16c854.top = 0; -this->renderingRect_16c854.right = DAT_WindowAndDirectDraw::instance.resolutionX; -this->renderingRect_16c854.bottom = DAT_WindowAndDirectDraw::instance.resolutionY; -return; -} - - + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00454960 + void TextureRenderCore::setRenderingRectToGameResolution() + { + this->renderingRect_16c854.left = 0; + this->renderingRect_16c854.top = 0; + this->renderingRect_16c854.right = DAT_WindowAndDirectDraw::instance.resolutionX; + this->renderingRect_16c854.bottom = DAT_WindowAndDirectDraw::instance.resolutionY; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp index fc3fc6e2..067aefdc 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "../TextureRenderCore.func.hpp" namespace OpenSHC { namespace UI { @@ -6,7 +6,6 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x0044CCD0 void TextureRenderCore::temporarySaveMapSurfaceHeightRangeUnk() - { this->mapSurfaceRangeTemporaryUnk_0x16c864.start = this->mapGameSurfaceHeightRange.start; this->mapSurfaceRangeTemporaryUnk_0x16c864.end = this->mapGameSurfaceHeightRange.end; diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp index b45b277c..3000196a 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp @@ -1,12 +1,5 @@ -// ============================================================================ -// Program : Stronghold Crusader.exe -// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore -// Function : transformTgxCompressedImageToRGB565 -// Address : 00455270 -// Signature : void __thiscall transformTgxCompressedImageToRGB565(TextureRenderCore * this, int imageIndex) -// ============================================================================ -#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" +#include "../TextureRenderCore.func.hpp" #include "OpenSHC/Globals/DAT_GMImageOffsets.hpp" #include "OpenSHC/Globals/DAT_GMImageSizes.hpp" @@ -16,15 +9,12 @@ namespace OpenSHC { namespace UI { namespace Rendering { - /* decompilerscript: committed: 2025-01-30 21:57:43.216000 */ // FUNCTION: STRONGHOLDCRUSADER 0x00455270 void TextureRenderCore::transformTgxCompressedImageToRGB565(int imageIndex) - { - this->transformTgxFromRGB555ToRGB565( - (ushort*)(DAT_GMImageOffsets::instance[imageIndex] + (int)this->gmProcessedImageData), + MACRO_CALL_MEMBER(TextureRenderCore_Func::transformTgxFromRGB555ToRGB565, this)( + (ushort*)(&(((byte*)this->gmProcessedImageData)[DAT_GMImageOffsets::instance[imageIndex]])), DAT_GMImageSizes::instance[imageIndex]); - return; } } diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp index 4a7cc5c4..a2d6f218 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp @@ -1,12 +1,5 @@ -// ============================================================================ -// Program : Stronghold Crusader.exe -// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore -// Function : transformUncompressedImageToRGB565 -// Address : 004552e0 -// Signature : void __thiscall transformUncompressedImageToRGB565(TextureRenderCore * this, int imageIndex) -// ============================================================================ -#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" +#include "../TextureRenderCore.func.hpp" #include "OpenSHC/Globals/DAT_GMImageOffsets.hpp" #include "OpenSHC/Globals/DAT_GMImageSizes.hpp" @@ -17,10 +10,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004552e0 void TextureRenderCore::transformUncompressedImageToRGB565(int imageIndex) - { - transformRawToRGB555To565(DAT_GMImageOffsets::instance[imageIndex], DAT_GMImageSizes::instance[imageIndex]); - return; + MACRO_CALL_MEMBER(TextureRenderCore_Func::transformRawToRGB555To565, this)( + DAT_GMImageOffsets::instance[imageIndex], DAT_GMImageSizes::instance[imageIndex]); } } diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp index 447d9db4..d50600fa 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp @@ -1,12 +1,4 @@ -// ============================================================================ -// Program : Stronghold Crusader.exe -// Namespace : _HoldStrong::UI::Rendering::TextureRenderCore -// Function : transformUncompressedImageWithMarkerUnkToRGB565 -// Address : 00455250 -// Signature : void __thiscall transformUncompressedImageWithMarkerUnkToRGB565(TextureRenderCore * this, int imageIndex) -// ============================================================================ - -#include "OpenSHC/UI/Rendering/TextureRenderCore.hpp" +#include "../TextureRenderCore.func.hpp" #include "OpenSHC/Globals/DAT_GMImageOffsets.hpp" #include "OpenSHC/Globals/DAT_GMImageSizes.hpp" @@ -18,7 +10,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x00455250 void TextureRenderCore::transformUncompressedImageWithMarkerUnkToRGB565(int imageIndex) { - transformRawWithMarkerUnkToRGB555To565( + MACRO_CALL_MEMBER(TextureRenderCore_Func::transformRawWithMarkerUnkToRGB555To565, this)( DAT_GMImageOffsets::instance[imageIndex], DAT_GMImageSizes::instance[imageIndex]); } From 983fe9f744972cb571fb3cb6564bcb67482119d4 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 21:22:15 +0200 Subject: [PATCH 38/61] reimplement: SHC_3BB0A8C1_0x0045D060 100% --- src/OpenSHC/Global/PrintToDestination.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/OpenSHC/Global/PrintToDestination.cpp b/src/OpenSHC/Global/PrintToDestination.cpp index 005ab6a1..b8e97a0b 100644 --- a/src/OpenSHC/Global/PrintToDestination.cpp +++ b/src/OpenSHC/Global/PrintToDestination.cpp @@ -6,8 +6,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0045D060 void Global::PrintToDestination(wchar_t* destination, wchar_t* format, ...) { - // fixme: The calls that call PrintToDestination() use 2, 3, or 4 arguments, but the original assembly - // always uses add esp, 0xc suggesting three parameters. Currently this optimizes to a jump directly. va_list args; va_start(args, format); MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, format, args); From f5c4e152989dde94d5461c4a780627be1cb01a1b Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 22:19:50 +0200 Subject: [PATCH 39/61] progress --- .../GameStateStructures/getBatchBuyPrice.cpp | 2 +- .../GameStateStructures/resetTraderState.cpp | 31 +++---- ...lyVersionUpgradeAccessibilityRecompute.cpp | 3 +- .../getBuildingStorageTypeForResourceType.cpp | 3 +- .../Map/TileMapState/clearMoatData.cpp | 41 ++++----- .../TileMapState/forceFullTileMapRedraw.cpp | 41 ++++----- .../processMapOrientationChange.cpp | 42 ++++----- .../TileMapState/recountTotalOwnedMoats.cpp | 65 ++++++-------- .../Map/TileMapState/resetMoatArray.cpp | 55 ++++++------ .../Map/TileMapState/resetPitchDitchArray.cpp | 55 ++++++------ .../Map/TileMapState/setMapRotation.cpp | 2 +- .../setMoatOwnerForAllMatching.cpp | 63 ++++++------- .../TileMapState/setMoatVisualStateAtTile.cpp | 43 ++++----- .../spreadBrazierPlacementAlgorithm.cpp | 35 ++++---- .../spreadFlagPlacementAlgorithm.cpp | 38 ++++---- .../Map/TileMapState/toggleFlatView.cpp | 2 +- ...updateBuildingPlacementRotationPreview.cpp | 44 ++++------ .../updateMoatCountdownTimers.cpp | 88 +++++++++---------- .../stopAllBinkPlaybackThunk.cpp | 2 +- .../createFloatingTextElement.cpp | 31 +++---- .../ViewportRenderState/focusOnCoordinate.cpp | 2 +- .../resetBatchedRender.cpp | 39 ++++---- .../resetupViewportThunk.cpp | 2 +- .../ViewportRenderState/restoreFocusTile.cpp | 2 +- .../storeWindowRectangleInfoUnk.cpp | 31 ++----- .../TextEditorState/setHelpWindowBounds.cpp | 33 +++---- .../setActiveMenuTabIndexToZero.cpp | 2 +- .../TextureRenderCore/setMenuTabIndexUnk.cpp | 2 +- 28 files changed, 337 insertions(+), 462 deletions(-) diff --git a/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp index dc456d60..736371e1 100644 --- a/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp +++ b/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { diff --git a/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp b/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp index 2f1e4bad..6f20f5f2 100644 --- a/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp +++ b/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp @@ -1,29 +1,20 @@ -#include "OpenSHC/Game/GameStateStructures.func.hpp" - - - - +#include "../GameStateStructures.func.hpp" namespace OpenSHC { namespace Game { + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004586F0 + void GameStateStructures::resetTraderState() + { + this->mapAndTime.traderRelated2 = 0; + this->mapAndTime.traderRelatedCounter1 = 0; + return; + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004586F0 -void GameStateStructures::resetTraderState() - -{ -this->mapAndTime.traderRelated2 = 0; -this->mapAndTime.traderRelatedCounter1 = 0; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp index e223c865..3141c733 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "../BuildingsState.func.hpp" + #include "OpenSHC/IO/PackagedFileMagicNum.hpp" namespace OpenSHC { diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp index f938cfd7..70863055 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "../BuildingsState.func.hpp" + #include "OpenSHC/Game/Resources/ResourceType.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" diff --git a/src/OpenSHC/Map/TileMapState/clearMoatData.cpp b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp index 70ace946..7893c1e7 100644 --- a/src/OpenSHC/Map/TileMapState/clearMoatData.cpp +++ b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp @@ -1,36 +1,31 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/IO/LowLevelMemory.func.hpp" - +#include "../TileMapState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x005002D0 + void TileMapState::clearMoatData(uint moatID) -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + { + if (moatID < 16000) { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x10, '\0', (void*)((int)(this->moats + moatID))); + this->moatTileCount = this->moatTileCount + -1; + } + return; + } -// FUNCTION: STRONGHOLDCRUSADER 0x005002D0 -void TileMapState::clearMoatData(uint moatID) - -{ -if (moatID < 16000) { -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x10, '\0', (void *)((int)(this->moats + moatID))); -this->moatTileCount = this->moatTileCount + -1; -} -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp index a493f76f..8d2acfea 100644 --- a/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp +++ b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp @@ -1,35 +1,26 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" - - - - +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x005017A0 + void TileMapState::forceFullTileMapRedraw() -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + { + this->forceUpdateLogicalAndMiscDisplayLayers = 1; + this->forceUpdateTextureTilemap = 1; + this->forceUpdateGFXLayers = 1; + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::setChangedLayerToThreeAndMapping0x40x40, this)(); + return; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x005017A0 -void TileMapState::forceFullTileMapRedraw() - -{ -this->forceUpdateLogicalAndMiscDisplayLayers = 1; -this->forceUpdateTextureTilemap = 1; -this->forceUpdateGFXLayers = 1; -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::setChangedLayerToThreeAndMapping0x40x40, this)(); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp index c27bff28..9d6e47a7 100644 --- a/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp +++ b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp @@ -1,35 +1,27 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" - - - - +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00512920 + void TileMapState::processMapOrientationChange() -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + { + if (this->DAT_FutureMapOrientation < 8) { + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::changeMapOrientation, this)( + this->DAT_FutureMapOrientation); + this->DAT_FutureMapOrientation = 8; + } + return; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00512920 -void TileMapState::processMapOrientationChange() - -{ -if (this->DAT_FutureMapOrientation < 8) { -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::changeMapOrientation, this)(this->DAT_FutureMapOrientation); -this->DAT_FutureMapOrientation = 8; -} -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp index 9cc14699..ab9ce364 100644 --- a/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp +++ b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp @@ -1,44 +1,35 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" - - - - +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x005000A0 + void TileMapState::recountTotalOwnedMoats() + + { + int iVar1; + byte* pbVar2; + + this->currentMoatCount = 0; + iVar1 = 1; + pbVar2 = &this->moats[1].owner; + do { + if (*pbVar2 != 0) { + this->currentMoatCount = iVar1 + 1; + } + iVar1 = iVar1 + 1; + pbVar2 = pbVar2 + 0x10; + } while (iVar1 < 16000); + return; + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x005000A0 -void TileMapState::recountTotalOwnedMoats() - -{ -int iVar1; -byte *pbVar2; - -this->currentMoatCount = 0; -iVar1 = 1; -pbVar2 = &this->moats[1].owner; -do { -if (*pbVar2 != 0) { -this->currentMoatCount = iVar1 + 1; } -iVar1 = iVar1 + 1; -pbVar2 = pbVar2 + 0x10; -} while (iVar1 < 16000); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp index 01ed4260..7ae9775c 100644 --- a/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp +++ b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp @@ -1,44 +1,41 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/Map/Moat.hpp" -#include "OpenSHC/IO/LowLevelMemory.func.hpp" - +#include "../TileMapState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/Moat.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Moat; - + using OpenSHC::Map::Moat; -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00500680 + void TileMapState::resetMoatArray() -// FUNCTION: STRONGHOLDCRUSADER 0x00500680 -void TileMapState::resetMoatArray() + { + Moat* destination; + int iVar1; -{ -Moat *destination; -int iVar1; + destination = this->moats; + iVar1 = 16000; + do { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x10, '\0', (void*)((int)(destination))); + destination = destination + 1; + iVar1 = iVar1 + -1; + } while (iVar1 != 0); + this->moatTileCount = iVar1; + return; + } -destination = this->moats; -iVar1 = 16000; -do { -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x10, '\0', (void *)((int)(destination))); -destination = destination + 1; -iVar1 = iVar1 + -1; -} while (iVar1 != 0); -this->moatTileCount = iVar1; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp index 2357e538..9c7455a1 100644 --- a/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp +++ b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp @@ -1,44 +1,41 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/Map/PitchDitch.hpp" -#include "OpenSHC/IO/LowLevelMemory.func.hpp" - +#include "../TileMapState.func.hpp" +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/PitchDitch.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::PitchDitch; - + using OpenSHC::Map::PitchDitch; -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x005007D0 + void TileMapState::resetPitchDitchArray() -// FUNCTION: STRONGHOLDCRUSADER 0x005007D0 -void TileMapState::resetPitchDitchArray() + { + PitchDitch* destination; + int iVar1; -{ -PitchDitch *destination; -int iVar1; + iVar1 = 4000; + this->maxPitchDitchCount = 4000; + destination = this->pitchDitches; + do { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x14, '\0', (void*)((int)(destination))); + destination = destination + 1; + iVar1 = iVar1 + -1; + } while (iVar1 != 0); + return; + } -iVar1 = 4000; -this->maxPitchDitchCount = 4000; -destination = this->pitchDitches; -do { -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x14, '\0', (void *)((int)(destination))); -destination = destination + 1; -iVar1 = iVar1 + -1; -} while (iVar1 != 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/setMapRotation.cpp b/src/OpenSHC/Map/TileMapState/setMapRotation.cpp index fb91f8b3..2aa68190 100644 --- a/src/OpenSHC/Map/TileMapState/setMapRotation.cpp +++ b/src/OpenSHC/Map/TileMapState/setMapRotation.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp index f1b83ebe..53fcef63 100644 --- a/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp +++ b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp @@ -1,43 +1,34 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" - - - - +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00500750 + void TileMapState::setMoatOwnerForAllMatching(int param_1, undefined4 param_2) + + { + byte* pbVar1; + int iVar2; + + pbVar1 = &this->moats[1].owner; + iVar2 = 15999; + do { + if ((*pbVar1 != 0) && ((char)*pbVar1 == param_1)) { + *pbVar1 = (byte)param_2; + } + pbVar1 = pbVar1 + 0x10; + iVar2 = iVar2 + -1; + } while (iVar2 != 0); + return; + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00500750 -void TileMapState::setMoatOwnerForAllMatching(int param_1,undefined4 param_2) - -{ -byte *pbVar1; -int iVar2; - -pbVar1 = &this->moats[1].owner; -iVar2 = 15999; -do { -if ((*pbVar1 != 0) && ((char)*pbVar1 == param_1)) { -*pbVar1 = (byte)param_2; } -pbVar1 = pbVar1 + 0x10; -iVar2 = iVar2 + -1; -} while (iVar2 != 0); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp index e14386dc..0471e800 100644 --- a/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp +++ b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp @@ -1,37 +1,28 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" - - - - +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00500720 + void TileMapState::setMoatVisualStateAtTile(int tile, undefined4 zeroOrTwo) -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + { + int iVar1; + iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::returnOwnedMoatAtTile, this)(tile); + if (iVar1 != 0) { + this->moats[iVar1].zeroOrTwo = (short)zeroOrTwo; + } + return; + } -// FUNCTION: STRONGHOLDCRUSADER 0x00500720 -void TileMapState::setMoatVisualStateAtTile(int tile,undefined4 zeroOrTwo) - -{ -int iVar1; - -iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::returnOwnedMoatAtTile, this)(tile); -if (iVar1 != 0) { -this->moats[iVar1].zeroOrTwo = (short)zeroOrTwo; -} -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp index ca5e0e13..2b217727 100644 --- a/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp +++ b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp @@ -1,33 +1,28 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" - +#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" #include "OpenSHC/Globals/DAT_PathFindingState.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x005011A0 + void TileMapState::spreadBrazierPlacementAlgorithm(int playerID, uint x, uint y) -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + { + MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, + DAT_PathFindingState::ptr)(playerID, x, y, 4, 1); + return; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x005011A0 -void TileMapState::spreadBrazierPlacementAlgorithm(int playerID,uint x,uint y) - -{ -MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, DAT_PathFindingState::ptr)(playerID, x, y, 4, 1); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp index 511d4fae..cc8e9e6f 100644 --- a/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp +++ b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp @@ -1,35 +1,31 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" - +#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" #include "OpenSHC/Globals/DAT_PathFindingState.hpp" namespace OpenSHC { namespace Map { + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00501180 + int TileMapState::spreadFlagPlacementAlgorithm(int param_1, uint param_2, uint param_3) -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + { + int iVar1; + iVar1 + = MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, + DAT_PathFindingState::ptr)(param_1, param_2, param_3, 4, 0); + return iVar1; + } -// FUNCTION: STRONGHOLDCRUSADER 0x00501180 -int TileMapState::spreadFlagPlacementAlgorithm(int param_1,uint param_2,uint param_3) - -{ -int iVar1; - -iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, DAT_PathFindingState::ptr)(param_1, param_2, param_3, 4, 0); -return iVar1; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp b/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp index becb2628..1a08ba51 100644 --- a/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp +++ b/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" +#include "../TileMapState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp index e4932f28..c38d23f1 100644 --- a/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp +++ b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp @@ -1,38 +1,32 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../TileMapState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00504EE0 + void TileMapState::updateBuildingPlacementRotationPreview(int param_1, int param_2) -// FUNCTION: STRONGHOLDCRUSADER 0x00504EE0 -void TileMapState::updateBuildingPlacementRotationPreview(int param_1,int param_2) + { + BOOLEnum BVar1; -{ -BOOLEnum BVar1; + BVar1 = this->buildingPlacementFail; + this->buildingPlacementFail = FALSE; + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::determineBuildingPlacementRotation, this)(param_1, param_2); + this->buildingPlacementFail = BVar1; + return; + } -BVar1 = this->buildingPlacementFail; -this->buildingPlacementFail = FALSE; -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::determineBuildingPlacementRotation, this)(param_1, param_2); -this->buildingPlacementFail = BVar1; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp index 87d52e0e..31d39f2b 100644 --- a/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp +++ b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp @@ -1,55 +1,49 @@ -#include "OpenSHC/Map/TileMapState.func.hpp" -#include "OpenSHC/Map/Moat.hpp" - - - +#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/Moat.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Moat; - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Moat; + + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ + + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + + // FUNCTION: STRONGHOLDCRUSADER 0x00500640 + void TileMapState::updateMoatCountdownTimers() + + { + Moat* _pMoats; + int iVar1; + + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::recountTotalOwnedMoats, this)(); + iVar1 = 0; + /* + DAT_TotalOwnedMoats + */ + + if (0 < this->currentMoatCount) { + /* + SEC_MoatArray[0].field11_0xf + */ + + _pMoats = &this->moats[0]; + do { + if ((_pMoats->owner != 0) && ('\0' < (char)_pMoats->someCountDown)) { + _pMoats->someCountDown = _pMoats->someCountDown - 1; + } + iVar1 = iVar1 + 1; + _pMoats = _pMoats + 0x10; + } while (iVar1 < this->currentMoatCount); + } + return; + } -// FUNCTION: STRONGHOLDCRUSADER 0x00500640 -void TileMapState::updateMoatCountdownTimers() - -{ -Moat * _pMoats; -int iVar1; - -MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::recountTotalOwnedMoats, this)(); -iVar1 = 0; -/* - DAT_TotalOwnedMoats - */ - -if (0 < this->currentMoatCount) { -/* - SEC_MoatArray[0].field11_0xf - */ - -_pMoats = &this->moats[0]; -do { -if ((_pMoats->owner != 0) && ('\0' < (char)_pMoats->someCountDown)) { -_pMoats->someCountDown = _pMoats->someCountDown - 1; } -iVar1 = iVar1 + 1; -_pMoats = _pMoats + 0x10; -} while (iVar1 < this->currentMoatCount); -} -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp index fe5c0ce5..3f9bffb0 100644 --- a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "../BinkControlClass.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp index 87cea179..0acff3e4 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp @@ -1,29 +1,24 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" -#include "OpenSHC/IO/Graphics/GmID.hpp" - - - +#include "../ViewportRenderState.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" namespace OpenSHC { namespace Rendering { -using OpenSHC::IO::Graphics::GmID; - + using OpenSHC::IO::Graphics::GmID; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004E8CC0 + void ViewportRenderState::createFloatingTextElement(int param_1, int param_2, int param_3, int param_4, int param_5) -// FUNCTION: STRONGHOLDCRUSADER 0x004E8CC0 -void ViewportRenderState::createFloatingTextElement(int param_1,int param_2,int param_3,int param_4,int param_5) + { + MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, this)( + OpenSHC::IO::Graphics::GID_FLOATS, param_1, param_2, param_3, param_4, param_5); + return; + } -{ -MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, this)(OpenSHC::IO::Graphics::GID_FLOATS, param_1, param_2, param_3, param_4, param_5); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp b/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp index a2a9c1d2..04999c0a 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "../ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp index ac76bade..2b5e2419 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp @@ -1,33 +1,24 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" - - - - +#include "../ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x004E2600 + int ViewportRenderState::resetBatchedRender() + { + this->unitBatchedRenderCounterUntil6 = 1; + this->unitRender1 = 0; + this->unitRender2 = 0; + this->unitRender3 = 0; + this->unitRender4 = 0; + this->unitRender5 = 0; + return 0; + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004E2600 -int ViewportRenderState::resetBatchedRender() - -{ -this->unitBatchedRenderCounterUntil6 = 1; -this->unitRender1 = 0; -this->unitRender2 = 0; -this->unitRender3 = 0; -this->unitRender4 = 0; -this->unitRender5 = 0; -return 0; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp index d3eb6027..4c88f30e 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "../ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp b/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp index 41736049..cba66425 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "../ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp b/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp index 3b1f4d65..3337070c 100644 --- a/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp +++ b/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp @@ -1,31 +1,16 @@ #include "OpenSHC/Rendering/WindowInformation.func.hpp" - - - - namespace OpenSHC { namespace Rendering { + // FUNCTION: STRONGHOLDCRUSADER 0x00467F60 + void WindowInformation::storeWindowRectangleInfoUnk(LONG param_1, LONG param_2, LONG param_3, LONG param_4) + { + this->RECT_SomeGameWindowRectUnk.left = param_1; + this->RECT_SomeGameWindowRectUnk.top = param_3; + this->RECT_SomeGameWindowRectUnk.right = param_2; + this->RECT_SomeGameWindowRectUnk.bottom = param_4; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00467F60 -void WindowInformation::storeWindowRectangleInfoUnk(LONG param_1,LONG param_2,LONG param_3,LONG param_4) - -{ -this->RECT_SomeGameWindowRectUnk.left = param_1; -this->RECT_SomeGameWindowRectUnk.top = param_3; -this->RECT_SomeGameWindowRectUnk.right = param_2; -this->RECT_SomeGameWindowRectUnk.bottom = param_4; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp index 3937b14a..8b5d9e01 100644 --- a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp +++ b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp @@ -1,31 +1,18 @@ #include "OpenSHC/Text/TextEditorState.func.hpp" - - - - namespace OpenSHC { namespace Text { + // FUNCTION: STRONGHOLDCRUSADER 0x0045D080 + void TextEditorState::setHelpWindowBounds( + undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4) + { + this->dialogContentX = param_1; + this->dialogContentY = param_2; + this->dialogContentHeight = param_3; + this->dialogContentWidth = param_4; + return; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045D080 -void TextEditorState::setHelpWindowBounds(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4) - -{ -this->dialogContentX = param_1; -this->dialogContentY = param_2; -this->dialogContentHeight = param_3; -this->dialogContentWidth = param_4; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp index 3ef586ac..8b472002 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "../TextureRenderCore.func.hpp" namespace OpenSHC { namespace UI { diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp index dbfdfea9..e56bf0c5 100644 --- a/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "../TextureRenderCore.func.hpp" namespace OpenSHC { namespace UI { From 9505221bd4a8d1cadd93903eec49473052973a4f Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 23:10:44 +0200 Subject: [PATCH 40/61] reimplement: SHC_3BB0A8C1_0x0045D690 60% --- .../bltTextToScreenIfNeedBe.cpp | 39 +++++++------------ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp index dd587f84..17d39383 100644 --- a/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp +++ b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp @@ -1,36 +1,25 @@ #include "OpenSHC/Text/TextEditorState.func.hpp" #include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" - - #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" namespace OpenSHC { namespace Text { + // FUNCTION: STRONGHOLDCRUSADER 0x0045D690 + void TextEditorState::bltTextToScreenIfNeedBe() + { + // fixme: wrong register usage, make part of 0x004403d0 ? + if (this->intArray1[20] != 0) { + if (((this->savedMenuViewType == 0xc) || (this->savedMenuViewType == 0xe)) + || (this->savedMenuViewType == 0x10)) { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::WindowAndDirectDraw_Func::bltMapGameSurfaceToScreenMenuSurfaceComplete, + DAT_WindowAndDirectDraw::ptr)(); + } + this->intArray1[20] = 0; + } + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045D690 -void TextEditorState::bltTextToScreenIfNeedBe() - -{ -if (this->intArray1[0x14] != 0) { -if (((this->savedMenuViewType == 0xc) || -(this->savedMenuViewType == 0xe)) || -(this->savedMenuViewType == 0x10)) { -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::WindowAndDirectDraw_Func::bltMapGameSurfaceToScreenMenuSurfaceComplete, DAT_WindowAndDirectDraw::ptr)(); -} -this->intArray1[0x14] = 0; -} -return; } - - } -} \ No newline at end of file diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 45dadcfd..f1124e3e 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -18335,7 +18335,7 @@ SHC_3BB0A8C1_0x0045D430 | 0.0% | Pending SHC_3BB0A8C1_0x0045D460 | 0.0% | Pending -SHC_3BB0A8C1_0x0045D690 | 0.0% | Pending +SHC_3BB0A8C1_0x0045D690 | 60.0% | Probably needs to be part of 0x004403d0 SHC_3BB0A8C1_0x0045D6C0 | 0.0% | Pending From 30ced40fed66ab8fcb68ba5032df47488db33ae4 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 23:15:27 +0200 Subject: [PATCH 41/61] reimplement: SHC_3BB0A8C1_0x0045D9E0 100% --- .../TextEditorState/getHelpSectionText.cpp | 45 +++++-------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp index 68ba0d33..958b0f60 100644 --- a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp +++ b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp @@ -1,43 +1,22 @@ #include "OpenSHC/Text/TextEditorState.func.hpp" - - #include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" namespace OpenSHC { namespace Text { + // FUNCTION: STRONGHOLDCRUSADER 0x0045D9E0 + char* TextEditorState::getHelpSectionText(int param_1) + { + int _entry = 0; + while (DAT_UserHelpDefinedData::instance.field5_0x7a124[_entry].unknown_0x4 != -1) { + if (DAT_UserHelpDefinedData::instance.field5_0x7a124[_entry].unknown_0x4 == param_1) { + return DAT_UserHelpDefinedData::instance.field5_0x7a124[_entry].text_0x0; + } + _entry++; + } + return (char*)NULL; + } - - -/* - Walks the UserHelpDefinedData help section list to find the entry with ID matching param_1. - Returns a pointer to its text_0x0 field if found, or null if param_1 is not present in the list. - - renamed by: Claude Sonnet 4.6 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045D9E0 -char * TextEditorState::getHelpSectionText(int param_1) - -{ -int iVar1; -int iVar2; - -iVar2 = 0; -iVar1 = DAT_UserHelpDefinedData::instance.field5_0x7a124[0].unknown_0x4; -while( true ) { -if (iVar1 == -1) { -return (char *)0x0; -} -if (iVar1 == param_1) break; -iVar1 = DAT_UserHelpDefinedData::instance.field5_0x7a124[iVar2 + 1].unknown_0x4; -iVar2 = iVar2 + 1; } -return DAT_UserHelpDefinedData::instance.field5_0x7a124[iVar2].text_0x0; -} - - } -} \ No newline at end of file diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index f1124e3e..3b248e59 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -18349,7 +18349,7 @@ SHC_3BB0A8C1_0x0045D950 | 0.0% | Pending SHC_3BB0A8C1_0x0045D990 | 0.0% | Pending -SHC_3BB0A8C1_0x0045D9E0 | 0.0% | Pending +SHC_3BB0A8C1_0x0045D9E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0045DA20 | 100.0% | Reimplemented From 0e7d624429e52e66a6638c434a3fd1d9a98f700c Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 27 Aug 2026 23:42:58 +0200 Subject: [PATCH 42/61] reimplement: SHC_3BB0A8C1_0x00462150 27% --- .../TextEditorState/popHelpDialogStack.cpp | 55 ++++++------------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp index 56baec1f..515647c7 100644 --- a/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp +++ b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp @@ -1,46 +1,23 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" - - - - +#include "../TextEditorState.func.hpp" namespace OpenSHC { namespace Text { + // FUNCTION: STRONGHOLDCRUSADER 0x00462150 + void TextEditorState::popHelpDialogStack() + { + this->currentHelpSectionID = this->helpSectionHistoryStack[0]; + for (int iVar1 = 29; iVar1 != 0; iVar1 = iVar1 + -1) { + this->helpSectionHistoryStack[iVar1] = this->helpSectionHistoryStack[iVar1 + 1]; + } + this->helpSectionHistoryStack[29] = -1; + if (this->helpSectionHistoryStack[0] == -1) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::closeHelpDialogAndReturnToMenu, this)(); + return; + } + MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::loadAndLayoutHelpContent, this)(); + return; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00462150 -void TextEditorState::popHelpDialogStack() - -{ -int iVar1; -undefined4 *puVar2; -undefined4 *puVar3; -bool bVar4; - -this->currentHelpSectionID = this->helpSectionHistoryStack[0]; -bVar4 = this->helpSectionHistoryStack[0] == -1; -puVar2 = this->helpSectionHistoryStack; -puVar3 = this->helpSectionHistoryStack; -for (iVar1 = 29; puVar2 = puVar2 + 1, iVar1 != 0; iVar1 = iVar1 + -1) { -*puVar3 = *puVar2; -puVar3 = puVar3 + 1; -} -this->helpSectionHistoryStack[0x1d] = 0xffffffff; -if (bVar4) { -MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::closeHelpDialogAndReturnToMenu, this)(); -return; } -MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::loadAndLayoutHelpContent, this)(); -return; -} - - } -} \ No newline at end of file diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3b248e59..1a502859 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -18893,7 +18893,7 @@ SHC_3BB0A8C1_0x00461F90 | 0.0% | Pending SHC_3BB0A8C1_0x004620F0 | 0.0% | Pending -SHC_3BB0A8C1_0x00462150 | 0.0% | Pending +SHC_3BB0A8C1_0x00462150 | 27.0% | Stuck SHC_3BB0A8C1_0x00462190 | 0.0% | Pending From 1793bbb66ec754dec5aecdee4170df8e8e518e97 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Fri, 28 Aug 2026 00:18:32 +0200 Subject: [PATCH 43/61] reimplement: SHC_3BB0A8C1_0x00468C50 100% --- .../PencilRenderCore/setupPencilSurface.cpp | 51 ++++++++----------- status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp index 2b47236d..ccdfa10e 100644 --- a/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp @@ -1,39 +1,30 @@ #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" - - #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" namespace OpenSHC { namespace UI { -namespace Rendering { - -using OpenSHC::Rendering::Enums::RenderTarget; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00468C50 -void PencilRenderCore::setupPencilSurface() - -{ -this->surfacePtr = DAT_WindowAndDirectDraw::instance.surfacePointer_mapGame; -if (this->surfaceTarget == OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { -this->surfacePtr = DAT_WindowAndDirectDraw::instance.surfacePointer_screenMenu; -} -if (this->surfaceTarget != OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { -this->horizontalByteSize = 8112; -return; -} -this->horizontalByteSize = DAT_WindowAndDirectDraw::instance.byteSizeOfOneHorizontalLine; -return; -} - - + namespace Rendering { + + using OpenSHC::Rendering::Enums::RenderTarget; + + // FUNCTION: STRONGHOLDCRUSADER 0x00468C50 + void PencilRenderCore::setupPencilSurface() + { + Ghidra::ushort* surface = DAT_WindowAndDirectDraw::instance.surfacePointer_mapGame; + if (this->surfaceTarget == OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { + surface = DAT_WindowAndDirectDraw::instance.surfacePointer_screenMenu; + } + this->surfacePtr = surface; + + if (this->surfaceTarget != OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { + this->horizontalByteSize = 8112; + return; + } + this->horizontalByteSize = DAT_WindowAndDirectDraw::instance.byteSizeOfOneHorizontalLine; + } + + } } } -} \ No newline at end of file diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1a502859..aae3e3f9 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20097,7 +20097,7 @@ SHC_3BB0A8C1_0x00468C30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00468C40 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00468C50 | 0.0% | Pending +SHC_3BB0A8C1_0x00468C50 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00468C80 | 0.0% | Pending From e5174800964a934cc0c20b9b434f40722678d661 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Fri, 28 Aug 2026 00:19:25 +0200 Subject: [PATCH 44/61] progress --- .../MouseState/resetMouseCursorState.cpp | 43 +++++---------- .../Actions/SetBuildingProductionType.cpp | 28 +++------- .../bltTextToScreenIfNeedBe.cpp | 3 +- .../TextEditorState/getHelpSectionText.cpp | 2 +- .../getHelpTokenAdvanceLength.cpp | 52 +++++++----------- .../getNextHelpColorEntryIndex.cpp | 2 +- .../getPrevHelpColorEntryIndex.cpp | 54 ++++++------------- .../TextEditorState/loadAndParseHelpFile.cpp | 46 ++++++---------- .../renderHelpDialogIfOpen.cpp | 2 +- .../TextEditorState/setHelpWindowBounds.cpp | 2 +- src/OpenSHC/UI/Helpers/CheckGoldResource.cpp | 43 +++++---------- .../Helpers/CheckIfEnoughGoldForLadderman.cpp | 37 +++---------- .../UI/Helpers/CheckIfEnoughGoldForMonk.cpp | 37 +++---------- .../Helpers/CheckIfEnoughGoldForTunneler.cpp | 37 +++---------- ...er_BuildingAndStatusMenu_BuildingSleep.cpp | 45 +++++----------- ...gAndStatusMenu_MarketMenuChangeButtons.cpp | 6 --- ...dingAndStatusMenu_OutpostUnitSelection.cpp | 17 ++---- ...RenderFunction_BuildMenu_BuildingIcons.cpp | 18 ++----- ...on_BuildMenu_BuildingSubcategoryButton.cpp | 14 ++--- .../ButtonGmData/getPictureNumberInGm.cpp | 3 +- 20 files changed, 144 insertions(+), 347 deletions(-) diff --git a/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp b/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp index 11fe8794..ba4eff1c 100644 --- a/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp +++ b/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp @@ -1,37 +1,22 @@ #include "OpenSHC/Input/MouseState.func.hpp" - - - - namespace OpenSHC { namespace Input { + // FUNCTION: STRONGHOLDCRUSADER 0x00468590 + void MouseState::resetMouseCursorState() + { + this->selectionBox.left = 0; + this->selectionBox.top = 0; + this->selectionBox.right = 0; + this->selectionBox.bottom = 0; + this->previousSelectionBox.left = 0; + this->previousSelectionBox.top = 0; + this->previousSelectionBox.right = 0; + this->previousSelectionBox.bottom = 0; + this->selectionBoxMode = 0; + this->field31_0x94 = 0; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00468590 -void MouseState::resetMouseCursorState() - -{ -this->selectionBox.left = 0; -this->selectionBox.top = 0; -this->selectionBox.right = 0; -this->selectionBox.bottom = 0; -this->previousSelectionBox.left = 0; -this->previousSelectionBox.top = 0; -this->previousSelectionBox.right = 0; -this->previousSelectionBox.bottom = 0; -this->selectionBoxMode = 0; -this->field31_0x94 = 0; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp b/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp index cc130e2d..2f336b40 100644 --- a/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp +++ b/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp @@ -1,30 +1,18 @@ #include "OpenSHC/Synchrony/Actions.func.hpp" - - #include "OpenSHC/Globals/DAT_BuildingsState.hpp" namespace OpenSHC { namespace Synchrony { + // FUNCTION: STRONGHOLDCRUSADER 0x004652A0 + void Actions::SetBuildingProductionType( + undefined4 playerID, int buildingID, ushort producedItemType, int buildingUID) + { + if (DAT_BuildingsState::instance.buildings[buildingID].uid == buildingUID) { + DAT_BuildingsState::instance.buildings[buildingID].producedItemType = producedItemType; + } + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004652A0 -void Actions::SetBuildingProductionType(undefined4 playerID,int buildingID,ushort producedItemType,int buildingUID) - -{ -if (DAT_BuildingsState::instance.buildings[buildingID].uid == buildingUID) { -DAT_BuildingsState::instance.buildings[buildingID].producedItemType = producedItemType; -} -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp index 17d39383..b7c163ee 100644 --- a/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp +++ b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "../TextEditorState.func.hpp" + #include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" diff --git a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp index 958b0f60..97a1d36e 100644 --- a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp +++ b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "../TextEditorState.func.hpp" #include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" diff --git a/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp b/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp index dc604f93..80c1d243 100644 --- a/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp +++ b/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp @@ -1,40 +1,26 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" - - - - +#include "../TextEditorState.func.hpp" namespace OpenSHC { namespace Text { + // FUNCTION: STRONGHOLDCRUSADER 0x0045F080 + undefined4 TextEditorState::getHelpTokenAdvanceLength(undefined4 param_1) + { + switch (param_1) { + case 1: + return 4; + case 2: + case 3: + case 4: + case 10: + case 0xb: + case 0xc: + case 0xe: + return 3; + default: + return 1; + } + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0045F080 -undefined4 TextEditorState::getHelpTokenAdvanceLength(undefined4 param_1) - -{ -switch(param_1) { -case 1: -return(undefined4)( 4); -case 2: -case 3: -case 4: -case 10: -case 0xb: -case 0xc: -case 0xe: -return(undefined4)( 3); -default: -return(undefined4)( 1); } } - - -} -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp index 4414ada2..5cd98137 100644 --- a/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp +++ b/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "../TextEditorState.func.hpp" #include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" diff --git a/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp index fddc4cca..e9211db5 100644 --- a/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp +++ b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp @@ -1,47 +1,27 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" -#include "OpenSHC/Text/HelpTextRelatedColorStruct.hpp" - +#include "../TextEditorState.func.hpp" +#include "OpenSHC/Text/HelpTextRelatedColorStruct.hpp" #include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" namespace OpenSHC { namespace Text { -using OpenSHC::Text::HelpTextRelatedColorStruct; - - -/* - Returns param_1 - 1 if non-negative. If param_1 - 1 goes below 0, walks the field6_0x7a16c array - forward to find the last entry with a non-null name and returns that index. Simple circular - previous-index for the help colour/style entry array. - - renamed by: Claude Sonnet 4.6 - */ - + using OpenSHC::Text::HelpTextRelatedColorStruct; + + // FUNCTION: STRONGHOLDCRUSADER 0x0045DA40 + int TextEditorState::getPrevHelpColorEntryIndex(int param_1) + { + int iVar1 = param_1 + -1; + if (iVar1 < 0) { + iVar1 = 0; + while (DAT_UserHelpDefinedData::instance.field6_0x7a16c[iVar1].name_0x0 != (char*)0x0) { + iVar1++; + } + iVar1 = iVar1 + -1; + } + return iVar1; + } -// FUNCTION: STRONGHOLDCRUSADER 0x0045DA40 -int TextEditorState::getPrevHelpColorEntryIndex(int param_1) - -{ -int iVar1; -HelpTextRelatedColorStruct *pHVar2; - -iVar1 = param_1 + -1; -if (iVar1 < 0) { -iVar1 = 0; -if (DAT_UserHelpDefinedData::instance.field6_0x7a16c[0].name_0x0 != (char *)0x0) { -pHVar2 = DAT_UserHelpDefinedData::instance.field6_0x7a16c; -do { -pHVar2 = pHVar2 + 1; -iVar1 = iVar1 + 1; -} while (pHVar2->name_0x0 != (char *)0x0); -} -iVar1 = iVar1 + -1; } -return iVar1; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp index 688639d9..ce480bbf 100644 --- a/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp +++ b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp @@ -1,38 +1,26 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "../TextEditorState.func.hpp" + #include "OpenSHC/OS.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Text { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0045F580 + undefined4 TextEditorState::loadAndParseHelpFile(char const* param_1) + { + FILE* _File = (FILE*)MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::readCrusaderHelpHlp, this)(param_1); + if (_File != (FILE*)0x0) { + MACRO_CALL(OpenSHC::OS_Func::_fclose)(_File); + // fixme: I thought I could return the comparison directly, but that produces different bytecode. + if (this->helpSectionParseSucceeded != FALSE) { + return 1; + } + } + return 0; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0045F580 -undefined4 TextEditorState::loadAndParseHelpFile(FILE *param_1) - -{ -FILE *_File; - -_File = (FILE *)MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::readCrusaderHelpHlp, this)((CHAR *)param_1); -if (_File != (FILE *)0x0) { -MACRO_CALL(OpenSHC::OS_Func::_fclose)(_File); -if (this->helpSectionParseSucceeded != FALSE) { -return(undefined4)( 1); -} } -return(undefined4)( 0); -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp b/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp index 5f5756a5..5b0225b8 100644 --- a/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp +++ b/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "../TextEditorState.func.hpp" namespace OpenSHC { namespace Text { diff --git a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp index 8b5d9e01..b0e53ddd 100644 --- a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp +++ b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "../TextEditorState.func.hpp" namespace OpenSHC { namespace Text { diff --git a/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp b/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp index f213a8f6..1be7983c 100644 --- a/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp +++ b/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp @@ -1,44 +1,27 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { 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 - */ + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004650C0 + BOOLEnum Helpers::CheckGoldResource(int param_1) + { + int iVar1; + iVar1 = 0; + if (param_1 == 5) { + iVar1 = 0x1e; + } + return DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[0xf] + >= iVar1; + } -// FUNCTION: STRONGHOLDCRUSADER 0x004650C0 -BOOLEnum Helpers::CheckGoldResource(int param_1) - -{ -int iVar1; - -iVar1 = 0; -if (param_1 == 5) { -iVar1 = 0x1e; -} -return (uint)(iVar1 <= DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. -currentResources[0xf]); } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp index 5cc2aff0..a2b554a7 100644 --- a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp @@ -1,40 +1,19 @@ #include "OpenSHC/UI/Helpers.func.hpp" - - -#include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x00465080 + void Helpers::CheckIfEnoughGoldForLadderman() + { + DAT_EnoughGoldForRequestedUnit::instance + = 4 <= DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[0xf]; + } - - -/* - 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 0x00465080 -void Helpers::CheckIfEnoughGoldForLadderman() - -{ -DAT_EnoughGoldForRequestedUnit::instance = -(uint)(3 < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. -currentResources[0xf]); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp index 1fbf6841..af06a630 100644 --- a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp @@ -1,40 +1,19 @@ #include "OpenSHC/UI/Helpers.func.hpp" - - -#include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004650A0 + void Helpers::CheckIfEnoughGoldForMonk() + { + DAT_EnoughGoldForRequestedUnit::instance + = 10 <= DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[0xf]; + } - - -/* - 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 0x004650A0 -void Helpers::CheckIfEnoughGoldForMonk() - -{ -DAT_EnoughGoldForRequestedUnit::instance = -(uint)(9 < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. -currentResources[0xf]); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp index c307dfb3..6de67164 100644 --- a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp @@ -1,40 +1,19 @@ #include "OpenSHC/UI/Helpers.func.hpp" - - -#include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_EnoughGoldForRequestedUnit.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004650F0 + void Helpers::CheckIfEnoughGoldForTunneler() + { + DAT_EnoughGoldForRequestedUnit::instance + = 0x1e <= DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[0xf]; + } - - -/* - 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 0x004650F0 -void Helpers::CheckIfEnoughGoldForTunneler() - -{ -DAT_EnoughGoldForRequestedUnit::instance = -(uint)(0x1d < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]. -currentResources[0xf]); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp index 0675882e..7a1ac495 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp @@ -1,47 +1,28 @@ -#include "OpenSHC/UI.func.hpp" -#include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Game/GameMode2.hpp" - - -#include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { -using OpenSHC::Game::GameMode2; using OpenSHC::Commands::GameCommandType; - - -/* - 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 - */ - +using OpenSHC::Game::GameMode2; // FUNCTION: STRONGHOLDCRUSADER 0x004660B0 void UI::MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep() - { -if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) { -MACRO_CALL(OpenSHC::UI_Func::SetTutorialHintActiveWithTimestamp)(); -return; -} -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = -(int)(short)DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]. -buildingType; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_BUILDING_SLEEP); -return; + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) { + MACRO_CALL(OpenSHC::UI_Func::SetTutorialHintActiveWithTimestamp)(); + return; + } + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].buildingType; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_BUILDING_SLEEP); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp index f2096c23..9ff099ab 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp @@ -8,19 +8,13 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuViewType; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00465920 void UI::MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons(int param_1, ...) - { DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = param_1; MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0); DAT_GameCore::instance.field61_0x100 = param_1; - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp index bd443a19..ebcc0a58 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp @@ -4,20 +4,13 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00466710 -void UI::MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection(int param_1, ...) - +void UI::MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection(int bitIndex, ...) { - short* psVar1; - - psVar1 = &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] - .outpostRelatedUnk1; - *psVar1 = *psVar1 ^ (ushort)(1 << ((byte)param_1 & 0x1f)); - return; + // Toggle the bit selected by the menu action in the currently selected + // building's outpost unit-selection mask. + DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .outpostRelatedUnk1 ^= (ushort)(1 << bitIndex); } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp index 4b1ca90d..c3c1d6df 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp @@ -9,30 +9,18 @@ namespace OpenSHC { using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004668F0 void UI::MenuItemRenderFunction_BuildMenu_BuildingIcons(int param_1, ...) - { - BOOLEnum BVar1; - - BVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::isMapperAvailable, DAT_MapPropertiesState::ptr)( - (MappersEnum)param_1); - if (BVar1 != FALSE) { + if (MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::isMapperAvailable, DAT_MapPropertiesState::ptr)( + (MappersEnum)param_1) + != FALSE) { MACRO_CALL(OpenSHC::UI_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); DAT_ButtonUnknownZero::instance = 0; return; } DAT_ButtonUnknownZero::instance = 1; - return; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp index 3c1b6453..bcd46e6e 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp @@ -6,26 +6,18 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00466920 void UI::MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton(int param_1, ...) - { - int iVar1; - - iVar1 = MACRO_CALL_MEMBER( - OpenSHC::Map::MapPropertiesState_Func::isMercRecruitableForBuildingType, DAT_MapPropertiesState::ptr)(param_1); - if (iVar1 != 0) { + if (MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::isMercRecruitableForBuildingType, + DAT_MapPropertiesState::ptr)(param_1) + != 0) { MACRO_CALL(OpenSHC::UI_Func:: MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); DAT_ButtonUnknownZero::instance = 0; return; } DAT_ButtonUnknownZero::instance = 1; - return; } } diff --git a/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp b/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp index 591bc1a2..6189c725 100644 --- a/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp +++ b/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp" +#include "../ButtonGmData.func.hpp" + #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { From dfc83e87dde0721d5dfe707ce040bda5a9db0d3e Mon Sep 17 00:00:00 2001 From: sourcehold Date: Mon, 31 Aug 2026 21:42:24 +0200 Subject: [PATCH 45/61] progress --- .../getBuildingResourceAmountByUid.cpp | 2 +- .../BuildingsState/isReligiousBuilding.cpp | 2 +- .../EntityState/activateProjectileEntity.cpp | 3 +- .../Map/Units/UnitsState/deselectUnit.cpp | 37 +++++++------------ .../Map/Units/UnitsState/unitIsInMoat.cpp | 33 +++++++---------- .../Map/Version/UpgradeBuildingField1.cpp | 2 +- .../Map/Version/UpgradeBuildingField2.cpp | 4 +- .../Map/Version/UpgradeBuildingField4.cpp | 2 +- 8 files changed, 35 insertions(+), 50 deletions(-) diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp index c5b24aea..6c16ec0d 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp @@ -9,7 +9,7 @@ namespace Map { using OpenSHC::Game::Resources::ResourceType; // FUNCTION: STRONGHOLDCRUSADER 0x00409330 - undefined4 BuildingsState::getBuildingResourceAmountByUid(int buildingID, int param_2, ResourceType param_3) + int BuildingsState::getBuildingResourceAmountByUid(int buildingID, int param_2, ResourceType param_3) { if (this->buildings[buildingID].uid != param_2) { return 0; diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp index 87f84d1b..454fc0fd 100644 --- a/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp +++ b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp @@ -11,7 +11,7 @@ namespace Map { using OpenSHC::Map::Buildings::BuildingTypeShort; // FUNCTION: STRONGHOLDCRUSADER 0x0040A4A0 - uint BuildingsState::isReligiousBuilding(int buildingID) + BOOLEnum BuildingsState::isReligiousBuilding(int buildingID) { // fixme: logic is correct but original is written differently apparently. return this->buildings[buildingID].buildingType == Buildings::BT_CHAPEL diff --git a/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp index 3e3bf341..9037e799 100644 --- a/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp @@ -11,13 +11,12 @@ namespace Map { using OpenSHC::Map::Entities::EntityTypeShort; // FUNCTION: STRONGHOLDCRUSADER 0x004039B0 - int EntityState::activateProjectileEntity(int entityID) + void EntityState::activateProjectileEntity(int entityID) { this->entityArray[entityID].logicalState = 2; this->entityArray[entityID].field72_0xa8 = 1; MACRO_CALL_MEMBER(OpenSHC::Map::Entities::EntityState_Func::setProjectileEntityValues2, this)( entityID, (EntityType)this->entityArray[entityID].entityType2); - return entityID; // fixme: likely void } } diff --git a/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp index 3c54a78d..3974cd2e 100644 --- a/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp @@ -1,33 +1,24 @@ #include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - namespace OpenSHC { namespace Map { -namespace Units { - - + namespace Units { + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00535190 -void UnitsState::deselectUnit(int unitID) - -{ -if (this->units[unitID].isSelected != 0) { -this->units[unitID].isSelected = 0; -this->totalUnitsInSelection = this->totalUnitsInSelection + -1; -} -return; -} + // FUNCTION: STRONGHOLDCRUSADER 0x00535190 + void UnitsState::deselectUnit(int unitID) + { + if (this->units[unitID].isSelected != 0) { + this->units[unitID].isSelected = 0; + this->totalUnitsInSelection = this->totalUnitsInSelection + -1; + } + return; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp index 0c4bee9e..d5f50ee6 100644 --- a/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp @@ -1,34 +1,29 @@ #include "OpenSHC/Map/Units/UnitsState.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; + namespace Units { + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ + /* + WARNING: Enum "MappersEnum": Some values do not have unique names + */ -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + /* + decompilerscript: committed: 2025-01-30 21:57:43.216000 + */ + // FUNCTION: STRONGHOLDCRUSADER 0x00534460 + BOOLEnum UnitsState::unitIsInMoat(int unitID) -// FUNCTION: STRONGHOLDCRUSADER 0x00534460 -BOOLEnum UnitsState::unitIsInMoat(int unitID) - -{ -return (uint)DAT_TileMapState::instance.LogicLayer[this->units[unitID].tile] >> 0x1e &TRUE; -} - + { + return (uint)DAT_TileMapState::instance.LogicLayer[this->units[unitID].tile] >> 0x1e & TRUE; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp index 46961cb5..acc2b16d 100644 --- a/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp @@ -16,7 +16,7 @@ namespace Map { for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { DAT_BuildingsState::instance.buildings[_buildingID].uidWhenPlaced - = DAT_BuildingsState::instance.buildings[_buildingID].someUID; + = DAT_BuildingsState::instance.buildings[_buildingID].uidPlaced; } } } diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp index 0aff6e2a..b252d01f 100644 --- a/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp @@ -15,8 +15,8 @@ namespace Map { { for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { - DAT_BuildingsState::instance.buildings[_buildingID].field207_0x288 = 0; - DAT_BuildingsState::instance.buildings[_buildingID].field189_0x264 = 0; + DAT_BuildingsState::instance.buildings[_buildingID].field206_0x288 = 0; + DAT_BuildingsState::instance.buildings[_buildingID].field188_0x264 = 0; } } } diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp index 81b58c5e..a9cee13e 100644 --- a/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp @@ -15,7 +15,7 @@ namespace Map { { for (int _buildingID = 1; _buildingID < 2000; _buildingID++) { if (DAT_BuildingsState::instance.buildings[_buildingID].logicalState != ((BuildingLogicalState)0)) { - DAT_BuildingsState::instance.buildings[_buildingID].field245_0x2c6 = 0; + DAT_BuildingsState::instance.buildings[_buildingID].field244_0x2c6 = 0; } } } From 4dbcfb445931e92497fc11c148f9b2ccc9803e2d Mon Sep 17 00:00:00 2001 From: sourcehold Date: Tue, 1 Sep 2026 17:23:23 +0200 Subject: [PATCH 46/61] flush with main --- src/OpenSHC/IO/Base64EncodeInit.cpp | 19 ------------------- src/OpenSHC/IO/SwapInts.cpp | 19 +++++++++---------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/src/OpenSHC/IO/Base64EncodeInit.cpp b/src/OpenSHC/IO/Base64EncodeInit.cpp index 2a301ffc..c2783dee 100644 --- a/src/OpenSHC/IO/Base64EncodeInit.cpp +++ b/src/OpenSHC/IO/Base64EncodeInit.cpp @@ -1,4 +1,3 @@ -<<<<<<< HEAD #include "../IO.func.hpp" namespace OpenSHC { @@ -12,21 +11,3 @@ void IO::Base64EncodeInit(Base64State* state) } } -======= - -#include "OpenSHC/IO/Base64State.hpp" - -namespace OpenSHC { -namespace IO { - - // FUNCTION: STRONGHOLDCRUSADER 0x00487080 - void Base64EncodeInit(Base64State* state) - { - state->phase = 0; - *(unsigned char*)&state->carryByte = 0; - state->lineCharacterCounter = 0; - } - -} // namespace IO -} // namespace OpenSHC ->>>>>>> 29a5686e (batch 2) diff --git a/src/OpenSHC/IO/SwapInts.cpp b/src/OpenSHC/IO/SwapInts.cpp index 4e01811a..588ad7fa 100644 --- a/src/OpenSHC/IO/SwapInts.cpp +++ b/src/OpenSHC/IO/SwapInts.cpp @@ -1,15 +1,14 @@ -#include "OpenSHC/IO.hpp" +#include "../IO.func.hpp" namespace OpenSHC { -namespace IO { - // FUNCTION: STRONGHOLDCRUSADER 0x0041a740 - void SwapInts(int* param_1, int* param_2) - { - int temp; - temp = *param_1; - *param_1 = *param_2; - *param_2 = temp; - } +// FUNCTION: STRONGHOLDCRUSADER 0x0041A740 +void IO::SwapInts(undefined4* param_1, undefined4* param_2) +{ + undefined4 uVar1; + uVar1 = *param_1; + *param_1 = *param_2; + *param_2 = uVar1; } + } From f0fd6933f40473d83f81784e1043eaf9fc62531a Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 2 Sep 2026 13:12:28 +0200 Subject: [PATCH 47/61] reimplement: SHC_3BB0A8C1_0x00462150 100% --- .../Text/TextEditorState/popHelpDialogStack.cpp | 12 ++++++------ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp index 515647c7..bd3736bf 100644 --- a/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp +++ b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp @@ -1,22 +1,22 @@ #include "../TextEditorState.func.hpp" +#include + namespace OpenSHC { namespace Text { // FUNCTION: STRONGHOLDCRUSADER 0x00462150 void TextEditorState::popHelpDialogStack() { - this->currentHelpSectionID = this->helpSectionHistoryStack[0]; - for (int iVar1 = 29; iVar1 != 0; iVar1 = iVar1 + -1) { - this->helpSectionHistoryStack[iVar1] = this->helpSectionHistoryStack[iVar1 + 1]; - } + int iVar1 = this->helpSectionHistoryStack[0]; + memcpy(&this->helpSectionHistoryStack[0], &this->helpSectionHistoryStack[1], 29 * sizeof(int)); this->helpSectionHistoryStack[29] = -1; - if (this->helpSectionHistoryStack[0] == -1) { + this->currentHelpSectionID = iVar1; + if (iVar1 == -1) { MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::closeHelpDialogAndReturnToMenu, this)(); return; } MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::loadAndLayoutHelpContent, this)(); - return; } } diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index aae3e3f9..15e5de11 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -18893,7 +18893,7 @@ SHC_3BB0A8C1_0x00461F90 | 0.0% | Pending SHC_3BB0A8C1_0x004620F0 | 0.0% | Pending -SHC_3BB0A8C1_0x00462150 | 27.0% | Stuck +SHC_3BB0A8C1_0x00462150 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00462190 | 0.0% | Pending From 2a9d5564e73dda19f81137b5c71f413928eac8df Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 2 Sep 2026 13:15:32 +0200 Subject: [PATCH 48/61] reimplement: 100% --- src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp | 2 +- .../Text/TextEditorState/getPrevHelpColorEntryIndex.cpp | 2 +- src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp | 6 +++--- src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp index 97a1d36e..44394e1c 100644 --- a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp +++ b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp @@ -15,7 +15,7 @@ namespace Text { } _entry++; } - return (char*)NULL; + return NULL; } } diff --git a/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp index e9211db5..f74f38be 100644 --- a/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp +++ b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp @@ -15,7 +15,7 @@ namespace Text { int iVar1 = param_1 + -1; if (iVar1 < 0) { iVar1 = 0; - while (DAT_UserHelpDefinedData::instance.field6_0x7a16c[iVar1].name_0x0 != (char*)0x0) { + while (DAT_UserHelpDefinedData::instance.field6_0x7a16c[iVar1].name_0x0 != NULL) { iVar1++; } iVar1 = iVar1 + -1; diff --git a/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp index ce480bbf..3c3cb27e 100644 --- a/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp +++ b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp @@ -9,17 +9,17 @@ namespace Text { using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x0045F580 - undefined4 TextEditorState::loadAndParseHelpFile(char const* param_1) + BOOLEnum TextEditorState::loadAndParseHelpFile(char const* param_1) { FILE* _File = (FILE*)MACRO_CALL_MEMBER(OpenSHC::Text::TextEditorState_Func::readCrusaderHelpHlp, this)(param_1); if (_File != (FILE*)0x0) { MACRO_CALL(OpenSHC::OS_Func::_fclose)(_File); // fixme: I thought I could return the comparison directly, but that produces different bytecode. if (this->helpSectionParseSucceeded != FALSE) { - return 1; + return TRUE; } } - return 0; + return FALSE; } } diff --git a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp index b0e53ddd..0269f1c6 100644 --- a/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp +++ b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp @@ -11,7 +11,6 @@ namespace Text { this->dialogContentY = param_2; this->dialogContentHeight = param_3; this->dialogContentWidth = param_4; - return; } } From b666f9fcc2ce21c636fa03d7d0f5789bf78585c8 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Wed, 2 Sep 2026 13:40:11 +0200 Subject: [PATCH 49/61] remove WideCharMultiByteState --- .../multiByteToWideCharThunk.cpp | 22 ------------- .../multiByteToWideCharThunk2.cpp | 27 --------------- .../wideCharToByteUnk.cpp | 33 ------------------- .../wideCharToMultiByteWithSize.cpp | 26 --------------- 4 files changed, 108 deletions(-) delete mode 100644 src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp delete mode 100644 src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp delete mode 100644 src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp delete mode 100644 src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp diff --git a/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp b/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp deleted file mode 100644 index 7fdc8e6d..00000000 --- a/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" - -#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" - -namespace OpenSHC { -namespace Util { - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0046B140 - void WideCharMultiByteState::multiByteToWideCharThunk(LPWSTR param_1, LPCSTR param_2, int param_3) - - { - MultiByteToWideChar(DAT_TextManagerObject::instance.codePage, 1, param_2, param_3, param_1, param_3); - param_1[param_3] = L'\0'; - return; - } - -} -} diff --git a/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp b/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp deleted file mode 100644 index 50a98516..00000000 --- a/src/OpenSHC/Util/WideCharMultiByteState/multiByteToWideCharThunk2.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" - -#include "OpenSHC/Globals/MSVC_SecurityCookie.hpp" - -namespace OpenSHC { -namespace Util { - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0046B1B0 - void WideCharMultiByteState::multiByteToWideCharThunk2(char const param_1) - - { - WCHAR local_18[10]; - uint local_4; - - local_4 = MSVC_SecurityCookie::instance ^ (uint)local_18; - MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::multiByteToWideCharThunk, this)( - local_18, ¶m_1, 1); - ; - return; - } - -} -} diff --git a/src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp b/src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp deleted file mode 100644 index 6cba9c37..00000000 --- a/src/OpenSHC/Util/WideCharMultiByteState/wideCharToByteUnk.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" - - - -#include "OpenSHC/Globals/MSVC_SecurityCookie.hpp" - -namespace OpenSHC { -namespace Util { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0046B170 -char WideCharMultiByteState::wideCharToByteUnk(WCHAR wideChar) - -{ -uint _securityValue; -char _byteBuffer [12]; - -_securityValue = MSVC_SecurityCookie::instance ^ (uint)_byteBuffer; -MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, this)(_byteBuffer, &wideChar, 1); -; -return _byteBuffer[0]; -} - - -} -} \ No newline at end of file diff --git a/src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp b/src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp deleted file mode 100644 index b3c6bf5c..00000000 --- a/src/OpenSHC/Util/WideCharMultiByteState/wideCharToMultiByteWithSize.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" - -#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" - -namespace OpenSHC { -namespace Util { - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x0046B110 - int WideCharMultiByteState::wideCharToMultiByteWithSize( - LPSTR lpMultiByteStr, LPWSTR lpWideCharStr, int numOfSymbols) - - { - int _numOfBytesWritten; - - _numOfBytesWritten = WideCharToMultiByte(DAT_TextManagerObject::instance.codePage, 0, lpWideCharStr, - numOfSymbols, lpMultiByteStr, numOfSymbols, (CHAR*)0x0, (BOOL*)0x0); - lpMultiByteStr[numOfSymbols] = '\0'; - return _numOfBytesWritten; - } - -} -} From 05d7133612d2c9d0ee18ab379b49666b41457b24 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 3 Sep 2026 22:07:17 +0200 Subject: [PATCH 50/61] reimplement: 100% --- .../exitToScenarioDescriptionMenu.cpp | 35 +++--------- .../Game/GameCore/getAreWeInAInGameMenu.cpp | 2 +- .../Game/GameCore/isGameHaltingMenuOpen.cpp | 55 +++++++------------ .../Game/GameCore/setTabToSwitchTo.cpp | 1 + .../switchToScenarioDescriptionMenuView.cpp | 30 +++------- src/OpenSHC/Util/Timing/Stopwatch/stop.cpp | 41 +++++--------- 6 files changed, 53 insertions(+), 111 deletions(-) diff --git a/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp b/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp index f594e089..6d905a65 100644 --- a/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp +++ b/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp @@ -1,36 +1,19 @@ #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" - - - - namespace OpenSHC { namespace Game { -using OpenSHC::UI::Enums::MenuViewType; - + using OpenSHC::UI::Enums::MenuViewType; -/* - Exits the current game view back to the scenario description screen. Calls - Game::GameCore::removeLadyAndJester, clears field25_0x64 on GameCore, then switches to - MVT_SCENARIO_DESCRIPTION via switchToMenuView. Likely triggered by a cancel or back button in a - pre-game UI screen. - - renamed by: Claude Sonnet 4.6 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x00471A80 + void GameCore::exitToScenarioDescriptionMenu() + { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::removeLadyAndJester, this)(); + this->field22_0x64 = 0; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, this)( + OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00471A80 -void GameCore::exitToScenarioDescriptionMenu() - -{ -MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::removeLadyAndJester, this)(); -this->field22_0x64 = 0; -MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, this)(OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp b/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp index 53bd2e20..04c91ee0 100644 --- a/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp +++ b/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp @@ -1,4 +1,4 @@ -#include "..\GameCore.func.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" namespace OpenSHC { namespace Game { diff --git a/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp b/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp index c09a4c47..db40763f 100644 --- a/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp +++ b/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp @@ -1,49 +1,32 @@ #include "OpenSHC/Game/GameCore.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Game/GameMode.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" #include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Game { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::Game::GameMode; -using OpenSHC::UI::Enums::MenuModalType; - - -/* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ + using OpenSHC::Game::GameMode; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0046BD20 + BOOLEnum GameCore::isGameHaltingMenuOpen() + { + if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) + && (DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { + return FALSE; + } + if (DAT_MenuTextInputState::instance.currentModalDialog != OpenSHC::UI::Enums::MMT_NO_MENU) { + return TRUE; + } + return ( + uint)(DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_IN_GAME_HELP_TEXT); + } -/* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0046BD20 -BOOLEnum GameCore::isGameHaltingMenuOpen() - -{ -if ((DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SOLITARY) && -(DAT_GameSynchronyState::instance.currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { -return FALSE; } -if (DAT_MenuTextInputState::instance.currentModalDialog != OpenSHC::UI::Enums::MMT_NO_MENU) { -return TRUE; -} -return (uint)(DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_IN_GAME_HELP_TEXT); -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp b/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp index b1b3fb84..9a93c254 100644 --- a/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp +++ b/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp @@ -5,6 +5,7 @@ namespace OpenSHC { namespace Game { using OpenSHC::UI::Enums::MenuViewType; + // FUNCTION: STRONGHOLDCRUSADER 0x0046B300 void GameCore::setTabToSwitchTo() { diff --git a/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp b/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp index 664b0009..8e2bf467 100644 --- a/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp +++ b/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp @@ -1,31 +1,19 @@ #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" - - - - namespace OpenSHC { namespace Game { -using OpenSHC::UI::Enums::MenuViewType; - + using OpenSHC::UI::Enums::MenuViewType; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004719E0 + void GameCore::switchToScenarioDescriptionMenuView() + { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::removeJesterAndLadyUnitsInCertainMissions, this)(); + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, this)( + OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); + this->field22_0x64 = 0; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004719E0 -void GameCore::switchToScenarioDescriptionMenuView() - -{ -MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::removeJesterAndLadyUnitsInCertainMissions, this)(); -MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, this)(OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); -this->field22_0x64 = 0; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp b/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp index 34fa73a3..13999878 100644 --- a/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp +++ b/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp @@ -1,38 +1,25 @@ #include "OpenSHC/Util/Timing/Stopwatch.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Util { -namespace Timing { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + namespace Timing { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x0046CEF0 + void Stopwatch::stop() + { + DWORD _currentTime; -// FUNCTION: STRONGHOLDCRUSADER 0x0046CEF0 -void Stopwatch::stop() - -{ -DWORD _currentTime; - -if (this->running_0x4 != FALSE) { -_currentTime = timeGetTime(); -this->stopTime_0xc = _currentTime; -this->running_0x4 = FALSE; -this->duration_0x0 = _currentTime - this->startTime_0x8; -} -return; -} - + if (this->running_0x4 != FALSE) { + _currentTime = timeGetTime(); + this->stopTime_0xc = _currentTime; + this->running_0x4 = FALSE; + this->duration_0x0 = _currentTime - this->startTime_0x8; + } + } + } } } -} \ No newline at end of file From 834e05795e537b238b3c62cf64d6c6daa36a7033 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 3 Sep 2026 22:34:56 +0200 Subject: [PATCH 51/61] reimplement: 100% --- .../clearGameCommandEntry.cpp | 39 ++++---------- ...ompressOrCreateLengthPrefixedPacketUnk.cpp | 36 +++---------- .../computeSomeHashOnUnitArray.cpp | 4 +- .../decompressTooLongPacketData.cpp | 18 +------ .../throttledMultiplayerSyncUpdate.cpp | 52 +++++-------------- ...ActionHandler_Chat_SendMessageToPlayer.cpp | 23 +------- ...eNetworkServiceProvider_ModemTableRows.cpp | 1 - ...ndler_FindingNetworkSessions_TableRows.cpp | 1 - 8 files changed, 36 insertions(+), 138 deletions(-) diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp index 4fdb9dc2..779e44e0 100644 --- a/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp +++ b/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp @@ -1,40 +1,19 @@ -#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/IO/LowLevelMemory.func.hpp" - - +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Synchrony { + // FUNCTION: STRONGHOLDCRUSADER 0x004800B0 + void GameSynchronyState::clearGameCommandEntry(int gameCommandID) + { + if (gameCommandID < 200) { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x4f8, '\0', (void*)((int)(this->DAT_GameCommandArray + gameCommandID))); + } + } - - -/* - 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 0x004800B0 -void GameSynchronyState::clearGameCommandEntry(int gameCommandID) - -{ -if (gameCommandID < 200) { -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x4f8, '\0', (void *)((int)( -this->DAT_GameCommandArray + gameCommandID))); } -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp index 2346daf5..8c5d4c48 100644 --- a/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp +++ b/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp @@ -1,39 +1,19 @@ -#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/IO/DecoderState.func.hpp" - - +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Globals/DAT_DecoderState.hpp" namespace OpenSHC { namespace Synchrony { + // FUNCTION: STRONGHOLDCRUSADER 0x0047E7E0 + int GameSynchronyState::compressOrCreateLengthPrefixedPacketUnk(int size, char* src, void* dst) + { + int iVar1; + iVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::DecoderState_Func::compressRLE, DAT_DecoderState::ptr)(src, dst, size); + return iVar1; + } - -/* - 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 0x0047E7E0 -int GameSynchronyState::compressOrCreateLengthPrefixedPacketUnk(int size,char *src,void *dst) - -{ -int iVar1; - -iVar1 = MACRO_CALL_MEMBER(OpenSHC::IO::DecoderState_Func::compressRLE, DAT_DecoderState::ptr)(src, dst, size); -return iVar1; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp index 0ce2b524..30e1c1b4 100644 --- a/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp +++ b/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp @@ -10,8 +10,8 @@ namespace Synchrony { // FUNCTION: STRONGHOLDCRUSADER 0x0047EEB0 int GameSynchronyState::computeSomeHashOnUnitArray() { - return (int)(MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::DirectionAlgorithmState_Func::computeHash, - DAT_DirectionAlgorithmState::ptr)(2920000, (int*)((int)(DAT_UnitsState::instance.units)))); + return MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::DirectionAlgorithmState_Func::computeHash, + DAT_DirectionAlgorithmState::ptr)(2920000, (int*)((int)(DAT_UnitsState::instance.units))); } } diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp index 57aab2fd..ae3c59f2 100644 --- a/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp +++ b/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp @@ -8,29 +8,13 @@ namespace OpenSHC { namespace Synchrony { - /* - 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 0x0047E800 void GameSynchronyState::decompressTooLongPacketData(byte* source, byte* destination) - { - size_t _size; - - _size = MACRO_CALL_MEMBER(OpenSHC::IO::DecoderState_Func::decompressRLE, DAT_DecoderState::ptr)( + size_t _size = MACRO_CALL_MEMBER(OpenSHC::IO::DecoderState_Func::decompressRLE, DAT_DecoderState::ptr)( (char*)source, (char*)((int)(this->DAT_PacketDecodingDestination))); MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::copyData, DAT_LowLevelMemory::ptr)( _size, (void*)((int)(this->DAT_PacketDecodingDestination)), destination); - return; } } diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp index 8a991e05..83e76539 100644 --- a/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp +++ b/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp @@ -1,47 +1,23 @@ #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Game/GameMode.hpp" - - - - namespace OpenSHC { namespace Synchrony { -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 - */ + using OpenSHC::Game::GameMode; + + // FUNCTION: STRONGHOLDCRUSADER 0x00490340 + void GameSynchronyState::throttledMultiplayerSyncUpdate() + { + if ((this->currentGameMode != OpenSHC::Game::GM_SOLITARY) + && (this->currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { + DWORD _now = timeGetTime(); + if (10 < _now - this->field309_0x109e94) { + this->field309_0x109e94 = _now; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::sendPeriodicSyncMessages, this)(); + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x00490340 -void GameSynchronyState::throttledMultiplayerSyncUpdate() - -{ -DWORD DVar1; - -if ((this->currentGameMode != OpenSHC::Game::GM_SOLITARY) && -(this->currentGameMode != OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER)) { -DVar1 = timeGetTime(); -if (10 < DVar1 - this->field309_0x109e94) { -this->field309_0x109e94 = DVar1; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::sendPeriodicSyncMessages, this)(); -return; -} } -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp b/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp index 12d37461..a28f3020 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp @@ -4,34 +4,15 @@ namespace OpenSHC { -/* - 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 0x0047FFA0 void UI::MenuItemActionHandler_Chat_SendMessageToPlayer(int param_1, ...) - { - uint* puVar1; - if (param_1 < 0) { - puVar1 = (uint*)((int)DAT_GameSynchronyState::ptr + param_1 * -4 + 0x109264); - *puVar1 = *puVar1 ^ 1; - DAT_GameSynchronyState::instance - .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 1; - return; + unsigned int param = -param_1; + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[param] ^= 1; } DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 1; - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp index 1d46e798..0e13a97e 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -6,7 +6,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0047D0E0 void UI::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows(int param_1, ...) - { if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 < DAT_GameSynchronyState::instance.modemScrollbarCount) { diff --git a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp index 0cac54c2..551207c0 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp @@ -6,7 +6,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x0047D3F0 void UI::MenuItemActionHandler_FindingNetworkSessions_TableRows(int param_1, ...) - { if (DAT_GameSynchronyState::instance.scrollBarItemOffset + param_1 < DAT_GameSynchronyState::instance.DPLAY_SessionsCount) { From b363b36c5ac4ef75c5f801c2de123dc6055be68b Mon Sep 17 00:00:00 2001 From: sourcehold Date: Thu, 3 Sep 2026 22:53:45 +0200 Subject: [PATCH 52/61] reimplement: 100% --- .../PathFindingState/clearAllClimbData.cpp | 43 +++++----------- .../PathFindingState/clearClimbData.cpp | 30 ++++------- .../retraceAndCommitPathPlan.cpp | 38 +++++--------- ...hLinkageLayerForEachBuildingAtEachTile.cpp | 43 +++++----------- src/OpenSHC/Synchrony/ProgressBarRelated.cpp | 22 +++----- ...eSpeedAndResourceLackDisplayElementUnk.cpp | 39 +++++---------- src/OpenSHC/UI/FindDisplayElementWithID.cpp | 33 ++++-------- ...ayElementByIDAndSetForUnlimitedDisplay.cpp | 50 +++++++------------ .../GetIfDisplayElementStateNotZero.cpp | 44 ++++++---------- .../MinimapViewState/triggerMinimapRedraw.cpp | 35 ++++--------- .../RenderInGameChatDisplayElement.cpp | 2 +- .../RenderNoTreeGrowthTextDisplayElement.cpp | 29 ++++------- .../RenderResourceMissing1DisplayElement.cpp | 26 +++------- .../RenderResourceMissing2DisplayElement.cpp | 26 +++------- .../RenderUnknownDisplayElement7.cpp | 30 ++++------- .../TogglePlayerPingDisplayElementUnk.cpp | 42 +++++----------- .../UI/ShowProgressBarSaveLoadDialog.cpp | 15 +----- 17 files changed, 167 insertions(+), 380 deletions(-) diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp index 73d91dff..29a8fb67 100644 --- a/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp +++ b/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp @@ -1,37 +1,18 @@ #include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" - - - - namespace OpenSHC { namespace Map { -namespace Navigation { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004A94E0 -void PathFindingState::clearAllClimbData() - -{ -int iVar1; - -iVar1 = 0; -this->numberOfClimbTeleports = 0; -do { -MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::clearClimbData, this)(iVar1); -iVar1 = iVar1 + 1; -} while (iVar1 < 200); -return; -} - - + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x004A94E0 + void PathFindingState::clearAllClimbData() + { + this->numberOfClimbTeleports = 0; + for (int iVar1 = 0; iVar1 < 200; iVar1++) { + MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::clearClimbData, this)(iVar1); + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp index 702cb07b..5d537d9d 100644 --- a/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp +++ b/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp @@ -1,31 +1,19 @@ -#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" #include "OpenSHC/IO/LowLevelMemory.func.hpp" - - +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { -namespace Navigation { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004A4B80 -void PathFindingState::clearClimbData(int param_1) - -{ -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(0x204, '\0', (void *)((int)(this->climbData + param_1))); -return; -} + namespace Navigation { + // FUNCTION: STRONGHOLDCRUSADER 0x004A4B80 + void PathFindingState::clearClimbData(int param_1) + { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x204, 0, &this->climbData[param_1]); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp index 0c836dbd..592967e9 100644 --- a/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp +++ b/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp @@ -1,32 +1,18 @@ #include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" - - - - namespace OpenSHC { namespace Map { -namespace Navigation { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004A9DD0 -undefined4 PathFindingState::retraceAndCommitPathPlan() - -{ -this->searchQueue.pathPlanIndex = 0; -MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::traceAndCommitPathPlan, this)(this->unitX, (uint)((int)(this->unitY)), (uint)((int)( -this->destinationX)), (uint)((int)(this->destinationY)), 0); -return this->searchQueue.pathPlanIndex; -} - - + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x004A9DD0 + undefined4 PathFindingState::retraceAndCommitPathPlan() + { + this->searchQueue.pathPlanIndex = 0; + MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::traceAndCommitPathPlan, this)( + this->unitX, this->unitY, this->destinationX, this->destinationY, 0); + return this->searchQueue.pathPlanIndex; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp index 2d83068c..4004e28f 100644 --- a/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp +++ b/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp @@ -1,38 +1,21 @@ #include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" - - #include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" namespace OpenSHC { namespace Map { -namespace Navigation { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004A5F60 -void PathFindingState::updatePathLinkageLayerForEachBuildingAtEachTile() - -{ -int _tileIndex; - -_tileIndex = 0; -do { -MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::updatePathLinkageLayerBasedOnBuildingsUnk, this)( -(int)DAT_ViewportRenderState::instance.tileTranslationMatrix_YComponent[_tileIndex], _tileIndex) -; -_tileIndex = _tileIndex + 1; -} while (_tileIndex < 80400); -return; -} - - + namespace Navigation { + + // FUNCTION: STRONGHOLDCRUSADER 0x004A5F60 + void PathFindingState::updatePathLinkageLayerForEachBuildingAtEachTile() + { + for (int _tileIndex = 0; _tileIndex < 80400; _tileIndex++) { + MACRO_CALL_MEMBER( + OpenSHC::Map::Navigation::PathFindingState_Func::updatePathLinkageLayerBasedOnBuildingsUnk, this)( + DAT_ViewportRenderState::instance.tileTranslationMatrix_YComponent[_tileIndex], _tileIndex); + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Synchrony/ProgressBarRelated.cpp b/src/OpenSHC/Synchrony/ProgressBarRelated.cpp index 787654d5..854198c8 100644 --- a/src/OpenSHC/Synchrony/ProgressBarRelated.cpp +++ b/src/OpenSHC/Synchrony/ProgressBarRelated.cpp @@ -1,9 +1,7 @@ #include "OpenSHC/Synchrony.func.hpp" +#include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" -#include "OpenSHC/UI.func.hpp" - - #include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" #include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" @@ -12,21 +10,13 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00495840 void Synchrony::ProgressBarRelated() - { -DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 0x1f; -MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog2, DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX); -MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic)(0); -return; + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 0x1f; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog2, DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX); + MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic)(0); } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp b/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp index 72e08258..a6811fe1 100644 --- a/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp +++ b/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp @@ -1,38 +1,23 @@ #include "OpenSHC/UI.func.hpp" -#include "OpenSHC/UI/Enums/DisplayElementID.hpp" #include "OpenSHC/UI/DisplayElement.hpp" - - - - +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" namespace OpenSHC { -using OpenSHC::UI::Enums::DisplayElementID; using OpenSHC::UI::DisplayElement; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - +using OpenSHC::UI::Enums::DisplayElementID; // FUNCTION: STRONGHOLDCRUSADER 0x004AF680 -void UI::ActivateGameSpeedAndResourceLackDisplayElementUnk(DisplayElementID elementId,dword elementState,int displayDuration) - +void UI::ActivateGameSpeedAndResourceLackDisplayElementUnk( + DisplayElementID elementId, dword elementState, int displayDuration) { -DisplayElement *_displayElementPtr; -DWORD _currentTime; - -_displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(elementId); -if (_displayElementPtr != (DisplayElement *)0x0) { -_displayElementPtr->elementStateUnk_0xc = elementState; -_displayElementPtr->displayDuration_0x14 = displayDuration; -_currentTime = timeGetTime(); -_displayElementPtr->activationTime_0x10 = _currentTime; -} -return; + DisplayElement* _displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(elementId); + if (_displayElementPtr != (DisplayElement*)0x0) { + _displayElementPtr->elementStateUnk_0xc = elementState; + _displayElementPtr->displayDuration_0x14 = displayDuration; + DWORD _currentTime = timeGetTime(); + _displayElementPtr->activationTime_0x10 = _currentTime; + } } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/FindDisplayElementWithID.cpp b/src/OpenSHC/UI/FindDisplayElementWithID.cpp index 4611351e..37151423 100644 --- a/src/OpenSHC/UI/FindDisplayElementWithID.cpp +++ b/src/OpenSHC/UI/FindDisplayElementWithID.cpp @@ -1,37 +1,22 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/DisplayElement.hpp" - - #include "OpenSHC/Globals/DAT_PointerToDisplayElementStackTop.hpp" namespace OpenSHC { using OpenSHC::UI::DisplayElement; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AF630 -DisplayElement * UI::FindDisplayElementWithID(int elementID) - +DisplayElement* UI::FindDisplayElementWithID(int elementID) { -DisplayElement *pDVar1; -DisplayElement *_displayElementPtrUnk; - -pDVar1 = DAT_PointerToDisplayElementStackTop::instance; -while( true ) { -if (pDVar1 == (DisplayElement *)0x0) { -return (DisplayElement *)0x0; -} -if (pDVar1->elementID_0x8 == elementID) break; -pDVar1 = pDVar1->nextDisplayElement_0x20; -} -return pDVar1; + DisplayElement* _pCurrent = DAT_PointerToDisplayElementStackTop::instance; + while (_pCurrent != NULL) { + if (_pCurrent->elementID_0x8 == elementID) + return _pCurrent; + _pCurrent = _pCurrent->nextDisplayElement_0x20; + } + return NULL; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp b/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp index a8dd3683..ec8e1b5f 100644 --- a/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp +++ b/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp @@ -1,43 +1,31 @@ +#include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/UI/Enums/DisplayElementID.hpp" #include "OpenSHC/UI/DisplayElement.hpp" -#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/BOOL_RelatedToInitialGranaryAndKeepPlacement.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::UI::Enums::DisplayElementID; -using OpenSHC::UI::DisplayElement; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::UI::DisplayElement; + using OpenSHC::UI::Enums::DisplayElementID; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004AF650 + void Helpers::CheckDisplayElementByIDAndSetForUnlimitedDisplay( + DisplayElementID displayElementID, dword elementState) + { + DisplayElement* _displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); + if (_displayElementPtr != NULL) { + if (_displayElementPtr->elementStateUnk_0xc != elementState) { + BOOL_RelatedToInitialGranaryAndKeepPlacement::instance = FALSE; + } + _displayElementPtr->elementStateUnk_0xc = elementState; + _displayElementPtr->displayDuration_0x14 = -1; + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004AF650 -void Helpers::CheckDisplayElementByIDAndSetForUnlimitedDisplay(DisplayElementID displayElementID,dword elementState) - -{ -DisplayElement *_displayElementPtr; - -_displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); -if (_displayElementPtr != (DisplayElement *)0x0) { -if (_displayElementPtr->elementStateUnk_0xc != elementState) { -BOOL_RelatedToInitialGranaryAndKeepPlacement::instance = FALSE; -} -_displayElementPtr->elementStateUnk_0xc = elementState; -_displayElementPtr->displayDuration_0x14 = -1; } -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp b/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp index 27d402db..0430c33d 100644 --- a/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp +++ b/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp @@ -1,39 +1,25 @@ +#include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" -#include "OpenSHC/UI/Enums/DisplayElementID.hpp" #include "OpenSHC/UI/DisplayElement.hpp" -#include "OpenSHC/UI.func.hpp" - - - - +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::UI::Enums::DisplayElementID; -using OpenSHC::UI::DisplayElement; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::UI::DisplayElement; + using OpenSHC::UI::Enums::DisplayElementID; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -// FUNCTION: STRONGHOLDCRUSADER 0x004AF6E0 -BOOLEnum Helpers::GetIfDisplayElementStateNotZero(DisplayElementID displayElementID) + // FUNCTION: STRONGHOLDCRUSADER 0x004AF6E0 + BOOLEnum Helpers::GetIfDisplayElementStateNotZero(DisplayElementID displayElementID) + { + DisplayElement* _displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); + if (_displayElementPtr != NULL) { + return _displayElementPtr->elementStateUnk_0xc != 0; + } + return FALSE; + } -{ -DisplayElement *_displayElementPtr; - -_displayElementPtr = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); -if (_displayElementPtr != (DisplayElement *)0x0) { -return (uint)(_displayElementPtr->elementStateUnk_0xc != 0); -} -return FALSE; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp b/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp index 849abcfa..9aa825b1 100644 --- a/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp +++ b/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp @@ -1,33 +1,18 @@ #include "OpenSHC/UI/MinimapViewState.func.hpp" - - - - namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004B5300 + void MinimapViewState::triggerMinimapRedraw() + { + if (this->field14_0x38 == 0) { + this->field13_0x34 = 0; + this->field14_0x38 = 2; + return; + } + this->field14_0x38 = 1; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004B5300 -void MinimapViewState::triggerMinimapRedraw() - -{ -if (this->field14_0x38 == 0) { -this->field13_0x34 = 0; -this->field14_0x38 = 2; -return; } -this->field14_0x38 = 1; -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp index 1b0d4f7f..d2aa7267 100644 --- a/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp +++ b/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp @@ -10,7 +10,7 @@ namespace UI { void Rendering::RenderInGameChatDisplayElement(int posX, int posY, DWORD elementState) { MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::renderInGameChat, DAT_GameSynchronyState::ptr)( - posX, posY, (int)((int)(elementState))); + posX, posY, elementState); } } diff --git a/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp index 0e1cb9aa..541dafd0 100644 --- a/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp +++ b/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp @@ -1,32 +1,23 @@ -#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_TextManagerObject.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::Text::TextAlignment; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004AFB00 + void Rendering::RenderNoTreeGrowthTextDisplayElement(int posX, int posY, DWORD elementState) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_No_tree_growth_005a779c, posX, posY, OpenSHC::Text::TTA_LEFT, 0x80ff, 0, 0x11, FALSE, 0); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004AFB00 -void Rendering::RenderNoTreeGrowthTextDisplayElement(int posX,int posY,DWORD elementState) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)("No tree growth", posX, posY, OpenSHC::Text::TTA_LEFT, 0x80ff, 0, 0x11, FALSE, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp index e5c9acd7..22cb9bc0 100644 --- a/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp +++ b/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp @@ -1,29 +1,17 @@ -#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Audio/MissingResourceState.func.hpp" - - +#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Globals/DAT_MissingResourceState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004AF820 + void Rendering::RenderResourceMissing1DisplayElement(int posX, int posY, DWORD elementState) + { + MACRO_CALL_MEMBER(OpenSHC::Audio::MissingResourceState_Func::renderResourceMissingText, + DAT_MissingResourceState::ptr)(posX, posY, elementState, 1); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004AF820 -void Rendering::RenderResourceMissing1DisplayElement(int posX,int posY,DWORD elementState) - -{ -MACRO_CALL_MEMBER(OpenSHC::Audio::MissingResourceState_Func::renderResourceMissingText, DAT_MissingResourceState::ptr)(posX, posY, (dword)((int)(elementState)), 1); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp index 190e5f65..22dc85ab 100644 --- a/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp +++ b/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp @@ -1,29 +1,17 @@ -#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Audio/MissingResourceState.func.hpp" - - +#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Globals/DAT_MissingResourceState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004AF840 + void Rendering::RenderResourceMissing2DisplayElement(int posX, int posY, DWORD elementState) + { + MACRO_CALL_MEMBER(OpenSHC::Audio::MissingResourceState_Func::renderResourceMissingText, + DAT_MissingResourceState::ptr)(posX, posY, elementState, 2); + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004AF840 -void Rendering::RenderResourceMissing2DisplayElement(int posX,int posY,DWORD elementState) - -{ -MACRO_CALL_MEMBER(OpenSHC::Audio::MissingResourceState_Func::renderResourceMissingText, DAT_MissingResourceState::ptr)(posX, posY, (dword)((int)(elementState)), 2); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp b/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp index 7bcefa82..46a413ef 100644 --- a/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp +++ b/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp @@ -1,34 +1,24 @@ -#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Text/TextAlignment.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_TextManagerObject.hpp" #include "OpenSHC/Globals/DAT_UnknownStopwatch.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::Text::TextAlignment; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004AFA50 + void Rendering::RenderUnknownDisplayElement7(int posX, int posY, DWORD elementState) + { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_UnknownStopwatch::instance.duration_0x0, posX, posY + 5, OpenSHC::Text::TTA_RIGHT, 0x80ff, 0, 0xf, + FALSE, 0); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004AFA50 -void Rendering::RenderUnknownDisplayElement7(int posX,int posY,DWORD elementState) - -{ -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(DAT_UnknownStopwatch::instance.duration_0x0, posX, posY + 5, OpenSHC::Text::TTA_RIGHT, 0x80ff -, 0, 0xf, FALSE, 0); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp b/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp index cbd26b1d..0d27d5b9 100644 --- a/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp +++ b/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp @@ -1,39 +1,23 @@ +#include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering.func.hpp" -#include "OpenSHC/UI/Enums/DisplayElementID.hpp" #include "OpenSHC/UI/DisplayElement.hpp" -#include "OpenSHC/UI.func.hpp" - - - - +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" namespace OpenSHC { namespace UI { -using OpenSHC::UI::Enums::DisplayElementID; -using OpenSHC::UI::DisplayElement; + using OpenSHC::UI::DisplayElement; + using OpenSHC::UI::Enums::DisplayElementID; + // FUNCTION: STRONGHOLDCRUSADER 0x004AF6B0 + void Rendering::TogglePlayerPingDisplayElementUnk(DisplayElementID displayElementID, uint toggleValue) + { + DisplayElement* _displayElement = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); + if (_displayElement != NULL) { + _displayElement->displayDuration_0x14 = -1; + _displayElement->elementStateUnk_0xc = _displayElement->elementStateUnk_0xc != 0 ? 0 : toggleValue; + } + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004AF6B0 -void Rendering::TogglePlayerPingDisplayElementUnk(DisplayElementID displayElementID,uint toggleValue) - -{ -DisplayElement *_displayElement; - -_displayElement = MACRO_CALL(OpenSHC::UI_Func::FindDisplayElementWithID)(displayElementID); -if (_displayElement != (DisplayElement *)0x0) { -_displayElement->displayDuration_0x14 = -1; -_displayElement->elementStateUnk_0xc = -~-(uint)(_displayElement->elementStateUnk_0xc != 0) &toggleValue; } -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp b/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp index 2b060622..87a3a5f4 100644 --- a/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp +++ b/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp @@ -9,25 +9,14 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; -/* - Sets DAT_MenuOptionsActionParameter to a value derived from param_1 (0x20 or 0x2e), activates the - MMT_PROGRESS_BAR_BOX modal dialog and immediately calls - MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic(0). Entry point for triggering - the save/load progress bar UI. - - renamed by: Claude Sonnet 4.6 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00495800 void UI::ShowProgressBarSaveLoadDialog(int param_1) - { - DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = (-(uint)(param_1 != 0) & 0xe) + 0x20; + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = (param_1 != 0 ? 0xe : 0) + 0x20; MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog2, DAT_MenuModalComposition1::ptr)( OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX); - DAT_MenuModalComposition1::instance.activeModalDialogID = OpenSHC::UI::Enums::MMT_PROGRESS_BAR_BOX; + DAT_MenuModalComposition1::instance.activeModalDialogID = Enums::MMT_PROGRESS_BAR_BOX; MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic)(0); - return; } } From 9e10eb8a2441353153f20a7203068dfac8823538 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Fri, 4 Sep 2026 23:32:22 +0200 Subject: [PATCH 53/61] reimplement: 100% --- .../isMercRecruitableForBuildingType.cpp | 36 +++++------------- .../isValueInRangeOneToTwenty.cpp | 2 +- ...SelectionMoveInstructionNoMatchedSpeed.cpp | 10 +---- .../playNextStoredBinkVideo.cpp | 1 - .../setMapPropertyDependingOnMapSize.cpp | 37 ++++++------------- .../setTileColorsDependingOnMapSize.cpp | 36 +++++------------- 6 files changed, 34 insertions(+), 88 deletions(-) diff --git a/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp b/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp index d9e86f66..7579a35f 100644 --- a/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp @@ -1,38 +1,22 @@ #include "OpenSHC/Map/MapPropertiesState.func.hpp" #include "OpenSHC/Game/GameMode2.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Game::GameMode2; - - -/* - Returns 1 always in editor mode. Otherwise returns SEC_MercRecruitable[param_1 - 0x38] from - MapPropertiesState, indicating whether the mercenary unit type associated with this building - offset is recruitable in the current map configuration. - - renamed by: Claude Sonnet 4.6 - */ - + using OpenSHC::Game::GameMode2; -// FUNCTION: STRONGHOLDCRUSADER 0x004BB0B0 -int MapPropertiesState::isMercRecruitableForBuildingType(int param_1) + // FUNCTION: STRONGHOLDCRUSADER 0x004BB0B0 + int MapPropertiesState::isMercRecruitableForBuildingType(int param_1) + { + int iVar1 = 1; + if (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_EDITOR) { + iVar1 = ((short*)&this->field10_0x520)[param_1]; + } + return iVar1; + } -{ -int iVar1; - -iVar1 = 1; -if (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_EDITOR) { -iVar1 = (int)this->SEC_MercRecruitable[param_1 + -0x38]; -} -return iVar1; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp b/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp index 68158533..f27b663a 100644 --- a/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp @@ -7,7 +7,7 @@ namespace Map { using OpenSHC::WindowsHelper::Enums::BOOLEnum; // FUNCTION: STRONGHOLDCRUSADER 0x004B77E0 - BOOLEnum MapPropertiesState::isValueInRangeOneToTwenty(int param_1) { return param_1 + -1 < 0x14; } + BOOLEnum MapPropertiesState::isValueInRangeOneToTwenty(int param_1) { return param_1 + -1 < 20; } } } diff --git a/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp index bf624ccb..7d5f5815 100644 --- a/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp +++ b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp @@ -7,18 +7,12 @@ namespace Map { using OpenSHC::Map::Units::Instructions::UnitMatchSpeedEnum; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004B7700 void TribesState::giveUnitSelectionMoveInstructionNoMatchedSpeed( - undefined4 tribeID, undefined4 x, undefined4 y, undefined4 rallyBool, undefined4 doRally) - + int tribeID, uint x, uint y, int rallyBool, int doRally) { MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::giveTribeMoveInstruction, this)( - tribeID, x, y, rallyBool, doRally, OpenSHC::Map::Units::Instructions::UMSE_0); - return; + tribeID, x, y, rallyBool, doRally, Units::Instructions::UMSE_0); } } diff --git a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp index d1f1154c..6957783b 100644 --- a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp +++ b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp @@ -9,7 +9,6 @@ namespace Rendering { // FUNCTION: STRONGHOLDCRUSADER 0x004C62A0 void AIMessageQueue::playNextStoredBinkVideo() - { if (this->messagePlaying_0x0 != FALSE) { MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::AIMessageQueue_Func::playNextStoredAIMessage, this)(); diff --git a/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp b/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp index 7799b8b0..761a9c96 100644 --- a/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp +++ b/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp @@ -1,36 +1,21 @@ #include "OpenSHC/UI/MinimapViewState.func.hpp" - - #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004B6640 + void MinimapViewState::setMapPropertyDependingOnMapSize(uint param_1, int param_2) + { + if (200 < DAT_TileMapState::instance.mapSize) { + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileStripWithLuminescence, this)( + 4, 2, 1, param_1, param_2); + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileStripWithLuminescence, this)( + 4, 4, 2, param_1, param_2); + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004B6640 -void MinimapViewState::setMapPropertyDependingOnMapSize(uint param_1,int param_2) - -{ -if (200 < DAT_TileMapState::instance.mapSize) { -MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileStripWithLuminescence, this)(4, 2, 1, param_1, param_2); -return; -} -MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileStripWithLuminescence, this)(4, 4, 2, param_1, param_2); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp b/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp index decb5af3..9e0acb09 100644 --- a/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp +++ b/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp @@ -1,36 +1,20 @@ #include "OpenSHC/UI/MinimapViewState.func.hpp" - - #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace UI { + // FUNCTION: STRONGHOLDCRUSADER 0x004B6680 + void MinimapViewState::setTileColorsDependingOnMapSize(int param_1, uint param_2) + { + if (200 < DAT_TileMapState::instance.mapSize) { + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileColors, this)( + 4, 2, 1, param_1, param_2); + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileColors, this)(4, 4, 2, param_1, param_2); + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004B6680 -void MinimapViewState::setTileColorsDependingOnMapSize(int param_1,uint param_2) - -{ -if (200 < DAT_TileMapState::instance.mapSize) { -MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileColors, this)(4, 2, 1, param_1, param_2); -return; -} -MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapTileColors, this)(4, 4, 2, param_1, param_2); -return; } - - } -} \ No newline at end of file From ec8d6fbe901baa872e446439fcbcf5ce8b82d72b Mon Sep 17 00:00:00 2001 From: sourcehold Date: Fri, 4 Sep 2026 23:56:47 +0200 Subject: [PATCH 54/61] reimplement: 100% --- cmake/compiler-flags-gl.txt | 2 + .../TileMapState/recountTotalOwnedMoats.cpp | 28 +++----------- .../updateMoatCountdownTimers.cpp | 38 +++---------------- 3 files changed, 13 insertions(+), 55 deletions(-) diff --git a/cmake/compiler-flags-gl.txt b/cmake/compiler-flags-gl.txt index 848d70de..5d54ae56 100644 --- a/cmake/compiler-flags-gl.txt +++ b/cmake/compiler-flags-gl.txt @@ -7,3 +7,5 @@ src/OpenSHC/IO/ResourceManager/swapMapDataWithNextMap.cpp src/OpenSHC/UI/Rendering/WindowAndDirectDraw/takeScreenshot.cpp src/OpenSHC/IO/ResourceManager/readFirstPartOfCurrentResourceIntoMemory.cpp src/OpenSHC/IO/ResourceManager/readNextPartOfCurrentResourceIntoMemory.cpp +src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp +src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp index ab9ce364..43472a4d 100644 --- a/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp +++ b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp @@ -1,34 +1,18 @@ -#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x005000A0 void TileMapState::recountTotalOwnedMoats() - { - int iVar1; - byte* pbVar2; - this->currentMoatCount = 0; - iVar1 = 1; - pbVar2 = &this->moats[1].owner; - do { - if (*pbVar2 != 0) { - this->currentMoatCount = iVar1 + 1; + for (int i = 1; i < 16000; i++) { + if (this->moats[i].owner != 0) { + // fixme: this must be wrong, but it is 100% Why not this->currentMoatCount += 1 ? + this->currentMoatCount = i + 1; } - iVar1 = iVar1 + 1; - pbVar2 = pbVar2 + 0x10; - } while (iVar1 < 16000); - return; + } } } diff --git a/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp index 31d39f2b..4934a62a 100644 --- a/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp +++ b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp @@ -1,5 +1,4 @@ -#include "../TileMapState.func.hpp" - +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Map/Moat.hpp" namespace OpenSHC { @@ -7,42 +6,15 @@ namespace Map { using OpenSHC::Map::Moat; - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00500640 void TileMapState::updateMoatCountdownTimers() - { - Moat* _pMoats; - int iVar1; - MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::recountTotalOwnedMoats, this)(); - iVar1 = 0; - /* - DAT_TotalOwnedMoats - */ - - if (0 < this->currentMoatCount) { - /* - SEC_MoatArray[0].field11_0xf - */ - - _pMoats = &this->moats[0]; - do { - if ((_pMoats->owner != 0) && ('\0' < (char)_pMoats->someCountDown)) { - _pMoats->someCountDown = _pMoats->someCountDown - 1; - } - iVar1 = iVar1 + 1; - _pMoats = _pMoats + 0x10; - } while (iVar1 < this->currentMoatCount); + for (int i = 0; i < this->currentMoatCount; i++) { + if (this->moats[i].owner != 0 && this->moats[i].someCountDown > 0) { + this->moats[i].someCountDown -= 1; + } } - return; } } From 1178bbe69530c71c0a06675c59b884ab24d685d6 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Fri, 4 Sep 2026 23:57:13 +0200 Subject: [PATCH 55/61] reimplement: 100% --- .../constructLandscapeState.cpp | 32 +++++----------- .../Map/LandscapeState/isTreeAdult.cpp | 30 +++++---------- .../isTreeAliveAndMatchingUID.cpp | 30 ++++----------- src/OpenSHC/Map/LandscapeState/resetWind.cpp | 33 +++++----------- .../upgradeTreesAndRocksForMapVersion.cpp | 38 +++++++------------ .../Map/TileMapState/clearMoatData.cpp | 22 +++-------- .../Map/TileMapState/resetMoatArray.cpp | 28 +++----------- .../Map/TileMapState/resetPitchDitchArray.cpp | 26 ++----------- .../setMoatOwnerForAllMatching.cpp | 27 +++---------- .../TileMapState/setMoatVisualStateAtTile.cpp | 18 ++------- .../Map/TileMapState/toggleFlatView.cpp | 2 +- src/OpenSHC/Map/Trees/UpdateTree16.cpp | 33 ++++------------ .../Version/UpgradeRemoveRocksBeyond1000.cpp | 34 +++++------------ .../createFloatingTextElement.cpp | 9 +---- .../ViewportRenderState/focusOnCoordinate.cpp | 2 +- .../resetBatchedRender.cpp | 7 +--- 16 files changed, 94 insertions(+), 277 deletions(-) diff --git a/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp b/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp index b7e95a8d..383c8b95 100644 --- a/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp +++ b/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp @@ -1,32 +1,20 @@ #include "OpenSHC/Map/LandscapeState.func.hpp" #include "OpenSHC/Map/LandscapeState.hpp" - - - - namespace OpenSHC { namespace Map { -using OpenSHC::Map::LandscapeState; - + using OpenSHC::Map::LandscapeState; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004F3930 + LandscapeState* LandscapeState::constructLandscapeState() + { + this->creationTime = timeGetTime(); + MACRO_CALL_MEMBER(OpenSHC::Map::LandscapeState_Func::clearRocksAndTrees, this)(); + MACRO_CALL_MEMBER(OpenSHC::Map::LandscapeState_Func::resetWind, this)(); + this->field1_0x4 = 1; + return this; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004F3930 -LandscapeState * LandscapeState::constructLandscapeState() - -{ -this->creationTime = timeGetTime(); -MACRO_CALL_MEMBER(OpenSHC::Map::LandscapeState_Func::clearRocksAndTrees, this)(); -MACRO_CALL_MEMBER(OpenSHC::Map::LandscapeState_Func::resetWind, this)(); -this->field1_0x4 = 1; -return this; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp b/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp index e04be0b2..fb765ba1 100644 --- a/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp +++ b/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp @@ -1,31 +1,19 @@ #include "OpenSHC/Map/LandscapeState.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace Map { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004F2FE0 + BOOLEnum LandscapeState::isTreeAdult(int treeID, int treeUID) + { + if (this->trees[treeID].uid != treeUID) { + return FALSE; + } + return 0 < (short)this->trees[treeID].treeAdultHoodStageRelatedVisual3; + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004F2FE0 -BOOLEnum LandscapeState::isTreeAdult(int treeID,int treeUID) - -{ -if (this->trees[treeID].uid != treeUID) { -return FALSE; -} -return (uint)(0 < (short)this->trees[treeID].treeAdultHoodStageRelatedVisual3); } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp b/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp index 6d1e9847..96f3cd01 100644 --- a/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp +++ b/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp @@ -1,30 +1,16 @@ #include "OpenSHC/Map/LandscapeState.func.hpp" - - - - namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x004F2FB0 + uint LandscapeState::isTreeAliveAndMatchingUID(int treeID, int param_2) + { + if (this->trees[treeID].uid != param_2) { + return FALSE; + } + return this->trees[treeID].zeroUpTo2 == 0; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004F2FB0 -uint LandscapeState::isTreeAliveAndMatchingUID(int treeID,int param_2) - -{ -if (this->trees[treeID].uid != param_2) { -return 0; } -return (uint)(this->trees[treeID].zeroUpTo2 == 0); -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/resetWind.cpp b/src/OpenSHC/Map/LandscapeState/resetWind.cpp index 3e16ffef..d7c186a3 100644 --- a/src/OpenSHC/Map/LandscapeState/resetWind.cpp +++ b/src/OpenSHC/Map/LandscapeState/resetWind.cpp @@ -1,32 +1,17 @@ #include "OpenSHC/Map/LandscapeState.func.hpp" - - - - namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x004F3700 + void LandscapeState::resetWind() + { + this->wind.value = 0; + this->wind.index = 0; + this->wind.countdown = 0; + this->wind.field4_0x10 = 0; + this->wind.counter = 0; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004F3700 -void LandscapeState::resetWind() - -{ -this->wind.value = 0; -this->wind.index = 0; -this->wind.countdown = 0; -this->wind.field4_0x10 = 0; -this->wind.counter = 0; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp b/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp index 68a814b3..c041bcb9 100644 --- a/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp +++ b/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp @@ -1,35 +1,23 @@ #include "OpenSHC/Map/LandscapeState.func.hpp" -#include "OpenSHC/IO/PackagedFileMagicNum.hpp" #include "OpenSHC/Map/Version.func.hpp" - - - - +#include "OpenSHC/IO/PackagedFileMagicNum.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::IO::PackagedFileMagicNum; + using OpenSHC::IO::PackagedFileMagicNum; + // FUNCTION: STRONGHOLDCRUSADER 0x004F3D30 + void LandscapeState::upgradeTreesAndRocksForMapVersion( + PackagedFileMagicNum receivedMapVersion, PackagedFileMagicNum packagerMapVersion) + { + MACRO_CALL(OpenSHC::Map::Version_Func::UpdateTreesOfCertainTypes)(); + MACRO_CALL(OpenSHC::Map::Version_Func::UpdateFixTrees2)(); + MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeRemoveCertainRockTypesUnk)(); + if ((receivedMapVersion != packagerMapVersion) && ((int)receivedMapVersion < 0xa5)) { + MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeRemoveRocksBeyond1000)(); + } + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004F3D30 -void LandscapeState::upgradeTreesAndRocksForMapVersion(PackagedFileMagicNum receivedMapVersion,PackagedFileMagicNum packagerMapVersion) - -{ -MACRO_CALL(OpenSHC::Map::Version_Func::UpdateTreesOfCertainTypes)(); -MACRO_CALL(OpenSHC::Map::Version_Func::UpdateFixTrees2)(); -MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeRemoveCertainRockTypesUnk)(); -if ((receivedMapVersion != packagerMapVersion) && ((int)receivedMapVersion < 0xa5)) { -MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeRemoveRocksBeyond1000)(); } -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/TileMapState/clearMoatData.cpp b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp index 7893c1e7..464b6140 100644 --- a/src/OpenSHC/Map/TileMapState/clearMoatData.cpp +++ b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp @@ -1,30 +1,20 @@ -#include "../TileMapState.func.hpp" - #include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x005002D0 void TileMapState::clearMoatData(uint moatID) - { - if (moatID < 16000) { - MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( - 0x10, '\0', (void*)((int)(this->moats + moatID))); - this->moatTileCount = this->moatTileCount + -1; + if (moatID > 15999) { + return; } - return; + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x10, 0, &this->moats[moatID]); + this->moatTileCount -= 1; } } diff --git a/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp index 7ae9775c..5e1aaa02 100644 --- a/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp +++ b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp @@ -1,6 +1,5 @@ -#include "../TileMapState.func.hpp" - #include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Map/Moat.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" @@ -10,31 +9,14 @@ namespace Map { using OpenSHC::Map::Moat; - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00500680 void TileMapState::resetMoatArray() - { - Moat* destination; - int iVar1; - - destination = this->moats; - iVar1 = 16000; - do { + for (int i = 0; i < 16000; i++) { MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( - 0x10, '\0', (void*)((int)(destination))); - destination = destination + 1; - iVar1 = iVar1 + -1; - } while (iVar1 != 0); - this->moatTileCount = iVar1; - return; + 0x10, 0, &this->moats[i]); + } + this->moatTileCount = 0; } } diff --git a/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp index 9c7455a1..d2a39514 100644 --- a/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp +++ b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp @@ -1,6 +1,5 @@ -#include "../TileMapState.func.hpp" - #include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Map/PitchDitch.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" @@ -10,31 +9,14 @@ namespace Map { using OpenSHC::Map::PitchDitch; - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x005007D0 void TileMapState::resetPitchDitchArray() - { - PitchDitch* destination; - int iVar1; - - iVar1 = 4000; this->maxPitchDitchCount = 4000; - destination = this->pitchDitches; - do { + for (int i = 0; i < 4000; i++) { MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( - 0x14, '\0', (void*)((int)(destination))); - destination = destination + 1; - iVar1 = iVar1 + -1; - } while (iVar1 != 0); - return; + 0x14, 0, &this->pitchDitches[i]); + } } } diff --git a/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp index 53fcef63..142f0f4e 100644 --- a/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp +++ b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp @@ -1,33 +1,16 @@ -#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00500750 void TileMapState::setMoatOwnerForAllMatching(int param_1, undefined4 param_2) - { - byte* pbVar1; - int iVar2; - - pbVar1 = &this->moats[1].owner; - iVar2 = 15999; - do { - if ((*pbVar1 != 0) && ((char)*pbVar1 == param_1)) { - *pbVar1 = (byte)param_2; + for (int i = 1; i < 16000; i++) { + if (this->moats[i].owner != 0 && this->moats[i].owner == param_1) { + this->moats[i].owner = param_2; } - pbVar1 = pbVar1 + 0x10; - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - return; + } } } diff --git a/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp index 0471e800..87ca49d4 100644 --- a/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp +++ b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp @@ -1,27 +1,15 @@ -#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00500720 void TileMapState::setMoatVisualStateAtTile(int tile, undefined4 zeroOrTwo) - { - int iVar1; - - iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::returnOwnedMoatAtTile, this)(tile); + int iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::returnOwnedMoatAtTile, this)(tile); if (iVar1 != 0) { - this->moats[iVar1].zeroOrTwo = (short)zeroOrTwo; + this->moats[iVar1].zeroOrTwo = zeroOrTwo; } - return; } } diff --git a/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp b/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp index 1a08ba51..becb2628 100644 --- a/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp +++ b/src/OpenSHC/Map/TileMapState/toggleFlatView.cpp @@ -1,4 +1,4 @@ -#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Trees/UpdateTree16.cpp b/src/OpenSHC/Map/Trees/UpdateTree16.cpp index 75a81034..38fa7a94 100644 --- a/src/OpenSHC/Map/Trees/UpdateTree16.cpp +++ b/src/OpenSHC/Map/Trees/UpdateTree16.cpp @@ -1,35 +1,18 @@ #include "OpenSHC/Map/Trees.func.hpp" - - -#include "OpenSHC/Globals/DAT_LandscapeState.hpp" #include "OpenSHC/Globals/DAT_CurrentTreeID.hpp" +#include "OpenSHC/Globals/DAT_LandscapeState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x004F28F0 + void Trees::UpdateTree16() + { + int iVar2 = (DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].rng1 & 7U) + 10; + DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].animationFrameUnk = iVar2; + DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].animationFrame2Unk = iVar2; + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x004F28F0 -void Trees::UpdateTree16() - -{ -int iVar1; -int iVar2; - -iVar1 = DAT_CurrentTreeID::instance; -iVar2 = (DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].rng1 &7U) + 10; -DAT_LandscapeState::instance.trees[DAT_CurrentTreeID::instance].animationFrameUnk = iVar2; -DAT_LandscapeState::instance.trees[iVar1].animationFrame2Unk = iVar2; -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp b/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp index 8b907c81..2ae7d8c8 100644 --- a/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp +++ b/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp @@ -1,8 +1,6 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" #include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Map/Rocks/Rock.hpp" -#include "OpenSHC/IO/LowLevelMemory.func.hpp" - - #include "OpenSHC/Globals/DAT_LandscapeState.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" @@ -10,28 +8,16 @@ namespace OpenSHC { namespace Map { -using OpenSHC::Map::Rocks::Rock; - + using OpenSHC::Map::Rocks::Rock; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x004F3900 + void Version::UpgradeRemoveRocksBeyond1000() + { + for (int i = 2000; i < 4000; i += 1) { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 32, 0, &DAT_LandscapeState::instance.rocks[i]); + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x004F3900 -void Version::UpgradeRemoveRocksBeyond1000() - -{ -Rock *destination; - -destination = DAT_LandscapeState::instance.rocks + 2000; -do { -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(32, '\0', (void *)((int)(destination))); -destination = destination + 1; -} while ((int)destination < 0xf98330); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp index 0acff3e4..a790f02a 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp @@ -1,5 +1,4 @@ -#include "../ViewportRenderState.func.hpp" - +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" #include "OpenSHC/IO/Graphics/GmID.hpp" namespace OpenSHC { @@ -7,17 +6,11 @@ namespace Rendering { using OpenSHC::IO::Graphics::GmID; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004E8CC0 void ViewportRenderState::createFloatingTextElement(int param_1, int param_2, int param_3, int param_4, int param_5) - { MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, this)( OpenSHC::IO::Graphics::GID_FLOATS, param_1, param_2, param_3, param_4, param_5); - return; } } diff --git a/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp b/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp index 04999c0a..a2a9c1d2 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/focusOnCoordinate.cpp @@ -1,4 +1,4 @@ -#include "../ViewportRenderState.func.hpp" +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp index 2b5e2419..e11881f1 100644 --- a/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp @@ -1,15 +1,10 @@ -#include "../ViewportRenderState.func.hpp" +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" namespace OpenSHC { namespace Rendering { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004E2600 int ViewportRenderState::resetBatchedRender() - { this->unitBatchedRenderCounterUntil6 = 1; this->unitRender1 = 0; From 3c75f776bf081819e12d697f0686c0b76142ec92 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sat, 5 Sep 2026 00:17:30 +0200 Subject: [PATCH 56/61] reimplement: 100% --- .../TileMapState/forceFullTileMapRedraw.cpp | 12 +--- .../processMapOrientationChange.cpp | 12 +--- .../spreadBrazierPlacementAlgorithm.cpp | 13 +---- .../spreadFlagPlacementAlgorithm.cpp | 20 +------ ...updateBuildingPlacementRotationPreview.cpp | 19 +------ .../attackInfoHasArch2Building.cpp | 51 ++++++----------- .../attackInfoHasHigh2Building.cpp | 55 +++++++----------- .../clearAIInfoLayerOutsideStartZone.cpp | 54 ++++++------------ .../getTileInTargetedBuildingTiles.cpp | 56 +++++++------------ .../TroopValueState/isAttackWaveComplete.cpp | 53 ++++++------------ .../Version/UpgradeMapLogicToVersion_125.cpp | 44 ++++----------- .../Version/UpgradeMapLogicToVersion_147.cpp | 44 ++++----------- .../resetWallAndPitchState.cpp | 41 +++++--------- .../resetWallPlacementInfo.cpp | 41 +++++--------- 14 files changed, 149 insertions(+), 366 deletions(-) diff --git a/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp index 8d2acfea..50d53018 100644 --- a/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp +++ b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp @@ -1,25 +1,15 @@ -#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x005017A0 void TileMapState::forceFullTileMapRedraw() - { this->forceUpdateLogicalAndMiscDisplayLayers = 1; this->forceUpdateTextureTilemap = 1; this->forceUpdateGFXLayers = 1; MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::setChangedLayerToThreeAndMapping0x40x40, this)(); - return; } } diff --git a/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp index 9d6e47a7..c7d16dd4 100644 --- a/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp +++ b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp @@ -1,26 +1,16 @@ -#include "../TileMapState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00512920 void TileMapState::processMapOrientationChange() - { if (this->DAT_FutureMapOrientation < 8) { MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::changeMapOrientation, this)( this->DAT_FutureMapOrientation); this->DAT_FutureMapOrientation = 8; } - return; } } diff --git a/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp index 2b217727..3c163739 100644 --- a/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp +++ b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp @@ -1,27 +1,16 @@ -#include "../TileMapState.func.hpp" - #include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Globals/DAT_PathFindingState.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x005011A0 void TileMapState::spreadBrazierPlacementAlgorithm(int playerID, uint x, uint y) - { MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, DAT_PathFindingState::ptr)(playerID, x, y, 4, 1); - return; } } diff --git a/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp index cc8e9e6f..5080c550 100644 --- a/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp +++ b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp @@ -1,30 +1,16 @@ -#include "../TileMapState.func.hpp" - #include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/Globals/DAT_PathFindingState.hpp" namespace OpenSHC { namespace Map { - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00501180 int TileMapState::spreadFlagPlacementAlgorithm(int param_1, uint param_2, uint param_3) - { - int iVar1; - - iVar1 - = MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, - DAT_PathFindingState::ptr)(param_1, param_2, param_3, 4, 0); - return iVar1; + return MACRO_CALL_MEMBER(OpenSHC::Map::Navigation::PathFindingState_Func::spreadAlgorithmForFlagsAndBraziersUnk, + DAT_PathFindingState::ptr)(param_1, param_2, param_3, 4, 0); } } diff --git a/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp index c38d23f1..922487ac 100644 --- a/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp +++ b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp @@ -1,5 +1,4 @@ -#include "../TileMapState.func.hpp" - +#include "OpenSHC/Map/TileMapState.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { @@ -7,25 +6,13 @@ namespace Map { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00504EE0 void TileMapState::updateBuildingPlacementRotationPreview(int param_1, int param_2) - { - BOOLEnum BVar1; - - BVar1 = this->buildingPlacementFail; + BOOLEnum _previous = this->buildingPlacementFail; this->buildingPlacementFail = FALSE; MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::determineBuildingPlacementRotation, this)(param_1, param_2); - this->buildingPlacementFail = BVar1; - return; + this->buildingPlacementFail = _previous; } } diff --git a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp index c90efce6..36f3a053 100644 --- a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp +++ b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp @@ -1,42 +1,23 @@ #include "OpenSHC/Map/Units/TroopValueState.func.hpp" - - - +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0051ACB0 -undefined4 TroopValueState::attackInfoHasArch2Building(int buildingID) - -{ -int *piVar1; - -piVar1 = &this->attackInfo.arch2ValuesArray[0].buildingID; -do { -if (buildingID == *piVar1) { -return(undefined4)( 1); -} -piVar1 = piVar1 + 4; -} while ((int)piVar1 < 0x177e994); -return(undefined4)( 0); -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0051ACB0 + undefined4 TroopValueState::attackInfoHasArch2Building(int buildingID) + { + for (int i = 0; i < 1000; i++) { + // fixme: this function doesn't use this-> (would be not 100% matching!) + if (buildingID == DAT_TroopValueState::instance.attackInfo.arch2ValuesArray[i].buildingID) { + return TRUE; + } + } + return FALSE; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp index 4d3ead85..20b5eb7b 100644 --- a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp +++ b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp @@ -2,44 +2,27 @@ #include "OpenSHC/Map/AttackInfoSubArrayElement1.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Map::AttackInfoSubArrayElement1; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0051AC80 -BOOLEnum TroopValueState::attackInfoHasHigh2Building(int buildingID) - -{ -AttackInfoSubArrayElement1 * piVar1; - -piVar1 = &this->attackInfo.high2ValuesArray[0]; -do { -if (buildingID == piVar1->buildingID) { -return TRUE; -} -piVar1 = piVar1 + 4; -} while ((int)piVar1 < 0x177aaf8); -return FALSE; -} - - + namespace Units { + + using OpenSHC::Map::AttackInfoSubArrayElement1; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0051AC80 + BOOLEnum TroopValueState::attackInfoHasHigh2Building(int buildingID) + { + for (int i = 0; i < 1000; i++) { + // fixme: this function doesn't use this-> (would be not 100% matching!) + if (buildingID == DAT_TroopValueState::instance.attackInfo.high2ValuesArray[i].buildingID) { + return TRUE; + } + } + return FALSE; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp b/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp index 4fd4950b..ae97ac88 100644 --- a/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp +++ b/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp @@ -1,45 +1,25 @@ #include "OpenSHC/Map/Units/TroopValueState.func.hpp" - - #include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0051B680 -void TroopValueState::clearAIInfoLayerOutsideStartZone() - -{ -int iVar1; -int iVar2; - -iVar1 = this->attackInfo.startCon; -iVar2 = 0; -do { -if ((DAT_TileMapState::instance.AIInfoLayer[iVar2] != '\0') && -((short)DAT_TileMapState::instance.PathConnectionLayer[iVar2] != iVar1)) { -DAT_TileMapState::instance.AIInfoLayer[iVar2] = '\0'; -} -iVar2 = iVar2 + 1; -} while (iVar2 < 0x13a10); -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0051B680 + void TroopValueState::clearAIInfoLayerOutsideStartZone() + { + // fixme: this function doesn't use this-> (would be not 100% matching!) + int area = DAT_TroopValueState::instance.attackInfo.startCon; + for (int iVar2 = 0; iVar2 < 80400; iVar2++) { + if ((DAT_TileMapState::instance.AIInfoLayer[iVar2] != '\0') + && ((short)DAT_TileMapState::instance.PathConnectionLayer[iVar2] != area)) { + DAT_TileMapState::instance.AIInfoLayer[iVar2] = '\0'; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp b/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp index c83528f9..1a80ac4f 100644 --- a/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp +++ b/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp @@ -1,45 +1,27 @@ #include "OpenSHC/Map/Units/TroopValueState.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00519960 -BOOLEnum TroopValueState::getTileInTargetedBuildingTiles(int tile) - -{ -int _index; - -_index = 0; -if (0 < this->attackInfo.targetedBuildingTilesArraySize) { -do { -if (this->attackInfo.targetedBuildingTilesArray[_index] == tile) { -return TRUE; -} -_index = _index + 1; -} while (_index < this->attackInfo.targetedBuildingTilesArraySize); -} -return FALSE; -} - - + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00519960 + BOOLEnum TroopValueState::getTileInTargetedBuildingTiles(int tile) + { + // fixme: this function doesn't use this-> (would be not 100% matching!) + for (int _index = 0; _index < DAT_TroopValueState::instance.attackInfo.targetedBuildingTilesArraySize; + _index++) { + if (DAT_TroopValueState::instance.attackInfo.targetedBuildingTilesArray[_index] == tile) { + return TRUE; + } + } + return FALSE; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp b/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp index 551cae7d..e9e02ceb 100644 --- a/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp +++ b/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp @@ -1,43 +1,24 @@ #include "OpenSHC/Map/Units/TroopValueState.func.hpp" - - - +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00518350 -undefined4 TroopValueState::isAttackWaveComplete() - -{ -int iVar1; - -iVar1 = 0; -while ((this->attackInfo.nof_tribes[iVar1] == 0 || -(this->attackInfo.value3Array01[iVar1] == 6))) { -iVar1 = iVar1 + 1; -if (0x31 < iVar1) { -return(undefined4)( 1); -} -} -return(undefined4)( 0); -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00518350 + undefined4 TroopValueState::isAttackWaveComplete() + { + for (int i = 0; i < 50; i++) { + // fixme: this function doesn't use this-> (would be not 100% matching!) + if ((DAT_TroopValueState::instance.attackInfo.nof_tribes[i] != 0 + && (DAT_TroopValueState::instance.attackInfo.value3Array01[i] != 6))) { + return FALSE; + } + } + return TRUE; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp index 3ffaae5e..0aeb79a9 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp @@ -1,43 +1,21 @@ #include "OpenSHC/Map/Version.func.hpp" - - #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x005011C0 + void Version::UpgradeMapLogicToVersion_125() + { + for (int i = 0; i < 80400; i++) { + if (DAT_TileMapState::instance.HeightLayer[i] == 80) { + DAT_TileMapState::instance.Logic2Layer[i] = 4; + } else if (DAT_TileMapState::instance.HeightLayer[i] == 130) { + DAT_TileMapState::instance.Logic2Layer[i] = 8; + } + } + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x005011C0 -void Version::UpgradeMapLogicToVersion_125() - -{ -int iVar1; - -iVar1 = 0; -do { -if (DAT_TileMapState::instance.HeightLayer[iVar1] == 80) { -DAT_TileMapState::instance.Logic2Layer[iVar1] = 4; -} -else if (DAT_TileMapState::instance.HeightLayer[iVar1] == 130) { -DAT_TileMapState::instance.Logic2Layer[iVar1] = 8; } -iVar1 = iVar1 + 1; -} while (iVar1 < 0x13a10); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp index 6cbc1ef1..61632162 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp @@ -1,43 +1,21 @@ #include "OpenSHC/Map/Version.func.hpp" - - #include "OpenSHC/Globals/DAT_TileMapState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00501730 + void Version::UpgradeMapLogicToVersion_147() + { + for (int _tile = 0; _tile < 80400; _tile++) { + if (156 < DAT_TileMapState::instance.DefaultHeightLayer[_tile]) { + DAT_TileMapState::instance.HeightLayer[_tile] = DAT_TileMapState::instance.HeightLayer[_tile] + + (156 - DAT_TileMapState::instance.DefaultHeightLayer[_tile]); + DAT_TileMapState::instance.DefaultHeightLayer[_tile] = 156; + } + } + } - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00501730 -void Version::UpgradeMapLogicToVersion_147() - -{ -int _tile; - -_tile = 0; -do { -if (156 < DAT_TileMapState::instance.DefaultHeightLayer[_tile]) { -DAT_TileMapState::instance.HeightLayer[_tile] = -DAT_TileMapState::instance.HeightLayer[_tile] + (156 - DAT_TileMapState::instance.DefaultHeightLayer[_tile]) -; -DAT_TileMapState::instance.DefaultHeightLayer[_tile] = 156; } -_tile = _tile + 1; -} while (_tile < 80400); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp b/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp index cb46a796..3f6880b1 100644 --- a/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp +++ b/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp @@ -2,38 +2,27 @@ #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_UIDragDropDefinedData.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Game::GameMode2; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Game::GameMode2; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00500C80 + void WallAndPitchState::resetWallAndPitchState() + { + if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) + && (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { + this->state = 4; + this->countdown = 400; + this->index = 0; + this->counter = 0; + DAT_UIDragDropDefinedData::instance.MenuView_TriggerInitial = TRUE; + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x00500C80 -void WallAndPitchState::resetWallAndPitchState() - -{ -if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) && -(DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { -this->state = 4; -this->countdown = 400; -this->index = 0; -this->counter = 0; -DAT_UIDragDropDefinedData::instance.MenuView_TriggerInitial = TRUE; -} -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp b/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp index 61680df7..c6e948e7 100644 --- a/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp +++ b/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp @@ -2,38 +2,27 @@ #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_UIDragDropDefinedData.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Game::GameMode2; -using OpenSHC::WindowsHelper::Enums::BOOLEnum; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Game::GameMode2; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00500D30 + void WallAndPitchState::resetWallPlacementInfo() + { + if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) + && (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { + this->state = 3; + this->countdown = 400; + this->index = 0; + this->counter = 0; + DAT_UIDragDropDefinedData::instance.MenuView_TriggerInitial = TRUE; + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x00500D30 -void WallAndPitchState::resetWallPlacementInfo() - -{ -if ((DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) && -(DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SIEGE_THAT)) { -this->state = 3; -this->countdown = 400; -this->index = 0; -this->counter = 0; -DAT_UIDragDropDefinedData::instance.MenuView_TriggerInitial = TRUE; -} -return; } - - } -} \ No newline at end of file From 6189fe2948f0fa5ea1da449a2056e7ba6bd2270f Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sat, 5 Sep 2026 01:39:18 +0200 Subject: [PATCH 57/61] reimplement: 100% --- .../TribesState/Constructor_TribesState.cpp | 22 ++++++++ .../Units/TribesState/addUnitToSelected.cpp | 40 ++++----------- .../Map/Units/TribesState/clearTribe.cpp | 30 ++++------- .../TribesState/playPatrolCommandSpeech.cpp | 6 --- .../TribesState/playUnitSelectSpeech.cpp | 12 +---- .../TribesState/playWorkCommandSpeech.cpp | 16 ++---- .../Map/Units/TribesState/queueUnitStance.cpp | 39 ++++----------- .../reassignOwnerForTribesOfBehaviorType2.cpp | 45 +++++------------ .../Map/Units/TribesState/setCamelSpawnXY.cpp | 45 ++++++----------- .../Map/Units/TribesState/setUnitStance.cpp | 29 ++++------- .../setWhetherTribeContainsAnyUnits.cpp | 50 ++++++------------- .../TribesState/storeDeerXAndYinMapInfo.cpp | 45 ++++++----------- .../TribesState/storeLionXAndYInMapInfo.cpp | 48 +++++++----------- .../TribesState/tribeCorrespondsWithUID.cpp | 38 +++++--------- 14 files changed, 150 insertions(+), 315 deletions(-) create mode 100644 src/OpenSHC/Map/Units/TribesState/Constructor_TribesState.cpp diff --git a/src/OpenSHC/Map/Units/TribesState/Constructor_TribesState.cpp b/src/OpenSHC/Map/Units/TribesState/Constructor_TribesState.cpp new file mode 100644 index 00000000..233e2d31 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/Constructor_TribesState.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::TribesState; + + // FUNCTION: STRONGHOLDCRUSADER 0x00521180 + TribesState* TribesState::Constructor_TribesState() + { + this->constructorTime = timeGetTime(); + this->clans = 0; + this->fcn_mtribe = 0; + this->field2_0x8 = 1; + return this; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp index a846a614..fa80c643 100644 --- a/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp +++ b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp @@ -1,42 +1,22 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - #include "OpenSHC/Globals/DAT_UnitSelectionDefinedData.hpp" #include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x00522520 + void TribesState::addUnitToSelected(uint unitID) + { + int index; -// FUNCTION: STRONGHOLDCRUSADER 0x00522520 -void TribesState::addUnitToSelected(uint unitID) - -{ -uint uVar1; - -uVar1 = unitID &0x8000000f; -if ((int)uVar1 < 0) { -uVar1 = (uVar1 - 1 | 0xfffffff0) + 1; -} -*(ushort *) -(DAT_UnitsState::instance.selectedUnitsBitFlags + ((int)(unitID + ((int)unitID >> 0x1f &0xfU)) >> 4) * 2) -= *(ushort *) -(DAT_UnitsState::instance.selectedUnitsBitFlags + -((int)(unitID + ((int)unitID >> 0x1f &0xfU)) >> 4) * 2) | -DAT_UnitSelectionDefinedData::instance.BitMaskHelper[uVar1]; -return; -} - + index = (int)unitID / 16; + *(ushort*)(DAT_UnitsState::instance.selectedUnitsBitFlags + index * 2) + |= DAT_UnitSelectionDefinedData::instance.BitMaskHelper[(int)unitID % 16]; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp index 31128f24..e04c9d28 100644 --- a/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp +++ b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp @@ -1,31 +1,19 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/IO/LowLevelMemory.func.hpp" - - +#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00522BC0 -void TribesState::clearTribe(int param_1) - -{ -MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(820, '\0', (void *)((int)(this->tribes + param_1))); -return; -} + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x00522BC0 + void TribesState::clearTribe(int param_1) + { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 820, 0, &this->tribes[param_1]); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp index 8566ec2e..114155c3 100644 --- a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp @@ -12,13 +12,8 @@ namespace Map { using OpenSHC::Map::Units::UnitType; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00522110 void TribesState::playPatrolCommandSpeech(undefined4 param_1) - { UnitType unitType; int actionID; @@ -30,7 +25,6 @@ namespace Map { param_1, (int*)¶m_1); MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( unitType, actionID); - return; } } diff --git a/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp index 56c7299b..13d00210 100644 --- a/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp @@ -12,22 +12,14 @@ namespace Map { using OpenSHC::Map::Units::UnitType; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00521EB0 void TribesState::playUnitSelectSpeech(undefined4 param_1) - { - UnitType unitType; - MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( 1); - unitType = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( - param_1, (int*)¶m_1); + UnitType unitType = MACRO_CALL_MEMBER( + OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)(param_1, (int*)¶m_1); MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)(unitType, 0xb); - return; } } diff --git a/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp index 0d55b8e9..5483f07b 100644 --- a/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp @@ -12,25 +12,15 @@ namespace Map { using OpenSHC::Map::Units::UnitType; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00522160 void TribesState::playWorkCommandSpeech(undefined4 param_1) - { - UnitType unitType; - int actionID; - MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( 1); - actionID = 0x24; - unitType = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( - param_1, (int*)¶m_1); MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( - unitType, actionID); - return; + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( + param_1, (int*)¶m_1), + 0x24); } } diff --git a/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp index 3e3c3784..bd736140 100644 --- a/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp +++ b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp @@ -2,41 +2,24 @@ #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Commands::GameCommandType; - - -/* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ + namespace Units { -/* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ + using OpenSHC::Commands::GameCommandType; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00522BF0 -void TribesState::queueUnitStance(undefined4 stanceID,undefined4 param_2) - -{ -DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = stanceID; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_UNIT_STANCE); -return; -} + // FUNCTION: STRONGHOLDCRUSADER 0x00522BF0 + void TribesState::queueUnitStance(undefined4 stanceID, undefined4 param_2) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = stanceID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_UNIT_STANCE); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp index bad249b1..5944ec7d 100644 --- a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp +++ b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp @@ -1,38 +1,19 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - - - namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00521210 -void TribesState::reassignOwnerForTribesOfBehaviorType2(int param_1,int param_2) - -{ -int *piVar1; - -piVar1 = &this->tribes[1].owner; -do { -if ((*(short *)(piVar1 + 5) == 2) && (*piVar1 == param_1)) { -*piVar1 = param_2; -} -piVar1 = piVar1 + 0xcd; -} while ((int)piVar1 < 0x176238c); -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00521210 + void TribesState::reassignOwnerForTribesOfBehaviorType2(int param_1, int param_2) + { + for (int i = 1; i < 1250; i++) { + if (this->tribes[i].tribeState == 2 && this->tribes[i].owner == param_1) { + this->tribes[i].owner = param_2; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp index 516695d0..9dc34213 100644 --- a/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp +++ b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp @@ -1,39 +1,22 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - #include "OpenSHC/Globals/DAT_GameState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x005233E0 -void TribesState::setCamelSpawnXY(undefined4 x,undefined4 y) - -{ -short (*pasVar1) [2]; - -pasVar1 = DAT_GameState::instance.mapAndTime.camelSpawnXY; -do { -if ((*pasVar1)[0] == 0) { -(*pasVar1)[0] = (short)x; -(*pasVar1)[1] = (short)y; -} -pasVar1 = pasVar1 + 1; -} while ((int)pasVar1 < 0x117ef30); -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x005233E0 + void TribesState::setCamelSpawnXY(undefined4 x, undefined4 y) + { + for (int i = 0; i < 4; i++) { + if (DAT_GameState::instance.mapAndTime.camelSpawnXY[i][0] == 0) { + DAT_GameState::instance.mapAndTime.camelSpawnXY[i][0] = x; + DAT_GameState::instance.mapAndTime.camelSpawnXY[i][1] = y; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp index 2ade4fe8..b931d072 100644 --- a/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp +++ b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp @@ -1,32 +1,21 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Map/Units/Behavior/UnitStanceEnum.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Map::Units::Behavior::UnitStanceEnum; - + namespace Units { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00522C20 -void TribesState::setUnitStance(int tribeID,UnitStanceEnum unitStance) - -{ -this->tribes[tribeID].unitStance = (undefined2)unitStance; -DAT_GameCore::instance.countdown = 1; -return; -} + using OpenSHC::Map::Units::Behavior::UnitStanceEnum; + // FUNCTION: STRONGHOLDCRUSADER 0x00522C20 + void TribesState::setUnitStance(int tribeID, UnitStanceEnum unitStance) + { + this->tribes[tribeID].unitStance = unitStance; + DAT_GameCore::instance.countdown = 1; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp index 3ee4e147..f9c200d8 100644 --- a/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp +++ b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp @@ -1,42 +1,20 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - - - namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x005224E0 -int TribesState::setWhetherTribeContainsAnyUnits(int tribeID) - -{ -int iVar1; -short *psVar2; - -iVar1 = 0; -psVar2 = this->tribes[tribeID].unitSelectionBitMasked; -do { -if (*psVar2 != 0) { -this->tribes[tribeID].highestID = (short)iVar1; -return iVar1; -} -iVar1 = iVar1 + 1; -psVar2 = psVar2 + 1; -} while (iVar1 < 200); -return iVar1; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x005224E0 + void TribesState::setWhetherTribeContainsAnyUnits(int tribeID) + { + for (int iVar1 = 0; iVar1 < 200; iVar1++) { + if (this->tribes[tribeID].unitSelectionBitMasked[iVar1] != 0) { + this->tribes[tribeID].highestID = iVar1; + return; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp index fd9346fd..fa297da7 100644 --- a/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp +++ b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp @@ -1,39 +1,22 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - #include "OpenSHC/Globals/DAT_GameState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00523340 -void TribesState::storeDeerXAndYinMapInfo(undefined4 x,undefined4 y) - -{ -short (*pasVar1) [2]; - -pasVar1 = DAT_GameState::instance.mapAndTime.deerSpawnLocationsXY; -do { -if ((*pasVar1)[0] == 0) { -(*pasVar1)[0] = (short)x; -(*pasVar1)[1] = (short)y; -} -pasVar1 = pasVar1 + 1; -} while ((int)pasVar1 < 0x117d1dc); -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00523340 + void TribesState::storeDeerXAndYinMapInfo(undefined4 x, undefined4 y) + { + for (int i = 0; i < 4; i++) { + if (DAT_GameState::instance.mapAndTime.deerSpawnLocationsXY[i][0] == 0) { + DAT_GameState::instance.mapAndTime.deerSpawnLocationsXY[i][0] = x; + DAT_GameState::instance.mapAndTime.deerSpawnLocationsXY[i][1] = y; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp index a4b52d42..2c27ec3b 100644 --- a/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp +++ b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp @@ -1,39 +1,25 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - +#include "OpenSHC/Map/Location/Point4ShortXY.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00523370 -void TribesState::storeLionXAndYInMapInfo(undefined4 x,undefined4 y) - -{ -short (*pasVar1) [2]; - -pasVar1 = DAT_GameState::instance.mapAndTime.field2270_0xdf0; -do { -if ((*pasVar1)[0] == 0) { -(*pasVar1)[0] = (short)x; -(*pasVar1)[1] = (short)y; -} -pasVar1 = pasVar1 + 1; -} while ((int)pasVar1 < 0x117d58c); -return; -} - - + namespace Units { + + using OpenSHC::Map::Location::Point4ShortXY; + + // FUNCTION: STRONGHOLDCRUSADER 0x00523370 + void TribesState::storeLionXAndYInMapInfo(undefined4 x, undefined4 y) + { + for (int i = 0; i < 4; i++) { + if (DAT_GameState::instance.mapAndTime.lionLocationsXY[i].x == 0) { + DAT_GameState::instance.mapAndTime.lionLocationsXY[i].x = x; + DAT_GameState::instance.mapAndTime.lionLocationsXY[i].y = y; + } + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp index ddcb5c10..d812c4dc 100644 --- a/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp +++ b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp @@ -1,32 +1,18 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" - - - - namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00522360 -uint TribesState::tribeCorrespondsWithUID(int tribeID,uint tribeUID) - -{ -if (tribeUID == 0) { -return 0; -} -return (uint)(this->tribes[tribeID].uid == tribeUID); -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00522360 + uint TribesState::tribeCorrespondsWithUID(int tribeID, uint tribeUID) + { + if (tribeUID == 0) { + return 0; + } + return this->tribes[tribeID].uid == tribeUID; + } + + } } } -} \ No newline at end of file From 7b04f19b307f3e483e9999fa4018bc2a162cf44f Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 6 Sep 2026 12:31:17 +0200 Subject: [PATCH 58/61] checkout cpp files already on main --- .../Audio/ResetGreatestLordGenieSpeechState.cpp | 2 +- .../Audio/SFX/UpdateUnitLossSpeechFeedback.cpp | 4 ++-- src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp | 4 ++-- .../mss/SoundSystem/markMusicChangePending.cpp | 2 +- .../Audio/mss/SoundSystem/setSection1079_28_4_.cpp | 4 ++-- .../Game/GameCore/getAreWeInAInGameMenu.cpp | 2 +- .../IO/DecoderBuffer/ReadBufferAndComputeHash.cpp | 2 +- .../IO/DecoderBuffer/WriteBufferAndComputeHash.cpp | 2 +- src/OpenSHC/OS/OS.cpp | 14 +++++++------- src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp | 6 +++++- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp b/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp index 1d16b204..53ff473a 100644 --- a/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp +++ b/src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp @@ -21,7 +21,7 @@ namespace OpenSHC { namespace Audio { // FUNCTION: STRONGHOLDCRUSADER 0x0044A720 - void ResetGreatestLordGenieSpeechState() + void __cdecl ResetGreatestLordGenieSpeechState() { DAT_CurrentPlayerRanking::instance = -1; INT_00b98698::instance = -1; diff --git a/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp b/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp index e5c31a35..55eb522b 100644 --- a/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp +++ b/src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp @@ -22,7 +22,7 @@ namespace Audio { namespace SFX { // FUNCTION: STRONGHOLDCRUSADER 0x0044B840 - void UpdateUnitLossSpeechFeedback() + void __stdcall UpdateUnitLossSpeechFeedback() { if (DAT_GameCore::instance.currentMenuViewType != UI::Enums::MVT_BUILD_MENU) { return; @@ -180,7 +180,7 @@ namespace Audio { } // FUNCTION: STRONGHOLDCRUSADER 0x0044AAB0 - int UpdateUnitLossSpeechFeedback_RelativeValueForGenie(int larger, int smaller) + int __cdecl UpdateUnitLossSpeechFeedback_RelativeValueForGenie(int larger, int smaller) { if (larger < 1) { larger = 1; diff --git a/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp b/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp index b7ec3f26..dfa7378a 100644 --- a/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp +++ b/src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp @@ -8,10 +8,10 @@ namespace OpenSHC { namespace Audio { namespace MSS { - void AIL_shutdown_proxy() { AIL_shutdown(); } + void __cdecl AIL_shutdown_proxy() { AIL_shutdown(); } // FUNCTION: STRONGHOLDCRUSADER 0x0057E160 - int RegisterMilesAILShutdown() + int __cdecl RegisterMilesAILShutdown() { MACRO_CALL(OS_Func::_atexit)(AIL_shutdown_proxy); return 0; diff --git a/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp b/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp index 16c08d09..b626e2db 100644 --- a/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp +++ b/src/OpenSHC/Audio/mss/SoundSystem/markMusicChangePending.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "../SoundSystem.func.hpp" namespace OpenSHC { namespace Audio { diff --git a/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp b/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp index e03a04b2..5723e377 100644 --- a/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp +++ b/src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "../SoundSystem.func.hpp" #include "OpenSHC/Globals/DAT_SoundEffectsHelperData1.hpp" @@ -9,7 +9,7 @@ namespace Audio { // FUNCTION: STRONGHOLDCRUSADER 0x0047A570 void SoundSystem::setSection1079_28_4_(int param_1) { - DAT_SoundEffectsHelperData1::instance.SEC_Section1079.field7_0x1c = param_1; + DAT_SoundEffectsHelperData1::ptr->SEC_Section1079.field7_0x1c = param_1; } } diff --git a/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp b/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp index 04c91ee0..53bd2e20 100644 --- a/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp +++ b/src/OpenSHC/Game/GameCore/getAreWeInAInGameMenu.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Game/GameCore.func.hpp" +#include "..\GameCore.func.hpp" namespace OpenSHC { namespace Game { diff --git a/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp b/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp index cf37526c..b093095d 100644 --- a/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp +++ b/src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp @@ -9,7 +9,7 @@ namespace IO { namespace DecoderBuffer { // FUNCTION: STRONGHOLDCRUSADER 0x0046D270 - unsigned int ReadBufferAndComputeHash(char* buf, unsigned int* size, void* param) + unsigned int __cdecl ReadBufferAndComputeHash(char* buf, unsigned int* size, void* param) { uint bytesToLoad = *size; BufferHelper* bufferHelper = (BufferHelper*)param; diff --git a/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp b/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp index 069d5bcc..c0271829 100644 --- a/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp +++ b/src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp @@ -9,7 +9,7 @@ namespace IO { namespace DecoderBuffer { // FUNCTION: STRONGHOLDCRUSADER 0x0046D300 - void WriteBufferAndComputeHash(char* buf, unsigned int* size, void* param) + void __cdecl WriteBufferAndComputeHash(char* buf, unsigned int* size, void* param) { uint bytesToWrite = *size; BufferHelper* bufferHelper = (BufferHelper*)param; diff --git a/src/OpenSHC/OS/OS.cpp b/src/OpenSHC/OS/OS.cpp index 05797263..1200943c 100644 --- a/src/OpenSHC/OS/OS.cpp +++ b/src/OpenSHC/OS/OS.cpp @@ -46,10 +46,10 @@ namespace OS { // This seems to be the games main free function // STUB: STRONGHOLDCRUSADER 0x0057FA74 - void _free_base(void* _Memory) { free(_Memory); } + void __cdecl _free_base(void* _Memory) { free(_Memory); } // STUB: STRONGHOLDCRUSADER 0x0057FC19 - int __tolower(int _C) { return tolower(_C); }; + int __cdecl __tolower(int _C) { return tolower(_C); }; // STUB: STRONGHOLDCRUSADER 0x0057FCB2 int _fclose(FILE* _File) { return fclose(_File); } @@ -67,7 +67,7 @@ namespace OS { long _ftell(FILE* _File) { return ftell(_File); } // STUB: STRONGHOLDCRUSADER 0x00580384 - int _fseek(FILE* _File, long _Offset, DWORD _Origin) { return fseek(_File, _Offset, _Origin); } + int __cdecl _fseek(FILE* _File, long _Offset, DWORD _Origin) { return fseek(_File, _Offset, _Origin); } // STUB: STRONGHOLDCRUSADER 0x005804CD FILE* _fopen(char const* _Filename, char const* _Mode) { return fopen(_Filename, _Mode); } @@ -89,7 +89,7 @@ namespace OS { // Only jumps to _free in game version // STUB: STRONGHOLDCRUSADER 0x00580DC1 - void _free(void* _Memory) { free(_Memory); } + void __cdecl _free(void* _Memory) { free(_Memory); } // STUB: STRONGHOLDCRUSADER 0x00580DC6 errno_t _memcpy_s(void* _Dst, rsize_t _DstSize, void* _Src, rsize_t _MaxCount) @@ -99,7 +99,7 @@ namespace OS { // Only jumps to _free // STUB: STRONGHOLDCRUSADER 0x00580E9C - void _free_cpp(void* _Memory) { free(_Memory); } + void __cdecl _free_cpp(void* _Memory) { free(_Memory); } // STUB: STRONGHOLDCRUSADER 0x00580F38 int _ucrt_close(int fileDescriptor) { return _close(fileDescriptor); } @@ -126,10 +126,10 @@ namespace OS { void* _memcpy(void* _Dst, void* _Src, size_t _Size) { return memcpy(_Dst, _Src, _Size); } // STUB: STRONGHOLDCRUSADER 0x005824CD - int __toupper(int _C) { return toupper(_C); } + int __cdecl __toupper(int _C) { return toupper(_C); } // STUB: STRONGHOLDCRUSADER 0x005826FB - int _ucrt_tell(int handle) { return _tell(handle); } + int __cdecl _ucrt_tell(int handle) { return _tell(handle); } // STUB: STRONGHOLDCRUSADER 0x0058277E int _ucrt_lseek(int fileDescriptor, long lDistanceToMove, DWORD moveMethod) diff --git a/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp b/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp index 41dad9fc..5d469e1c 100644 --- a/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp +++ b/src/OpenSHC/Random/RNG/setTimeBasedSeed.cpp @@ -8,7 +8,11 @@ namespace OpenSHC { namespace Random { // FUNCTION: STRONGHOLDCRUSADER 0x0046A740 - void RNG::setTimeBasedSeed() { this->seed = (__time64_t)MACRO_CALL(OpenSHC::OS_Func::__time64)((__time64_t*)0x0); } + void RNG::setTimeBasedSeed() + { + __time64_t time = MACRO_CALL(OpenSHC::OS_Func::__time64)((__time64_t*)0x0); + this->seed = (int)time; + } } } From 5b9da3d3b9dfd449453da4f3b9123b09b5924cad Mon Sep 17 00:00:00 2001 From: sourcehold Date: Sun, 6 Sep 2026 12:53:35 +0200 Subject: [PATCH 59/61] reimplement: 100% --- .../Map/Units/TribesState/playPatrolCommandSpeech.cpp | 11 +++-------- .../reassignOwnerForTribesOfBehaviorType2.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp index 114155c3..3b569c36 100644 --- a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp @@ -15,16 +15,11 @@ namespace Map { // FUNCTION: STRONGHOLDCRUSADER 0x00522110 void TribesState::playPatrolCommandSpeech(undefined4 param_1) { - UnitType unitType; - int actionID; - MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( 1); - actionID = 0x29; - unitType = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( - param_1, (int*)¶m_1); - MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( - unitType, actionID); + UnitType unitType = MACRO_CALL_MEMBER( + OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)(param_1, (int*)¶m_1); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)(unitType, 0x29); } } diff --git a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp index 5944ec7d..a9d0fb09 100644 --- a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp +++ b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp @@ -1,5 +1,7 @@ #include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Globals/DAT_TribesState.hpp" + namespace OpenSHC { namespace Map { namespace Units { @@ -8,8 +10,10 @@ namespace Map { void TribesState::reassignOwnerForTribesOfBehaviorType2(int param_1, int param_2) { for (int i = 1; i < 1250; i++) { - if (this->tribes[i].tribeState == 2 && this->tribes[i].owner == param_1) { - this->tribes[i].owner = param_2; + // DAT_TribesState::instance is required instead of this for there to be 100% match + if (DAT_TribesState::instance.tribes[i].tribeState == 2 + && DAT_TribesState::instance.tribes[i].owner == param_1) { + DAT_TribesState::instance.tribes[i].owner = param_2; } } } From 8e4a5fb575b23a8a296be18df765d467bb844059 Mon Sep 17 00:00:00 2001 From: sourcehold Date: Mon, 7 Sep 2026 22:10:01 +0200 Subject: [PATCH 60/61] reimplement: 100% --- .../TribesState/playArcherCommandSpeech.cpp | 10 ++-- .../Units/TribesState/popUnitFromTribe.cpp | 45 +++++---------- .../TribesState/upgradeMapTribesState.cpp | 49 +++++++--------- .../ComputeDamageFearFactorBonus.cpp | 28 +++------ .../UnitsState/Constructor_UnitsState.cpp | 25 ++++++++ .../changeDestinationByLeftover.cpp | 44 +++++--------- .../checkIfCitizenUnitIsAliveBasedOnState.cpp | 57 ++++++++----------- .../checkUnitHasPropertyBasedOnUnitType.cpp | 30 +++------- .../clearHiddenFlagAndUpdatePosition.cpp | 42 +++++--------- .../Map/Units/UnitsState/deselectUnit.cpp | 10 +--- .../Map/Units/UnitsState/extendRallyPoint.cpp | 53 ++++++----------- .../Map/Units/UnitsState/getArmySize.cpp | 3 +- .../getDestination2EqualsGivenCoordinates.cpp | 37 +++++------- .../UnitsState/getFirstSelectedUnitID.cpp | 43 +++++--------- .../hasTunnelerNotFinishedDigging.cpp | 31 ++++------ .../isComputerManagedNonPeasant.cpp | 54 +++++++----------- ...StopWalkingByClearingPathProgressState.cpp | 41 +++++-------- .../queueClickNavigateMenuOrEscape.cpp | 19 +------ .../queueDisbandAndAttackCommand2Params.cpp | 43 +++++--------- .../queueDisbandAndAttackCommand3Params.cpp | 45 +++++---------- .../queueDisbandAndAttackCommand4Params.cpp | 54 +++++++----------- .../Map/Units/UnitsState/queueStopCommand.cpp | 23 -------- .../Units/UnitsState/queueUnitTypeCommand.cpp | 19 +------ .../saveUnitStateBeforeInterruption.cpp | 37 ++++-------- .../selectionContainsEngineersOnly.cpp | 32 ++++------- .../selectionContainsLadermenOnly.cpp | 22 +++---- .../selectionContainsOnlyArabAssassins.cpp | 23 ++++---- .../selectionContainsShieldmenOnly.cpp | 22 +++---- .../selectionContainsTunnelersOnly.cpp | 22 +++---- .../Units/UnitsState/selectionHasArchers.cpp | 37 +++++------- .../setupUnitSharingCurrentTilePosition.cpp | 32 +++-------- .../Units/UnitsState/sitDownIfStanding.cpp | 44 +++++--------- .../Map/Units/UnitsState/standUpIfSeated.cpp | 44 +++++--------- .../Map/Units/UnitsState/unitIsInMoat.cpp | 15 ++--- .../UpdateWorker_ConsiderTakingABreakUnk.cpp | 30 +++------- .../UpgradeMapTribesStateVersionTo_142.cpp | 36 ++++-------- ...pgradeMapTribesStateVersionTo_Unknown2.cpp | 41 ++++--------- .../Map/Version/UpgradeMapUnitsTo_112.cpp | 46 ++++++--------- .../Map/Version/UpgradeMapUnitsTo_114.cpp | 43 +++++--------- .../Map/Version/UpgradeMapUnitsTo_130.cpp | 49 ++++++---------- .../Map/Version/UpgradeMapUnitsTo_149.cpp | 41 +++++-------- .../Map/Version/UpgradeMapUnitsTo_155.cpp | 41 +++++-------- .../Map/WildlifeState/clearWildlifeState.cpp | 2 +- 43 files changed, 508 insertions(+), 956 deletions(-) create mode 100644 src/OpenSHC/Map/Units/UnitsState/Constructor_UnitsState.cpp delete mode 100644 src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp diff --git a/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp index c2d0d337..cfe4c679 100644 --- a/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp @@ -1,5 +1,6 @@ +#include "../TribesState.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" -#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Map/Units/UnitType.hpp" #include "OpenSHC/Globals/DAT_SFXState.hpp" @@ -13,11 +14,10 @@ namespace Map { // FUNCTION: STRONGHOLDCRUSADER 0x00525090 void TribesState::playArcherCommandSpeech(int selectionID) { - int actionID = 0x1f; - UnitType _majorityUnitType = MACRO_CALL_MEMBER( - OpenSHC::Map::Units::TribesState_Func::getMajorityArcherTypeEuropeanOrArabian, this)(selectionID); MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( - _majorityUnitType, actionID); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajorityArcherTypeEuropeanOrArabian, this)( + selectionID), + 0x1f); } } diff --git a/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp b/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp index 63a96999..74b446b7 100644 --- a/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp +++ b/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp @@ -1,35 +1,20 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" - - - - +#include "../TribesState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00525B70 -int TribesState::popUnitFromTribe(int tribeID) - -{ -uint _unitID; - -_unitID = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getUnitIDForIndexInTribe, this)(tribeID, 0); -if (_unitID != 0) { -MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::removeUnitFromTribe, this)(_unitID, tribeID); -} -return(int)( _unitID); -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00525B70 + int TribesState::popUnitFromTribe(int tribeID) + { + int _unitID + = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getUnitIDForIndexInTribe, this)(tribeID, 0); + if (_unitID != 0) { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::removeUnitFromTribe, this)(_unitID, tribeID); + } + return _unitID; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp b/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp index 573294d3..298a1214 100644 --- a/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp +++ b/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp @@ -1,36 +1,25 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" -#include "OpenSHC/IO/PackagedFileMagicNum.hpp" -#include "OpenSHC/Map/Version.func.hpp" - - - +#include "../TribesState.func.hpp" +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/IO/PackagedFileMagicNum.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::IO::PackagedFileMagicNum; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00526370 -void TribesState::upgradeMapTribesState(PackagedFileMagicNum receivedMapVersion,PackagedFileMagicNum packagerMapVersion) - -{ -MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_Unknown1)(); -MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_Unknown2)(); -if ((receivedMapVersion != packagerMapVersion) && ((int)receivedMapVersion < 0x8e)) { -MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_142)(); -} -return; -} - - + namespace Units { + + using OpenSHC::IO::PackagedFileMagicNum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00526370 + void TribesState::upgradeMapTribesState( + PackagedFileMagicNum receivedMapVersion, PackagedFileMagicNum packagerMapVersion) + { + MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_Unknown1)(); + MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_Unknown2)(); + if ((receivedMapVersion != packagerMapVersion) && ((int)receivedMapVersion < 0x8e)) { + MACRO_CALL(OpenSHC::Map::Version_Func::UpgradeMapTribesStateVersionTo_142)(); + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp b/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp index f4c40e4c..8ae098d5 100644 --- a/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp @@ -1,29 +1,17 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - +#include "../UnitsState.func.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x005311F0 -int UnitsState::ComputeDamageFearFactorBonus(int damage,int playerID) - -{ -return ((DAT_GameState::instance.playerDataArray[playerID].fearFactorLevel + 0x14) * damage * 5) / 100; -} + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x005311F0 + int UnitsState::computeDamageFearFactorBonus(int damage, int playerID) + { + return ((DAT_GameState::instance.playerDataArray[playerID].fearFactorLevel + 20) * damage * 5) / 100; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/Constructor_UnitsState.cpp b/src/OpenSHC/Map/Units/UnitsState/Constructor_UnitsState.cpp new file mode 100644 index 00000000..a9e30900 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/Constructor_UnitsState.cpp @@ -0,0 +1,25 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/Map/Units/UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitsState; + + // FUNCTION: STRONGHOLDCRUSADER 0x0053B8B0 + UnitsState* UnitsState::Constructor_UnitsState() + { + this->creationTime = timeGetTime(); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::clearAllUnits, this)(); + this->lastSelectedUnitID = 0; + this->unknownInitially0_01 = 0; + this->lostChimps = 0; + this->maxUnitCount = 2500; + return this; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp b/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp index fec089ce..9e893060 100644 --- a/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp @@ -1,35 +1,19 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00533C70 -void UnitsState::changeDestinationByLeftover(int unitID) - -{ -short _leftover; - -_leftover = this->units[unitID].leftover; -if (0 < _leftover) { -MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::changeDestinationByAmount, this)(unitID, (int)((int)(_leftover))); -} -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00533C70 + void UnitsState::changeDestinationByLeftover(int unitID) + { + short _leftover = this->units[unitID].leftover; + if (0 < _leftover) { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::changeDestinationByAmount, this)( + unitID, _leftover); + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp b/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp index 9e902615..6b387660 100644 --- a/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp @@ -1,38 +1,31 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" -#include "OpenSHC/Map/Units/States/UnitStateShort.hpp" - - - +#include "../UnitsState.func.hpp" +#include "OpenSHC/Map/Units/States/UnitStateShort.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::Map::Units::States::UnitStateShort; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00530FD0 -BOOLEnum UnitsState::checkIfCitizenUnitIsAliveBasedOnState(int param_1) - -{ -UnitStateShort _state; - -_state = this->units[param_1].state.generic; -if ((0x6e < (short)_state) && ((short)_state < 0x75)) { -return TRUE; -} -return FALSE; -} - - + namespace Units { + + using OpenSHC::Map::Units::States::UnitState; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00530FD0 + BOOLEnum UnitsState::checkIfCitizenUnitIsAliveBasedOnState(int param_1) + { + short _state = (unsigned short)this->units[param_1].state.generic; + if ((0x6f <= _state)) { + if (_state <= 0x74) { + return TRUE; + } else { + return FALSE; + } + + } else { + return FALSE; + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp b/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp index 9effceeb..fdad9cc5 100644 --- a/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp @@ -1,30 +1,18 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - +#include "../UnitsState.func.hpp" #include "OpenSHC/Globals/DAT_UnitPropertiesDefinedData.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0052F0A0 -int UnitsState::checkUnitHasPropertyBasedOnUnitType(int unitID,int property) - -{ -return DAT_UnitPropertiesDefinedData::instance.UnitClimbStateFlags[property] -[(short)this->units[unitID].unitType]; -} + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x0052F0A0 + int UnitsState::checkUnitHasPropertyBasedOnUnitType(int unitID, int property) + { + return DAT_UnitPropertiesDefinedData::instance + .UnitClimbStateFlags[property][(short)this->units[unitID].unitType]; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp b/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp index 767fe545..14cd0185 100644 --- a/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp @@ -1,34 +1,18 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0053E8D0 -void UnitsState::clearHiddenFlagAndUpdatePosition(int unitID) - -{ -if (this->units[unitID].unknownTestAgainst0_2 != 0) { -this->units[unitID].unknownTestAgainst0_2 = 0; -MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::commitPendingUnitPosition, this)(unitID); -return; -} -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0053E8D0 + void UnitsState::clearHiddenFlagAndUpdatePosition(int unitID) + { + if (this->units[unitID].unknownTestAgainst0_2 != 0) { + this->units[unitID].unknownTestAgainst0_2 = 0; + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::commitPendingUnitPosition, this)(unitID); + } + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp index 3974cd2e..1ee99753 100644 --- a/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp @@ -1,22 +1,16 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { namespace Units { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00535190 void UnitsState::deselectUnit(int unitID) - { if (this->units[unitID].isSelected != 0) { this->units[unitID].isSelected = 0; - this->totalUnitsInSelection = this->totalUnitsInSelection + -1; + this->totalUnitsInSelection -= 1; } - return; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp b/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp index 9292bee7..dc5242d8 100644 --- a/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp @@ -1,44 +1,27 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Commands::GameCommandType; - - -/* - 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 0x005370C0 -void UnitsState::extendRallyPoint(int tribeID,int mouseX,int mouseY,int rallyCount) - -{ -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = tribeID; -DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = mouseX; -DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = mouseY; -DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = rallyCount; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_UNIT_EXTEND_RALLY_POINT); -return; -} - - + namespace Units { + + using OpenSHC::Commands::GameCommandType; + + // FUNCTION: STRONGHOLDCRUSADER 0x005370C0 + void UnitsState::extendRallyPoint(int tribeID, int mouseX, int mouseY, int rallyCount) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = tribeID; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = mouseX; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = mouseY; + DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = rallyCount; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_UNIT_EXTEND_RALLY_POINT); + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp b/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp index cb7d8835..0c11f2a7 100644 --- a/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" @@ -7,6 +7,7 @@ namespace OpenSHC { namespace Map { namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x00532f60 int UnitsState::getArmySize(int playerID) { return DAT_GameState::ptr->playerDataArray[playerID].armySize; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp b/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp index 6858c7fd..41f9370d 100644 --- a/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp @@ -1,33 +1,22 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; + namespace Units { + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00533920 -BOOLEnum UnitsState::getDestination2EqualsGivenCoordinates(int unitID,int x,int y) - -{ -if (this->units[unitID].destinationX_2Unk != x) { -return TRUE; -} -return (uint)(this->units[unitID].destinationY_2Unk != y); -} - + // FUNCTION: STRONGHOLDCRUSADER 0x00533920 + BOOLEnum UnitsState::getDestination2EqualsGivenCoordinates(int unitID, int x, int y) + { + if (this->units[unitID].destinationX_2Unk != x) { + return TRUE; + } + return this->units[unitID].destinationY_2Unk != y; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp b/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp index f921e931..2c2459a7 100644 --- a/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp @@ -1,43 +1,26 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" #include "OpenSHC/Globals/DAT_TribesState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Commands::GameCommandType; - - -/* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ + namespace Units { -/* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00535DF0 -void UnitsState::getFirstSelectedUnitID(undefined4 param_1) - -{ -DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = DAT_TribesState::instance.DAT_CurrentTribeID; -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(((GameCommandType)0x48)); -return; -} + using OpenSHC::Commands::GameCommandType; + // FUNCTION: STRONGHOLDCRUSADER 0x00535DF0 + void UnitsState::getFirstSelectedUnitID(undefined4 param_1) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = DAT_TribesState::instance.DAT_CurrentTribeID; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + ((GameCommandType)0x48)); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp b/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp index faa72c7d..da188c72 100644 --- a/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp @@ -1,30 +1,19 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; + namespace Units { + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x005339F0 -BOOLEnum UnitsState::hasTunnelerNotFinishedDigging(int param_1) - -{ -return (uint)(this->units[param_1].tunnelerFinishedDigging == 0); -} - + // FUNCTION: STRONGHOLDCRUSADER 0x005339F0 + BOOLEnum UnitsState::hasTunnelerNotFinishedDigging(int param_1) + { + return this->units[param_1].tunnelerFinishedDigging == 0; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp b/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp index d93f7531..6e549235 100644 --- a/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp @@ -1,40 +1,30 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" -#include "OpenSHC/Map/Units/UnitTypeShort.hpp" -#include "OpenSHC/Map/Units/UnitType.hpp" - +#include "../UnitsState.func.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" +#include "OpenSHC/Map/Units/UnitTypeShort.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_UnitPropertiesDefinedData.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::Map::Units::UnitTypeShort; -using OpenSHC::Map::Units::UnitType; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00530080 -BOOLEnum UnitsState::isComputerManagedNonPeasant(int param_1) - -{ -UnitTypeShort UVar1; - -UVar1 = this->units[param_1].unitType; -if (UVar1 == OpenSHC::Map::Units::UT_PEASANT) { -return FALSE; -} -return (uint)(DAT_UnitPropertiesDefinedData::instance.COMPUTER_MANAGED[(short)UVar1] != 0); -} - - + namespace Units { + + using OpenSHC::Map::Units::UnitType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00530080 + BOOLEnum UnitsState::isComputerManagedNonPeasant(int param_1) + { + // fixme: UnitType is loaded as an unsigned short in this function (movzx), but cast to a signed version on + // the stack for use later. + short UVar1 = (unsigned short)this->units[param_1].unitType; + if (UVar1 == OpenSHC::Map::Units::UT_PEASANT) { + return FALSE; + } + return DAT_UnitPropertiesDefinedData::instance.COMPUTER_MANAGED[UVar1] != 0; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp b/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp index e411f1cc..13ceb174 100644 --- a/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp @@ -1,33 +1,18 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0052F070 -void UnitsState::makeUnitStopWalkingByClearingPathProgressState(int unitID) - -{ -this->units[unitID].currentIndexInPathPlan = 0; -this->units[unitID].totalSizeOfPathPlan = 0; -this->units[unitID].unknownMovementRelated_0x2d2 = 0; -this->units[unitID].climbDataID = 0; -return; -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0052F070 + void UnitsState::makeUnitStopWalkingByClearingPathProgressState(int unitID) + { + this->units[unitID].currentIndexInPathPlan = 0; + this->units[unitID].totalSizeOfPathPlan = 0; + this->units[unitID].unknownMovementRelated_0x2d2 = 0; + this->units[unitID].climbDataID = 0; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp b/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp index 8db3336d..84fe5070 100644 --- a/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" @@ -10,27 +11,13 @@ namespace Map { using OpenSHC::Commands::GameCommandType; - /* - 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 0x00536CC0 void UnitsState::queueClickNavigateMenuOrEscape(undefined4 param_1) - { - DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0xfffffffe; + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = -1; DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_1; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( OpenSHC::Commands::GCT_ESCAPE); - return; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp index 11255e1e..3784a584 100644 --- a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp @@ -1,42 +1,25 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Commands::GameCommandType; - - -/* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ + namespace Units { -/* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00537100 -void UnitsState::queueDisbandAndAttackCommand2Params(undefined4 param_1,undefined4 param_2) - -{ -DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); -return; -} + using OpenSHC::Commands::GameCommandType; + // FUNCTION: STRONGHOLDCRUSADER 0x00537100 + void UnitsState::queueDisbandAndAttackCommand2Params(undefined4 param_1, undefined4 param_2) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp index 5d833060..c650ba8e 100644 --- a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp @@ -1,43 +1,26 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Commands::GameCommandType; - - -/* - WARNING: Enum "DPSEND_EnumInt": Some values do not have unique names - */ + namespace Units { -/* - WARNING: Enum "DPERRInt": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00537130 -void UnitsState::queueDisbandAndAttackCommand3Params(undefined4 param_1,undefined4 param_2,undefined4 param_3) - -{ -DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; -DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = param_3; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); -return; -} + using OpenSHC::Commands::GameCommandType; + // FUNCTION: STRONGHOLDCRUSADER 0x00537130 + void UnitsState::queueDisbandAndAttackCommand3Params(undefined4 param_1, undefined4 param_2, undefined4 param_3) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = param_3; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp index 1628026b..5588cd67 100644 --- a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp @@ -1,44 +1,28 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Commands::GameCommandType; - - -/* - 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 0x00537160 -void UnitsState::queueDisbandAndAttackCommand4Params(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4) - -{ -DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; -DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; -DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = param_3; -DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = param_4; -MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); -return; -} - - + namespace Units { + + using OpenSHC::Commands::GameCommandType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00537160 + void UnitsState::queueDisbandAndAttackCommand4Params( + undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4) + { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = param_1; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = param_2; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = param_3; + DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = param_4; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_DISBAND_AND_ATTACK_UNITS); + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp b/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp deleted file mode 100644 index 47152546..00000000 --- a/src/OpenSHC/Map/Units/UnitsState/queueStopCommand.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" -#include "OpenSHC/Commands/GameCommandType.hpp" - -#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" - -namespace OpenSHC { -namespace Map { - namespace Units { - - using OpenSHC::Commands::GameCommandType; - - // FUNCTION: STRONGHOLDCRUSADER 0x00536C70 - void UnitsState::queueEscapeCommand() - { - DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0; - MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( - (GameCommandType)0xf); - } - - } -} -} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp b/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp index 3b147118..e0a68b52 100644 --- a/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" @@ -10,27 +11,13 @@ namespace Map { using OpenSHC::Commands::GameCommandType; - /* - 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 0x00536C90 void UnitsState::queueUnitTypeCommand(undefined4 unitType) - { - DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0xffffffff; + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = -1; DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = unitType; MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( OpenSHC::Commands::GCT_ESCAPE); - return; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp b/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp index 03fb3b01..d8b019de 100644 --- a/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp @@ -1,35 +1,18 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/Map/Units/States/UnitStateUnion.hpp" - - - +#include "../UnitsState.func.hpp" +#include "OpenSHC/Map/Units/States/UnitStateUnion.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::Map::Units::States::UnitStateUnion; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00533F90 -void UnitsState::saveUnitStateBeforeInterruption(int param_1) - -{ -UnitStateUnion UVar1; - -UVar1 = this->units[param_1].state; -this->units[param_1].tunnelerFinishedDigging = 5; -this->units[param_1].state_3 = UVar1; -return; -} + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x00533F90 + void UnitsState::saveUnitStateBeforeInterruption(int param_1) + { + this->units[param_1].tunnelerFinishedDigging = 5; + this->units[param_1].state_3 = this->units[param_1].state; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp index 8354489e..6ea0e23b 100644 --- a/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/Map/Units/UnitsState.hpp" namespace OpenSHC { @@ -7,33 +8,24 @@ namespace Map { using OpenSHC::Map::Units::UnitsState; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00535520 int UnitsState::selectionContainsEngineersOnly() { - + int result = FALSE; + // I tried simplifying this with an early-return but didn't work if (this->selectionEngineers != 0) { - int* piVar2 = (int*)&this->selectionEuropeanArchers; - for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { - if ((iVar1 != 7) && (piVar2[iVar1] != 0)) { + // This really is field pointer increment style. I tried a for loop over the fields as a int[] + // but that didn't work + int* pUnitSelection = (int*)&this->selectionEuropeanArchers; + for (int index = 0; index <= 26; index++) { + if ((index != 7) && (*pUnitSelection != 0)) { return FALSE; } + pUnitSelection++; } - // piVar2 = &this->selectionEuropeanArchers; - // do { - // if ((iVar1 != 7) && (piVar2->selectionEuropeanArchers != 0)) { - // return 0; - // } - // iVar1 = iVar1 + 1; - // piVar2 = &piVar2->selectionSpearmen; - // } while (iVar1 < 0x1b); - // iVar1 = 1; - return TRUE; + result = TRUE; } - return FALSE; + return result; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp index 647972a5..9ebf426a 100644 --- a/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp @@ -1,27 +1,27 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { namespace Units { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x005357E0 int UnitsState::selectionContainsLadermenOnly() - { + int result = FALSE; + // I tried simplifying this with an early-return but didn't work if (this->selectionLaddermen != 0) { - int* piVar2 = (int*)&this->selectionEuropeanArchers; - for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { - if ((iVar1 != 8) && (piVar2[iVar1] != 0)) { + // This really is field pointer increment style. I tried a for loop over the fields as a int[] + // but that didn't work + int* pUnitSelection = (int*)&this->selectionEuropeanArchers; + for (int index = 0; index <= 26; index++) { + if ((index != 8) && (*pUnitSelection != 0)) { return FALSE; } + pUnitSelection++; } - return TRUE; + result = TRUE; } - return FALSE; + return result; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp index f9cc63bf..90ac8454 100644 --- a/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { @@ -7,24 +8,24 @@ namespace Map { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00535810 BOOLEnum UnitsState::selectionContainsOnlyArabAssassins() - { + BOOLEnum result = FALSE; + // I tried simplifying this with an early-return but didn't work if (this->selectionArabAssassin != 0) { - int* piVar2 = (int*)&this->selectionEuropeanArchers; - for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { - if ((iVar1 != 0x16) && (piVar2[iVar1] != 0)) { + // This really is field pointer increment style. I tried a for loop over the fields as a int[] + // but that didn't work + int* pUnitSelection = (int*)&this->selectionEuropeanArchers; + for (int index = 0; index <= 26; index++) { + if ((index != 22) && (*pUnitSelection != 0)) { return FALSE; } + pUnitSelection++; } - return TRUE; + result = TRUE; } - return FALSE; + return result; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp index 1130befb..822835f2 100644 --- a/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp @@ -1,27 +1,27 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { namespace Units { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00535840 int UnitsState::selectionContainsShieldmenOnly() - { + int result = FALSE; + // I tried simplifying this with an early-return but didn't work if (this->selectionShield != 0) { - int* piVar2 = (int*)&this->selectionEuropeanArchers; - for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { - if ((iVar1 != 0xf) && (piVar2[iVar1] != 0)) { + // This really is field pointer increment style. I tried a for loop over the fields as a int[] + // but that didn't work + int* pUnitSelection = (int*)&this->selectionEuropeanArchers; + for (int index = 0; index <= 26; index++) { + if ((index != 15) && (*pUnitSelection != 0)) { return FALSE; } + pUnitSelection++; } - return TRUE; + result = TRUE; } - return FALSE; + return result; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp index ed1c3714..95f8d48e 100644 --- a/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp @@ -1,27 +1,27 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { namespace Units { - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00535700 int UnitsState::selectionContainsTunnelersOnly() - { + int result = FALSE; + // I tried simplifying this with an early-return but didn't work if (this->selectionTunnelers != 0) { - int* piVar2 = (int*)&this->selectionEuropeanArchers; - for (int iVar1 = 0; iVar1 < 0x1b; iVar1++) { - if ((iVar1 != 9) && (piVar2[iVar1] != 0)) { + // This really is field pointer increment style. I tried a for loop over the fields as a int[] + // but that didn't work + int* pUnitSelection = (int*)&this->selectionEuropeanArchers; + for (int index = 0; index <= 26; index++) { + if ((index != 9) && (*pUnitSelection != 0)) { return FALSE; } + pUnitSelection++; } - return TRUE; + result = TRUE; } - return FALSE; + return result; } } diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp index 03edc06d..f5fa655c 100644 --- a/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp @@ -1,33 +1,22 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - +#include "../UnitsState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" namespace OpenSHC { namespace Map { -namespace Units { - -using OpenSHC::WindowsHelper::Enums::BOOLEnum; + namespace Units { + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00535560 -BOOLEnum UnitsState::selectionHasArchers() - -{ -if (this->selectionEuropeanArchers != 0) { -return TRUE; -} -return (uint)(this->selectionArabArcher != 0); -} - + // FUNCTION: STRONGHOLDCRUSADER 0x00535560 + BOOLEnum UnitsState::selectionHasArchers() + { + if (this->selectionEuropeanArchers != 0) { + return TRUE; + } + return this->selectionArabArcher != 0; + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp b/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp index 4f9117cc..d448f751 100644 --- a/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp @@ -1,30 +1,16 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0053BB70 -void UnitsState::setupUnitSharingCurrentTilePosition(int unitID) - -{ -MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::setupUnitSharingTileIDs, this)(unitID, this->units[unitID].tile); -return; -} + namespace Units { + // FUNCTION: STRONGHOLDCRUSADER 0x0053BB70 + void UnitsState::setupUnitSharingCurrentTilePosition(int unitID) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::setupUnitSharingTileIDs, this)( + unitID, this->units[unitID].tile); + } + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp b/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp index 51dfb876..7b80d567 100644 --- a/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp @@ -1,34 +1,20 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0052FBF0 -undefined4 UnitsState::sitDownIfStanding(int param_1) - -{ -if (this->units[param_1].seated != 0) { -return(undefined4)( 0); -} -this->units[param_1].substate = 0x65; -this->units[param_1].animationCycleNumber = 0; -return(undefined4)( 1); -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0052FBF0 + undefined4 UnitsState::sitDownIfStanding(int param_1) + { + if (this->units[param_1].seated != 0) { + return FALSE; + } + this->units[param_1].substate = 0x65; + this->units[param_1].animationCycleNumber = 0; + return TRUE; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp b/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp index b17dc65e..8cc37cbc 100644 --- a/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp @@ -1,34 +1,20 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" - - - - +#include "../UnitsState.func.hpp" namespace OpenSHC { namespace Map { -namespace Units { - - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0052FBB0 -undefined4 UnitsState::standUpIfSeated(int param_1) - -{ -if (this->units[param_1].seated == 0) { -return(undefined4)( 0); -} -this->units[param_1].substate = 100; -this->units[param_1].animationCycleNumber = 0; -return(undefined4)( 1); -} - - + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0052FBB0 + undefined4 UnitsState::standUpIfSeated(int param_1) + { + if (this->units[param_1].seated == 0) { + return FALSE; + } + this->units[param_1].substate = 100; + this->units[param_1].animationCycleNumber = 0; + return TRUE; + } + + } } } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp index d5f50ee6..3fbe35a4 100644 --- a/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp +++ b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "../UnitsState.func.hpp" + #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_TileMapState.hpp" @@ -7,21 +8,13 @@ namespace OpenSHC { namespace Map { namespace Units { + using OpenSHC::Map::Logic1; using OpenSHC::WindowsHelper::Enums::BOOLEnum; - /* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00534460 BOOLEnum UnitsState::unitIsInMoat(int unitID) - { - return (uint)DAT_TileMapState::instance.LogicLayer[this->units[unitID].tile] >> 0x1e & TRUE; + return DAT_TileMapState::instance.LogicLayer[this->units[unitID].tile] >> 30 & TRUE; } } diff --git a/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp b/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp index 91ae9583..57ddb4f4 100644 --- a/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp +++ b/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp @@ -1,33 +1,21 @@ #include "OpenSHC/Map/Units.func.hpp" -#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Map/Units/States/UnitState.hpp" - - +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::WindowsHelper::Enums::BOOLEnum; -using OpenSHC::Map::Units::States::UnitState; - + using OpenSHC::Map::Units::States::UnitState; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x0053CAC0 + BOOLEnum Units::UpdateWorker_ConsiderTakingABreakUnk(int unitID) + { + return MACRO_CALL(OpenSHC::Map::Units_Func::ConsiderHavingABreakNowUnk)( + unitID, (UnitState)((int)((int)(short)DAT_UnitsState::instance.units[unitID].state.generic))); + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0053CAC0 -BOOLEnum Units::UpdateWorker_ConsiderTakingABreakUnk(int unitID) - -{ -BOOLEnum BVar1; - -BVar1 = MACRO_CALL(OpenSHC::Map::Units_Func::ConsiderHavingABreakNowUnk)(unitID, (UnitState)((int)((int)(short)DAT_UnitsState::instance.units[unitID].state.generic))); -return BVar1; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp index cf75dd96..f0e01abc 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp @@ -1,37 +1,23 @@ #include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Map/Units/SomeTribeBehaviorType.hpp" - - #include "OpenSHC/Globals/DAT_TribesState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Units::SomeTribeBehaviorType; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - + using OpenSHC::Map::Units::SomeTribeBehaviorType; -// FUNCTION: STRONGHOLDCRUSADER 0x00523E00 -void Version::UpgradeMapTribesStateVersionTo_142() + // FUNCTION: STRONGHOLDCRUSADER 0x00523E00 + void Version::UpgradeMapTribesStateVersionTo_142() + { + for (int _tribeID = 1; _tribeID < 1250; _tribeID++) { + if (DAT_TribesState::instance.tribes[_tribeID].tribeState != 0 + && DAT_TribesState::instance.tribes[_tribeID].attackWave <= 0) { + DAT_TribesState::instance.tribes[_tribeID].tribeBehaviorType = 0; + } + } + } -{ -short *psVar1; - -psVar1 = &DAT_TribesState::instance.tribes[1].attackWave; -do { -if ((psVar1[-0x13e] != 0) && (*psVar1 < 1)) { -psVar1[-0x136] = ((SomeTribeBehaviorType)0); -} -psVar1 = psVar1 + 0x19a; -} while ((int)psVar1 < 0x176261c); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp index 824f785e..088d3b49 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp @@ -1,40 +1,21 @@ -#include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Map/Units/TribesState.func.hpp" - - +#include "OpenSHC/Map/Version.func.hpp" #include "OpenSHC/Globals/DAT_TribesState.hpp" namespace OpenSHC { namespace Map { + // FUNCTION: STRONGHOLDCRUSADER 0x00523EB0 + void Version::UpgradeMapTribesStateVersionTo_Unknown2() + { + for (int tribeID = 1; tribeID < 1250; tribeID++) { + if (DAT_TribesState::instance.tribes[tribeID].tribeState != 0) { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::setWhetherTribeContainsAnyUnits, + DAT_TribesState::ptr)(tribeID); + } + } + } - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x00523EB0 -void Version::UpgradeMapTribesStateVersionTo_Unknown2() - -{ -short *psVar1; -int tribeID; - -tribeID = 1; -psVar1 = &DAT_TribesState::instance.tribes[1].tribeState; -do { -if (*psVar1 != 0) { -MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::setWhetherTribeContainsAnyUnits, DAT_TribesState::ptr)(tribeID); } -psVar1 = psVar1 + 0x19a; -tribeID = tribeID + 1; -} while ((int)psVar1 < 0x17623a0); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp index fd1a9633..9ebfff2a 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp @@ -2,40 +2,28 @@ #include "OpenSHC/Map/Units/Unit.hpp" #include "OpenSHC/Map/Units/UnitLogicState.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" #include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Units::Unit; -using OpenSHC::Map::Units::UnitLogicState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::Map::Units::Unit; + using OpenSHC::Map::Units::UnitLogicState; + + // FUNCTION: STRONGHOLDCRUSADER 0x0053B340 + void Version::UpgradeMapUnitsTo_112() + { + DAT_CurrentUnitSlotID::instance = 2500; + // fixme: the reimplementation always unrolls this for loop (because 2499/3 = 833), but the original isn't + // unrolled + for (int _unitID = 1; _unitID < 2500; _unitID++) { + if (DAT_UnitsState::instance.units[_unitID].logicalState == Units::ULS_NORMAL) { + DAT_UnitsState::instance.units[_unitID].buildingID + = DAT_UnitsState::instance.units[_unitID].workplaceBuildingID_1; + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0053B340 -void Version::UpgradeMapUnitsTo_112() - -{ -Unit * psVar1; - -psVar1 = &DAT_UnitsState::instance.units[1]; -DAT_CurrentUnitSlotID::instance = 2500; -do { -if (psVar1->logicalState == OpenSHC::Map::Units::ULS_NORMAL) { -psVar1->buildingID = psVar1->workplaceBuildingID_1; } -psVar1 = psVar1 + 0x248; -} while ((int)psVar1 < 0x16516c4); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp index b5b092e2..4f93debd 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp @@ -1,41 +1,26 @@ #include "OpenSHC/Map/Version.func.hpp" -#include "OpenSHC/Map/Units/UnitLogicStateShort.hpp" #include "OpenSHC/Map/Units/UnitLogicState.hpp" +#include "OpenSHC/Map/Units/UnitLogicStateShort.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" #include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Units::UnitLogicStateShort; -using OpenSHC::Map::Units::UnitLogicState; - + using OpenSHC::Map::Units::UnitLogicState; + using OpenSHC::Map::Units::UnitLogicStateShort; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + // FUNCTION: STRONGHOLDCRUSADER 0x0053B310 + void Version::UpgradeMapUnitsTo_114() + { + DAT_CurrentUnitSlotID::instance = 2500; + for (int i = 1; i < 2500; i++) { + if (DAT_UnitsState::instance.units[i].logicalState == Units::ULS_NORMAL) { + DAT_UnitsState::instance.units[i].calculatedOwnerPlayerIndex = 0; + } + } + } - -// FUNCTION: STRONGHOLDCRUSADER 0x0053B310 -void Version::UpgradeMapUnitsTo_114() - -{ -int *piVar1; - -piVar1 = &DAT_UnitsState::instance.units[1].calculatedOwnerPlayerIndex; -DAT_CurrentUnitSlotID::instance = 2500; -do { -if (*(UnitLogicStateShort *)(piVar1 + 0x1f) == OpenSHC::Map::Units::ULS_NORMAL) { -*piVar1 = 0; } -piVar1 = piVar1 + 0x124; -} while ((int)piVar1 < 0x165139c); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp index b4641ad1..96abcb0d 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp @@ -1,43 +1,30 @@ #include "OpenSHC/Map/Version.func.hpp" -#include "OpenSHC/Map/Units/UnitTypeShort.hpp" #include "OpenSHC/Map/Units/UnitLogicState.hpp" #include "OpenSHC/Map/Units/UnitType.hpp" +#include "OpenSHC/Map/Units/UnitTypeShort.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" #include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Units::UnitTypeShort; -using OpenSHC::Map::Units::UnitLogicState; -using OpenSHC::Map::Units::UnitType; - + using OpenSHC::Map::Units::UnitLogicState; + using OpenSHC::Map::Units::UnitType; + using OpenSHC::Map::Units::UnitTypeShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x0053B530 + void Version::UpgradeMapUnitsTo_130() + { + DAT_CurrentUnitSlotID::instance = 2500; + for (int i = 1; i < 2500; i++) { + if (DAT_UnitsState::instance.units[i].logicalState == Units::ULS_NORMAL + && DAT_UnitsState::instance.units[i].unitType == Units::UT_COW) { + DAT_UnitsState::instance.units[i].digTileX__OR__countCurrentlyManningEnginers__OR__forCowsRandomBelow300 + = 0; + } + } + } -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0053B530 -void Version::UpgradeMapUnitsTo_130() - -{ -UnitTypeShort *pUVar1; - -pUVar1 = &DAT_UnitsState::instance.units[1].unitType; -DAT_CurrentUnitSlotID::instance = 0x9c4; -do { -if ((pUVar1[-1] == OpenSHC::Map::Units::ULS_NORMAL) && (*pUVar1 == OpenSHC::Map::Units::UT_COW)) { -pUVar1[0x193] = 0; } -pUVar1 = pUVar1 + 0x248; -} while ((int)pUVar1 < 0x165141a); -return; -} - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp index f548e937..7061514e 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp @@ -2,40 +2,25 @@ #include "OpenSHC/Map/Units/Unit.hpp" #include "OpenSHC/Map/Units/UnitLogicState.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" #include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Units::Unit; -using OpenSHC::Map::Units::UnitLogicState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::Map::Units::Unit; + using OpenSHC::Map::Units::UnitLogicState; + // FUNCTION: STRONGHOLDCRUSADER 0x0053B570 + void Version::UpgradeMapUnitsTo_149() + { + DAT_CurrentUnitSlotID::instance = 2500; + for (int _unitID = 1; _unitID < 2500; _unitID++) { + if (DAT_UnitsState::instance.units[_unitID].logicalState == Units::ULS_NORMAL) { + DAT_UnitsState::instance.units[_unitID].shootBeforeStop = 0; + } + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x0053B570 -void Version::UpgradeMapUnitsTo_149() - -{ -Unit * psVar1; - -psVar1 = &DAT_UnitsState::instance.units[1]; -DAT_CurrentUnitSlotID::instance = 0x9c4; -do { -if (psVar1->logicalState == OpenSHC::Map::Units::ULS_NORMAL) { -psVar1->shootBeforeStop = 0; -} -psVar1 = psVar1 + 0x248; -} while ((int)psVar1 < 0x1651764); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp index 61e5ff1a..ff73ed35 100644 --- a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp @@ -2,40 +2,25 @@ #include "OpenSHC/Map/Units/Unit.hpp" #include "OpenSHC/Map/Units/UnitLogicState.hpp" - - -#include "OpenSHC/Globals/DAT_UnitsState.hpp" #include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { namespace Map { -using OpenSHC::Map::Units::Unit; -using OpenSHC::Map::Units::UnitLogicState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ + using OpenSHC::Map::Units::Unit; + using OpenSHC::Map::Units::UnitLogicState; + // FUNCTION: STRONGHOLDCRUSADER 0x0053B5E0 + void Version::UpgradeMapUnitsTo_155() + { + DAT_CurrentUnitSlotID::instance = 2500; + for (int _unitID = 1; _unitID < 2500; _unitID++) { + if (DAT_UnitsState::instance.units[_unitID].logicalState != Units::ULS_INVISIBLE) { + DAT_UnitsState::instance.units[_unitID].killedFlagUnk = 0; + } + } + } -// FUNCTION: STRONGHOLDCRUSADER 0x0053B5E0 -void Version::UpgradeMapUnitsTo_155() - -{ -Unit * psVar1; - -psVar1 = &DAT_UnitsState::instance.units[1]; -DAT_CurrentUnitSlotID::instance = 2500; -do { -if (psVar1->logicalState != OpenSHC::Map::Units::ULS_INVISIBLE) { -psVar1->killedFlagUnk = 0; -} -psVar1 = psVar1 + 0x248; -} while ((int)psVar1 < 0x165177c); -return; } - - } -} \ No newline at end of file diff --git a/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp b/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp index 9f810b72..d6ba10c8 100644 --- a/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp +++ b/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp @@ -10,7 +10,7 @@ namespace Map { void WildlifeState::clearWildlifeState() { MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( - 256000, '\0', this); + 256000, 0, &this->grid[0][0]); } } From 3062b2719096d3db90829819bb99eee6957cbeac Mon Sep 17 00:00:00 2001 From: sourcehold Date: Mon, 7 Sep 2026 22:29:54 +0200 Subject: [PATCH 61/61] progress --- .../MapPropertiesState/mapHasCertainEvent.cpp | 16 +-------- .../openEventTriggerMenu.cpp | 6 ---- .../sumInvasionEventUnitCount.cpp | 17 +-------- .../Units/TribesState/addUnitToSelected.cpp | 2 +- .../Map/Units/TribesState/clearTribe.cpp | 3 +- .../TribesState/constructTribesState.cpp | 3 +- ...SelectionMoveInstructionNoMatchedSpeed.cpp | 3 +- .../TribesState/markTribeAsAnimalTribe.cpp | 2 +- .../TribesState/playPatrolCommandSpeech.cpp | 3 +- .../TribesState/playUnitSelectSpeech.cpp | 3 +- .../TribesState/playWorkCommandSpeech.cpp | 3 +- .../Map/Units/TribesState/queueUnitStance.cpp | 3 +- .../reassignOwnerForTribesOfBehaviorType2.cpp | 2 +- .../Map/Units/TribesState/setCamelSpawnXY.cpp | 2 +- .../Map/Units/TribesState/setUnitStance.cpp | 3 +- .../setWhetherTribeContainsAnyUnits.cpp | 2 +- .../TribesState/storeDeerXAndYinMapInfo.cpp | 2 +- .../TribesState/storeLionXAndYInMapInfo.cpp | 3 +- .../TribesState/tribeCorrespondsWithUID.cpp | 2 +- .../Units/UnitsState/constructUnitsState.cpp | 36 ------------------- .../UI/AppendCreditsClearImageCommand.cpp | 6 ---- src/OpenSHC/UI/AppendCreditsCommand.cpp | 6 ---- .../UI/AppendCreditsListTerminator.cpp | 6 ---- src/OpenSHC/UI/AppendCreditsPauseCommand.cpp | 6 ---- .../UI/AppendCreditsSegmentEndCommand.cpp | 6 ---- .../UI/AppendCreditsSoundStreamCommand.cpp | 7 +--- .../SetTutorialBuildingActionState.cpp | 13 ++----- .../clearInvalidatedHoverStates.cpp | 25 +------------ src/OpenSHC/UI/Menu/updateMenuButtons.cpp | 13 +------ .../MenuHandlerState/setupBuildMenuState.cpp | 15 +------- .../UI/MenuItem/resetMenuItemStateUnk.cpp | 2 -- ...temActionHandler_DeleteGameRecord_Main.cpp | 6 ---- ...emActionHandler_DisableArabTroops_Main.cpp | 6 ---- ...emActionHandler_DisableEuroTroops_Main.cpp | 6 ---- ...onHandler_EnterTitleOnGameStart_Button.cpp | 6 ---- ...temActionHandler_SaveMap_ReturnKeySave.cpp | 6 ---- ...tionHandler_UnusedWinCondition_Options.cpp | 13 ------- ...derFunction_InGameMenu_MapEventIconUnk.cpp | 6 ---- ...emRenderFunction_SaveLoadMap_Scrollbar.cpp | 15 ++------ .../UI/MenuModalComposition/findModalMenu.cpp | 12 +------ .../loadAllMenuElementsOfMenuModals.cpp | 6 ---- ...RenderFunction_CreateOrTriggerInvasion.cpp | 18 +--------- ...enuModalRenderFunction_DebugDataAiInfo.cpp | 15 +------- ...derFunction_DebugDataCurrentPlayerData.cpp | 15 +------- ...nuModalRenderFunction_DebugDataMapData.cpp | 15 +------- ...lRenderFunction_DebugDataMousePointing.cpp | 15 +------- ...nuModalRenderFunction_DebugDataNetwork.cpp | 23 +----------- ...ModalRenderFunction_DebugDataSplitInfo.cpp | 23 +----------- ...uModalRenderFunction_DebugDataUnitData.cpp | 15 +------- ...dalRenderFunction_DebugDataZoneDataUnk.cpp | 19 +--------- .../MenuModalRenderFunction_DisableTroops.cpp | 18 +--------- .../MenuModalRenderFunction_DisableWeapon.cpp | 18 +--------- ...dalRenderFunction_DisplayAiLordMessage.cpp | 1 - ...alRenderFunction_EnterTitleOnGameStart.cpp | 18 +--------- ...enuModalRenderFunction_GameplayOptions.cpp | 18 +--------- ...MenuModalRenderFunction_NetworkOptions.cpp | 18 +--------- ...MenuModalRenderFunction_OnlineQuitGame.cpp | 18 +--------- .../MenuModalRenderFunction_OptionsMenu.cpp | 18 +--------- ...nderFunction_SkirmishConnectionOptions.cpp | 18 +--------- ...odalRenderFunction_SkirmishPlayOptions.cpp | 18 +--------- .../MenuModalRenderFunction_SoundOptions.cpp | 18 +--------- .../UI/MenuModalRenderFunction_StartGoods.cpp | 18 +--------- ...MenuModalRenderFunction_TraderSettings.cpp | 18 +--------- .../MenuModalRenderFunction_TriggerEvent.cpp | 18 +--------- ...rFunction_UnusedSiegeAttackingForceUnk.cpp | 18 +--------- .../UI/MenuView_CampaignUnk_DoEveryFrame.cpp | 13 +------ .../MenuView_CrusadeMissionIntro_Prepare.cpp | 15 +------- .../UI/MenuView_EditScenario_Prepare.cpp | 15 +------- ...nuView_General_DoInitial_OnlySetMenuXY.cpp | 13 +------ .../UI/MenuView_RankingGames_Prepare.cpp | 23 +----------- ...w_Unknown26_CampaignRelatedUnk_Prepare.cpp | 15 +------- .../UI/MenuView_UnusedExtremeAd_Prepare.cpp | 13 +------ src/OpenSHC/UI/PlayAMessageFromAI.cpp | 2 -- .../UI/Rendering/RenderMenuGfxHelper.cpp | 17 ++------- .../RenderNoRushDisplayElementUnk.cpp | 19 +++------- .../UI/SetActiveCreditsSequenceIndex.cpp | 6 ---- src/OpenSHC/UI/TacticalPowersFill.cpp | 1 - 77 files changed, 73 insertions(+), 793 deletions(-) delete mode 100644 src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp diff --git a/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp b/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp index 27200dae..e36a29a0 100644 --- a/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp @@ -1,23 +1,10 @@ #include "OpenSHC/Map/MapPropertiesState.func.hpp" - - - - namespace OpenSHC { namespace Map { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004B7890 undefined4 MapPropertiesState::mapHasCertainEvent() - { int iVar1; int *piVar2; @@ -36,6 +23,5 @@ piVar2 = piVar2 + 0x39; return(undefined4)( 0); } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp b/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp index 4ff3a233..342e014b 100644 --- a/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp @@ -12,20 +12,14 @@ namespace Map { using OpenSHC::Game::ScenarioEvents::InGameEventUnionVersion; using OpenSHC::UI::Enums::MenuModalType; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004BB9F0 void MapPropertiesState::openEventTriggerMenu(undefined4 eventType) - { this->eventType = eventType; MACRO_CALL_MEMBER(OpenSHC::Game::ScenarioEvents::InGameEventUnionVersion_Func::resetEvent, (InGameEventUnionVersion*)&this->invasionEvent)(); MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_TRIGGER_EVENT_OR_INVASION); - return; } } diff --git a/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp b/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp index 3c5dc166..f720350c 100644 --- a/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp @@ -1,23 +1,10 @@ #include "OpenSHC/Map/MapPropertiesState.func.hpp" - - - - namespace OpenSHC { namespace Map { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004BBA20 void MapPropertiesState::sumInvasionEventUnitCount() - { int *piVar1; int *piVar2; @@ -31,9 +18,7 @@ this->DAT_InvasionEventItemUnitCountSum + piVar1[-3] + piVar1[-2] + piVar1[-1] + piVar1[1] + *piVar1; piVar1 = piVar2; } while ((int)piVar2 < 0x1667ebc); -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp index fa80c643..8dbefc7c 100644 --- a/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp +++ b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" #include "OpenSHC/Globals/DAT_UnitSelectionDefinedData.hpp" #include "OpenSHC/Globals/DAT_UnitsState.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp index e04c9d28..5e77765c 100644 --- a/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp +++ b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp @@ -1,5 +1,6 @@ +#include "../TribesState.func.hpp" + #include "OpenSHC/IO/LowLevelMemory.func.hpp" -#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp b/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp index fd3ec8af..9744c66d 100644 --- a/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp +++ b/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" + #include "OpenSHC/Map/Units/TribesState.hpp" namespace OpenSHC { diff --git a/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp index 7d5f5815..7d9cb9f9 100644 --- a/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp +++ b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" + #include "OpenSHC/Map/Units/Instructions/UnitMatchSpeedEnum.hpp" namespace OpenSHC { diff --git a/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp b/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp index e6423dbb..a2b2f16b 100644 --- a/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp +++ b/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp index 3b569c36..1237f180 100644 --- a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp @@ -1,5 +1,6 @@ +#include "../TribesState.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" -#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Map/Units/UnitsState.func.hpp" #include "OpenSHC/Map/Units/UnitType.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp index 13d00210..b8be8047 100644 --- a/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp @@ -1,5 +1,6 @@ +#include "../TribesState.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" -#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Map/Units/UnitsState.func.hpp" #include "OpenSHC/Map/Units/UnitType.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp index 5483f07b..4f833a0f 100644 --- a/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp +++ b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp @@ -1,5 +1,6 @@ +#include "../TribesState.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" -#include "OpenSHC/Map/Units/TribesState.func.hpp" #include "OpenSHC/Map/Units/UnitsState.func.hpp" #include "OpenSHC/Map/Units/UnitType.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp index bd736140..686c1303 100644 --- a/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp +++ b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" + #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp index a9d0fb09..4b3a8c79 100644 --- a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp +++ b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" #include "OpenSHC/Globals/DAT_TribesState.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp index 9dc34213..441f137b 100644 --- a/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp +++ b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp index b931d072..57f79965 100644 --- a/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp +++ b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" + #include "OpenSHC/Map/Units/Behavior/UnitStanceEnum.hpp" #include "OpenSHC/Globals/DAT_GameCore.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp index f9c200d8..85b3a7ec 100644 --- a/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp +++ b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp index fa297da7..12999e72 100644 --- a/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp +++ b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp index 2c27ec3b..2ec59fd4 100644 --- a/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp +++ b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" + #include "OpenSHC/Map/Location/Point4ShortXY.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" diff --git a/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp index d812c4dc..d795e952 100644 --- a/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp +++ b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "../TribesState.func.hpp" namespace OpenSHC { namespace Map { diff --git a/src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp b/src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp deleted file mode 100644 index 259d2147..00000000 --- a/src/OpenSHC/Map/Units/UnitsState/constructUnitsState.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "OpenSHC/Map/Units/UnitsState.func.hpp" -#include "OpenSHC/Map/Units/UnitsState.hpp" - - - - - -namespace OpenSHC { -namespace Map { -namespace Units { - -using OpenSHC::Map::Units::UnitsState; - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - -// FUNCTION: STRONGHOLDCRUSADER 0x0053B8B0 -UnitsState * UnitsState::constructUnitsState() - -{ -this->creationTime = timeGetTime(); -MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::clearAllUnits, this)(); -this->lastSelectedUnitID = 0; -this->unknownInitially0_01 = 0; -this->lostChimps = 0; -this->maxUnitCount = 2500; -return this; -} - - -} -} -} \ No newline at end of file diff --git a/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp b/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp index 0935f3a0..bd00fb81 100644 --- a/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp +++ b/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp @@ -5,19 +5,13 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004DA8A0 void UI::AppendCreditsClearImageCommand() - { if (DAT_UnknownBinkCount::instance < 0x120) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x28; DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; } - return; } } diff --git a/src/OpenSHC/UI/AppendCreditsCommand.cpp b/src/OpenSHC/UI/AppendCreditsCommand.cpp index 71a87efc..10b42b8d 100644 --- a/src/OpenSHC/UI/AppendCreditsCommand.cpp +++ b/src/OpenSHC/UI/AppendCreditsCommand.cpp @@ -5,19 +5,13 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004DA7E0 void UI::AppendCreditsCommand(int param_1) - { if (DAT_UnknownBinkCount::instance < 0x120) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = param_1; DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; } - return; } } diff --git a/src/OpenSHC/UI/AppendCreditsListTerminator.cpp b/src/OpenSHC/UI/AppendCreditsListTerminator.cpp index 2b2df0c4..9195364a 100644 --- a/src/OpenSHC/UI/AppendCreditsListTerminator.cpp +++ b/src/OpenSHC/UI/AppendCreditsListTerminator.cpp @@ -5,19 +5,13 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004DA810 void UI::AppendCreditsListTerminator() - { if (DAT_UnknownBinkCount::instance < 288) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x20; DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; } - return; } } diff --git a/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp b/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp index 37f04353..b4a0d4f7 100644 --- a/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp +++ b/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp @@ -5,19 +5,13 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004DA840 void UI::AppendCreditsPauseCommand() - { if (DAT_UnknownBinkCount::instance < 0x120) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x1c; DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; } - return; } } diff --git a/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp b/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp index 6f60fce6..f2ab38e2 100644 --- a/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp +++ b/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp @@ -5,19 +5,13 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004DA870 void UI::AppendCreditsSegmentEndCommand() - { if (DAT_UnknownBinkCount::instance < 0x120) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field0_0x0 = 0x1f; DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; } - return; } } diff --git a/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp b/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp index 4806296a..c9a57cf6 100644 --- a/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp +++ b/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp @@ -1,4 +1,4 @@ -#include "../UI.func.hpp" +#include "OpenSHC/UI.func.hpp" #include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp" @@ -9,10 +9,6 @@ namespace OpenSHC { using OpenSHC::Audio::MSS::enums::SHC_SoundStream; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004DABF0 void UI::AppendCreditsSoundStreamCommand(int param_1, SHC_SoundStream param_2) { @@ -21,7 +17,6 @@ void UI::AppendCreditsSoundStreamCommand(int param_1, SHC_SoundStream param_2) DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = param_2; DAT_UnknownBinkCount::instance = DAT_UnknownBinkCount::instance + 1; } - return; } } diff --git a/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp b/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp index 43f5c34f..b80c0773 100644 --- a/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp +++ b/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp @@ -1,8 +1,6 @@ #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/Map/Buildings/BuildingType.hpp" - - #include "OpenSHC/Globals/DAT_00df5588.hpp" #include "OpenSHC/Globals/DAT_00df558c.hpp" @@ -11,28 +9,23 @@ namespace UI { using OpenSHC::Map::Buildings::BuildingType; - -/* +/* Sets DAT_00df5588 (tutorial action type) and DAT_00df558c (building type) unless param_1 is 0xb and DAT_00df5588 is already 7 — in which case the update is skipped to avoid overwriting a pending state. Used to record which building-related action the player last performed for tutorial step evaluation. - + renamed by: Claude Sonnet 4.6 */ - // FUNCTION: STRONGHOLDCRUSADER 0x004BC690 void Helpers::SetTutorialBuildingActionState(int param_1,BuildingType buildingType) - { if ((param_1 != 0xb) || (DAT_00df5588::instance != 7)) { DAT_00df5588::instance = param_1; DAT_00df558c::instance = buildingType; } -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp b/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp index 1eeabbe3..a78fde74 100644 --- a/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp +++ b/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp @@ -3,8 +3,6 @@ #include "OpenSHC/Game/GameMode.hpp" #include "OpenSHC/Commands/MappersEnum.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" @@ -15,27 +13,8 @@ using OpenSHC::UI::HoveredStateElement; using OpenSHC::Game::GameMode; using OpenSHC::Commands::MappersEnum; - -/* - WARNING: Enum "MappersEnumInt": Some values do not have unique names - */ - -/* - 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 0x005010E0 void HoveredState::clearInvalidatedHoverStates() - { HoveredStateElement * _pElement; int _index; @@ -52,9 +31,7 @@ _pElement = _pElement + 6; _index = _index + -1; } while (_index != 0); } -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/Menu/updateMenuButtons.cpp b/src/OpenSHC/UI/Menu/updateMenuButtons.cpp index 0517cc3d..1e0b3dc6 100644 --- a/src/OpenSHC/UI/Menu/updateMenuButtons.cpp +++ b/src/OpenSHC/UI/Menu/updateMenuButtons.cpp @@ -2,8 +2,6 @@ #include "OpenSHC/UI/MenuItem.hpp" #include "OpenSHC/UI/Enums/MenuItemHandleState.hpp" - - #include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" namespace OpenSHC { @@ -12,15 +10,8 @@ namespace UI { using OpenSHC::UI::MenuItem; using OpenSHC::UI::Enums::MenuItemHandleState; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004F6470 void Menu::updateMenuButtons() - { if (this->hoveredItem == (MenuItem *)0x0) { this->someMenuItemPtr_0x3c = (MenuItem *)0x0; @@ -30,9 +21,7 @@ this->field16_0x40 = 0; DAT_MenuHandlerState::instance.field18_0x3c = 0; MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::handleMenuItems, this)(OpenSHC::UI::Enums::MIHS_HANDLE_INPUT_CALLBACKSUnk); this->one = 0; -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp b/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp index 8212f49e..e893433a 100644 --- a/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp +++ b/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp @@ -1,33 +1,20 @@ #include "OpenSHC/UI/MenuHandlerState.func.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" - - - - namespace OpenSHC { namespace UI { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004F4C60 void MenuHandlerState::setupBuildMenuState(dword param_1,dword param_2) - { this->isBuildMenuTransitioning_0x18 = FALSE; this->buildMenuBackgroundLeftShift_0x24 = 0; this->buildMenuTransitionDirection_0x2c = -1; this->const017 = param_1; this->const516 = param_2; -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp b/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp index a8b0c398..fb5a421e 100644 --- a/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp +++ b/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp @@ -10,7 +10,6 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004F4C30 void MenuItem::resetMenuItemStateUnk() - { MenuItemTypeInt MVar1; @@ -23,7 +22,6 @@ namespace UI { if ((MVar1 == OpenSHC::UI::Enums::MIT_SLIDERUnk) || (MVar1 == OpenSHC::UI::Enums::MIT_SCROLLBARUnk)) { (this->secondItemTypeData).buttonState.currentButtonPictureInGm_0xc = -1000; } - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp index d2a6fe2b..4571b37b 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp @@ -12,13 +12,8 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004D9D60 void UI::MenuItemActionHandler_DeleteGameRecord_Main(int param_1, ...) - { if (param_1 == 0x16) { MACRO_CALL(OpenSHC::Game::Skirmish_Func::SkirmishLeaderboard_DeleteEntry)(DAT_00ed2788::instance); @@ -26,7 +21,6 @@ void UI::MenuItemActionHandler_DeleteGameRecord_Main(int param_1, ...) } MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( OpenSHC::UI::Enums::MMT_NONE, FALSE); - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp index 8333616b..29932eda 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp @@ -11,13 +11,8 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004BB650 void UI::MenuItemActionHandler_DisableArabTroops_Main(int param_1, ...) - { if ((uint)param_1 < 8) { DAT_MapPropertiesState::instance.SEC_MercRecruitable[param_1] @@ -28,7 +23,6 @@ void UI::MenuItemActionHandler_DisableArabTroops_Main(int param_1, ...) MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( OpenSHC::UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); } - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp index 8158b416..776391a0 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp @@ -11,13 +11,8 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004BB540 void UI::MenuItemActionHandler_DisableEuroTroops_Main(int param_1, ...) - { if ((uint)param_1 < 8) { DAT_MapPropertiesState::instance.SEC_MercRecruitable[param_1 + -7] @@ -28,7 +23,6 @@ void UI::MenuItemActionHandler_DisableEuroTroops_Main(int param_1, ...) MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( OpenSHC::UI::Enums::MMT_BUILDING_AVAILABILITY, FALSE); } - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp b/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp index 47187ca9..4bf107f3 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp @@ -16,20 +16,14 @@ using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::UI::Enums::MenuViewType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00491C20 void UI::MenuItemActionHandler_EnterTitleOnGameStart_Button(int param_1, ...) - { MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( OpenSHC::UI::Enums::MMT_NONE, FALSE); MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp b/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp index d5a7b22c..6ffadf7b 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp @@ -4,13 +4,8 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x00494920 void UI::MenuItemActionHandler_SaveMap_ReturnKeySave(int param_1, ...) - { bool bVar1; @@ -20,7 +15,6 @@ void UI::MenuItemActionHandler_SaveMap_ReturnKeySave(int param_1, ...) MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_SaveLoadMap_Buttons)(3); return; } - return; } } diff --git a/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp b/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp index bfd813ec..f6626743 100644 --- a/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp +++ b/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp @@ -10,13 +10,8 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004B1090 void UI::MenuItemActionHandler_UnusedWinCondition_Options(int param_1, ...) - { if (param_1 < (int)DAT_MenuModalComposition1::instance.mbr_0x64) { DAT_MenuModalComposition1::instance.sliderValue = param_1; @@ -24,19 +19,11 @@ void UI::MenuItemActionHandler_UnusedWinCondition_Options(int param_1, ...) MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( OpenSHC::UI::Enums::MMT_NONE, FALSE); if (DAT_MenuModalComposition1::instance.sliderCallbackFunction != (undefined*)0x0) { - /* - WARNING: Could not recover jumptable at 0x004b10c0. Too many branches - */ - - /* - WARNING: Treating indirect jump as call - */ ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); return; } } - return; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp index 143b8bca..ce5fe9e2 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp @@ -6,13 +6,8 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004B6500 void UI::MenuItemRenderFunction_InGameMenu_MapEventIconUnk(int param_1, ...) - { DAT_ButtonUnknownZero::instance = 1; if ((DAT_MinimapViewState::instance.spawnMomentCount != 0) && (DAT_GameCore::instance.isBinkVideoPlaying == 0)) { @@ -21,7 +16,6 @@ void UI::MenuItemRenderFunction_InGameMenu_MapEventIconUnk(int param_1, ...) MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); return; } - return; } } diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp index eb28e327..18c3c45e 100644 --- a/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp +++ b/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp @@ -2,8 +2,6 @@ #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_ButtonX.hpp" #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" #include "OpenSHC/Globals/DAT_ButtonH.hpp" @@ -13,20 +11,11 @@ namespace OpenSHC { using OpenSHC::WindowsHelper::Enums::BOOLEnum; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00492C60 void UI::MenuItemRenderFunction_SaveLoadMap_Scrollbar(int param_1,int thumbYPos,int param_3,int thumbHeight,BOOLEnum isDragged) - { -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, +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); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp b/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp index b2b68f62..46398724 100644 --- a/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp +++ b/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp @@ -2,8 +2,6 @@ #include "OpenSHC/UI/MenuModal.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" - - #include "OpenSHC/Globals/DAT_ModalMenuArrayPointerToStackTop.hpp" namespace OpenSHC { @@ -12,15 +10,8 @@ namespace UI { using OpenSHC::UI::MenuModal; using OpenSHC::UI::Enums::MenuModalType; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004A9EB0 MenuModal * MenuModalComposition::findModalMenu(MenuModalType menuModalID) - { MenuModal *pMVar1; @@ -35,6 +26,5 @@ pMVar1 = pMVar1->pointerToNextModalMenu; return pMVar1; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp b/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp index 8354c52d..3e7175fb 100644 --- a/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp +++ b/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp @@ -11,13 +11,8 @@ namespace UI { using OpenSHC::UI::Menu; using OpenSHC::UI::MenuModal; - /* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004A9E80 void MenuModalComposition::loadAllMenuElementsOfMenuModals() - { MenuModal* pMVar1; @@ -27,7 +22,6 @@ namespace UI { MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::loadMenuElements, pMVar1->pointerToMenu)(0); } } - return; } } diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp index ed27bc74..24acd33a 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AB540 void UI::MenuModalRenderFunction_CreateOrTriggerInvasion(int x,int y,int width,int height) - { -/* - added by script: "Invasion" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x2e, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp index 4d47f426..5565c26a 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp @@ -1,27 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/AI/AICState.func.hpp" - - #include "OpenSHC/Globals/DAT_AICState.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAA60 void UI::MenuModalRenderFunction_DebugDataAiInfo(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::AI::AICState_Func::renderDebugDataAiInfo, DAT_AICState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp index 0408b549..ff33a710 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp @@ -1,27 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Game/GameStateStructures.func.hpp" - - #include "OpenSHC/Globals/DAT_GameState.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAA40 void UI::MenuModalRenderFunction_DebugDataCurrentPlayerData(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::renderDebugDataCurrentPlayerData, DAT_GameState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp index b9951931..d7f5c123 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp @@ -1,27 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Map/WildlifeState.func.hpp" - - #include "OpenSHC/Globals/DAT_WildlifeState.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAB20 void UI::MenuModalRenderFunction_DebugDataMapData(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Map::WildlifeState_Func::renderDebugDataMapData, DAT_WildlifeState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp index 9f85da9b..9bd6922b 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp @@ -1,27 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Rendering/ViewportRenderState.func.hpp" - - #include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAAC0 void UI::MenuModalRenderFunction_DebugDataMousePointing(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::renderDebugDataMousePointing, DAT_ViewportRenderState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp index 159480f0..38ccf922 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp @@ -1,35 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { - - - -/* - 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 0x004AAAE0 void UI::MenuModalRenderFunction_DebugDataNetwork(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::renderDebugDataNetwork, DAT_GameSynchronyState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp index 9fa6001c..f8c01466 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp @@ -1,35 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" - - #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" namespace OpenSHC { - - - -/* - 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 0x004AAB00 void UI::MenuModalRenderFunction_DebugDataSplitInfo(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::renderDebugDataSplitInfo, DAT_GameSynchronyState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp index 9017bdfa..175300d4 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp @@ -1,27 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Map/Units/UnitsState.func.hpp" - - #include "OpenSHC/Globals/DAT_UnitsState.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAA80 void UI::MenuModalRenderFunction_DebugDataUnitData(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::renderDebugDataUnitData, DAT_UnitsState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp index d491005b..5f08646e 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp @@ -1,31 +1,14 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Map/Units/TroopValueState.func.hpp" - - #include "OpenSHC/Globals/DAT_TroopValueState.hpp" namespace OpenSHC { - - - -/* - WARNING: Enum "MappersEnum": Some values do not have unique names - */ - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AAAA0 void UI::MenuModalRenderFunction_DebugDataZoneDataUnk(int x,int y,int width,int height) - { MACRO_CALL_MEMBER(OpenSHC::Map::Units::TroopValueState_Func::renderAttackInfoDebugOverlay, DAT_TroopValueState::ptr)(x, y, width, height); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp index 0a0d96d8..9ea85f56 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004ABCB0 void UI::MenuModalRenderFunction_DisableTroops(int x,int y,int width,int height) - { -/* - added by script: "Troops" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xbc, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp index d183046b..480d7abf 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004ABCE0 void UI::MenuModalRenderFunction_DisableWeapon(int x,int y,int width,int height) - { -/* - added by script: "Weapons" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xbd, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp index 52d3ea64..bf1581db 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp @@ -7,7 +7,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004AB440 void UI::MenuModalRenderFunction_DisplayAiLordMessage(int x, int y, int width, int height) - { MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::AIMessageQueue_Func::playAiLordMessage, DAT_VideoBikQueue::ptr)(x, y); } diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp index d1dbfeda..0cdf07fb 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00491BF0 void UI::MenuModalRenderFunction_EnterTitleOnGameStart(int x,int y,int width,int height) - { -/* - added by script: "Enter Your Title" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(5, 6, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp index ba513c93..6829cfce 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00491E80 void UI::MenuModalRenderFunction_GameplayOptions(int x,int y,int width,int height) - { -/* - added by script: "Game Play Options" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 0x19, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp index d797d0fe..89119611 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00492A60 void UI::MenuModalRenderFunction_NetworkOptions(int x,int y,int width,int height) - { -/* - added by script: "Network Options" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 6, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp index 82058ae6..103839cc 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004937B0 void UI::MenuModalRenderFunction_OnlineQuitGame(int x,int y,int width,int height) - { -/* - added by script: "Quit Mission" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 7, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp index 8055fd85..c2652dd3 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00491810 void UI::MenuModalRenderFunction_OptionsMenu(int x,int y,int width,int height) - { -/* - added by script: "Game Options" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 1, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp index 405cbd23..1886af70 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004ABE50 void UI::MenuModalRenderFunction_SkirmishConnectionOptions(int x,int y,int width,int height) - { -/* - added by script: "Connection options" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4f, 0x5d, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp index d0091b4b..660c7451 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004ABE80 void UI::MenuModalRenderFunction_SkirmishPlayOptions(int x,int y,int width,int height) - { -/* - added by script: "Play Options" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4f, 0x67, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp index 440be5fd..aedb4866 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x00492660 void UI::MenuModalRenderFunction_SoundOptions(int x,int y,int width,int height) - { -/* - added by script: "Sound Options" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 5, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp index ae462643..03acec8b 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AB4E0 void UI::MenuModalRenderFunction_StartGoods(int x,int y,int width,int height) - { -/* - added by script: "Start Goods" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x29, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp index e4c1f596..26d7bafc 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AB4B0 void UI::MenuModalRenderFunction_TraderSettings(int x,int y,int width,int height) - { -/* - added by script: "Trader" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x26, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp index c3b22bc3..29e745bd 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AC250 void UI::MenuModalRenderFunction_TriggerEvent(int x,int y,int width,int height) - { -/* - added by script: "Events" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x17, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp index a58e8e0a..a8a31369 100644 --- a/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp +++ b/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp @@ -1,31 +1,15 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004AB510 void UI::MenuModalRenderFunction_UnusedSiegeAttackingForceUnk(int x,int y,int width,int height) - { -/* - added by script: "Attacking Force" - */ MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xa4, x, y, width); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp index b9507be4..fe86b85c 100644 --- a/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp +++ b/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp @@ -2,23 +2,14 @@ #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" namespace OpenSHC { using OpenSHC::UI::Enums::MenuViewType; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004D6EF0 void UI::MenuView_CampaignUnk_DoEveryFrame() - { int iVar1; @@ -30,8 +21,6 @@ return; } MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(OpenSHC::UI::Enums::MVT_UNKNOWN_26_CAMPAIGN_RELATEDUnk, 0); } -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp b/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp index 2b11ee12..0fa4f8ee 100644 --- a/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp @@ -1,33 +1,20 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - #include "OpenSHC/Globals/INT_00eb9ae8.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" #include "OpenSHC/Globals/DAT_MissionDefinedData.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004D8AB0 void UI::MenuView_CrusadeMissionIntro_Prepare() - { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("skirmish_background.tgx"); MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); INT_00eb9ae8::instance = 0; DAT_MissionDefinedData::instance.field26_0xaf8 = true; -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp b/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp index 4869731b..d251852f 100644 --- a/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp @@ -2,8 +2,6 @@ #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" #include "OpenSHC/Map/MapPropertiesState.func.hpp" - - #include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" #include "OpenSHC/Globals/DAT_GameState.hpp" @@ -11,24 +9,13 @@ namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004BEC10 void UI::MenuView_EditScenario_Prepare() - { DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_builder2.tgx"); MACRO_CALL_MEMBER(OpenSHC::Map::MapPropertiesState_Func::updateEventYearsAndCommitBuildingAvailability, DAT_MapPropertiesState::ptr)(); DAT_CopyOfScenarioGold::instance = (int)DAT_GameState::instance.mapAndTime.scenarioGold; -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp b/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp index f3ee2c37..fb64168e 100644 --- a/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp +++ b/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp @@ -1,8 +1,6 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/UI/Menu.hpp" - - #include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" @@ -10,15 +8,8 @@ namespace OpenSHC { using OpenSHC::UI::Menu; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004B8050 void UI::MenuView_General_DoInitial_OnlySetMenuXY() - { Menu *pMVar1; @@ -27,8 +18,6 @@ DAT_MenuHandlerState::instance.x = DAT_WindowAndDirectDraw::instance.mainMenuBor pMVar1 = DAT_MenuHandlerState::instance.currentMenu; (DAT_MenuHandlerState::instance.currentMenu)->xPosition = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; pMVar1->yPosition = DAT_MenuHandlerState::instance.y; -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp b/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp index f8997d98..5a2784b0 100644 --- a/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp @@ -2,8 +2,6 @@ #include "OpenSHC/Game/Skirmish.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_00ed27a0.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" @@ -11,25 +9,8 @@ namespace OpenSHC { - - - -/* - 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 0x004D9700 void UI::MenuView_RankingGames_Prepare() - { MACRO_CALL(OpenSHC::Game::Skirmish_Func::Skirmish_PrepareLeaderboardView)(); DAT_00ed27a0::instance = 0; @@ -37,8 +18,6 @@ DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, DAT_TextureRenderCoreObject::ptr)("frontend_combat3.tgx"); MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); DAT_StoredGameMode::instance = DAT_GameSynchronyState::instance.currentGameMode; -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp b/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp index db652234..32a92cff 100644 --- a/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp @@ -1,29 +1,16 @@ #include "OpenSHC/UI.func.hpp" #include "OpenSHC/Rendering.func.hpp" - - #include "OpenSHC/Globals/DAT_GameCore.hpp" namespace OpenSHC { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004DCC70 void UI::MenuView_Unknown26_CampaignRelatedUnk_Prepare() - { MACRO_CALL(OpenSHC::UI_Func::ResetCredits)(); MACRO_CALL(OpenSHC::UI_Func::BuildIntroLogoSequence)(DAT_GameCore::instance.missionNumber1to20, (undefined4)((int)(DAT_GameCore::instance.section1066))); MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp index 1957554f..0622ec65 100644 --- a/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp +++ b/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp @@ -4,8 +4,6 @@ #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" #include "OpenSHC/Rendering.func.hpp" - - #include "OpenSHC/Globals/DAT_00ed278c.hpp" #include "OpenSHC/Globals/DAT_MenuModalComposition3.hpp" @@ -14,23 +12,14 @@ namespace OpenSHC { using OpenSHC::UI::Enums::MenuModalType; using OpenSHC::WindowsHelper::Enums::BOOLEnum; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004E1A20 void UI::MenuView_UnusedExtremeAd_Prepare() - { MACRO_CALL(OpenSHC::UI_Func::ResetCredits)(); MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition3::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); MACRO_CALL(OpenSHC::UI_Func::BuildExtremeDemoIntroScript)(); MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); DAT_00ed278c::instance = 0; -return; } - -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/PlayAMessageFromAI.cpp b/src/OpenSHC/UI/PlayAMessageFromAI.cpp index 19793823..80de2012 100644 --- a/src/OpenSHC/UI/PlayAMessageFromAI.cpp +++ b/src/OpenSHC/UI/PlayAMessageFromAI.cpp @@ -16,13 +16,11 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004B7F60 void UI::PlayAMessageFromAI(uint param_1, int param_2) - { if ((param_1 < 0x11) && (param_2 - 1U < 0x21)) { MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playWAVSFX, DAT_SFXState::ptr)( (char const*)DAT_MissionAestheticsDefinedData::instance.field92_0x170[param_2 * 0x11 + param_1 + -0xc]); } - return; } } diff --git a/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp b/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp index 63e6e499..50c05417 100644 --- a/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp +++ b/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp @@ -1,31 +1,18 @@ #include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" namespace OpenSHC { namespace UI { - - - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004DA640 void Rendering::RenderMenuGfxHelper(int gfxIndex,int x,int y,int blendStrength) - { -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, DAT_TextureRenderCoreObject::ptr)(gfxIndex, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, DAT_TextureRenderCoreObject::ptr)(gfxIndex, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y, blendStrength); -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp b/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp index eccbf796..1e0e257a 100644 --- a/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp +++ b/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp @@ -10,8 +10,6 @@ #include "OpenSHC/Rendering/ScreenResolutionEnum.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" - - #include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" #include "OpenSHC/Globals/DAT_TextManagerObject.hpp" #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" @@ -30,15 +28,8 @@ using OpenSHC::DE::SHCDE::eTextSections; using OpenSHC::Rendering::Enums::RenderTarget; using OpenSHC::Rendering::ScreenResolutionEnum; - -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - - // FUNCTION: STRONGHOLDCRUSADER 0x004B20B0 void Rendering::RenderNoRushDisplayElementUnk(int posX,int posY,DWORD elementState) - { char *pcVar1; int left; @@ -55,7 +46,7 @@ int iVar4; int blendStrength; if (DAT_GameState::instance.mapAndTime.skirmishNoRushTicks == 0) { -/* +/* Plays pa paam pa pa pa paam */ @@ -127,18 +118,16 @@ alignment = OpenSHC::Text::TTA_CENTER; xParam = iVar2; yParam = posY; pcVar1 = MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_SKIRMISH_MISC, 7); -MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)(pcVar1, xParam, yParam, alignment, foregroundColor, backgroundColor, +MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)(pcVar1, xParam, yParam, alignment, foregroundColor, backgroundColor, fontSize, keepOffsetX, blendStrength); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)(left + -1, posY + 0x12, iVar3 + 1 + iVar2, posY + 0x18, (ushort)((int)( COL_BLACK::instance.shortValue))); -MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(left, posY + 0x13, +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(left, posY + 0x13, ((DAT_GameState::instance.mapAndTime.skirmishNoRushTicks * (iVar4 + 0x32)) / DAT_GameState::instance.mapAndTime.skirmishNoRushTicksLeft - iVar3) + iVar2, posY + 0x17, (ushort)((int)( COL_DARK_LIME::instance.shortValue))); DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; -return; } - } -} \ No newline at end of file +} diff --git a/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp b/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp index ac8f3889..fcee92dc 100644 --- a/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp +++ b/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp @@ -5,17 +5,11 @@ namespace OpenSHC { -/* - decompilerscript: committed: 2025-01-30 21:57:43.216000 - */ - // FUNCTION: STRONGHOLDCRUSADER 0x004D9270 void __cdecl UI::SetActiveCreditsSequenceIndex(undefined4 param_1) - { DAT_00ed3124::instance = param_1; DAT_00ed3120::instance = 0; - return; } } diff --git a/src/OpenSHC/UI/TacticalPowersFill.cpp b/src/OpenSHC/UI/TacticalPowersFill.cpp index a6599a69..1497b289 100644 --- a/src/OpenSHC/UI/TacticalPowersFill.cpp +++ b/src/OpenSHC/UI/TacticalPowersFill.cpp @@ -7,7 +7,6 @@ namespace OpenSHC { // FUNCTION: STRONGHOLDCRUSADER 0x004D9D90 void UI::TacticalPowersFill() - { if ((DAT_TacticalPowersHelpTextDisplayBool::instance != '\0') && (DAT_MissionDefinedData::instance.field39_0x1370 = DAT_MissionDefinedData::instance.field39_0x1370 + -1,