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/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/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/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/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/exitToScenarioDescriptionMenu.cpp b/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp new file mode 100644 index 00000000..6d905a65 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/exitToScenarioDescriptionMenu.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::UI::Enums::MenuViewType; + + // 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); + } + +} +} diff --git a/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp b/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp new file mode 100644 index 00000000..db40763f --- /dev/null +++ b/src/OpenSHC/Game/GameCore/isGameHaltingMenuOpen.cpp @@ -0,0 +1,32 @@ +#include "OpenSHC/Game/GameCore.func.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" + +namespace OpenSHC { +namespace Game { + + 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); + } + +} +} diff --git a/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp b/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp new file mode 100644 index 00000000..9a93c254 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp @@ -0,0 +1,21 @@ +#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/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/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/GameCore/switchToScenarioDescriptionMenuView.cpp b/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp new file mode 100644 index 00000000..8e2bf467 --- /dev/null +++ b/src/OpenSHC/Game/GameCore/switchToScenarioDescriptionMenuView.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::UI::Enums::MenuViewType; + + // 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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp b/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp new file mode 100644 index 00000000..b5d60d31 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/activateTraderState.cpp @@ -0,0 +1,14 @@ +#include "../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/calculateTaxBribeExpenseForPlayer.cpp b/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp new file mode 100644 index 00000000..2c0b4bd8 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/calculateTaxBribeExpenseForPlayer.cpp @@ -0,0 +1,17 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp b/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp new file mode 100644 index 00000000..88683c04 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/clearTribeHotKey.cpp @@ -0,0 +1,20 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Game/State/UnitSelectionHotKeyEntry.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::Game::State::UnitSelectionHotKeyEntry; + + // 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; + } + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp b/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp new file mode 100644 index 00000000..2087fbaa --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/destroyPlayerCompletely.cpp @@ -0,0 +1,28 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Map/Buildings/BuildingsState.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_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); + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp b/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp new file mode 100644 index 00000000..2948e601 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp @@ -0,0 +1,23 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Game/GameStateStructures.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::Game::GameStateStructures; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp b/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp new file mode 100644 index 00000000..dc163282 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/findNextPlayerWithMarketplace.cpp @@ -0,0 +1,22 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Game/Player/PlayerData.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::Game::Player::PlayerData; + + // FUNCTION: STRONGHOLDCRUSADER 0x00458700 + int GameStateStructures::findNextPlayerWithMarketplace(int param_1) + { + 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/getBatchBuyPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp new file mode 100644 index 00000000..736371e1 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp @@ -0,0 +1,13 @@ +#include "../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/Game/GameStateStructures/getBuyPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp new file mode 100644 index 00000000..4fc13374 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getBuyPrice.cpp @@ -0,0 +1,13 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp b/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp new file mode 100644 index 00000000..1b141009 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getBuyPriceForOneUnit.cpp @@ -0,0 +1,13 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp new file mode 100644 index 00000000..93c881c5 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayBribeIncome.cpp @@ -0,0 +1,19 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp new file mode 100644 index 00000000..2fffb57e --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getNumberToDisplayPlayerTaxIncome.cpp @@ -0,0 +1,19 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp b/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp new file mode 100644 index 00000000..3d06ffbb --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getSalePriceOfGood.cpp @@ -0,0 +1,17 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Game/Resources/ResourceType.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::Game::Resources::ResourceType; + + // FUNCTION: STRONGHOLDCRUSADER 0x004588F0 + int GameStateStructures::getSalePriceOfGood(ResourceType param_1) + { + return this->mapAndTime.buyAndSalesPriceArray[param_1].salesPrice / 5; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp new file mode 100644 index 00000000..9ffd6215 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getSalesPrice.cpp @@ -0,0 +1,15 @@ +#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); + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp b/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp new file mode 100644 index 00000000..c823f1ed --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getSellPrice.cpp @@ -0,0 +1,13 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp b/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp new file mode 100644 index 00000000..e7d0eac3 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/getTeamsDifferent.cpp @@ -0,0 +1,20 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp b/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp new file mode 100644 index 00000000..967b56e2 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/isFullIDEqualsToMinus1.cpp @@ -0,0 +1,19 @@ +#include "../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/isResourceTypeTradeable.cpp b/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp new file mode 100644 index 00000000..606cd3d2 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/isResourceTypeTradeable.cpp @@ -0,0 +1,22 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Game/Resources/ResourceType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Game { + + 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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp b/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp new file mode 100644 index 00000000..d93bb754 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/isSameTeam.cpp @@ -0,0 +1,17 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Game { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00401090 + BOOLEnum GameStateStructures::isSameTeam(int playerID1, int playerID2) + { + return this->mapAndTime.playerTeams[playerID1] == this->mapAndTime.playerTeams[playerID2]; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp b/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp new file mode 100644 index 00000000..84106d9c --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/resetSomethingBuildingRelatedForAllPlayers.cpp @@ -0,0 +1,18 @@ +#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); + } + } + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp b/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp new file mode 100644 index 00000000..6f20f5f2 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp @@ -0,0 +1,20 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp b/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp new file mode 100644 index 00000000..5f57f695 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/switchPlayerOwnership.cpp @@ -0,0 +1,23 @@ +#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)(); + } + +} +} 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..b8e97a0b --- /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; + va_start(args, format); + 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/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..ba4eff1c --- /dev/null +++ b/src/OpenSHC/Input/MouseState/resetMouseCursorState.cpp @@ -0,0 +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; + } + +} +} 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/Input/getCurrentTutorialStep.cpp b/src/OpenSHC/Input/getCurrentTutorialStep.cpp new file mode 100644 index 00000000..4f93809a --- /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 OpenSHC::Input::GetCurrentTutorialStep(void) { return DAT_TutorialCurrentStep::instance; } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp new file mode 100644 index 00000000..3141c733 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/applyVersionUpgradeAccessibilityRecompute.cpp @@ -0,0 +1,21 @@ +#include "../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)(); + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp new file mode 100644 index 00000000..b0854055 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/clearBuildingValueWhenStateIsTwo.cpp @@ -0,0 +1,19 @@ +#include "../BuildingsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp new file mode 100644 index 00000000..fd941425 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getArmoryWithSpaceLeft.cpp @@ -0,0 +1,38 @@ +#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::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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp new file mode 100644 index 00000000..61e1bd26 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag1.cpp @@ -0,0 +1,12 @@ +#include "../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..ce88669a --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingFlag3.cpp @@ -0,0 +1,12 @@ +#include "../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/getBuildingResourceAmountByUid.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp new file mode 100644 index 00000000..6c16ec0d --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingResourceAmountByUid.cpp @@ -0,0 +1,22 @@ +#include "../BuildingsState.func.hpp" + +#include "OpenSHC/Game/Resources/ResourceType.hpp" + +namespace OpenSHC { +namespace Map { + namespace Buildings { + + using OpenSHC::Game::Resources::ResourceType; + + // FUNCTION: STRONGHOLDCRUSADER 0x00409330 + int 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]; + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp new file mode 100644 index 00000000..70863055 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getBuildingStorageTypeForResourceType.cpp @@ -0,0 +1,23 @@ +#include "../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]); + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp new file mode 100644 index 00000000..95dd7a81 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getResourceCountThatCanBeDeposited.cpp @@ -0,0 +1,20 @@ +#include "../BuildingsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp new file mode 100644 index 00000000..9662bf66 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/getSpriteID2.cpp @@ -0,0 +1,32 @@ +#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; + + // 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp new file mode 100644 index 00000000..454fc0fd --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/isReligiousBuilding.cpp @@ -0,0 +1,24 @@ +#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::BuildingType; + using OpenSHC::Map::Buildings::BuildingTypeShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x0040A4A0 + BOOLEnum 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp new file mode 100644 index 00000000..cf8c4194 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/setBuildingToAppleFarm.cpp @@ -0,0 +1,12 @@ +#include "../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/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp b/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp new file mode 100644 index 00000000..d8cfb7db --- /dev/null +++ b/src/OpenSHC/Map/Buildings/BuildingsState/updatePathLinkageLayerForAllBuildings.cpp @@ -0,0 +1,29 @@ +#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::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); + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp b/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp new file mode 100644 index 00000000..ef4df72b --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateBadBuildingCessPitOrDancingBearUnk.cpp @@ -0,0 +1,17 @@ +#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() + { + DAT_BuildingsState::instance.buildings[DAT_CurrentBuildingID::instance].renderAnimation = 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 new file mode 100644 index 00000000..42734366 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateBadBuildingRackFlogging.cpp @@ -0,0 +1,21 @@ +#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" + +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); + } + +} +} 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/Buildings/UpdateGoodBuildingGarden.cpp b/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp new file mode 100644 index 00000000..6e7fc0b9 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateGoodBuildingGarden.cpp @@ -0,0 +1,24 @@ +#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" + +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); + } + +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround2.cpp new file mode 100644 index 00000000..4ed55305 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround2.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 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; + } + +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround3.cpp new file mode 100644 index 00000000..e310a565 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround3.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 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; + } + +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp b/src/OpenSHC/Map/Buildings/UpdateParadeGround4.cpp new file mode 100644 index 00000000..688d6903 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdateParadeGround4.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 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; + } + +} +} diff --git a/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp b/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp new file mode 100644 index 00000000..db633589 --- /dev/null +++ b/src/OpenSHC/Map/Buildings/UpdatePlacedSiegeTower.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Map/Buildings.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.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; + + // 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; + } + } + +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp new file mode 100644 index 00000000..9037e799 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/activateProjectileEntity.cpp @@ -0,0 +1,24 @@ +#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::EntityType; + using OpenSHC::Map::Entities::EntityTypeShort; + + // FUNCTION: STRONGHOLDCRUSADER 0x004039B0 + 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp b/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp new file mode 100644 index 00000000..af2a57c2 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/deleteEntity.cpp @@ -0,0 +1,22 @@ +#include "../EntityState.func.hpp" + +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + 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]); + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp b/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp new file mode 100644 index 00000000..ff14fd34 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/destroyEntitiesPart2.cpp @@ -0,0 +1,19 @@ +#include "../EntityState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp b/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp new file mode 100644 index 00000000..b0f274e7 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/getFireEntityIDAtTile.cpp @@ -0,0 +1,27 @@ +#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; + + // 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp b/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp new file mode 100644 index 00000000..dc3e2432 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/markEntityDestroyed.cpp @@ -0,0 +1,18 @@ +#include "../EntityState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp b/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp new file mode 100644 index 00000000..b2a5e3ce --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/reassignEntitiesOwner.cpp @@ -0,0 +1,19 @@ +#include "../EntityState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp b/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp new file mode 100644 index 00000000..883d41da --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/tickEntityDecayCounter.cpp @@ -0,0 +1,20 @@ +#include "../EntityState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp b/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp new file mode 100644 index 00000000..6083bfd2 --- /dev/null +++ b/src/OpenSHC/Map/Entities/IgniteFireAtMiniTile_Convenience.cpp @@ -0,0 +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); + } + +} +} diff --git a/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp b/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp new file mode 100644 index 00000000..60ebf70f --- /dev/null +++ b/src/OpenSHC/Map/Entities/SetPlaceOnFire.cpp @@ -0,0 +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); + } + +} +} diff --git a/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp b/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp new file mode 100644 index 00000000..985a7a94 --- /dev/null +++ b/src/OpenSHC/Map/Entities/UpdateBrazierEntity.cpp @@ -0,0 +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; + } + +} +} diff --git a/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp b/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp new file mode 100644 index 00000000..383c8b95 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/constructLandscapeState.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/Map/LandscapeState.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::LandscapeState; + + // 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; + } + +} +} 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/LandscapeState/isTreeAdult.cpp b/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp new file mode 100644 index 00000000..fb765ba1 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/isTreeAdult.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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; + } + +} +} diff --git a/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp b/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp new file mode 100644 index 00000000..96f3cd01 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/isTreeAliveAndMatchingUID.cpp @@ -0,0 +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; + } + +} +} diff --git a/src/OpenSHC/Map/LandscapeState/resetWind.cpp b/src/OpenSHC/Map/LandscapeState/resetWind.cpp new file mode 100644 index 00000000..d7c186a3 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/resetWind.cpp @@ -0,0 +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; + } + +} +} diff --git a/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp b/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp new file mode 100644 index 00000000..c041bcb9 --- /dev/null +++ b/src/OpenSHC/Map/LandscapeState/upgradeTreesAndRocksForMapVersion.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/IO/PackagedFileMagicNum.hpp" + +namespace OpenSHC { +namespace Map { + + 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)(); + } + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp b/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp new file mode 100644 index 00000000..7579a35f --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/isMercRecruitableForBuildingType.cpp @@ -0,0 +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; + + // 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; + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp b/src/OpenSHC/Map/MapPropertiesState/isValueInRangeOneToTwenty.cpp new file mode 100644 index 00000000..f27b663a --- /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 < 20; } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp b/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp new file mode 100644 index 00000000..e36a29a0 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/mapHasCertainEvent.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" + +namespace OpenSHC { +namespace Map { + +// 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); +} + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp b/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp new file mode 100644 index 00000000..342e014b --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/openEventTriggerMenu.cpp @@ -0,0 +1,26 @@ +#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; + + // 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); + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp b/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp new file mode 100644 index 00000000..f720350c --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/sumInvasionEventUnitCount.cpp @@ -0,0 +1,24 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" + +namespace OpenSHC { +namespace Map { + +// 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); +} + +} +} diff --git a/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp b/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp new file mode 100644 index 00000000..62f5b13e --- /dev/null +++ b/src/OpenSHC/Map/Navigation/DirectionAlgorithmState/computeHealthPercentage.cpp @@ -0,0 +1,18 @@ +#include "../DirectionAlgorithmState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} 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/Navigation/PathFindingState/clearAllClimbData.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp new file mode 100644 index 00000000..29a8fb67 --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/clearAllClimbData.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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); + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp new file mode 100644 index 00000000..5d537d9d --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/clearClimbData.cpp @@ -0,0 +1,19 @@ +#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 { + + // 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]); + } + + } +} +} 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 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/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp new file mode 100644 index 00000000..592967e9 --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/retraceAndCommitPathPlan.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp b/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp new file mode 100644 index 00000000..4004e28f --- /dev/null +++ b/src/OpenSHC/Map/Navigation/PathFindingState/updatePathLinkageLayerForEachBuildingAtEachTile.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" + +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { +namespace Map { + 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); + } + } + + } +} +} diff --git a/src/OpenSHC/Map/TileMapState/clearMoatData.cpp b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp new file mode 100644 index 00000000..464b6140 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/clearMoatData.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x005002D0 + void TileMapState::clearMoatData(uint moatID) + { + if (moatID > 15999) { + 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/forceFullTileMapRedraw.cpp b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp new file mode 100644 index 00000000..50d53018 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/forceFullTileMapRedraw.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x005017A0 + void TileMapState::forceFullTileMapRedraw() + { + this->forceUpdateLogicalAndMiscDisplayLayers = 1; + this->forceUpdateTextureTilemap = 1; + this->forceUpdateGFXLayers = 1; + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::setChangedLayerToThreeAndMapping0x40x40, this)(); + } + +} +} 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/processDamageToBuildingThunk.cpp b/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp new file mode 100644 index 00000000..9a0c3244 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/processDamageToBuildingThunk.cpp @@ -0,0 +1,19 @@ +#include "../TileMapState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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); + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp b/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp new file mode 100644 index 00000000..1f8d85fe --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/processEntityDamageToBuildingCollateralThunk.cpp @@ -0,0 +1,15 @@ +#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); + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp new file mode 100644 index 00000000..c7d16dd4 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/processMapOrientationChange.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // 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; + } + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp new file mode 100644 index 00000000..43472a4d --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x005000A0 + void TileMapState::recountTotalOwnedMoats() + { + this->currentMoatCount = 0; + 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp new file mode 100644 index 00000000..5e1aaa02 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/resetMoatArray.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Moat.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::Moat; + + // FUNCTION: STRONGHOLDCRUSADER 0x00500680 + void TileMapState::resetMoatArray() + { + for (int i = 0; i < 16000; i++) { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x10, 0, &this->moats[i]); + } + this->moatTileCount = 0; + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp new file mode 100644 index 00000000..d2a39514 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/resetPitchDitchArray.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/PitchDitch.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::PitchDitch; + + // FUNCTION: STRONGHOLDCRUSADER 0x005007D0 + void TileMapState::resetPitchDitchArray() + { + this->maxPitchDitchCount = 4000; + for (int i = 0; i < 4000; i++) { + MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + 0x14, 0, &this->pitchDitches[i]); + } + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/setMapRotation.cpp b/src/OpenSHC/Map/TileMapState/setMapRotation.cpp new file mode 100644 index 00000000..2aa68190 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/setMapRotation.cpp @@ -0,0 +1,10 @@ +#include "../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/TileMapState/setMoatOwnerForAllMatching.cpp b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp new file mode 100644 index 00000000..142f0f4e --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/setMoatOwnerForAllMatching.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x00500750 + void TileMapState::setMoatOwnerForAllMatching(int param_1, undefined4 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp new file mode 100644 index 00000000..87ca49d4 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/setMoatVisualStateAtTile.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x00500720 + void TileMapState::setMoatVisualStateAtTile(int tile, undefined4 zeroOrTwo) + { + int iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::returnOwnedMoatAtTile, this)(tile); + if (iVar1 != 0) { + this->moats[iVar1].zeroOrTwo = zeroOrTwo; + } + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp new file mode 100644 index 00000000..3c163739 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/spreadBrazierPlacementAlgorithm.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" + +#include "OpenSHC/Globals/DAT_PathFindingState.hpp" + +namespace OpenSHC { +namespace Map { + + // 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); + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp new file mode 100644 index 00000000..5080c550 --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/spreadFlagPlacementAlgorithm.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Map/Navigation/PathFindingState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" + +#include "OpenSHC/Globals/DAT_PathFindingState.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x00501180 + int TileMapState::spreadFlagPlacementAlgorithm(int param_1, uint param_2, uint param_3) + { + 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/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/TileMapState/updateBuildingPlacementRotationPreview.cpp b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp new file mode 100644 index 00000000..922487ac --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/updateBuildingPlacementRotationPreview.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00504EE0 + void TileMapState::updateBuildingPlacementRotationPreview(int param_1, int param_2) + { + BOOLEnum _previous = this->buildingPlacementFail; + this->buildingPlacementFail = FALSE; + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::determineBuildingPlacementRotation, this)(param_1, param_2); + this->buildingPlacementFail = _previous; + } + +} +} diff --git a/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp new file mode 100644 index 00000000..4934a62a --- /dev/null +++ b/src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Map/Moat.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::Moat; + + // FUNCTION: STRONGHOLDCRUSADER 0x00500640 + void TileMapState::updateMoatCountdownTimers() + { + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::recountTotalOwnedMoats, this)(); + for (int i = 0; i < this->currentMoatCount; i++) { + if (this->moats[i].owner != 0 && this->moats[i].someCountDown > 0) { + this->moats[i].someCountDown -= 1; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Trees/UpdateTree16.cpp b/src/OpenSHC/Map/Trees/UpdateTree16.cpp new file mode 100644 index 00000000..38fa7a94 --- /dev/null +++ b/src/OpenSHC/Map/Trees/UpdateTree16.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Map/Trees.func.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; + } + +} +} 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/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 new file mode 100644 index 00000000..8dbefc7c --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/addUnitToSelected.cpp @@ -0,0 +1,22 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Globals/DAT_UnitSelectionDefinedData.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00522520 + void TribesState::addUnitToSelected(uint unitID) + { + int index; + + index = (int)unitID / 16; + *(ushort*)(DAT_UnitsState::instance.selectedUnitsBitFlags + index * 2) + |= DAT_UnitSelectionDefinedData::instance.BitMaskHelper[(int)unitID % 16]; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp new file mode 100644 index 00000000..5e77765c --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/clearTribe.cpp @@ -0,0 +1,20 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/IO/LowLevelMemory.func.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + 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]); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp b/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp new file mode 100644 index 00000000..9744c66d --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/constructTribesState.cpp @@ -0,0 +1,28 @@ +#include "../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..7d9cb9f9 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/giveUnitSelectionMoveInstructionNoMatchedSpeed.cpp @@ -0,0 +1,21 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Map/Units/Instructions/UnitMatchSpeedEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::Instructions::UnitMatchSpeedEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004B7700 + void TribesState::giveUnitSelectionMoveInstructionNoMatchedSpeed( + 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, Units::Instructions::UMSE_0); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp b/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp new file mode 100644 index 00000000..a2b2f16b --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/markTribeAsAnimalTribe.cpp @@ -0,0 +1,12 @@ +#include "../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..cfe4c679 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playArcherCommandSpeech.cpp @@ -0,0 +1,25 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.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) + { + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajorityArcherTypeEuropeanOrArabian, this)( + selectionID), + 0x1f); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp new file mode 100644 index 00000000..1237f180 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playPatrolCommandSpeech.cpp @@ -0,0 +1,28 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.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; + + // FUNCTION: STRONGHOLDCRUSADER 0x00522110 + void TribesState::playPatrolCommandSpeech(undefined4 param_1) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( + 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, 0x29); + } + + } +} +} 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/TribesState/playUnitSelectSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp new file mode 100644 index 00000000..b8be8047 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playUnitSelectSpeech.cpp @@ -0,0 +1,28 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.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; + + // FUNCTION: STRONGHOLDCRUSADER 0x00521EB0 + void TribesState::playUnitSelectSpeech(undefined4 param_1) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( + 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp new file mode 100644 index 00000000..4f833a0f --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/playWorkCommandSpeech.cpp @@ -0,0 +1,29 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.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; + + // FUNCTION: STRONGHOLDCRUSADER 0x00522160 + void TribesState::playWorkCommandSpeech(undefined4 param_1) + { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::selectionContainsCombatUnit, DAT_UnitsState::ptr)( + 1); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::playUnitSpeech, DAT_SFXState::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getMajoritySelectedUnitType, this)( + param_1, (int*)¶m_1), + 0x24); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp b/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp new file mode 100644 index 00000000..74b446b7 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/popUnitFromTribe.cpp @@ -0,0 +1,20 @@ +#include "../TribesState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp new file mode 100644 index 00000000..686c1303 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/queueUnitStance.cpp @@ -0,0 +1,26 @@ +#include "../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; + + // 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp new file mode 100644 index 00000000..4b3a8c79 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/reassignOwnerForTribesOfBehaviorType2.cpp @@ -0,0 +1,23 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Globals/DAT_TribesState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00521210 + void TribesState::reassignOwnerForTribesOfBehaviorType2(int param_1, int param_2) + { + for (int i = 1; i < 1250; i++) { + // 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp new file mode 100644 index 00000000..441f137b --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/setCamelSpawnXY.cpp @@ -0,0 +1,22 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp new file mode 100644 index 00000000..57f79965 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/setUnitStance.cpp @@ -0,0 +1,22 @@ +#include "../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; + + // FUNCTION: STRONGHOLDCRUSADER 0x00522C20 + void TribesState::setUnitStance(int tribeID, UnitStanceEnum unitStance) + { + this->tribes[tribeID].unitStance = unitStance; + DAT_GameCore::instance.countdown = 1; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp new file mode 100644 index 00000000..85b3a7ec --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/setWhetherTribeContainsAnyUnits.cpp @@ -0,0 +1,20 @@ +#include "../TribesState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp new file mode 100644 index 00000000..12999e72 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/storeDeerXAndYinMapInfo.cpp @@ -0,0 +1,22 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp new file mode 100644 index 00000000..2ec59fd4 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/storeLionXAndYInMapInfo.cpp @@ -0,0 +1,26 @@ +#include "../TribesState.func.hpp" + +#include "OpenSHC/Map/Location/Point4ShortXY.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp new file mode 100644 index 00000000..d795e952 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/tribeCorrespondsWithUID.cpp @@ -0,0 +1,18 @@ +#include "../TribesState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00522360 + uint TribesState::tribeCorrespondsWithUID(int tribeID, uint tribeUID) + { + if (tribeUID == 0) { + return 0; + } + return this->tribes[tribeID].uid == tribeUID; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp b/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp new file mode 100644 index 00000000..298a1214 --- /dev/null +++ b/src/OpenSHC/Map/Units/TribesState/upgradeMapTribesState.cpp @@ -0,0 +1,25 @@ +#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; + + // 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)(); + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp new file mode 100644 index 00000000..36f3a053 --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasArch2Building.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp new file mode 100644 index 00000000..20b5eb7b --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/attackInfoHasHigh2Building.cpp @@ -0,0 +1,28 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" +#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; + + // 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp b/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp new file mode 100644 index 00000000..ae97ac88 --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/clearAIInfoLayerOutsideStartZone.cpp @@ -0,0 +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 { + + // 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'; + } + } + } + + } +} +} 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/TroopValueState/getTileInTargetedBuildingTiles.cpp b/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp new file mode 100644 index 00000000..1a80ac4f --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/getTileInTargetedBuildingTiles.cpp @@ -0,0 +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; + + // 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp b/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp new file mode 100644 index 00000000..e9e02ceb --- /dev/null +++ b/src/OpenSHC/Map/Units/TroopValueState/isAttackWaveComplete.cpp @@ -0,0 +1,24 @@ +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp b/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp new file mode 100644 index 00000000..8ae098d5 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/ComputeDamageFearFactorBonus.cpp @@ -0,0 +1,17 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x005311F0 + int UnitsState::computeDamageFearFactorBonus(int damage, int playerID) + { + return ((DAT_GameState::instance.playerDataArray[playerID].fearFactorLevel + 20) * damage * 5) / 100; + } + + } +} +} 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 new file mode 100644 index 00000000..9e893060 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/changeDestinationByLeftover.cpp @@ -0,0 +1,19 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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); + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp b/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp new file mode 100644 index 00000000..6b387660 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/checkIfCitizenUnitIsAliveBasedOnState.cpp @@ -0,0 +1,31 @@ +#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::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; + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp b/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp new file mode 100644 index 00000000..fdad9cc5 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/checkUnitHasPropertyBasedOnUnitType.cpp @@ -0,0 +1,18 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/Globals/DAT_UnitPropertiesDefinedData.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x0052F0A0 + int UnitsState::checkUnitHasPropertyBasedOnUnitType(int unitID, int property) + { + return DAT_UnitPropertiesDefinedData::instance + .UnitClimbStateFlags[property][(short)this->units[unitID].unitType]; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp b/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp new file mode 100644 index 00000000..14cd0185 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/clearHiddenFlagAndUpdatePosition.cpp @@ -0,0 +1,18 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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); + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp new file mode 100644 index 00000000..1ee99753 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/deselectUnit.cpp @@ -0,0 +1,18 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // FUNCTION: STRONGHOLDCRUSADER 0x00535190 + void UnitsState::deselectUnit(int unitID) + { + if (this->units[unitID].isSelected != 0) { + this->units[unitID].isSelected = 0; + this->totalUnitsInSelection -= 1; + } + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp b/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp new file mode 100644 index 00000000..dc5242d8 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/extendRallyPoint.cpp @@ -0,0 +1,27 @@ +#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; + + // 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp b/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp new file mode 100644 index 00000000..0c11f2a7 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/getArmySize.cpp @@ -0,0 +1,17 @@ +#include "../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/getDestination2EqualsGivenCoordinates.cpp b/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp new file mode 100644 index 00000000..41f9370d --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/getDestination2EqualsGivenCoordinates.cpp @@ -0,0 +1,22 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp b/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp new file mode 100644 index 00000000..2c2459a7 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/getFirstSelectedUnitID.cpp @@ -0,0 +1,26 @@ +#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; + + // 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)); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp b/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp new file mode 100644 index 00000000..da188c72 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/hasTunnelerNotFinishedDigging.cpp @@ -0,0 +1,19 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x005339F0 + BOOLEnum UnitsState::hasTunnelerNotFinishedDigging(int param_1) + { + return this->units[param_1].tunnelerFinishedDigging == 0; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp b/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp new file mode 100644 index 00000000..6e549235 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/isComputerManagedNonPeasant.cpp @@ -0,0 +1,30 @@ +#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::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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp b/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp new file mode 100644 index 00000000..13ceb174 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/makeUnitStopWalkingByClearingPathProgressState.cpp @@ -0,0 +1,18 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp b/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp new file mode 100644 index 00000000..84fe5070 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueClickNavigateMenuOrEscape.cpp @@ -0,0 +1,25 @@ +#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; + + // FUNCTION: STRONGHOLDCRUSADER 0x00536CC0 + void UnitsState::queueClickNavigateMenuOrEscape(undefined4 param_1) + { + 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp new file mode 100644 index 00000000..3784a584 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand2Params.cpp @@ -0,0 +1,25 @@ +#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; + + // 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp new file mode 100644 index 00000000..c650ba8e --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand3Params.cpp @@ -0,0 +1,26 @@ +#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; + + // 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp new file mode 100644 index 00000000..5588cd67 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueDisbandAndAttackCommand4Params.cpp @@ -0,0 +1,28 @@ +#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; + + // 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp b/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp new file mode 100644 index 00000000..e0a68b52 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/queueUnitTypeCommand.cpp @@ -0,0 +1,25 @@ +#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; + + // FUNCTION: STRONGHOLDCRUSADER 0x00536C90 + void UnitsState::queueUnitTypeCommand(undefined4 unitType) + { + 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); + } + + } +} +} 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/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; } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp b/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp new file mode 100644 index 00000000..d8b019de --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/saveUnitStateBeforeInterruption.cpp @@ -0,0 +1,18 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/Map/Units/States/UnitStateUnion.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp new file mode 100644 index 00000000..6ea0e23b --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsEngineersOnly.cpp @@ -0,0 +1,33 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/Map/Units/UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Units::UnitsState; + + // 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) { + // 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++; + } + result = TRUE; + } + return result; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp new file mode 100644 index 00000000..9ebf426a --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsLadermenOnly.cpp @@ -0,0 +1,29 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // 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) { + // 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++; + } + result = TRUE; + } + return result; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp new file mode 100644 index 00000000..90ac8454 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsOnlyArabAssassins.cpp @@ -0,0 +1,33 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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) { + // 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++; + } + result = TRUE; + } + return result; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp new file mode 100644 index 00000000..822835f2 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsShieldmenOnly.cpp @@ -0,0 +1,29 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // 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) { + // 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++; + } + result = TRUE; + } + return result; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp new file mode 100644 index 00000000..95f8d48e --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionContainsTunnelersOnly.cpp @@ -0,0 +1,29 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + // 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) { + // 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++; + } + result = TRUE; + } + return result; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp b/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp new file mode 100644 index 00000000..f5fa655c --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/selectionHasArchers.cpp @@ -0,0 +1,22 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00535560 + BOOLEnum UnitsState::selectionHasArchers() + { + if (this->selectionEuropeanArchers != 0) { + return TRUE; + } + return this->selectionArabArcher != 0; + } + + } +} +} 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/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp b/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp new file mode 100644 index 00000000..d448f751 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/setupUnitSharingCurrentTilePosition.cpp @@ -0,0 +1,16 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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); + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp b/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp new file mode 100644 index 00000000..7b80d567 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/sitDownIfStanding.cpp @@ -0,0 +1,20 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp b/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp new file mode 100644 index 00000000..8cc37cbc --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/standUpIfSeated.cpp @@ -0,0 +1,20 @@ +#include "../UnitsState.func.hpp" + +namespace OpenSHC { +namespace Map { + 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; + } + + } +} +} diff --git a/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp new file mode 100644 index 00000000..3fbe35a4 --- /dev/null +++ b/src/OpenSHC/Map/Units/UnitsState/unitIsInMoat.cpp @@ -0,0 +1,22 @@ +#include "../UnitsState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_TileMapState.hpp" + +namespace OpenSHC { +namespace Map { + namespace Units { + + using OpenSHC::Map::Logic1; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00534460 + BOOLEnum UnitsState::unitIsInMoat(int unitID) + { + 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 new file mode 100644 index 00000000..57ddb4f4 --- /dev/null +++ b/src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/Map/Units.func.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::Map::Units::States::UnitState; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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))); + } + +} +} diff --git a/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp b/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp new file mode 100644 index 00000000..7954d6e4 --- /dev/null +++ b/src/OpenSHC/Map/Version/SetBuildingsEmployeeCountToValue.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.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; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp b/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp new file mode 100644 index 00000000..8f5dc46b --- /dev/null +++ b/src/OpenSHC/Map/Version/SetDairyCheeseToZero.cpp @@ -0,0 +1,32 @@ +#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() + { + 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp b/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp new file mode 100644 index 00000000..dc430a67 --- /dev/null +++ b/src/OpenSHC/Map/Version/SetUndamagedBuildingHealthToValue.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" +#include "OpenSHC/Map/Buildings/BuildingLogicalState.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; + + // 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; + } + } + } + +} +} 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/UpdateUnitLossData.cpp b/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp new file mode 100644 index 00000000..7cc5c29e --- /dev/null +++ b/src/OpenSHC/Map/Version/UpdateUnitLossData.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Map/Version.func.hpp" + +#include "OpenSHC/Globals/DAT_UnitValueLossesPerEnemyPlayer.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044AA80 + void Version::UpdateUnitLossData(int lossValue, int playerID) + { + if (lossValue < 0) { + DAT_UnitValueLossesPerEnemyPlayer::instance[playerID] -= lossValue; + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp new file mode 100644 index 00000000..acc2b16d --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField1.cpp @@ -0,0 +1,25 @@ +#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; + + // 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].uidPlaced; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp new file mode 100644 index 00000000..b252d01f --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField2.cpp @@ -0,0 +1,25 @@ +#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; + + // 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].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 new file mode 100644 index 00000000..a9cee13e --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeBuildingField4.cpp @@ -0,0 +1,24 @@ +#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; + + // 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].field244_0x2c6 = 0; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp b/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp new file mode 100644 index 00000000..5f2d93a5 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeClearBuildings1000AndHigher.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Buildings/Building.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::Buildings::Building; + + // 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]); + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp b/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp new file mode 100644 index 00000000..aad5b09e --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeFirst9Buildings.cpp @@ -0,0 +1,21 @@ +#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); + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp b/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp new file mode 100644 index 00000000..24ee46f3 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeKillingPitField.cpp @@ -0,0 +1,28 @@ +#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; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp new file mode 100644 index 00000000..0aeb79a9 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_125.cpp @@ -0,0 +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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp new file mode 100644 index 00000000..61632162 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapLogicToVersion_147.cpp @@ -0,0 +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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp new file mode 100644 index 00000000..f0e01abc --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_142.cpp @@ -0,0 +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; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp new file mode 100644 index 00000000..088d3b49 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapTribesStateVersionTo_Unknown2.cpp @@ -0,0 +1,21 @@ +#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); + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp new file mode 100644 index 00000000..9ebfff2a --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_112.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/Unit.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.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; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp new file mode 100644 index 00000000..4f93debd --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_114.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" +#include "OpenSHC/Map/Units/UnitLogicStateShort.hpp" + +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::Units::UnitLogicState; + using OpenSHC::Map::Units::UnitLogicStateShort; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp new file mode 100644 index 00000000..96abcb0d --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_130.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" +#include "OpenSHC/Map/Units/UnitTypeShort.hpp" + +#include "OpenSHC/Globals/DAT_CurrentUnitSlotID.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace Map { + + 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp new file mode 100644 index 00000000..7061514e --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_149.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/Unit.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.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; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp new file mode 100644 index 00000000..ff73ed35 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeMapUnitsTo_155.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Units/Unit.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.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; + + // 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp b/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp new file mode 100644 index 00000000..de8cc321 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeOutpostField.cpp @@ -0,0 +1,30 @@ +#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; + + // FUNCTION: STRONGHOLDCRUSADER 0x0041A710 + void Version::UpgradeOutpostField() + { + 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; + } + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp b/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp new file mode 100644 index 00000000..2ae7d8c8 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeRemoveRocksBeyond1000.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Map/Version.func.hpp" +#include "OpenSHC/Map/Rocks/Rock.hpp" + +#include "OpenSHC/Globals/DAT_LandscapeState.hpp" +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" + +namespace OpenSHC { +namespace Map { + + using OpenSHC::Map::Rocks::Rock; + + // 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]); + } + } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp b/src/OpenSHC/Map/Version/UpgradeSetCurrentEntityID3000.cpp new file mode 100644 index 00000000..97b23d68 --- /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; } + +} +} diff --git a/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp b/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp new file mode 100644 index 00000000..974015a3 --- /dev/null +++ b/src/OpenSHC/Map/Version/UpgradeSolitaryMapBuildingField3.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/Map/Version.func.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::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; + } + } + } + } + +} +} diff --git a/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp b/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp new file mode 100644 index 00000000..3f6880b1 --- /dev/null +++ b/src/OpenSHC/Map/WallAndPitchState/resetWallAndPitchState.cpp @@ -0,0 +1,28 @@ +#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; + + // 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; + } + } + +} +} diff --git a/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp b/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp new file mode 100644 index 00000000..c6e948e7 --- /dev/null +++ b/src/OpenSHC/Map/WallAndPitchState/resetWallPlacementInfo.cpp @@ -0,0 +1,28 @@ +#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; + + // 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; + } + } + +} +} diff --git a/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp b/src/OpenSHC/Map/WildlifeState/clearWildlifeState.cpp new file mode 100644 index 00000000..d6ba10c8 --- /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->grid[0][0]); + } + +} +} diff --git a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp new file mode 100644 index 00000000..6957783b --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp @@ -0,0 +1,21 @@ +#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/setBinkSndStreamAndStartTime.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp new file mode 100644 index 00000000..665bc117 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/setBinkSndStreamAndStartTime.cpp @@ -0,0 +1,26 @@ +#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; + + // 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(); + } + } + + } +} +} diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp new file mode 100644 index 00000000..f7815eb7 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlayback.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" + +namespace OpenSHC { +namespace Rendering { + namespace Bink { + + // FUNCTION: STRONGHOLDCRUSADER 0x00408EB0 + void BinkControlClass::stopAllBinkPlayback() + { + for (int binkObjIndex = 0; binkObjIndex < 2; binkObjIndex++) + MACRO_CALL_MEMBER(BinkControlClass_Func::stopBinkPlayback, this)(binkObjIndex); + } + + } // namespace Bink +} // namespace Rendering +} // namespace OpenSHC diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp new file mode 100644 index 00000000..3f9bffb0 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/stopAllBinkPlaybackThunk.cpp @@ -0,0 +1,15 @@ +#include "../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)(); + } + + } +} +} diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp new file mode 100644 index 00000000..ec551067 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/zeroBinkPtrAndLoadBinkSoundSystem.cpp @@ -0,0 +1,18 @@ +#include "../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/computeTileXOffset.cpp b/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp new file mode 100644 index 00000000..91e7004d --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/computeTileXOffset.cpp @@ -0,0 +1,13 @@ +#include "../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/createFloatingTextElement.cpp b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp new file mode 100644 index 00000000..a790f02a --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/createFloatingTextElement.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" + +namespace OpenSHC { +namespace Rendering { + + using OpenSHC::IO::Graphics::GmID; + + // 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); + } + +} +} 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/resetBatchedRender.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp new file mode 100644 index 00000000..e11881f1 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetBatchedRender.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +namespace OpenSHC { +namespace Rendering { + + // 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; + } + +} +} diff --git a/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp b/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp new file mode 100644 index 00000000..4c88f30e --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/resetupViewportThunk.cpp @@ -0,0 +1,14 @@ +#include "../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..cba66425 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/restoreFocusTile.cpp @@ -0,0 +1,13 @@ +#include "../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/Rendering/ViewportRenderState/translateXYToTile.cpp b/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp new file mode 100644 index 00000000..437a8147 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/translateXYToTile.cpp @@ -0,0 +1,10 @@ +#include "../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/Rendering/ViewportRenderState/xyAreValid.cpp b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp new file mode 100644 index 00000000..7e538608 --- /dev/null +++ b/src/OpenSHC/Rendering/ViewportRenderState/xyAreValid.cpp @@ -0,0 +1,17 @@ +#include "../ViewportRenderState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Rendering { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x00401000 + BOOLEnum ViewportRenderState::xyAreValid(uint x, uint y) + { + return ((x <= 399) && (y <= 399)) && this->DAT_BinaryTileMap400x400[y * 400 + x] != 0; + } + +} +} diff --git a/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp b/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp new file mode 100644 index 00000000..3337070c --- /dev/null +++ b/src/OpenSHC/Rendering/WindowInformation/storeWindowRectangleInfoUnk.cpp @@ -0,0 +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; + } + +} +} 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/Actions/RemovePositionOfPlayer.cpp b/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp new file mode 100644 index 00000000..503542eb --- /dev/null +++ b/src/OpenSHC/Synchrony/Actions/RemovePositionOfPlayer.cpp @@ -0,0 +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; + } + } + } + +} +} diff --git a/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp b/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp new file mode 100644 index 00000000..2f336b40 --- /dev/null +++ b/src/OpenSHC/Synchrony/Actions/SetBuildingProductionType.cpp @@ -0,0 +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; + } + } + +} +} diff --git a/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp b/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp new file mode 100644 index 00000000..b7a00609 --- /dev/null +++ b/src/OpenSHC/Synchrony/Commands/QueueChangeGameIntensityOrBalance.cpp @@ -0,0 +1,22 @@ +#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/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/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp new file mode 100644 index 00000000..779e44e0 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/clearGameCommandEntry.cpp @@ -0,0 +1,19 @@ +#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))); + } + } + +} +} diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp new file mode 100644 index 00000000..8c5d4c48 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/compressOrCreateLengthPrefixedPacketUnk.cpp @@ -0,0 +1,19 @@ +#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; + } + +} +} diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/computeSomeHashOnUnitArray.cpp new file mode 100644 index 00000000..30e1c1b4 --- /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 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 new file mode 100644 index 00000000..ae3c59f2 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/decompressTooLongPacketData.cpp @@ -0,0 +1,21 @@ +#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 { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047E800 + void GameSynchronyState::decompressTooLongPacketData(byte* source, byte* destination) + { + 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); + } + +} +} 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; } + +} +} diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp new file mode 100644 index 00000000..6c6f8ec9 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/isAIPlayer.cpp @@ -0,0 +1,20 @@ +#include "../GameSynchronyState.func.hpp" + +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Synchrony { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004010B0 + BOOLEnum GameSynchronyState::isAIPlayer(int playerID) + { + if (this->currentPlayerFullIDArray[playerID] != -1) { + return FALSE; + } + return this->currentAIArray[playerID] != 0; + } + +} +} diff --git a/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp b/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp new file mode 100644 index 00000000..83e76539 --- /dev/null +++ b/src/OpenSHC/Synchrony/GameSynchronyState/throttledMultiplayerSyncUpdate.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Game/GameMode.hpp" + +namespace OpenSHC { +namespace Synchrony { + + 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)(); + } + } + } + +} +} diff --git a/src/OpenSHC/Synchrony/GetPlayerPosition.cpp b/src/OpenSHC/Synchrony/GetPlayerPosition.cpp new file mode 100644 index 00000000..3036cbf4 --- /dev/null +++ b/src/OpenSHC/Synchrony/GetPlayerPosition.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Synchrony.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0042AC60 +int Synchrony::GetPlayerPosition(int playerID) +{ + for (int _position = 0; _position < 8; _position++) { + if (DAT_GameSynchronyState::instance.playerPositionsArray[_position] + 1 == playerID) { + return _position + 1; + } + } + return 0; +} + +} diff --git a/src/OpenSHC/Synchrony/ProgressBarRelated.cpp b/src/OpenSHC/Synchrony/ProgressBarRelated.cpp new file mode 100644 index 00000000..854198c8 --- /dev/null +++ b/src/OpenSHC/Synchrony/ProgressBarRelated.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Synchrony.func.hpp" +#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; + +// 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); +} + +} 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..b7c163ee --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/bltTextToScreenIfNeedBe.cpp @@ -0,0 +1,26 @@ +#include "../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; + } + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp new file mode 100644 index 00000000..44394e1c --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getHelpSectionText.cpp @@ -0,0 +1,22 @@ +#include "../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 NULL; + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp b/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp new file mode 100644 index 00000000..80c1d243 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getHelpTokenAdvanceLength.cpp @@ -0,0 +1,26 @@ +#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; + } + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp new file mode 100644 index 00000000..5cd98137 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getNextHelpColorEntryIndex.cpp @@ -0,0 +1,19 @@ +#include "../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/getPrevHelpColorEntryIndex.cpp b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp new file mode 100644 index 00000000..f74f38be --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/getPrevHelpColorEntryIndex.cpp @@ -0,0 +1,27 @@ +#include "../TextEditorState.func.hpp" + +#include "OpenSHC/Text/HelpTextRelatedColorStruct.hpp" + +#include "OpenSHC/Globals/DAT_UserHelpDefinedData.hpp" + +namespace OpenSHC { +namespace Text { + + 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 != NULL) { + iVar1++; + } + iVar1 = iVar1 + -1; + } + return iVar1; + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp new file mode 100644 index 00000000..3c3cb27e --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/loadAndParseHelpFile.cpp @@ -0,0 +1,26 @@ +#include "../TextEditorState.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Text { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x0045F580 + 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 TRUE; + } + } + return FALSE; + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp new file mode 100644 index 00000000..bd3736bf --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/popHelpDialogStack.cpp @@ -0,0 +1,23 @@ +#include "../TextEditorState.func.hpp" + +#include + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00462150 + void TextEditorState::popHelpDialogStack() + { + int iVar1 = this->helpSectionHistoryStack[0]; + memcpy(&this->helpSectionHistoryStack[0], &this->helpSectionHistoryStack[1], 29 * sizeof(int)); + this->helpSectionHistoryStack[29] = -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)(); + } + +} +} diff --git a/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp b/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp new file mode 100644 index 00000000..5b0225b8 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/renderHelpDialogIfOpen.cpp @@ -0,0 +1,16 @@ +#include "../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/TextEditorState/setHelpWindowBounds.cpp b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp new file mode 100644 index 00000000..0269f1c6 --- /dev/null +++ b/src/OpenSHC/Text/TextEditorState/setHelpWindowBounds.cpp @@ -0,0 +1,17 @@ +#include "../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; + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp b/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp new file mode 100644 index 00000000..b01bbc8e --- /dev/null +++ b/src/OpenSHC/Text/TextManager/computeTextWidthForTextGroup.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" + +namespace OpenSHC { +namespace Text { + + using OpenSHC::DE::SHCDE::eTextSections; + + // 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); + } + +} +} 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/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..ca79f008 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderInGameText.cpp @@ -0,0 +1,20 @@ +#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; + + // 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); + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp b/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp new file mode 100644 index 00000000..254beec1 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderLeftAlignedNumberToScreen.cpp @@ -0,0 +1,20 @@ +#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; + + // 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); + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/renderNumber.cpp b/src/OpenSHC/Text/TextManager/renderNumber.cpp new file mode 100644 index 00000000..79f7e475 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderNumber.cpp @@ -0,0 +1,20 @@ +#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; + + // 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); + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp b/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp new file mode 100644 index 00000000..1549229c --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderNumberToScreen.cpp @@ -0,0 +1,20 @@ +#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; + + // 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); + } + +} +} 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..8ca4e4e2 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/renderTextToScreen2.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace Text { + + 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); + } + +} +} 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/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/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]; } + +} +} 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/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/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/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/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/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/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..a6811fe1 --- /dev/null +++ b/src/OpenSHC/UI/ActivateGameSpeedAndResourceLackDisplayElementUnk.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::DisplayElement; +using OpenSHC::UI::Enums::DisplayElementID; + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF680 +void UI::ActivateGameSpeedAndResourceLackDisplayElementUnk( + DisplayElementID elementId, dword elementState, int displayDuration) +{ + 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; + } +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp b/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp new file mode 100644 index 00000000..bd00fb81 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsClearImageCommand.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsCommand.cpp b/src/OpenSHC/UI/AppendCreditsCommand.cpp new file mode 100644 index 00000000..10b42b8d --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsCommand.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsListTerminator.cpp b/src/OpenSHC/UI/AppendCreditsListTerminator.cpp new file mode 100644 index 00000000..9195364a --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsListTerminator.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp b/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp new file mode 100644 index 00000000..b4a0d4f7 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsPauseCommand.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp b/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp new file mode 100644 index 00000000..f2ab38e2 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsSegmentEndCommand.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp b/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp new file mode 100644 index 00000000..c9a57cf6 --- /dev/null +++ b/src/OpenSHC/UI/AppendCreditsSoundStreamCommand.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/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; + +// 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; + } +} + +} 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/FindDisplayElementWithID.cpp b/src/OpenSHC/UI/FindDisplayElementWithID.cpp new file mode 100644 index 00000000..37151423 --- /dev/null +++ b/src/OpenSHC/UI/FindDisplayElementWithID.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" + +#include "OpenSHC/Globals/DAT_PointerToDisplayElementStackTop.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::DisplayElement; + +// FUNCTION: STRONGHOLDCRUSADER 0x004AF630 +DisplayElement* UI::FindDisplayElementWithID(int elementID) +{ + DisplayElement* _pCurrent = DAT_PointerToDisplayElementStackTop::instance; + while (_pCurrent != NULL) { + if (_pCurrent->elementID_0x8 == elementID) + return _pCurrent; + _pCurrent = _pCurrent->nextDisplayElement_0x20; + } + return NULL; +} + +} diff --git a/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp b/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp new file mode 100644 index 00000000..0605a841 --- /dev/null +++ b/src/OpenSHC/UI/GreatestLord/IfAiGreatestLordGetAiType.cpp @@ -0,0 +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; + + // 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; + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp b/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp new file mode 100644 index 00000000..ea6078cc --- /dev/null +++ b/src/OpenSHC/UI/Helpers/AModalDialogIsActiveButIsNotQuitting.cpp @@ -0,0 +1,28 @@ +#include "OpenSHC/UI/Helpers.func.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::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; + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp b/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp new file mode 100644 index 00000000..ec8e1b5f --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckDisplayElementByIDAndSetForUnlimitedDisplay.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/DisplayElement.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::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; + } + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp b/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp new file mode 100644 index 00000000..1be7983c --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckGoldResource.cpp @@ -0,0 +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; + + // 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; + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp new file mode 100644 index 00000000..a2b554a7 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForLadderman.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/UI/Helpers.func.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]; + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp new file mode 100644 index 00000000..af06a630 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForMonk.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/UI/Helpers.func.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]; + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp new file mode 100644 index 00000000..6de67164 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/CheckIfEnoughGoldForTunneler.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/UI/Helpers.func.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]; + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp b/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp new file mode 100644 index 00000000..0430c33d --- /dev/null +++ b/src/OpenSHC/UI/Helpers/GetIfDisplayElementStateNotZero.cpp @@ -0,0 +1,25 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::UI::DisplayElement; + using OpenSHC::UI::Enums::DisplayElementID; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // 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; + } + +} +} 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/SetTaxesSetting_unknown.cpp b/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp new file mode 100644 index 00000000..7a510db6 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/SetTaxesSetting_unknown.cpp @@ -0,0 +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; + + // 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; + } + } + +} +} diff --git a/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp b/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp new file mode 100644 index 00000000..b80c0773 --- /dev/null +++ b/src/OpenSHC/UI/Helpers/SetTutorialBuildingActionState.cpp @@ -0,0 +1,31 @@ +#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; +} +} + +} +} 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/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/HoveredState/clearInvalidatedHoverStates.cpp b/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp new file mode 100644 index 00000000..a78fde74 --- /dev/null +++ b/src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp @@ -0,0 +1,37 @@ +#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; + +// 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); +} +} + +} +} 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/Menu/updateMenuButtons.cpp b/src/OpenSHC/UI/Menu/updateMenuButtons.cpp new file mode 100644 index 00000000..1e0b3dc6 --- /dev/null +++ b/src/OpenSHC/UI/Menu/updateMenuButtons.cpp @@ -0,0 +1,27 @@ +#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; + +// 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; +} + +} +} diff --git a/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp b/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp new file mode 100644 index 00000000..e893433a --- /dev/null +++ b/src/OpenSHC/UI/MenuHandlerState/setupBuildMenuState.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI/MenuHandlerState.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +namespace OpenSHC { +namespace UI { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +// 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; +} + +} +} diff --git a/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp b/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp new file mode 100644 index 00000000..fb5a421e --- /dev/null +++ b/src/OpenSHC/UI/MenuItem/resetMenuItemStateUnk.cpp @@ -0,0 +1,28 @@ +#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; + } + } + +} +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp new file mode 100644 index 00000000..49038c2b --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk.cpp @@ -0,0 +1,30 @@ +#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; + +// FUNCTION: STRONGHOLDCRUSADER 0x00433200 +void UI::MenuItemActionHandler_BuildMenu_SomeKeepAndGranaryCheckUnk(int param_1, ...) +{ + if (DAT_GameCore::instance.activeMenuTab.buildMenuTab == ((BuildMenuTabType)0x31)) { + 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); + } + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp new file mode 100644 index 00000000..9aae65b8 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_00b95b68.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0043FC80 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_ArmySwitchButton() +{ + DAT_00b95b68::instance = DAT_00b95b68::instance + 1; + if (2 < DAT_00b95b68::instance) { + DAT_00b95b68::instance = 0; + } +} + +} 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_BuildingAndStatusMenu_BuildingSleep.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp new file mode 100644 index 00000000..7a1ac495 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_BuildingSleep.cpp @@ -0,0 +1,28 @@ +#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_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +using OpenSHC::Commands::GameCommandType; +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 + = 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); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp new file mode 100644 index 00000000..9ff099ab --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_MarketMenuChangeButtons.cpp @@ -0,0 +1,20 @@ +#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; + +// 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; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp new file mode 100644 index 00000000..ebcc0a58 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00466710 +void UI::MenuItemActionHandler_BuildingAndStatusMenu_OutpostUnitSelection(int bitIndex, ...) +{ + // 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/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk.cpp new file mode 100644 index 00000000..afc23912 --- /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 UI::MenuItemActionHandler_BuildingAndStatusMenu_PopularityMenuSwitchButtonUnk() +{ + DAT_GameCore::instance.field80_0x144 = DAT_GameCore::instance.field80_0x144 ^ 1; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp new file mode 100644 index 00000000..44ba9683 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_BuildingAndStatusMenu_StopBuildingOrPeasantBinkPlayback.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +// 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); + } +} + +} 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_Chat_SendMessageToPlayer.cpp b/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp new file mode 100644 index 00000000..a28f3020 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_Chat_SendMessageToPlayer.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0047FFA0 +void UI::MenuItemActionHandler_Chat_SendMessageToPlayer(int param_1, ...) +{ + if (param_1 < 0) { + unsigned int param = -param_1; + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[param] ^= 1; + } + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + = 1; +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp b/src/OpenSHC/UI/MenuItemActionHandler_Chat_TauntButtons.cpp new file mode 100644 index 00000000..caed3023 --- /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, ...) +{ + 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..0e13a97e --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0047D0E0 +void UI::MenuItemActionHandler_ChooseNetworkServiceProvider_ModemTableRows(int param_1, ...) +{ + if (DAT_GameSynchronyState::instance.modemScrollBarOffset + param_1 + < DAT_GameSynchronyState::instance.modemScrollbarCount) { + DAT_GameSynchronyState::instance.modemScrollbarIndex = param_1; + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp new file mode 100644 index 00000000..4571b37b --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_DeleteGameRecord_Main.cpp @@ -0,0 +1,26 @@ +#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; + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp new file mode 100644 index 00000000..29932eda --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_DisableArabTroops_Main.cpp @@ -0,0 +1,28 @@ +#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; + +// 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); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp b/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp new file mode 100644 index 00000000..776391a0 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_DisableEuroTroops_Main.cpp @@ -0,0 +1,28 @@ +#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; + +// 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); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp b/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp new file mode 100644 index 00000000..4bf107f3 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_EnterTitleOnGameStart_Button.cpp @@ -0,0 +1,29 @@ +#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; + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_EnumerateDPlaySessions.cpp new file mode 100644 index 00000000..77918da0 --- /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, ...) +{ + 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..551207c0 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_FindingNetworkSessions_TableRows.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +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) { + 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..51354f3c --- /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, ...) +{ + 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 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 new file mode 100644 index 00000000..32f61b0e --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_General_Unknown2.cpp @@ -0,0 +1,10 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00434260 +void UI::MenuItemActionHandler_General_Unknown2(int param_1, ...) { DAT_GameCore::instance.field12_0x30 = param_1; } + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp b/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp new file mode 100644 index 00000000..e1d0c092 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_InGameMenu_UnknownBinkRelated.cpp @@ -0,0 +1,19 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp b/src/OpenSHC/UI/MenuItemActionHandler_NetworkOptions_LeaveButtonUnk.cpp new file mode 100644 index 00000000..2912f089 --- /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, ...) +{ + if (param_1 == 0x11) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp b/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp new file mode 100644 index 00000000..6ffadf7b --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_SaveMap_ReturnKeySave.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { + +// 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; + } +} + +} 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/MenuItemActionHandler_UnusedWinCondition_Options.cpp b/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp new file mode 100644 index 00000000..f6626743 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemActionHandler_UnusedWinCondition_Options.cpp @@ -0,0 +1,29 @@ +#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; + +// 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) { + + ((void (*)())DAT_MenuModalComposition1::instance.sliderCallbackFunction)(); + return; + } + } +} + +} 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/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp new file mode 100644 index 00000000..c3c1d6df --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingIcons.cpp @@ -0,0 +1,26 @@ +#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; + +// FUNCTION: STRONGHOLDCRUSADER 0x004668F0 +void UI::MenuItemRenderFunction_BuildMenu_BuildingIcons(int param_1, ...) +{ + 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; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp new file mode 100644 index 00000000..ac5f7efd --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingKeepSubcategoryButton.cpp @@ -0,0 +1,24 @@ +#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; + +// 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)(); +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp new file mode 100644 index 00000000..bcd46e6e --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton.cpp @@ -0,0 +1,23 @@ +#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 { + +// FUNCTION: STRONGHOLDCRUSADER 0x00466920 +void UI::MenuItemRenderFunction_BuildMenu_BuildingSubcategoryButton(int param_1, ...) +{ + 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; +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp new file mode 100644 index 00000000..b88c8c51 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00439390 +void UI::MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper(int param_1, ...) +{ + if ((DAT_UnitsState::instance.nHasOwnedUnitInSelection == 0) + || (DAT_ButtonUnknownZero::instance = 0, + ((int*)(&DAT_UnitsState::instance.selectionEngineers))[param_1] == -1)) { + DAT_ButtonUnknownZero::instance = 1; + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton.cpp new file mode 100644 index 00000000..6d16c144 --- /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 UI::MenuItemRenderFunction_BuildingAndStatusMenu_ArmyStatusSwitchButton() +{ + MACRO_CALL( + OpenSHC::UI_Func::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BarracksAndMercenaryPostHelpText.cpp new file mode 100644 index 00000000..32e73fbe --- /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, ...) +{ + if (DAT_BuildingsState::instance.field24_0x18e04c != 0) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp new file mode 100644 index 00000000..cbb1727b --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingHelpTextButton.cpp @@ -0,0 +1,25 @@ +#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; + +// 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)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp new file mode 100644 index 00000000..90fed05a --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_BuildingAndStatusMenu_PopularityMenuSwitchButton.cpp @@ -0,0 +1,21 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// 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)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_DisplayScenarioHelpText_AnotherButtonUnk.cpp new file mode 100644 index 00000000..67c927cb --- /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, ...) +{ + if (DAT_TextEditorState::instance.helpSectionHistoryStack[0] != -1) { + MACRO_CALL(OpenSHC::UI_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp new file mode 100644 index 00000000..ce5fe9e2 --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_InGameMenu_MapEventIconUnk.cpp @@ -0,0 +1,21 @@ +#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 { + +// 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; + } +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_LobbyMenu_Unknown.cpp new file mode 100644 index 00000000..e6f4b8ec --- /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, ...) +{ + 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/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp new file mode 100644 index 00000000..18c3c45e --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_SaveLoadMap_Scrollbar.cpp @@ -0,0 +1,21 @@ +#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; + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp b/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp new file mode 100644 index 00000000..4f343b3f --- /dev/null +++ b/src/OpenSHC/UI/MenuItemRenderFunction_SelectCrusade_Main.cpp @@ -0,0 +1,24 @@ +#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; + +// 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)(); +} + +} diff --git a/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp b/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp new file mode 100644 index 00000000..46398724 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalComposition/findModalMenu.cpp @@ -0,0 +1,30 @@ +#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; + +// 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; +} + +} +} diff --git a/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp b/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp new file mode 100644 index 00000000..3e7175fb --- /dev/null +++ b/src/OpenSHC/UI/MenuModalComposition/loadAllMenuElementsOfMenuModals.cpp @@ -0,0 +1,28 @@ +#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; + + // 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); + } + } + } + +} +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp new file mode 100644 index 00000000..24acd33a --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_CreateOrTriggerInvasion.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB540 +void UI::MenuModalRenderFunction_CreateOrTriggerInvasion(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x2e, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp new file mode 100644 index 00000000..5565c26a --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataAiInfo.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/AI/AICState.func.hpp" + +#include "OpenSHC/Globals/DAT_AICState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp new file mode 100644 index 00000000..ff33a710 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataCurrentPlayerData.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp new file mode 100644 index 00000000..d7f5c123 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMapData.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Map/WildlifeState.func.hpp" + +#include "OpenSHC/Globals/DAT_WildlifeState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp new file mode 100644 index 00000000..9bd6922b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataMousePointing.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" + +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp new file mode 100644 index 00000000..38ccf922 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataNetwork.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp new file mode 100644 index 00000000..f8c01466 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataSplitInfo.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp new file mode 100644 index 00000000..175300d4 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataUnitData.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" + +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp new file mode 100644 index 00000000..5f08646e --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DebugDataZoneDataUnk.cpp @@ -0,0 +1,14 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" + +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp new file mode 100644 index 00000000..9ea85f56 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisableTroops.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABCB0 +void UI::MenuModalRenderFunction_DisableTroops(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xbc, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp new file mode 100644 index 00000000..480d7abf --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisableWeapon.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABCE0 +void UI::MenuModalRenderFunction_DisableWeapon(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xbd, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp new file mode 100644 index 00000000..bf1581db --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_DisplayAiLordMessage.cpp @@ -0,0 +1,14 @@ +#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/MenuModalRenderFunction_EnterTitleOnGameStart.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp new file mode 100644 index 00000000..0cdf07fb --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_EnterTitleOnGameStart.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00491BF0 +void UI::MenuModalRenderFunction_EnterTitleOnGameStart(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(5, 6, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp new file mode 100644 index 00000000..6829cfce --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_GameplayOptions.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00491E80 +void UI::MenuModalRenderFunction_GameplayOptions(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 0x19, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp new file mode 100644 index 00000000..89119611 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_NetworkOptions.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00492A60 +void UI::MenuModalRenderFunction_NetworkOptions(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 6, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp new file mode 100644 index 00000000..103839cc --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_OnlineQuitGame.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004937B0 +void UI::MenuModalRenderFunction_OnlineQuitGame(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 7, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp new file mode 100644 index 00000000..c2652dd3 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_OptionsMenu.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00491810 +void UI::MenuModalRenderFunction_OptionsMenu(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 1, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp new file mode 100644 index 00000000..1886af70 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishConnectionOptions.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABE50 +void UI::MenuModalRenderFunction_SkirmishConnectionOptions(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4f, 0x5d, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp new file mode 100644 index 00000000..660c7451 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SkirmishPlayOptions.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004ABE80 +void UI::MenuModalRenderFunction_SkirmishPlayOptions(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4f, 0x67, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp new file mode 100644 index 00000000..aedb4866 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_SoundOptions.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x00492660 +void UI::MenuModalRenderFunction_SoundOptions(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(0x4a, 5, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp new file mode 100644 index 00000000..03acec8b --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_StartGoods.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB4E0 +void UI::MenuModalRenderFunction_StartGoods(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x29, x, y, width); +} + +} 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/MenuModalRenderFunction_TraderSettings.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp new file mode 100644 index 00000000..26d7bafc --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TraderSettings.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB4B0 +void UI::MenuModalRenderFunction_TraderSettings(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x26, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp new file mode 100644 index 00000000..29e745bd --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_TriggerEvent.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AC250 +void UI::MenuModalRenderFunction_TriggerEvent(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0x17, x, y, width); +} + +} diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_TutorialBox_Thunk.cpp new file mode 100644 index 00000000..153d2a1b --- /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 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 diff --git a/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp b/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp new file mode 100644 index 00000000..a8a31369 --- /dev/null +++ b/src/OpenSHC/UI/MenuModalRenderFunction_UnusedSiegeAttackingForceUnk.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004AB510 +void UI::MenuModalRenderFunction_UnusedSiegeAttackingForceUnk(int x,int y,int width,int height) +{ + +MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner, DAT_PencilRenderCore::ptr)(199, 0xa4, x, y, width); +} + +} 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/MenuView_CampaignUnk_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp new file mode 100644 index 00000000..fe86b85c --- /dev/null +++ b/src/OpenSHC/UI/MenuView_CampaignUnk_DoEveryFrame.cpp @@ -0,0 +1,26 @@ +#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; + +// 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); +} +} + +} diff --git a/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp b/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp new file mode 100644 index 00000000..0fa4f8ee --- /dev/null +++ b/src/OpenSHC/UI/MenuView_CrusadeMissionIntro_Prepare.cpp @@ -0,0 +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 { + +// 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; +} + +} diff --git a/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp b/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp new file mode 100644 index 00000000..d251852f --- /dev/null +++ b/src/OpenSHC/UI/MenuView_EditScenario_Prepare.cpp @@ -0,0 +1,21 @@ +#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 { + +// 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; +} + +} 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..de2b0011 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_General_DoEveryFrame_FirstGfxCentered.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { + +// 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); +} + +} 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..fb64168e --- /dev/null +++ b/src/OpenSHC/UI/MenuView_General_DoInitial_OnlySetMenuXY.cpp @@ -0,0 +1,23 @@ +#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; + +// 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; +} + +} 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..e379d80b --- /dev/null +++ b/src/OpenSHC/UI/MenuView_General_Prepare_SwordShieldAndBorder.cpp @@ -0,0 +1,20 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { + +// 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)( + s_frontend_combat3_tgx_005a2134); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +} + +} diff --git a/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp new file mode 100644 index 00000000..9c3d7902 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_IntroLogos_DoInitial.cpp @@ -0,0 +1,26 @@ +#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; + +// FUNCTION: STRONGHOLDCRUSADER 0x00424770 +void UI::MenuView_IntroLogos_DoInitial() +{ + 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_MapEditorLandscaping_Prepare.cpp b/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp new file mode 100644 index 00000000..783d4eb3 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_MapEditorLandscaping_Prepare.cpp @@ -0,0 +1,21 @@ +#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; + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp b/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp new file mode 100644 index 00000000..32bd5156 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_NewMapMapsize_Prepare.cpp @@ -0,0 +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 { + +// 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)( + s_frontend_builder2_tgx_005a206c); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); +} + +} diff --git a/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp b/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp new file mode 100644 index 00000000..dd262f73 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_NewMapMaptype_Prepare.cpp @@ -0,0 +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 { + +// 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)( + s_frontend_builder_tgx_005a2084); + MACRO_CALL(OpenSHC::UI_Func::LoadTGX_shc_back)(); + DAT_GameCore::instance.mapU3EndInt = 0; +} + +} diff --git a/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp b/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp new file mode 100644 index 00000000..5a2784b0 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_RankingGames_Prepare.cpp @@ -0,0 +1,23 @@ +#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 { + +// 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; +} + +} 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..32a92cff --- /dev/null +++ b/src/OpenSHC/UI/MenuView_Unknown26_CampaignRelatedUnk_Prepare.cpp @@ -0,0 +1,16 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/Rendering.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// 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)(); +} + +} diff --git a/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp new file mode 100644 index 00000000..3291b8dd --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedChooseAvailableKeeps_Prepare.cpp @@ -0,0 +1,17 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" + +namespace OpenSHC { + +// 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; +} + +} diff --git a/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp new file mode 100644 index 00000000..1b5b5c72 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedDemoBuyItScreen_DoEveryFrame.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/INT_00b960e0.hpp" + +namespace OpenSHC { + +// 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); +} + +} diff --git a/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp new file mode 100644 index 00000000..0622ec65 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedExtremeAd_Prepare.cpp @@ -0,0 +1,25 @@ +#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; + +// 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; +} + +} 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/MenuView_UnusedHelpTextEditor_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp new file mode 100644 index 00000000..0bb3c633 --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedHelpTextEditor_Prepare.cpp @@ -0,0 +1,26 @@ +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Menu.hpp" + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { + +using OpenSHC::UI::Menu; + +// FUNCTION: STRONGHOLDCRUSADER 0x004403D0 +void UI::MenuView_UnusedHelpTextEditor_Prepare() +{ + 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)(); +} + +} diff --git a/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp b/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp new file mode 100644 index 00000000..61fd61ee --- /dev/null +++ b/src/OpenSHC/UI/MenuView_UnusedSomeMissionStartUnk_Prepare.cpp @@ -0,0 +1,25 @@ +#include "OpenSHC/UI.func.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" + +namespace OpenSHC { + +using OpenSHC::WindowsHelper::Enums::BOOLEnum; + +// 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)( + 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)(); +} + +} diff --git a/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp b/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp new file mode 100644 index 00000000..761a9c96 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/setMapPropertyDependingOnMapSize.cpp @@ -0,0 +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); + } + +} +} diff --git a/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp b/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp new file mode 100644 index 00000000..9e0acb09 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/setTileColorsDependingOnMapSize.cpp @@ -0,0 +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); + } + +} +} diff --git a/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp b/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp new file mode 100644 index 00000000..9aa825b1 --- /dev/null +++ b/src/OpenSHC/UI/MinimapViewState/triggerMinimapRedraw.cpp @@ -0,0 +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; + } + +} +} diff --git a/src/OpenSHC/UI/PlayAMessageFromAI.cpp b/src/OpenSHC/UI/PlayAMessageFromAI.cpp new file mode 100644 index 00000000..80de2012 --- /dev/null +++ b/src/OpenSHC/UI/PlayAMessageFromAI.cpp @@ -0,0 +1,26 @@ +#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]); + } +} + +} 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/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..6189c725 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/ButtonGmData/getPictureNumberInGm.cpp @@ -0,0 +1,22 @@ +#include "../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/PencilRenderCore/setupPencilSurface.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp new file mode 100644 index 00000000..ccdfa10e --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencilSurface.cpp @@ -0,0 +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; + + // 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; + } + + } +} +} 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/RenderInGameChatDisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderInGameChatDisplayElement.cpp new file mode 100644 index 00000000..d2aa7267 --- /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, elementState); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp b/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp new file mode 100644 index 00000000..50c05417 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderMenuGfxHelper.cpp @@ -0,0 +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 { + +// 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); +} + +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp b/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp new file mode 100644 index 00000000..1e0e257a --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderNoRushDisplayElementUnk.cpp @@ -0,0 +1,133 @@ +#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; + +// 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; +} + +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp new file mode 100644 index 00000000..541dafd0 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderNoTreeGrowthTextDisplayElement.cpp @@ -0,0 +1,23 @@ +#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; + + // 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); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp new file mode 100644 index 00000000..22cb9bc0 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderResourceMissing1DisplayElement.cpp @@ -0,0 +1,17 @@ +#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); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp b/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp new file mode 100644 index 00000000..22dc85ab --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderResourceMissing2DisplayElement.cpp @@ -0,0 +1,17 @@ +#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); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp b/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp new file mode 100644 index 00000000..46a413ef --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderUnknownDisplayElement7.cpp @@ -0,0 +1,24 @@ +#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; + + // 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); + } + +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp new file mode 100644 index 00000000..36b666ba --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/CheckGfxResourceExists.cpp @@ -0,0 +1,28 @@ +#include "../TextureRenderCore.func.hpp" + +#include "OpenSHC/IO/ResourceManager.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; + + // FUNCTION: STRONGHOLDCRUSADER 0x004548D0 + BOOLEnum TextureRenderCore::checkGfxResourceExists(char* param_1) + { + MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::resolveResourceFileName, DAT_ResourceManager::ptr)( + OpenSHC::IO::FRT_GFX, (char const*)((int)(param_1))); + return MACRO_CALL_MEMBER( + OpenSHC::IO::ResourceManager_Func::getCurrentResourceSize, DAT_ResourceManager::ptr)() + != 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..12eaed2c --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/checkIfGfxTgxStartsWithTransparentPixels.cpp @@ -0,0 +1,23 @@ + +#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 { + + // FUNCTION: STRONGHOLDCRUSADER 0x004549C0 + BOOLEnum TextureRenderCore::checkIfGfxTgxStartsWithTransparentPixels(int gfxIndex) + { + // 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/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp new file mode 100644 index 00000000..c09122bc --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/restoreMapSurfaceHeightRangeFromTemporaryUnk.cpp @@ -0,0 +1,16 @@ +#include "../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/setActiveMenuTabIndexToZero.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp new file mode 100644 index 00000000..8b472002 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setActiveMenuTabIndexToZero.cpp @@ -0,0 +1,12 @@ +#include "../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/setMapSurfaceHeightRange.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp new file mode 100644 index 00000000..323bf36c --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMapSurfaceHeightRange.cpp @@ -0,0 +1,15 @@ +#include "../TextureRenderCore.func.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/setMenuTabIndexUnk.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp new file mode 100644 index 00000000..e56bf0c5 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setMenuTabIndexUnk.cpp @@ -0,0 +1,15 @@ +#include "../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/TextureRenderCore/setRenderingRect.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp new file mode 100644 index 00000000..fce1d8ae --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRect.cpp @@ -0,0 +1,18 @@ +#include "../TextureRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + 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; + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp new file mode 100644 index 00000000..10c88807 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/setRenderingRectToGameResolution.cpp @@ -0,0 +1,20 @@ +#include "../TextureRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + 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; + } + + } +} +} 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..067aefdc --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/temporarySaveMapSurfaceHeightRangeUnk.cpp @@ -0,0 +1,16 @@ +#include "../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/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp new file mode 100644 index 00000000..3000196a --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformTgxCompressedImageToRGB565.cpp @@ -0,0 +1,22 @@ + +#include "../TextureRenderCore.func.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 { + + // FUNCTION: STRONGHOLDCRUSADER 0x00455270 + void TextureRenderCore::transformTgxCompressedImageToRGB565(int imageIndex) + { + MACRO_CALL_MEMBER(TextureRenderCore_Func::transformTgxFromRGB555ToRGB565, this)( + (ushort*)(&(((byte*)this->gmProcessedImageData)[DAT_GMImageOffsets::instance[imageIndex]])), + DAT_GMImageSizes::instance[imageIndex]); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp new file mode 100644 index 00000000..a2d6f218 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageToRGB565.cpp @@ -0,0 +1,20 @@ + +#include "../TextureRenderCore.func.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) + { + 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 new file mode 100644 index 00000000..d50600fa --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TextureRenderCore/transformUncompressedImageWithMarkerUnkToRGB565.cpp @@ -0,0 +1,19 @@ +#include "../TextureRenderCore.func.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) + { + MACRO_CALL_MEMBER(TextureRenderCore_Func::transformRawWithMarkerUnkToRGB555To565, this)( + 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..0d27d5b9 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/TogglePlayerPingDisplayElementUnk.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/DisplayElement.hpp" +#include "OpenSHC/UI/Enums/DisplayElementID.hpp" + +namespace OpenSHC { +namespace UI { + + 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; + } + } + +} +} 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/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/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp b/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp new file mode 100644 index 00000000..fcee92dc --- /dev/null +++ b/src/OpenSHC/UI/SetActiveCreditsSequenceIndex.cpp @@ -0,0 +1,15 @@ +#include "OpenSHC/UI.func.hpp" + +#include "OpenSHC/Globals/DAT_00ed3120.hpp" +#include "OpenSHC/Globals/DAT_00ed3124.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004D9270 +void __cdecl UI::SetActiveCreditsSequenceIndex(undefined4 param_1) +{ + DAT_00ed3124::instance = param_1; + DAT_00ed3120::instance = 0; +} + +} 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/ShowProgressBarSaveLoadDialog.cpp b/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp new file mode 100644 index 00000000..87a3a5f4 --- /dev/null +++ b/src/OpenSHC/UI/ShowProgressBarSaveLoadDialog.cpp @@ -0,0 +1,22 @@ +#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; + +// FUNCTION: STRONGHOLDCRUSADER 0x00495800 +void UI::ShowProgressBarSaveLoadDialog(int param_1) +{ + 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 = Enums::MMT_PROGRESS_BAR_BOX; + MACRO_CALL(OpenSHC::UI_Func::MenuItemActionHandler_ProgressBarBox_LoadAndSaveGameButtonLogic)(0); +} + +} diff --git a/src/OpenSHC/UI/TacticalPowersFill.cpp b/src/OpenSHC/UI/TacticalPowersFill.cpp new file mode 100644 index 00000000..1497b289 --- /dev/null +++ b/src/OpenSHC/UI/TacticalPowersFill.cpp @@ -0,0 +1,18 @@ +#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/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp b/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp new file mode 100644 index 00000000..13999878 --- /dev/null +++ b/src/OpenSHC/Util/Timing/Stopwatch/stop.cpp @@ -0,0 +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; + + // 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; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 10a0c2b0..15e5de11 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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,15 +13393,15 @@ 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 +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 | 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 @@ -16649,11 +16649,11 @@ 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 | 0.0% | Pending +SHC_3BB0A8C1_0x0044AAA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044AAB0 | 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -18145,11 +18145,11 @@ 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 -SHC_3BB0A8C1_0x0045D0B0 | 0.0% | Pending +SHC_3BB0A8C1_0x0045D0B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0045D0C0 | 0.0% | Pending @@ -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 @@ -18349,9 +18349,9 @@ 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 | 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 @@ -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 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00462190 | 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -20123,23 +20123,23 @@ 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 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_0x00469880 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004698A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004698A0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004698C0 | 0.0% | Pending +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 @@ -20743,11 +20743,11 @@ 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 +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 @@ -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 @@ -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 @@ -24345,11 +24345,11 @@ 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 -SHC_3BB0A8C1_0x00496EA0 | 0.0% | Pending +SHC_3BB0A8C1_0x00496EA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00496EC0 | 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,11 +25535,11 @@ 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 -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 @@ -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 @@ -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 @@ -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,9 +37335,9 @@ 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 +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 @@ -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 @@ -38733,9 +38733,9 @@ 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 | 0.0% | Pending +SHC_3BB0A8C1_0x004F6A70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F6A80 | 0.0% | Pending @@ -38755,11 +38755,11 @@ 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 -SHC_3BB0A8C1_0x004F70E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004F70E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F70F0 | 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 @@ -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 @@ -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 @@ -51067,9 +51067,9 @@ 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 +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 @@ -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