From 5b643f8607aeb0b9d41bdd7896fb31357e3e6c44 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Fri, 13 Nov 2026 09:55:27 -0500 Subject: [PATCH 1/8] headers: INT_00ec083c is a float ResetCredits clears it with fldz/fstp in the original. Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Globals/INT_00ec083c.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenSHC/Globals/INT_00ec083c.hpp b/src/OpenSHC/Globals/INT_00ec083c.hpp index f55ee15ae7..0bbabe4138 100644 --- a/src/OpenSHC/Globals/INT_00ec083c.hpp +++ b/src/OpenSHC/Globals/INT_00ec083c.hpp @@ -9,11 +9,11 @@ #pragma once // GLOBAL: STRONGHOLDCRUSADER 0x00EC083C -// StructResolver::Instance::instance +// StructResolver::Instance::instance namespace OpenSHC { -MACRO_STRUCT_RESOLVER(int, false, Address::SHC_3BB0A8C1_0x00EC083C) INT_00ec083c; +MACRO_STRUCT_RESOLVER(float, false, Address::SHC_3BB0A8C1_0x00EC083C) INT_00ec083c; } // namespace OpenSHC MACRO_STRUCT_INSTANCE(Address::SHC_3BB0A8C1_0x00EC083C); From c044790766bb140d5e1470544b614d5c60701007 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Fri, 13 Nov 2026 09:55:28 -0500 Subject: [PATCH 2/8] Reimplement 23 UI, Credits, Rendering, Text and Audio functions at 100% Co-Authored-By: Claude Opus 5.5 --- .../Audio/SFX/ComputeCurrentPlayerRanking.cpp | 17 + .../Audio/SFX/ComputePlayerPoints1.cpp | 85 +++ .../playNextStoredBinkVideo.cpp | 18 + src/OpenSHC/Rendering/InitializeColors.cpp | 71 +++ src/OpenSHC/Text/TextManager/loadCRTex.cpp | 86 +++ ...CurrentlyDisplayedTextConstructionCost.cpp | 571 ++++++++++++++++++ .../Credits/AppendCreditsBinkVideoCommand.cpp | 29 + ...AppendCreditsBinkVideoWithAudioCommand.cpp | 27 + .../AppendCreditsFixedImageCommand.cpp | 31 + .../Credits/AppendCreditsImageEndCommand.cpp | 22 + .../AppendCreditsImageTransitionCommand.cpp | 38 ++ .../Credits/AppendCreditsShowImageCommand.cpp | 30 + .../UI/Credits/AppendCreditsSoundEntry.cpp | 23 + .../UI/Credits/AppendCreditsTextCommand.cpp | 37 ++ .../Credits/AppendCreditsTextEndCommand.cpp | 24 + .../EndCreditsSegmentAndAdvanceToNext.cpp | 64 ++ .../InsertElementIntoAnArrayAt_ec0348.cpp | 45 ++ .../InsertElementIntoArrayAt_ec0348_3.cpp | 39 ++ .../RenderScrollingCreditsTextFrame.cpp | 51 ++ src/OpenSHC/UI/Credits/ResetCredits.cpp | 39 ++ src/OpenSHC/UI/Menu/loadMenuElements.cpp | 31 + .../UI/MenuHandlerState/initializeUI.cpp | 28 + .../Credits/MenuView_Credits_DoEveryFrame.cpp | 112 ++++ status/addresses-SHC-3BB0A8C1.txt | 46 +- 24 files changed, 1541 insertions(+), 23 deletions(-) create mode 100644 src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp create mode 100644 src/OpenSHC/Audio/SFX/ComputePlayerPoints1.cpp create mode 100644 src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp create mode 100644 src/OpenSHC/Rendering/InitializeColors.cpp create mode 100644 src/OpenSHC/Text/TextManager/loadCRTex.cpp create mode 100644 src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp create mode 100644 src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp create mode 100644 src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp create mode 100644 src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp create mode 100644 src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp create mode 100644 src/OpenSHC/UI/Credits/ResetCredits.cpp create mode 100644 src/OpenSHC/UI/Menu/loadMenuElements.cpp create mode 100644 src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp create mode 100644 src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp diff --git a/src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp b/src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp new file mode 100644 index 0000000000..c04e72a0fe --- /dev/null +++ b/src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp @@ -0,0 +1,17 @@ +#include "../SFX.func.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Audio { + namespace SFX { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044C400 + int ComputeCurrentPlayerRanking() + { + return MACRO_CALL(SFX_Func::ComputePlayerRanking)(DAT_GameSynchronyState::instance.currentPlayerSlotID); + } + + } +} +} diff --git a/src/OpenSHC/Audio/SFX/ComputePlayerPoints1.cpp b/src/OpenSHC/Audio/SFX/ComputePlayerPoints1.cpp new file mode 100644 index 0000000000..862d11495f --- /dev/null +++ b/src/OpenSHC/Audio/SFX/ComputePlayerPoints1.cpp @@ -0,0 +1,85 @@ +#include "../SFX.func.hpp" + +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" + +namespace OpenSHC { +namespace Audio { + namespace SFX { + + using namespace OpenSHC::Game::Resources; + + // FUNCTION: STRONGHOLDCRUSADER 0x0044A830 + int ComputePlayerPoints1(int playerID) + { + int const goldPoints = DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_GOLD] / 10; + int const troopPoints = DAT_GameState::instance.playerDataArray[playerID].totalTroopValue; + int const foodPoints + = (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)(RT_BREAD) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_BREAD] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_CHEESE) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_CHEESE] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_MEAT) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_MEAT] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_APPLE) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_APPLE]) + / 10; + int const weaponPoints + = (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)(RT_BOW) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_BOW] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_CROSSBOW) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_CROSSBOW] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_SPEAR) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_SPEAR] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_PIKE) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_PIKE] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_MACE) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_MACE] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_SWORD) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_SWORD] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_LEATHERARMOR) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_LEATHERARMOR] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_IRONARMOR) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_IRONARMOR]) + / 10; + int const materialPoints + = (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)(RT_WOOD) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_WOOD] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_HOPS) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_HOPS] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_STONE) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_STONE] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_IRON) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_IRON] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_PARTIALPITCH) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_PARTIALPITCH] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_ALE) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_ALE] + + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( + RT_FLOUR) + * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_FLOUR]) + / 10; + return DAT_GameState::instance.playerDataArray[playerID].currentPopulation * 10 + materialPoints + + weaponPoints + foodPoints + troopPoints + goldPoints; + } + + } +} +} diff --git a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp new file mode 100644 index 0000000000..04d31b1ba6 --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp @@ -0,0 +1,18 @@ +#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" + +namespace OpenSHC { +namespace Rendering { + namespace Bink { + + // FUNCTION: STRONGHOLDCRUSADER 0x004C62A0 + void AIMessageQueue::playNextStoredBinkVideo() + { + if (this->messagePlaying_0x0) { + MACRO_CALL_MEMBER(AIMessageQueue_Func::playNextStoredAIMessage, this)(); + } + this->storedMessages_0x924 = 0; + } + + } +} +} diff --git a/src/OpenSHC/Rendering/InitializeColors.cpp b/src/OpenSHC/Rendering/InitializeColors.cpp new file mode 100644 index 0000000000..6d3c25106e --- /dev/null +++ b/src/OpenSHC/Rendering/InitializeColors.cpp @@ -0,0 +1,71 @@ +#include "OpenSHC/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Rendering/ColorMode.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/COL_BLUE.hpp" +#include "OpenSHC/Globals/COL_BRIGHT_YELLOW.hpp" +#include "OpenSHC/Globals/COL_DARK_CYAN_GREY.hpp" +#include "OpenSHC/Globals/COL_DARK_GRAYISH_GREEN.hpp" +#include "OpenSHC/Globals/COL_DARK_GREEN.hpp" +#include "OpenSHC/Globals/COL_DARK_LIME.hpp" +#include "OpenSHC/Globals/COL_DARK_RED.hpp" +#include "OpenSHC/Globals/COL_GREYISH_YELLOW.hpp" +#include "OpenSHC/Globals/COL_LIGHT_GREY.hpp" +#include "OpenSHC/Globals/COL_LIME.hpp" +#include "OpenSHC/Globals/COL_MAGENTA.hpp" +#include "OpenSHC/Globals/COL_MODERATE_GREEN.hpp" +#include "OpenSHC/Globals/COL_RED.hpp" +#include "OpenSHC/Globals/COL_VERY_DARK_GREY.hpp" +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/COL_VIVID_BLUE.hpp" +#include "OpenSHC/Globals/COL_WHITE.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00467890 + void InitializeColors() + { + COL_BLUE::instance.shortValue = 31; + COL_BLACK::instance.shortValue = 0; + if (DAT_WindowAndDirectDraw::instance.colorBitMode == RGB_555) { + COL_RED::instance.shortValue = (short)64512; + COL_LIME::instance.shortValue = (short)992; + COL_DARK_GREEN::instance.shortValue = (short)480; + COL_WHITE::instance.shortValue = (short)32767; + COL_BRIGHT_YELLOW::instance.shortValue = (short)29447; + COL_MODERATE_GREEN::instance.shortValue = (short)13063; + COL_DARK_CYAN_GREY::instance.shortValue = (short)13807; + COL_VERY_DARK_GREY::instance.shortValue = (short)7399; + COL_MAGENTA::instance.shortValue = (short)31775; + COL_VIVID_BLUE::instance.shortValue = (short)4703; + COL_VERY_SOFT_YELLOW::instance.shortValue = (short)30647; + } else { + COL_RED::instance.shortValue = (short)63488; + COL_LIME::instance.shortValue = (short)1984; + COL_DARK_GREEN::instance.shortValue = (short)960; + COL_WHITE::instance.shortValue = (short)65535; + COL_BRIGHT_YELLOW::instance.shortValue = (short)50695; + COL_MODERATE_GREEN::instance.shortValue = (short)17927; + COL_DARK_CYAN_GREY::instance.shortValue = (short)31695; + COL_VERY_DARK_GREY::instance.shortValue = (short)14791; + COL_MAGENTA::instance.shortValue = (short)63519; + COL_VIVID_BLUE::instance.shortValue = (short)9407; + COL_VERY_SOFT_YELLOW::instance.shortValue = (short)61303; + } + COL_LIGHT_GREY::instance.shortValue + = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(192, 192, 192); + COL_GREYISH_YELLOW::instance.shortValue + = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(215, 210, 164); + COL_DARK_LIME::instance.shortValue + = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(41, 117, 32); + COL_DARK_GRAYISH_GREEN::instance.shortValue + = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(104, 116, 88); + COL_DARK_RED::instance.shortValue + = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(140, 0, 0); + } + +} +} diff --git a/src/OpenSHC/Text/TextManager/loadCRTex.cpp b/src/OpenSHC/Text/TextManager/loadCRTex.cpp new file mode 100644 index 0000000000..34e77a5d7c --- /dev/null +++ b/src/OpenSHC/Text/TextManager/loadCRTex.cpp @@ -0,0 +1,86 @@ +#include "../TextManager.func.hpp" + +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Util/WideCharMultiByteState.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/GameLanguage.hpp" +#include "OpenSHC/WindowsHelper/Enums/CodePage.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" +#include "OpenSHC/Globals/DAT_WideCharMultiByteState.hpp" + +namespace OpenSHC { +namespace Text { + + // FUNCTION: STRONGHOLDCRUSADER 0x00473870 + void TextManager::loadCRTex() + { + this->codePage = WindowsHelper::Enums::CP_WINDOWS_1252; + this->field_0x14 = 1; + this->helpTextLinkActive = FALSE; + this->textSurfaceTarget = Rendering::Enums::RT_SCREEN_MENU; + this->field_0x1348 = 0; + int file = MACRO_CALL(OS_Func::_ucrt_open)("cr.tex", _O_BINARY, 0); + if (file == -1) { + return; + } + MACRO_CALL(OS_Func::_ucrt_read)(file, this->textOffsets, sizeof(this->textOffsets)); + LPWSTR wideText = (LPWSTR)MACRO_CALL(OS_Func::_malloc)(702000); + MACRO_CALL(OS_Func::_ucrt_read)(file, wideText, 702000); + MACRO_CALL_MEMBER(Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, + DAT_WideCharMultiByteState::ptr)(this->textStart, wideText, 351000); + this->alternativeCodePageUsedUnk = FALSE; + this->gameLanguage = GL_ENGLISH; + if (MACRO_CALL(OS_Func::__stricmp)("polish", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)(DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->codePage = WindowsHelper::Enums::CP_WINDOWS_1250; + this->alternativeCodePageUsedUnk = TRUE; + MACRO_CALL_MEMBER(Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, + DAT_WideCharMultiByteState::ptr)(this->textStart, wideText, 351000); + this->gameLanguage = GL_POLISH; + } else if (MACRO_CALL(OS_Func::__stricmp)("english", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( + DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->gameLanguage = GL_ENGLISH; + } else if (MACRO_CALL(OS_Func::__stricmp)("american", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( + DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->gameLanguage = GL_AMERICAN; + } else if (MACRO_CALL(OS_Func::__stricmp)("german", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( + DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->gameLanguage = GL_GERMAN; + } else if (MACRO_CALL(OS_Func::__stricmp)("french", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( + DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->gameLanguage = GL_FRENCH; + } else if (MACRO_CALL(OS_Func::__stricmp)("italian", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( + DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->gameLanguage = GL_ITALIAN; + } else if (MACRO_CALL(OS_Func::__stricmp)("SPANISH", + MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( + DE::SHCDE::TEXT_LANGUAGE, 0)) + == 0) { + this->gameLanguage = GL_SPANISH; + } + MACRO_CALL(OS_Func::_ucrt_close)(file); + this->field_0x1348 = 1; + this->field_0x24 = 0; + this->field_0x28 = 0; + MACRO_CALL_MEMBER(IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + sizeof(this->field_0x1334), 0, this->field_0x1334); + MACRO_CALL_MEMBER(TextManager_Func::resetTextClipRange, this)(); + this->field_0x34 = 0; + } + +} +} diff --git a/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp b/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp new file mode 100644 index 0000000000..0bbed18e88 --- /dev/null +++ b/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp @@ -0,0 +1,571 @@ +#include "../BottomLeftTextDisplayState.func.hpp" + +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_00ee1090.hpp" +#include "OpenSHC/Globals/DAT_00ee1094.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TroopDefinedData.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { +namespace UI { + + using namespace OpenSHC::DE::SHCDE; + using namespace OpenSHC::Text; + using namespace OpenSHC::Game::Resources; + + // FUNCTION: STRONGHOLDCRUSADER 0x004F4F60 + void BottomLeftTextDisplayState::renderCurrentlyDisplayedTextConstructionCost(int param_1) + { + int const activeMenuTab = DAT_GameCore::instance.activeMenuTab.tabType; + int const menuViewType = DAT_GameCore::instance.currentMenuViewType; + if (param_1 == 0 && menuViewType == 16 && (activeMenuTab == 1 || activeMenuTab == 44)) { + return; + } + if (this->currentlyDisplayedTextIsDisplayedUnk == 0) { + return; + } + if (this->currentlyDisplayedTextIsDisplayedUnk != 6 && this->currentlyDisplayedTextIsDisplayedUnk != 12 + && this->currentlyDisplayedTextIsDisplayedUnk != 7 && this->currentlyDisplayedTextIsDisplayedUnk != 13) { + DAT_TextManagerObject::instance.textSurfaceTarget = OpenSHC::Rendering::Enums::RT_MAP_GAME; + DAT_ButtonX::instance += DAT_ViewportRenderState::instance.viewportState.currentCameraOffsetX; + DAT_ButtonY::instance += DAT_ViewportRenderState::instance.viewportState.currentCameraOffsetY; + } + if (menuViewType == 14 && activeMenuTab == 61) { + DAT_ButtonX::instance += 130; + DAT_ButtonY::instance -= 2; + } + switch (this->currentlyDisplayedTextIsDisplayedUnk) { + case 6: { + int const unitIndex = this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType; + if (unitIndex < 10) { + if (DAT_GameState::instance.mapAndTime.euroRecruitable[unitIndex] == 0) { + break; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance + 260, DAT_ButtonY::instance, + TTA_CENTER, 12119803, 0, 18, FALSE); + if (DAT_GameSynchronyState::instance.currentGameMode != 0 + && DAT_GameSynchronyState::instance.skirmishTroopsCostGold == 0) { + break; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)((eTextSections)22, 2, + DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, FALSE); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber, DAT_TextManagerObject::ptr)( + DAT_TroopDefinedData::instance + .BarracksUnitCost[this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType], + DAT_ButtonX::instance + 6, DAT_ButtonY::instance, 12119803, 0, 18, TRUE); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 124, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 10, + DAT_ButtonY::instance); + } else { + if (DAT_GameState::instance.mapAndTime.euroRecruitable[unitIndex - 10] == 0) { + break; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, + TTA_LEFT, 12119803, 0, 18, FALSE); + } + break; + } + case 12: + if (this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType >= 10) { + break; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance + 260, DAT_ButtonY::instance + 152, + TTA_CENTER, 12119803, 0, 18, FALSE); + if (DAT_GameSynchronyState::instance.currentGameMode != 0 + && DAT_GameSynchronyState::instance.skirmishTroopsCostGold == 0) { + break; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)((eTextSections)22, 2, + DAT_ButtonX::instance + 10, DAT_ButtonY::instance + 152, TTA_LEFT, 12119803, 0, 18, FALSE); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber, DAT_TextManagerObject::ptr)( + DAT_TroopDefinedData::instance + .NonEuroUnitCost[this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType], + DAT_ButtonX::instance + 16, DAT_ButtonY::instance + 152, 12119803, 0, 18, TRUE); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 124, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 152); + break; + case 13: + if (menuViewType == 20 && DAT_MenuModalComposition1::instance.activeModalDialogID == -1 + && DAT_TextManagerObject::instance.gameLanguage != 0 + && DAT_TextManagerObject::instance.gameLanguage != 1) { + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance - 50, DAT_ButtonY::instance, + DAT_ButtonW::instance + 100, 12119803, 0, 18, 0); + } else { + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, + DAT_ButtonW::instance, 12119803, 0, 18, 0); + } + break; + case 1: + if (this->currentlyDisplayedUnkTextGroupIndex_0x4 == 8 + && this->currentlyDisplayedUnkTextNumInGroup_0x8 == 202) { + this->currentlyDisplayedUnkTextNumInGroup_0x8 = DAT_00ee1090::instance; + } + if (this->currentlyDisplayedUnkTextGroupIndex_0x4 == 8 + && this->currentlyDisplayedUnkTextNumInGroup_0x8 == 291) { + this->currentlyDisplayedUnkTextNumInGroup_0x8 = DAT_00ee1094::instance; + } + if (this->currentlyDisplayedUnkTextGroupIndex_0x4 == 77) { + int const height + = MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText2, DAT_TextManagerObject::ptr)( + (eTextSections)77, this->currentlyDisplayedUnkTextNumInGroup_0x8, 480, 18); + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, + DAT_ButtonY::instance - height + 24, 480, 12119803, 0, 18, 0); + } else { + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, + TTA_LEFT, 12119803, 0, 18, FALSE); + } + break; + case 10: + this->currentlyDisplayedUnkTextNumInGroup_0x8 + = DAT_RenderingDefinedData::instance.field_0x525a4[DAT_UnitsState::instance + .selectionSlots[this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType]]; + if (this->currentlyDisplayedUnkTextNumInGroup_0x8 != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, + TTA_LEFT, 12119803, 0, 18, FALSE); + } + break; + case 7: + if (DAT_MenuModalComposition1::instance.activeModalDialogID == -1) { + if (this->currentlyDisplayedUnkTextNumInGroup_0x8 >= 310 + && this->currentlyDisplayedUnkTextNumInGroup_0x8 <= 313) { + int const height = MACRO_CALL_MEMBER( + TextManager_Func::renderMultilineText2, DAT_TextManagerObject::ptr)((eTextSections)7, + this->currentlyDisplayedUnkTextNumInGroup_0x8 - 309, DAT_ButtonW::instance, 18); + DAT_TextManagerObject::instance.field_0x24 = 1; + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)7, this->currentlyDisplayedUnkTextNumInGroup_0x8 - 309, DAT_ButtonX::instance, + DAT_ButtonY::instance, DAT_ButtonW::instance, 13433599, 0, 18, 0); + DAT_TextManagerObject::instance.field_0x24 = 1; + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)250, this->currentlyDisplayedUnkTextNumInGroup_0x8 - 301, DAT_ButtonX::instance, + DAT_ButtonY::instance + height, DAT_ButtonW::instance, 13433599, 0, 18, 0); + break; + } + DAT_TextManagerObject::instance.field_0x24 = 1; + if (this->currentlyDisplayedUnkTextGroupIndex_0x4 == 8 + && this->currentlyDisplayedUnkTextNumInGroup_0x8 == 229 + && DAT_GameCore::instance.directDrawStatus < 1792) { + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, 344, DAT_ButtonX::instance, + DAT_ButtonY::instance, DAT_ButtonW::instance, 13433599, 0, 18, 0); + } else { + MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, + DAT_ButtonW::instance, 13433599, 0, 17, 0); + } + } else { + this->currentlyDisplayedTextIsDisplayedUnk = 0; + } + break; + case 5: + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, + 12119803, 0, 18, FALSE); + break; + case 2: { + Map::Buildings::BuildingType const buildingType + = MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::convertCommandBuildingTypeToBuildingType, + DAT_BuildingsState::ptr)(this->currentlyDisplayedUnktextExtraObject.buildingType); + int stone = DAT_BuildingsState::instance.buildingCosts[buildingType].requiredStone_0x4; + int wood = DAT_BuildingsState::instance.buildingCosts[buildingType].requiredWood; + int iron = DAT_BuildingsState::instance.buildingCosts[buildingType].requiredIron_0x8; + int pitch = DAT_BuildingsState::instance.buildingCosts[buildingType].requiredPitch_0xc; + int gold = DAT_BuildingsState::instance.buildingCosts[buildingType].requiredGold; + int const playerID = DAT_GameSynchronyState::instance.currentPlayerSlotID; + int stoneOwned = DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_STONE]; + int goldOwned = DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_GOLD]; + if (MACRO_CALL_MEMBER( + Map::Buildings::BuildingsState_Func::hasLessWoodThanTheCostOfAWoodcuttersHutAndNoWoodcutters, + DAT_BuildingsState::ptr)(playerID, buildingType) + != 0) { + wood = 0; + } + if (DAT_GameCore::instance.gameMode_2 == 1) { + iron = 0; + gold = 0; + pitch = 0; + stone = 0; + wood = 0; + } else if (DAT_GameCore::instance.gameMode_2 == Game::GM_SIEGE_THAT) { + goldOwned + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .startResources[RT_GOLD]; + stoneOwned + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .startResources[RT_STONE]; + pitch = 0; + iron = 0; + wood = 0; + MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::getBuildingCost, DAT_BuildingsState::ptr)( + this->currentlyDisplayedUnktextExtraObject.buildingType, &stone, &gold); + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, + 12119803, 0, 18, FALSE); + int offset = 30; + if (wood != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + wood, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 126, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance - 6); + offset += 32; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_WOOD], + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + offset += 30; + } + if (stone != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + stone, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 123, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance - 4); + offset += 32; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(stoneOwned, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + offset += 30; + } + if (iron != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + iron, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 125, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance - 4); + offset += 32; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_IRON], + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + offset += 30; + } + if (pitch != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + pitch, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 155, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance - 10); + offset += 26; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_PITCH], + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + offset += 10; + } + if (gold != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + gold, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 124, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance + 6); + offset += 32; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(goldOwned, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + } + break; + } + case 4: + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, + 12119803, 0, 18, FALSE); + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 123, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 30, + DAT_ButtonY::instance - 4); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, + TRUE, 0); + if (DAT_GameCore::instance.gameMode_2 == Game::GM_SIEGE_THAT) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .startResources[RT_STONE], + DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + } else { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_STONE], + DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + } + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, + TRUE, 0); + break; + case 9: + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, + 12119803, 0, 18, FALSE); + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 126, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 30, + DAT_ButtonY::instance - 4); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, + TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_WOOD], + DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, + TRUE, 0); + break; + case 11: { + int cost = 0; + switch (this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType) { + case 0: + case 2: + cost = 30; + break; + case 1: + cost = 4; + break; + case 3: + cost = 10; + break; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, + 12119803, 0, 18, FALSE); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + cost, DAT_ButtonX::instance + 30, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 124, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 32, + DAT_ButtonY::instance - 4); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, + TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_GOLD], + DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, + TRUE, 0); + break; + } + case 3: { + int const scroll = this->countdown / 15 + DAT_ButtonW::instance; + if (this->currentlyDisplayedUnkTextNumInGroup_0x8 == 1) { + MACRO_CALL_MEMBER(TextManager_Func::setTextClipRange, DAT_TextManagerObject::ptr)( + DAT_ButtonX::instance + 20, DAT_ButtonX::instance + DAT_ButtonW::instance); + int const crowding + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .crowding; + int textOffset; + if (crowding <= 30) { + textOffset = 2; + } else { + textOffset = crowding <= 70; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8 + textOffset, DAT_ButtonX::instance + scroll, + DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, FALSE); + int percentage; + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentPopulation + == 0) { + percentage = 0; + } else { + int const crowdingNow + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .crowding; + if (crowdingNow <= 100) { + percentage = 0; + } else if (crowdingNow <= 120) { + percentage = -50; + } else if (crowdingNow <= 140) { + percentage = -100; + } else if (crowdingNow <= 160) { + percentage = -150; + } else if (crowdingNow <= 180) { + percentage = -200; + } else { + percentage = -250; + } + } + int const percentageX + = DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + scroll + 28; + if (percentageX + 20 > DAT_TextManagerObject::instance.textClipMin + && percentageX < DAT_TextManagerObject::instance.textClipMax) { + MACRO_CALL(Rendering_Func::TransformAndRenderPercentage)( + percentageX, DAT_ButtonY::instance, percentage, FALSE); + } + MACRO_CALL_MEMBER( + Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, DAT_TextureRenderCoreObject::ptr)( + IO::Graphics::GID_INTERFACE_ICONS_2, 206, 124, 578, IO::Graphics::GID_INTERFACE_ICONS_2, 208, 0); + MACRO_CALL_MEMBER( + Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, DAT_TextureRenderCoreObject::ptr)( + IO::Graphics::GID_INTERFACE_ICONS_2, 207, 522, 578, IO::Graphics::GID_INTERFACE_ICONS_2, 209, 0); + if (scroll < -300) { + this->countdown = 0; + } + MACRO_CALL_MEMBER(TextManager_Func::resetTextClipRange, DAT_TextManagerObject::ptr)(); + } else if (this->currentlyDisplayedUnkTextNumInGroup_0x8 == 4) { + int textOffset; + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .storedPopularityPercent + > DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity) { + textOffset = 0; + } else if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .storedPopularityPercent + < DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity) { + textOffset = 2; + } else { + textOffset = 1; + } + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, textOffset + 4, DAT_ButtonX::instance, + DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, FALSE); + } + break; + } + case 8: { + int const woodCost = DAT_BuildingsState::instance.INT_SelectedBuildingStoneWoodCost; + int const stoneCost = DAT_BuildingsState::instance.INT_SelectedBuildingStoneRepairCost; + MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( + (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, + this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, + 12119803, 0, 18, FALSE); + int offset = 30; + if (woodCost != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(woodCost, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 126, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance - 6); + offset += 32; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_WOOD], + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + offset += 30; + } + if (stoneCost != 0) { + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(stoneCost, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + offset += 2; + MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + GM_INTERFACE_ICONS2, 123, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + offset, + DAT_ButtonY::instance - 4); + offset += 32; + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, + 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .currentResources[RT_STONE], + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, + 18, TRUE, 0); + } + break; + } + } + DAT_TextManagerObject::instance.textSurfaceTarget = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp new file mode 100644 index 0000000000..38a9f76cd3 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp @@ -0,0 +1,29 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAA80 + void AppendCreditsBinkVideoCommand( + undefined4 unused, char* fileName, int x, int y, int binkObjIndex, SoundFlagsAndLoopCount flagLoopCount) + { + if (DAT_UnknownBinkCount::instance < 288) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 12; + // the file name is stored inline, in the 32 bytes from binkFileName on + strcpy((char*)&DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkFileName, fileName); + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].y = y; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkObjIndex = binkObjIndex; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].flagLoopCount = flagLoopCount; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x28 = 0; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp new file mode 100644 index 0000000000..862d4cbf97 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp @@ -0,0 +1,27 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAB80 + void AppendCreditsBinkVideoWithAudioCommand(char* fileName, int binkObjIndex, int noLoop, int volume) + { + if (DAT_UnknownBinkCount::instance < 288) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 13; + // the file name is stored inline, in the 32 bytes from binkFileName on + strcpy((char*)&DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkFileName, fileName); + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkObjIndex = binkObjIndex; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].flagLoopCount + = (SoundFlagsAndLoopCount)(1 - noLoop); + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].volume = volume; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp new file mode 100644 index 0000000000..381bc9ed77 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAB00 + void AppendCreditsFixedImageCommand(int gfxIndex, int x, int y) + { + if (DAT_UnknownBinkCount::instance < 288) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 21; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].y = y; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x28 = 7; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 0; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].width + = DAT_TextureRenderCoreObject::instance.loadedGfxArray[gfxIndex].width; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].height + = DAT_TextureRenderCoreObject::instance.loadedGfxArray[gfxIndex].height; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp new file mode 100644 index 0000000000..048ae4a3f9 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp @@ -0,0 +1,22 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA9A0 + void AppendCreditsImageEndCommand(int command, int gfxIndex) + { + if (DAT_UnknownBinkCount::instance < 288 && gfxIndex >= 0 && (command == 7 || command == 42)) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = command; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp new file mode 100644 index 0000000000..98f9d13ad8 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp @@ -0,0 +1,38 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA8D0 + void AppendCreditsImageTransitionCommand(int command, int gfxIndex, int x, int y, int field10) + { + if (DAT_UnknownBinkCount::instance < 288 && gfxIndex >= 0 + && (command == 5 || command == 6 || command == 7)) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = command; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x38 = -1; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].y = y; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x28 = field10; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 0; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].width + = DAT_TextureRenderCoreObject::instance.loadedGfxArray[gfxIndex].width; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].height + = DAT_TextureRenderCoreObject::instance.loadedGfxArray[gfxIndex].height; + if (command == 6) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 1; + } else if (command == 7) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 2; + } + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp new file mode 100644 index 0000000000..8111db9450 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp @@ -0,0 +1,30 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA9F0 + void AppendCreditsShowImageCommand( + int command, int gfxIndex, int x, int y, int width, int height, undefined4 unused, int field10) + { + if (DAT_UnknownBinkCount::instance < 288 && gfxIndex >= 0 && command == 41) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 41; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x38 = 0; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].y = y; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x28 = field10; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 0; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].width = width; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].height = height; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp b/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp new file mode 100644 index 0000000000..ca6344a1ff --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp @@ -0,0 +1,23 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA7A0 + void AppendCreditsSoundEntry(SHC_SoundStreamInt soundStream, int x) + { + if (DAT_UnknownBinkCount::instance < 288) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 17; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = soundStream; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp new file mode 100644 index 0000000000..270b32ac51 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp @@ -0,0 +1,37 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAC30 + void AppendCreditsTextCommand( + int command, int textIndex, int field6, int field13, int x, int y, int width, int field12) + { + if (DAT_UnknownBinkCount::instance < 288 && textIndex >= 0 + && textIndex < (int)DAT_NumberOfStoredMenuStrings::instance) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = command; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = textIndex; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x18 = field6; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].y = y; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].width = width; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x30 = field12; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 0; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x34 = field13; + if (command == 15) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 1; + } else if (command == 16) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x1c = 2; + } + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp new file mode 100644 index 0000000000..03c5e8da90 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp @@ -0,0 +1,24 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DACF0 + void AppendCreditsTextEndCommand(int command, int textIndex) + { + if (DAT_UnknownBinkCount::instance < 288 && textIndex >= 0 + && textIndex < (int)DAT_NumberOfStoredMenuStrings::instance && command == 16) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 16; + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = textIndex; + DAT_UnknownBinkCount::instance += 1; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp b/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp new file mode 100644 index 0000000000..ee5a5576cc --- /dev/null +++ b/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp @@ -0,0 +1,64 @@ +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_00ed2bd8.hpp" +#include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" +#include "OpenSHC/Globals/DAT_ARRAY_00ec0348.hpp" +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkIndex.hpp" +#include "OpenSHC/Globals/DWORD_00eb9ac4.hpp" +#include "OpenSHC/Globals/INT_00eb1230.hpp" +#include "OpenSHC/Globals/INT_00eb9ac0.hpp" +#include "OpenSHC/Globals/INT_00ed27a4.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + using OpenSHC::DE::SHCDE::eMusicIDs; + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA200 + void EndCreditsSegmentAndAdvanceToNext() + { + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + OpenSHC::Audio::MSS::enums::SND_STR_SFX_1Unk); + DAT_SoundSystemState::instance.streamFlagsUnkAndLoopCount_0x34[4] = 0; + DAT_SoundSystemState::instance.streamFlagsUnkAndLoopCount_0x34[3] = 0; + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + OpenSHC::Audio::MSS::enums::SND_STR_SPEECH_1); + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + OpenSHC::Audio::MSS::enums::SND_STR_SPEECH_2); + if (INT_00ed27a4::instance != 2) { + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, DAT_BinkControlState::ptr)(0); + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, DAT_BinkControlState::ptr)(1); + } + DWORD_00eb9ac4::instance = 0; + INT_00eb1230::instance = 0; + INT_00eb9ac0::instance = 0; + DAT_00ed2bd8::instance = 0; + for (int i = 0; i < 24; i++) { + DAT_ARRAY_00ec0348::instance[i].type = 0; + } + for (DAT_UnknownBinkIndex::instance += 1; DAT_UnknownBinkIndex::instance < DAT_UnknownBinkCount::instance; + DAT_UnknownBinkIndex::instance += 1) { + if (DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkIndex::instance].commandType == 39) { + MACRO_CALL_MEMBER( + OpenSHC::Audio::MSS::SoundSystem_Func::setSomeSoundTime, DAT_SoundSystemState::ptr)(); + MACRO_CALL_MEMBER( + OpenSHC::Audio::MSS::SoundSystem_Func::setupVolumeAndSoundID, DAT_SoundSystemState::ptr)( + (eMusicIDs)DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkIndex::instance].soundStream); + } + if (DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkIndex::instance].commandType == 31) { + break; + } + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp b/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp new file mode 100644 index 0000000000..13ec34f111 --- /dev/null +++ b/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp @@ -0,0 +1,45 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00ec0348.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAD40 + void InsertElementIntoAnArrayAt_ec0348( + int state, int xSpace, int field11, int x, int y, int width, int height, int fadeMode, int field7) + { + if (state != 1 && state != 4) { + return; + } + int index = -1; + for (int i = 0; i < 24; i++) { + if (DAT_ARRAY_00ec0348::instance[i].type == 0) { + index = i; + break; + } + } + if (index == -1) { + return; + } + DAT_ARRAY_00ec0348::instance[index].type = state; + DAT_ARRAY_00ec0348::instance[index].blendStrength = 0.0f; + DAT_ARRAY_00ec0348::instance[index].xSpace = xSpace; + DAT_ARRAY_00ec0348::instance[index].field_0x2c = field11; + DAT_ARRAY_00ec0348::instance[index].x = x; + DAT_ARRAY_00ec0348::instance[index].y = y; + DAT_ARRAY_00ec0348::instance[index].width = width; + DAT_ARRAY_00ec0348::instance[index].height = height; + DAT_ARRAY_00ec0348::instance[index].fadeMode = fadeMode; + DAT_ARRAY_00ec0348::instance[index].field_0x1c = field7; + if (fadeMode == 1) { + DAT_ARRAY_00ec0348::instance[index].blendStrength = 31.0f; + } else if (fadeMode == 2) { + DAT_ARRAY_00ec0348::instance[index].blendStrength = 1.0f; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp b/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp new file mode 100644 index 0000000000..6da4e5e14f --- /dev/null +++ b/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_ARRAY_00ec0348.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAE00 + void InsertElementIntoArrayAt_ec0348_3( + int state, int xSpace, int x, int y, int width, int height, int fadeMode, int field7) + { + if (state != 3) { + return; + } + int index = -1; + for (int i = 0; i < 24; i++) { + if (DAT_ARRAY_00ec0348::instance[i].type == 0) { + index = i; + break; + } + } + if (index == -1) { + return; + } + DAT_ARRAY_00ec0348::instance[index].type = 3; + DAT_ARRAY_00ec0348::instance[index].blendStrength = 0.0f; + DAT_ARRAY_00ec0348::instance[index].xSpace = xSpace; + DAT_ARRAY_00ec0348::instance[index].x = x; + DAT_ARRAY_00ec0348::instance[index].y = y; + DAT_ARRAY_00ec0348::instance[index].width = width; + DAT_ARRAY_00ec0348::instance[index].height = height; + DAT_ARRAY_00ec0348::instance[index].fadeMode = fadeMode; + DAT_ARRAY_00ec0348::instance[index].field_0x1c = field7; + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp b/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp new file mode 100644 index 0000000000..c38bc7e54a --- /dev/null +++ b/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp @@ -0,0 +1,51 @@ +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_00eb9b28.hpp" +#include "OpenSHC/Globals/DAT_00eb9b2c.hpp" +#include "OpenSHC/Globals/DAT_00eb9b30.hpp" +#include "OpenSHC/Globals/DAT_00eb9b34.hpp" +#include "OpenSHC/Globals/DAT_00eb9b38.hpp" +#include "OpenSHC/Globals/DAT_00eb9b3c.hpp" +#include "OpenSHC/Globals/DAT_00eb9b40.hpp" +#include "OpenSHC/Globals/DAT_ArrayOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/FLOAT_00eb9b1c.hpp" +#include "OpenSHC/Globals/FLOAT_Between1And5.hpp" +#include "OpenSHC/Globals/INT_00eb9b20.hpp" +#include "OpenSHC/Globals/INT_00eb9b24.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DB390 + void RenderScrollingCreditsTextFrame(float frameTime) + { + FLOAT_00eb9b1c::instance -= FLOAT_Between1And5::instance * frameTime; + if (FLOAT_00eb9b1c::instance <= 0.0f) { + FLOAT_00eb9b1c::instance += 100.0; + INT_00eb9b20::instance += 1; + if (INT_00eb9b20::instance > INT_00eb9b24::instance) { + DAT_00eb9b28::instance = 1; + } + } + if (DAT_00eb9b28::instance != 0) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderMultilineText5Unk, DAT_TextManagerObject::ptr)( + DAT_ArrayOfStoredMenuStrings::instance[DAT_00eb9b2c::instance], + DAT_00eb9b30::instance + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth, + DAT_00eb9b34::instance + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight, + DAT_00eb9b38::instance, DAT_00eb9b3c::instance, DAT_00eb9b40::instance, 0); + } else { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderSomeSpecificTextUnk, DAT_TextManagerObject::ptr)( + INT_00eb9b20::instance, (int)FLOAT_00eb9b1c::instance, + DAT_00eb9b30::instance + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth, + DAT_00eb9b34::instance + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight, + DAT_00eb9b3c::instance, DAT_00eb9b40::instance); + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Credits/ResetCredits.cpp b/src/OpenSHC/UI/Credits/ResetCredits.cpp new file mode 100644 index 0000000000..90f270c4ac --- /dev/null +++ b/src/OpenSHC/UI/Credits/ResetCredits.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/UI/Credits.func.hpp" + +#include "OpenSHC/Globals/DAT_00eb0e40.hpp" +#include "OpenSHC/Globals/DAT_00ed2bd8.hpp" +#include "OpenSHC/Globals/DAT_ARRAY_00ec0348.hpp" +#include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkIndex.hpp" +#include "OpenSHC/Globals/DWORD_00eb9ac4.hpp" +#include "OpenSHC/Globals/INT_00eb1230.hpp" +#include "OpenSHC/Globals/INT_00eb9ac0.hpp" +#include "OpenSHC/Globals/INT_00ec083c.hpp" +#include "OpenSHC/Globals/INT_00ed27a4.hpp" + +namespace OpenSHC { +namespace UI { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA300 + void ResetCredits() + { + for (int i = 0; i < 24; i++) { + DAT_ARRAY_00ec0348::instance[i].type = 0; + } + DAT_UnknownBinkCount::instance = 0; + INT_00ec083c::instance = 0.0f; + DAT_UnknownBinkIndex::instance = 0; + DAT_NumberOfStoredMenuStrings::instance = 0; + INT_00ed27a4::instance = 0; + DAT_00eb0e40::instance = 0; + DWORD_00eb9ac4::instance = 0; + DAT_00ed2bd8::instance = 0; + INT_00eb1230::instance = 0; + INT_00eb9ac0::instance = 0; + } + + } +} +} diff --git a/src/OpenSHC/UI/Menu/loadMenuElements.cpp b/src/OpenSHC/UI/Menu/loadMenuElements.cpp new file mode 100644 index 0000000000..e4071d5d7a --- /dev/null +++ b/src/OpenSHC/UI/Menu/loadMenuElements.cpp @@ -0,0 +1,31 @@ +#include "OpenSHC/UI/Menu.func.hpp" +#include "OpenSHC/UI/UC.hpp" + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + + // 0x004F4D70 is not declared in the headers yet; it is a UCPointerStruct member (thiscall). + struct UCProxy { + void loadMenuElement(int ucID, int* x, int* y, ushort* iconDeactivated, int ucPositionIndex); + }; + + MACRO_FUNCTION_RESOLVER(void (UCProxy::*)(int, int*, int*, ushort*, int), false, Address::SHC_3BB0A8C1_0x004F4D70, + &UCProxy::loadMenuElement) + UCProxy_loadMenuElement; + + // FUNCTION: STRONGHOLDCRUSADER 0x004F69D0 + void Menu::loadMenuElements(int ucPositionIndex) + { + for (MenuItem* item = this->menuItemArray; item->menuItemType != 102; ++item) { + if (item->ucID >= 0) { + MACRO_CALL_MEMBER(UCProxy_loadMenuElement, (UCProxy*)&DAT_MenuHandlerState::instance.ucPtrStruct)( + item->ucID, &item->position.position.x, &item->position.position.y, &item->iconDeactivatedUnk_0x36, + ucPositionIndex); + } + } + } + +} +} diff --git a/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp b/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp new file mode 100644 index 0000000000..0417e7f649 --- /dev/null +++ b/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp @@ -0,0 +1,28 @@ +#include "OpenSHC/UI/Menu.func.hpp" +#include "OpenSHC/UI/MenuHandlerState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" + +#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004F6A20 + void MenuHandlerState::initializeUI( + MenuIDMenuElementAddressPair* menuIDMenuElementAddressPair, UC* ucPtr, char* ptrStrongholdUCString) + { + this->ucPtrStruct.ucArrayPointer = ucPtr; + this->pointerToMenuIDMenuElementAddressMap = menuIDMenuElementAddressPair; + for (MenuIDMenuElementAddressPair* pair = menuIDMenuElementAddressPair; pair->menuID != -1; ++pair) { + MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::loadMenuElements, pair->menuAddress)(0); + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::prepareButtonAndAlphaSurface, + AlphaAndButtonSurfaceObj::ptr)(); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuModalComposition_Func::loadAllMenuElementsOfMenuModals, DAT_MenuModalComposition1::ptr)(); + } + +} +} diff --git a/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp new file mode 100644 index 0000000000..c1bb066e65 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp @@ -0,0 +1,112 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Text/TextEditorState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/MenuViews/Credits.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_00b95b3c.hpp" +#include "OpenSHC/Globals/DAT_00b95b70.hpp" +#include "OpenSHC/Globals/DAT_00b9610c.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_ModifierKeyState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextEditorState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/INT_00b95954.hpp" +#include "OpenSHC/Globals/INT_00b960d0.hpp" +#include "OpenSHC/Globals/INT_00b960d4.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace Credits { + + // FUNCTION: STRONGHOLDCRUSADER 0x00426340 + void MenuView_Credits_DoEveryFrame() + { + DWORD now = timeGetTime(); + if ((int)DAT_00b9610c::instance > 0) { + int fade = (int)(now - INT_00b960d0::instance) / 50; + DAT_TextEditorState::instance.pendingCreditsFadeBorder = TRUE; + DAT_00b95b70::instance = fade; + if (fade >= 32) { + DAT_00b9610c::instance = 0; + INT_00b960d0::instance = now; + } + } else if ((int)DAT_00b9610c::instance < 0) { + int fade = 32 - (int)(now - INT_00b960d0::instance) / 50; + DAT_TextEditorState::instance.pendingCreditsFadeBorder = TRUE; + DAT_00b95b70::instance = fade; + if (fade <= 0) { + INT_00b960d0::instance = now; + DAT_00b9610c::instance = 1; + DAT_00b95b70::instance = 0; + DAT_00b95b3c::instance += 1; + if ((int)DAT_00b95b3c::instance >= 4) { + DAT_00b95b3c::instance = 0; + } + } + } else if ((int)(now - INT_00b960d0::instance) > 20000 && INT_00b95954::instance == 0) { + DAT_00b9610c::instance = -1; + INT_00b960d0::instance = now; + } + if (GetAsyncKeyState(VK_DOWN)) { + if (DAT_ModifierKeyState::instance.shift != 0) { + INT_00b960d4::instance -= 200; + } else { + INT_00b960d4::instance -= 60; + } + } + int scrollOffset = (int)(now - INT_00b960d4::instance) / 30 - 600; + if (scrollOffset != DAT_TextEditorState::instance.helpContentScrollOffsetY) { + DAT_TextEditorState::instance.helpContentScrollOffsetY = scrollOffset; + if (scrollOffset > DAT_TextEditorState::instance.topVisibleLineIndex) { + DAT_TextEditorState::instance.helpContentScrollOffsetY = -600; + INT_00b960d4::instance = now; + } + DAT_TextEditorState::instance.pendingCreditsFadeBorder = TRUE; + } + if (DAT_TextEditorState::instance.pendingCreditsFadeBorder != FALSE) { + MACRO_CALL_MEMBER(UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)(DAT_00b95b3c::instance, + (DAT_WindowAndDirectDraw::instance.resolutionX + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2, + (DAT_WindowAndDirectDraw::instance.resolutionY + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); + if ((int)DAT_00b95b70::instance < 32) { + timeGetTime(); + if (INT_00b95954::instance == 0) { + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(DAT_MenuHandlerState::instance.x, + DAT_MenuHandlerState::instance.y, DAT_MenuHandlerState::instance.x + 800, + DAT_MenuHandlerState::instance.y + 600, DAT_00b95b70::instance); + } else { + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, + DAT_PencilRenderCore::ptr)(0, 0, DAT_WindowAndDirectDraw::instance.resolutionX / 2, + DAT_WindowAndDirectDraw::instance.resolutionY, DAT_00b95b70::instance); + } + } + } + if (DAT_MouseState::instance.leftClickStart != 0) { + MACRO_CALL_MEMBER( + Text::TextEditorState_Func::closeHelpDialogAndReturnToMenu, DAT_TextEditorState::ptr)(); + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAIN_MENU, 0); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NONE, FALSE); + } + } + + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index a70f614bd4..8af94f8fdd 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6763,7 +6763,7 @@ SHC_3BB0A8C1_0x004261E0 | 0.0% | Pending SHC_3BB0A8C1_0x004262B0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00426340 | 0.0% | Pending +SHC_3BB0A8C1_0x00426340 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00426570 | 100.0% | Reimplemented @@ -16647,7 +16647,7 @@ SHC_3BB0A8C1_0x0044A6E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044A720 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0044A830 | 0.0% | Pending +SHC_3BB0A8C1_0x0044A830 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0044AA70 | 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 @@ -20027,7 +20027,7 @@ SHC_3BB0A8C1_0x00467830 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00467850 | 0.0% | Pending -SHC_3BB0A8C1_0x00467890 | 0.0% | Pending +SHC_3BB0A8C1_0x00467890 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004679F0 | 0.0% | Pending @@ -21445,7 +21445,7 @@ SHC_3BB0A8C1_0x004737B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00473830 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00473870 | 0.0% | Pending +SHC_3BB0A8C1_0x00473870 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00473A70 | 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 @@ -36123,11 +36123,11 @@ SHC_3BB0A8C1_0x004DA17F | 0.0% | Pending SHC_3BB0A8C1_0x004DA180 | 0.0% | Pending -SHC_3BB0A8C1_0x004DA200 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA200 | 100.0% | Reimplemented (counted: only the loop-end symbol differs) SHC_3BB0A8C1_0x004DA2A0 | 0.0% | Pending -SHC_3BB0A8C1_0x004DA300 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA300 | 100.0% | Reimplemented (counted: only the loop-end symbol differs) SHC_3BB0A8C1_0x004DA310 | 0.0% | Pending @@ -36143,7 +36143,7 @@ SHC_3BB0A8C1_0x004DA6E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DA750 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DA7A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA7A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DA7E0 | 100.0% | Reimplemented @@ -36155,31 +36155,31 @@ SHC_3BB0A8C1_0x004DA870 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DA8A0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DA8D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA8D0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DA9A0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA9A0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DA9F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DA9F0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DAA80 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAA80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DAAB0 | 0.0% | Pending -SHC_3BB0A8C1_0x004DAB00 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAB00 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DAB80 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAB80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DABB0 | 0.0% | Pending SHC_3BB0A8C1_0x004DABF0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DAC30 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAC30 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DACF0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DACF0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DAD40 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAD40 | 100.0% | Reimplemented (counted: only the loop-end symbol and the 31.0f constant's name differ) -SHC_3BB0A8C1_0x004DAE00 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAE00 | 100.0% | Reimplemented (counted: only the loop-end symbol differs) SHC_3BB0A8C1_0x004DAE90 | 0.0% | Pending @@ -36195,7 +36195,7 @@ SHC_3BB0A8C1_0x004DB210 | 100.0% | Reimplemented, only the loop's end address re SHC_3BB0A8C1_0x004DB300 | 100.0% | Reimplemented, only the float constant's address differs (same value) -SHC_3BB0A8C1_0x004DB390 | 0.0% | Pending +SHC_3BB0A8C1_0x004DB390 | 100.0% | Reimplemented (counted: only the 100.0 constant and _ftol2 symbol names differ) SHC_3BB0A8C1_0x004DB490 | 100.0% | Reimplemented, mismatches in float constants and functions @@ -38647,7 +38647,7 @@ SHC_3BB0A8C1_0x004F4E00 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F4EF0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004F4F60 | 0.0% | Pending +SHC_3BB0A8C1_0x004F4F60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F61C0 | 0.0% | Pending @@ -38729,9 +38729,9 @@ SHC_3BB0A8C1_0x004F69C8 | 0.0% | Pending SHC_3BB0A8C1_0x004F69CC | 0.0% | Pending -SHC_3BB0A8C1_0x004F69D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004F69D0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004F6A20 | 0.0% | Pending +SHC_3BB0A8C1_0x004F6A20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004F6A60 | 100.0% | Reimplemented From e09c4c408d7fa782395618db838d664a3e65b493 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Sun, 15 Nov 2026 20:43:30 -0500 Subject: [PATCH 3/8] headers: CreditsRelatedStructure2.binkFileName is an inline char[32] Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/UI/Credits/CreditsRelatedStructure2.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/OpenSHC/UI/Credits/CreditsRelatedStructure2.hpp b/src/OpenSHC/UI/Credits/CreditsRelatedStructure2.hpp index a85dabaf8a..191cd1d58c 100644 --- a/src/OpenSHC/UI/Credits/CreditsRelatedStructure2.hpp +++ b/src/OpenSHC/UI/Credits/CreditsRelatedStructure2.hpp @@ -37,8 +37,7 @@ namespace UI { int field_0x30; // 0x00000030 length: 4 int field_0x34; // 0x00000034 length: 4 int field_0x38; // 0x00000038 length: 4 - char* binkFileName; // 0x0000003C length: 4 - undefined1 padding_0x40[28]; // 0x00000040 length: 28 + char binkFileName[32]; // 0x0000003C length: 32 } CreditsRelatedStructure2; #pragma pack(pop) From a53abeba5320f00333d3a1424faa29706b2f5eb2 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Sun, 15 Nov 2026 20:46:02 -0500 Subject: [PATCH 4/8] headers: declare UCPointerStruct::loadMenuElement (0x4F4D70) Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/UI/UCPointerStruct.func.hpp | 16 ++++++++++++++++ src/OpenSHC/UI/UCPointerStruct.hpp | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 src/OpenSHC/UI/UCPointerStruct.func.hpp diff --git a/src/OpenSHC/UI/UCPointerStruct.func.hpp b/src/OpenSHC/UI/UCPointerStruct.func.hpp new file mode 100644 index 0000000000..5aeaa62727 --- /dev/null +++ b/src/OpenSHC/UI/UCPointerStruct.func.hpp @@ -0,0 +1,16 @@ +/** + path: 'OpenSHC/UI/UCPointerStruct.func.hpp' +*/ + +#include "OpenSHC/UI/UCPointerStruct.hpp" +namespace OpenSHC { +namespace UI { + namespace UCPointerStruct_Func { + + MACRO_FUNCTION_RESOLVER(void (UCPointerStruct::*)(int, int*, int*, ushort*, int), false, + Address::SHC_3BB0A8C1_0x004F4D70, &UCPointerStruct::loadMenuElement) + loadMenuElement; + + } // namespace UCPointerStruct_Func +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/UCPointerStruct.hpp b/src/OpenSHC/UI/UCPointerStruct.hpp index a5986cb681..9e94c225d9 100644 --- a/src/OpenSHC/UI/UCPointerStruct.hpp +++ b/src/OpenSHC/UI/UCPointerStruct.hpp @@ -21,6 +21,8 @@ namespace UI { UC* ucArrayPointer; // 0x00000000 length: 4 + void loadMenuElement(int ucID, int* x, int* y, ushort* iconDeactivated, int ucPositionIndex); + } UCPointerStruct; #pragma pack(pop) From f99d9499e7ade6f86b5c4e31bda8b48e58ae5d49 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Sun, 15 Nov 2026 20:46:53 -0500 Subject: [PATCH 5/8] Review: relative main includes, countof for the credits bound, enums and colours in the construction-cost text, string-literals in loadCRTex, loadMenuElements uses the declared member, no needless casts Co-Authored-By: Claude Opus 5.5 --- .../playNextStoredBinkVideo.cpp | 2 +- src/OpenSHC/Rendering/InitializeColors.cpp | 35 +-- src/OpenSHC/Text/TextManager/loadCRTex.cpp | 15 +- ...CurrentlyDisplayedTextConstructionCost.cpp | 216 ++++++++++-------- .../Credits/AppendCreditsBinkVideoCommand.cpp | 7 +- ...AppendCreditsBinkVideoWithAudioCommand.cpp | 7 +- .../AppendCreditsFixedImageCommand.cpp | 4 +- .../Credits/AppendCreditsImageEndCommand.cpp | 5 +- .../AppendCreditsImageTransitionCommand.cpp | 4 +- .../Credits/AppendCreditsShowImageCommand.cpp | 5 +- .../UI/Credits/AppendCreditsSoundEntry.cpp | 4 +- .../UI/Credits/AppendCreditsTextCommand.cpp | 6 +- .../Credits/AppendCreditsTextEndCommand.cpp | 6 +- .../EndCreditsSegmentAndAdvanceToNext.cpp | 3 +- .../InsertElementIntoAnArrayAt_ec0348.cpp | 2 +- .../InsertElementIntoArrayAt_ec0348_3.cpp | 2 +- .../RenderScrollingCreditsTextFrame.cpp | 3 +- src/OpenSHC/UI/Credits/ResetCredits.cpp | 4 +- src/OpenSHC/UI/Menu/loadMenuElements.cpp | 16 +- .../UI/MenuHandlerState/initializeUI.cpp | 3 +- .../Credits/MenuView_Credits_DoEveryFrame.cpp | 3 +- 21 files changed, 190 insertions(+), 162 deletions(-) diff --git a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp index 04d31b1ba6..5f305ddd5b 100644 --- a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp +++ b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" +#include "../AIMessageQueue.func.hpp" namespace OpenSHC { namespace Rendering { diff --git a/src/OpenSHC/Rendering/InitializeColors.cpp b/src/OpenSHC/Rendering/InitializeColors.cpp index 6d3c25106e..386fec595c 100644 --- a/src/OpenSHC/Rendering/InitializeColors.cpp +++ b/src/OpenSHC/Rendering/InitializeColors.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Rendering.func.hpp" +#include "../Rendering.func.hpp" + #include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/Rendering/ColorMode.hpp" @@ -32,27 +33,27 @@ namespace Rendering { COL_BLACK::instance.shortValue = 0; if (DAT_WindowAndDirectDraw::instance.colorBitMode == RGB_555) { COL_RED::instance.shortValue = (short)64512; - COL_LIME::instance.shortValue = (short)992; - COL_DARK_GREEN::instance.shortValue = (short)480; - COL_WHITE::instance.shortValue = (short)32767; - COL_BRIGHT_YELLOW::instance.shortValue = (short)29447; - COL_MODERATE_GREEN::instance.shortValue = (short)13063; - COL_DARK_CYAN_GREY::instance.shortValue = (short)13807; - COL_VERY_DARK_GREY::instance.shortValue = (short)7399; - COL_MAGENTA::instance.shortValue = (short)31775; - COL_VIVID_BLUE::instance.shortValue = (short)4703; - COL_VERY_SOFT_YELLOW::instance.shortValue = (short)30647; + COL_LIME::instance.shortValue = 992; + COL_DARK_GREEN::instance.shortValue = 480; + COL_WHITE::instance.shortValue = 32767; + COL_BRIGHT_YELLOW::instance.shortValue = 29447; + COL_MODERATE_GREEN::instance.shortValue = 13063; + COL_DARK_CYAN_GREY::instance.shortValue = 13807; + COL_VERY_DARK_GREY::instance.shortValue = 7399; + COL_MAGENTA::instance.shortValue = 31775; + COL_VIVID_BLUE::instance.shortValue = 4703; + COL_VERY_SOFT_YELLOW::instance.shortValue = 30647; } else { COL_RED::instance.shortValue = (short)63488; - COL_LIME::instance.shortValue = (short)1984; - COL_DARK_GREEN::instance.shortValue = (short)960; + COL_LIME::instance.shortValue = 1984; + COL_DARK_GREEN::instance.shortValue = 960; COL_WHITE::instance.shortValue = (short)65535; COL_BRIGHT_YELLOW::instance.shortValue = (short)50695; - COL_MODERATE_GREEN::instance.shortValue = (short)17927; - COL_DARK_CYAN_GREY::instance.shortValue = (short)31695; - COL_VERY_DARK_GREY::instance.shortValue = (short)14791; + COL_MODERATE_GREEN::instance.shortValue = 17927; + COL_DARK_CYAN_GREY::instance.shortValue = 31695; + COL_VERY_DARK_GREY::instance.shortValue = 14791; COL_MAGENTA::instance.shortValue = (short)63519; - COL_VIVID_BLUE::instance.shortValue = (short)9407; + COL_VIVID_BLUE::instance.shortValue = 9407; COL_VERY_SOFT_YELLOW::instance.shortValue = (short)61303; } COL_LIGHT_GREY::instance.shortValue diff --git a/src/OpenSHC/Text/TextManager/loadCRTex.cpp b/src/OpenSHC/Text/TextManager/loadCRTex.cpp index 34e77a5d7c..ce897b6308 100644 --- a/src/OpenSHC/Text/TextManager/loadCRTex.cpp +++ b/src/OpenSHC/Text/TextManager/loadCRTex.cpp @@ -7,6 +7,7 @@ #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" #include "OpenSHC/Text/GameLanguage.hpp" #include "OpenSHC/WindowsHelper/Enums/CodePage.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" #include "OpenSHC/Globals/DAT_WideCharMultiByteState.hpp" @@ -22,7 +23,7 @@ namespace Text { this->helpTextLinkActive = FALSE; this->textSurfaceTarget = Rendering::Enums::RT_SCREEN_MENU; this->field_0x1348 = 0; - int file = MACRO_CALL(OS_Func::_ucrt_open)("cr.tex", _O_BINARY, 0); + int file = MACRO_CALL(OS_Func::_ucrt_open)(s_cr_tex_005a6334, _O_BINARY, 0); if (file == -1) { return; } @@ -33,7 +34,7 @@ namespace Text { DAT_WideCharMultiByteState::ptr)(this->textStart, wideText, 351000); this->alternativeCodePageUsedUnk = FALSE; this->gameLanguage = GL_ENGLISH; - if (MACRO_CALL(OS_Func::__stricmp)("polish", + if (MACRO_CALL(OS_Func::__stricmp)(s_polish_005a632c, MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)(DE::SHCDE::TEXT_LANGUAGE, 0)) == 0) { this->codePage = WindowsHelper::Enums::CP_WINDOWS_1250; @@ -41,27 +42,27 @@ namespace Text { MACRO_CALL_MEMBER(Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, DAT_WideCharMultiByteState::ptr)(this->textStart, wideText, 351000); this->gameLanguage = GL_POLISH; - } else if (MACRO_CALL(OS_Func::__stricmp)("english", + } else if (MACRO_CALL(OS_Func::__stricmp)(s_english_005a6324, MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( DE::SHCDE::TEXT_LANGUAGE, 0)) == 0) { this->gameLanguage = GL_ENGLISH; - } else if (MACRO_CALL(OS_Func::__stricmp)("american", + } else if (MACRO_CALL(OS_Func::__stricmp)(s_american_005a6318, MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( DE::SHCDE::TEXT_LANGUAGE, 0)) == 0) { this->gameLanguage = GL_AMERICAN; - } else if (MACRO_CALL(OS_Func::__stricmp)("german", + } else if (MACRO_CALL(OS_Func::__stricmp)(s_german_005a6310, MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( DE::SHCDE::TEXT_LANGUAGE, 0)) == 0) { this->gameLanguage = GL_GERMAN; - } else if (MACRO_CALL(OS_Func::__stricmp)("french", + } else if (MACRO_CALL(OS_Func::__stricmp)(s_french_005a6308, MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( DE::SHCDE::TEXT_LANGUAGE, 0)) == 0) { this->gameLanguage = GL_FRENCH; - } else if (MACRO_CALL(OS_Func::__stricmp)("italian", + } else if (MACRO_CALL(OS_Func::__stricmp)(s_italian_005a6300, MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( DE::SHCDE::TEXT_LANGUAGE, 0)) == 0) { diff --git a/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp b/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp index 0bbed18e88..5c918f742d 100644 --- a/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp +++ b/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp @@ -7,6 +7,10 @@ #include "OpenSHC/DE/SHCDE/eGM.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/UI/Enums/BuildMenuTabType.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" #include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_00ee1090.hpp" @@ -38,7 +42,9 @@ namespace UI { { int const activeMenuTab = DAT_GameCore::instance.activeMenuTab.tabType; int const menuViewType = DAT_GameCore::instance.currentMenuViewType; - if (param_1 == 0 && menuViewType == 16 && (activeMenuTab == 1 || activeMenuTab == 44)) { + if (param_1 == 0 && menuViewType == Enums::MVT_BUILDING_AND_STATUS_MENU + && (activeMenuTab == Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM + || activeMenuTab == Enums::BASMTT_MERCENARYPOST)) { return; } if (this->currentlyDisplayedTextIsDisplayedUnk == 0) { @@ -50,7 +56,7 @@ namespace UI { DAT_ButtonX::instance += DAT_ViewportRenderState::instance.viewportState.currentCameraOffsetX; DAT_ButtonY::instance += DAT_ViewportRenderState::instance.viewportState.currentCameraOffsetY; } - if (menuViewType == 14 && activeMenuTab == 61) { + if (menuViewType == Enums::MVT_BUILD_MENU && activeMenuTab == Enums::BMTT_SOLDIERS) { DAT_ButtonX::instance += 130; DAT_ButtonY::instance -= 2; } @@ -64,17 +70,19 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance + 260, DAT_ButtonY::instance, - TTA_CENTER, 12119803, 0, 18, FALSE); + TTA_CENTER, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); if (DAT_GameSynchronyState::instance.currentGameMode != 0 && DAT_GameSynchronyState::instance.skirmishTroopsCostGold == 0) { break; } MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)((eTextSections)22, 2, - DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, FALSE); + DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, + 18, FALSE); MACRO_CALL_MEMBER(TextManager_Func::renderNumber, DAT_TextManagerObject::ptr)( DAT_TroopDefinedData::instance .BarracksUnitCost[this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType], - DAT_ButtonX::instance + 6, DAT_ButtonY::instance, 12119803, 0, 18, TRUE); + DAT_ButtonX::instance + 6, DAT_ButtonY::instance, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, + TRUE); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 124, @@ -87,7 +95,7 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, - TTA_LEFT, 12119803, 0, 18, FALSE); + TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); } break; } @@ -98,17 +106,19 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance + 260, DAT_ButtonY::instance + 152, - TTA_CENTER, 12119803, 0, 18, FALSE); + TTA_CENTER, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); if (DAT_GameSynchronyState::instance.currentGameMode != 0 && DAT_GameSynchronyState::instance.skirmishTroopsCostGold == 0) { break; } MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)((eTextSections)22, 2, - DAT_ButtonX::instance + 10, DAT_ButtonY::instance + 152, TTA_LEFT, 12119803, 0, 18, FALSE); + DAT_ButtonX::instance + 10, DAT_ButtonY::instance + 152, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); MACRO_CALL_MEMBER(TextManager_Func::renderNumber, DAT_TextManagerObject::ptr)( DAT_TroopDefinedData::instance .NonEuroUnitCost[this->currentlyDisplayedUnktextExtraObject.unitsAndWeaponsType], - DAT_ButtonX::instance + 16, DAT_ButtonY::instance + 152, 12119803, 0, 18, TRUE); + DAT_ButtonX::instance + 16, DAT_ButtonY::instance + 152, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, + TRUE); DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 124, @@ -116,18 +126,18 @@ namespace UI { DAT_ButtonY::instance + 152); break; case 13: - if (menuViewType == 20 && DAT_MenuModalComposition1::instance.activeModalDialogID == -1 + if (menuViewType == Enums::MVT_LOBBY_MENU && DAT_MenuModalComposition1::instance.activeModalDialogID == -1 && DAT_TextManagerObject::instance.gameLanguage != 0 && DAT_TextManagerObject::instance.gameLanguage != 1) { MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance - 50, DAT_ButtonY::instance, - DAT_ButtonW::instance + 100, 12119803, 0, 18, 0); + DAT_ButtonW::instance + 100, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, 0); } else { MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, - DAT_ButtonW::instance, 12119803, 0, 18, 0); + DAT_ButtonW::instance, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, 0); } break; case 1: @@ -146,12 +156,12 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, - DAT_ButtonY::instance - height + 24, 480, 12119803, 0, 18, 0); + DAT_ButtonY::instance - height + 24, 480, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, 0); } else { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, - TTA_LEFT, 12119803, 0, 18, FALSE); + TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); } break; case 10: @@ -162,7 +172,7 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, - TTA_LEFT, 12119803, 0, 18, FALSE); + TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); } break; case 7: @@ -175,11 +185,12 @@ namespace UI { DAT_TextManagerObject::instance.field_0x24 = 1; MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)7, this->currentlyDisplayedUnkTextNumInGroup_0x8 - 309, DAT_ButtonX::instance, - DAT_ButtonY::instance, DAT_ButtonW::instance, 13433599, 0, 18, 0); + DAT_ButtonY::instance, DAT_ButtonW::instance, OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18, 0); DAT_TextManagerObject::instance.field_0x24 = 1; MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)250, this->currentlyDisplayedUnkTextNumInGroup_0x8 - 301, DAT_ButtonX::instance, - DAT_ButtonY::instance + height, DAT_ButtonW::instance, 13433599, 0, 18, 0); + DAT_ButtonY::instance + height, DAT_ButtonW::instance, OpenSHC::Rendering::Colors::COL_CCFAFF, + 0, 18, 0); break; } DAT_TextManagerObject::instance.field_0x24 = 1; @@ -188,12 +199,12 @@ namespace UI { && DAT_GameCore::instance.directDrawStatus < 1792) { MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, 344, DAT_ButtonX::instance, - DAT_ButtonY::instance, DAT_ButtonW::instance, 13433599, 0, 18, 0); + DAT_ButtonY::instance, DAT_ButtonW::instance, OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18, 0); } else { MACRO_CALL_MEMBER(TextManager_Func::renderMultilineText3Unk, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, - DAT_ButtonW::instance, 13433599, 0, 17, 0); + DAT_ButtonW::instance, OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 17, 0); } } else { this->currentlyDisplayedTextIsDisplayedUnk = 0; @@ -203,7 +214,7 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, - 12119803, 0, 18, FALSE); + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); break; case 2: { Map::Buildings::BuildingType const buildingType @@ -223,7 +234,7 @@ namespace UI { != 0) { wood = 0; } - if (DAT_GameCore::instance.gameMode_2 == 1) { + if (DAT_GameCore::instance.gameMode_2 == Game::GM_EDITOR) { iron = 0; gold = 0; pitch = 0; @@ -245,11 +256,12 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, - 12119803, 0, 18, FALSE); + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); int offset = 30; if (wood != 0) { - MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( - wood, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(wood, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 126, @@ -257,20 +269,22 @@ namespace UI { DAT_ButtonY::instance - 6); offset += 32; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_WOOD], - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 30; } if (stone != 0) { - MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( - stone, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(stone, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 123, @@ -278,18 +292,20 @@ namespace UI { DAT_ButtonY::instance - 4); offset += 32; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(stoneOwned, - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 30; } if (iron != 0) { - MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( - iron, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(iron, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 125, @@ -297,20 +313,22 @@ namespace UI { DAT_ButtonY::instance - 4); offset += 32; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_IRON], - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 30; } if (pitch != 0) { - MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( - pitch, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(pitch, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 155, @@ -318,20 +336,22 @@ namespace UI { DAT_ButtonY::instance - 10); offset += 26; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_PITCH], - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 10; } if (gold != 0) { - MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( - gold, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(gold, + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 124, @@ -339,13 +359,14 @@ namespace UI { DAT_ButtonY::instance + 6); offset += 32; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(goldOwned, - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); } break; } @@ -353,48 +374,51 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, - 12119803, 0, 18, FALSE); + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 123, DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 30, DAT_ButtonY::instance - 4); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, - TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); if (DAT_GameCore::instance.gameMode_2 == Game::GM_SIEGE_THAT) { MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .startResources[RT_STONE], - DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, + 0, 18, TRUE, 0); } else { MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_STONE], - DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, + 0, 18, TRUE, 0); } MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, - TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); break; case 9: MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, - 12119803, 0, 18, FALSE); + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 126, DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 30, DAT_ButtonY::instance - 4); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, - TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_WOOD], - DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, + 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, - TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + 62, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); break; case 11: { int cost = 0; @@ -413,23 +437,25 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, - 12119803, 0, 18, FALSE); - MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( - cost, DAT_ButtonX::instance + 30, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); + MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(cost, + DAT_ButtonX::instance + 30, DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, + 18, TRUE, 0); MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 124, DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 32, DAT_ButtonY::instance - 4); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, - TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_GOLD], - DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, + 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, - TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + 64, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); break; } case 3: { @@ -449,7 +475,7 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8 + textOffset, DAT_ButtonX::instance + scroll, - DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, FALSE); + DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); int percentage; if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentPopulation @@ -507,7 +533,7 @@ namespace UI { } MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, textOffset + 4, DAT_ButtonX::instance, - DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, FALSE); + DAT_ButtonY::instance, TTA_LEFT, OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); } break; } @@ -517,11 +543,12 @@ namespace UI { MACRO_CALL_MEMBER(TextManager_Func::renderText, DAT_TextManagerObject::ptr)( (eTextSections)this->currentlyDisplayedUnkTextGroupIndex_0x4, this->currentlyDisplayedUnkTextNumInGroup_0x8, DAT_ButtonX::instance, DAT_ButtonY::instance, TTA_LEFT, - 12119803, 0, 18, FALSE); + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, FALSE); int offset = 30; if (woodCost != 0) { MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(woodCost, - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 126, @@ -529,20 +556,22 @@ namespace UI { DAT_ButtonY::instance - 6); offset += 32; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_WOOD], - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 30; } if (stoneCost != 0) { MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(stoneCost, - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); offset += 2; MACRO_CALL_MEMBER(Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( GM_INTERFACE_ICONS2, 123, @@ -550,15 +579,16 @@ namespace UI { DAT_ButtonY::instance - 4); offset += 32; MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, - 0, 18, TRUE, 0); + s_brace_close_005a2778, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] .currentResources[RT_STONE], - DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, 18, TRUE, 0); + DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); MACRO_CALL_MEMBER(TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( - s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, 12119803, 0, - 18, TRUE, 0); + s_brace_open_005a2774, DAT_ButtonX::instance + offset, DAT_ButtonY::instance, TTA_LEFT, + OpenSHC::Rendering::Colors::COL_B8EEFB, 0, 18, TRUE, 0); } break; } diff --git a/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp index 38a9f76cd3..6a1f2750fe 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" @@ -11,10 +11,9 @@ namespace UI { void AppendCreditsBinkVideoCommand( undefined4 unused, char* fileName, int x, int y, int binkObjIndex, SoundFlagsAndLoopCount flagLoopCount) { - if (DAT_UnknownBinkCount::instance < 288) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance)) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 12; - // the file name is stored inline, in the 32 bytes from binkFileName on - strcpy((char*)&DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkFileName, fileName); + strcpy(DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkFileName, fileName); DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].y = y; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkObjIndex = binkObjIndex; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp index 862d4cbf97..08d76261f0 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" @@ -10,10 +10,9 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DAB80 void AppendCreditsBinkVideoWithAudioCommand(char* fileName, int binkObjIndex, int noLoop, int volume) { - if (DAT_UnknownBinkCount::instance < 288) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance)) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 13; - // the file name is stored inline, in the 32 bytes from binkFileName on - strcpy((char*)&DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkFileName, fileName); + strcpy(DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkFileName, fileName); DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].binkObjIndex = binkObjIndex; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].flagLoopCount = (SoundFlagsAndLoopCount)(1 - noLoop); diff --git a/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp index 381bc9ed77..1393ca1b25 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" @@ -11,7 +11,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DAB00 void AppendCreditsFixedImageCommand(int gfxIndex, int x, int y) { - if (DAT_UnknownBinkCount::instance < 288) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance)) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 21; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp index 048ae4a3f9..3c45068a54 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" @@ -10,7 +10,8 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DA9A0 void AppendCreditsImageEndCommand(int command, int gfxIndex) { - if (DAT_UnknownBinkCount::instance < 288 && gfxIndex >= 0 && (command == 7 || command == 42)) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance) && gfxIndex >= 0 + && (command == 7 || command == 42)) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = command; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; DAT_UnknownBinkCount::instance += 1; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp index 98f9d13ad8..3ebfee7d9d 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" @@ -11,7 +11,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DA8D0 void AppendCreditsImageTransitionCommand(int command, int gfxIndex, int x, int y, int field10) { - if (DAT_UnknownBinkCount::instance < 288 && gfxIndex >= 0 + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance) && gfxIndex >= 0 && (command == 5 || command == 6 || command == 7)) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = command; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp index 8111db9450..d800924367 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" @@ -11,7 +11,8 @@ namespace UI { void AppendCreditsShowImageCommand( int command, int gfxIndex, int x, int y, int width, int height, undefined4 unused, int field10) { - if (DAT_UnknownBinkCount::instance < 288 && gfxIndex >= 0 && command == 41) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance) && gfxIndex >= 0 + && command == 41) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 41; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = gfxIndex; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x38 = 0; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp b/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp index ca6344a1ff..f55659a0de 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" @@ -10,7 +10,7 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DA7A0 void AppendCreditsSoundEntry(SHC_SoundStreamInt soundStream, int x) { - if (DAT_UnknownBinkCount::instance < 288) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance)) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 17; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = soundStream; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].x = x; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp index 270b32ac51..77029f7b78 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" @@ -12,8 +12,8 @@ namespace UI { void AppendCreditsTextCommand( int command, int textIndex, int field6, int field13, int x, int y, int width, int field12) { - if (DAT_UnknownBinkCount::instance < 288 && textIndex >= 0 - && textIndex < (int)DAT_NumberOfStoredMenuStrings::instance) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance) && textIndex >= 0 + && textIndex < DAT_NumberOfStoredMenuStrings::instance) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = command; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = textIndex; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].field_0x18 = field6; diff --git a/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp b/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp index 03c5e8da90..e60067a622 100644 --- a/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp +++ b/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" #include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" @@ -11,8 +11,8 @@ namespace UI { // FUNCTION: STRONGHOLDCRUSADER 0x004DACF0 void AppendCreditsTextEndCommand(int command, int textIndex) { - if (DAT_UnknownBinkCount::instance < 288 && textIndex >= 0 - && textIndex < (int)DAT_NumberOfStoredMenuStrings::instance && command == 16) { + if (DAT_UnknownBinkCount::instance < countof(DAT_ARRAY_00eb9b68::instance) && textIndex >= 0 + && textIndex < DAT_NumberOfStoredMenuStrings::instance && command == 16) { DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 16; DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].soundStream = textIndex; DAT_UnknownBinkCount::instance += 1; diff --git a/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp b/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp index ee5a5576cc..02677b518f 100644 --- a/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp +++ b/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp @@ -1,6 +1,7 @@ +#include "../Credits.func.hpp" + #include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" #include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" -#include "OpenSHC/UI/Credits.func.hpp" #include "OpenSHC/Globals/DAT_00ed2bd8.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00eb9b68.hpp" diff --git a/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp b/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp index 13ec34f111..a14c0b2c65 100644 --- a/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp +++ b/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00ec0348.hpp" diff --git a/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp b/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp index 6da4e5e14f..b1cfa2effb 100644 --- a/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp +++ b/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_ARRAY_00ec0348.hpp" diff --git a/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp b/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp index c38bc7e54a..15295bcd24 100644 --- a/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp +++ b/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp @@ -1,5 +1,6 @@ +#include "../Credits.func.hpp" + #include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/UI/Credits.func.hpp" #include "OpenSHC/Globals/DAT_00eb9b28.hpp" #include "OpenSHC/Globals/DAT_00eb9b2c.hpp" diff --git a/src/OpenSHC/UI/Credits/ResetCredits.cpp b/src/OpenSHC/UI/Credits/ResetCredits.cpp index e2864ac9ac..8c091fa0cb 100644 --- a/src/OpenSHC/UI/Credits/ResetCredits.cpp +++ b/src/OpenSHC/UI/Credits/ResetCredits.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/UI/Credits.func.hpp" +#include "../Credits.func.hpp" #include "OpenSHC/Globals/DAT_00eb0e40.hpp" #include "OpenSHC/Globals/DAT_00ed2bd8.hpp" @@ -7,9 +7,9 @@ #include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" #include "OpenSHC/Globals/DAT_UnknownBinkIndex.hpp" #include "OpenSHC/Globals/DWORD_00eb9ac4.hpp" +#include "OpenSHC/Globals/FLOAT_00ec083c.hpp" #include "OpenSHC/Globals/INT_00eb1230.hpp" #include "OpenSHC/Globals/INT_00eb9ac0.hpp" -#include "OpenSHC/Globals/FLOAT_00ec083c.hpp" #include "OpenSHC/Globals/INT_00ed27a4.hpp" namespace OpenSHC { diff --git a/src/OpenSHC/UI/Menu/loadMenuElements.cpp b/src/OpenSHC/UI/Menu/loadMenuElements.cpp index e4071d5d7a..dac2514f8d 100644 --- a/src/OpenSHC/UI/Menu/loadMenuElements.cpp +++ b/src/OpenSHC/UI/Menu/loadMenuElements.cpp @@ -1,26 +1,18 @@ -#include "OpenSHC/UI/Menu.func.hpp" -#include "OpenSHC/UI/UC.hpp" +#include "../Menu.func.hpp" + +#include "OpenSHC/UI/UCPointerStruct.func.hpp" #include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" namespace OpenSHC { namespace UI { - // 0x004F4D70 is not declared in the headers yet; it is a UCPointerStruct member (thiscall). - struct UCProxy { - void loadMenuElement(int ucID, int* x, int* y, ushort* iconDeactivated, int ucPositionIndex); - }; - - MACRO_FUNCTION_RESOLVER(void (UCProxy::*)(int, int*, int*, ushort*, int), false, Address::SHC_3BB0A8C1_0x004F4D70, - &UCProxy::loadMenuElement) - UCProxy_loadMenuElement; - // FUNCTION: STRONGHOLDCRUSADER 0x004F69D0 void Menu::loadMenuElements(int ucPositionIndex) { for (MenuItem* item = this->menuItemArray; item->menuItemType != 102; ++item) { if (item->ucID >= 0) { - MACRO_CALL_MEMBER(UCProxy_loadMenuElement, (UCProxy*)&DAT_MenuHandlerState::instance.ucPtrStruct)( + MACRO_CALL_MEMBER(UCPointerStruct_Func::loadMenuElement, &DAT_MenuHandlerState::instance.ucPtrStruct)( item->ucID, &item->position.position.x, &item->position.position.y, &item->iconDeactivatedUnk_0x36, ucPositionIndex); } diff --git a/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp b/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp index 0417e7f649..f7f974204c 100644 --- a/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp +++ b/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp @@ -1,5 +1,6 @@ +#include "../MenuHandlerState.func.hpp" + #include "OpenSHC/UI/Menu.func.hpp" -#include "OpenSHC/UI/MenuHandlerState.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" diff --git a/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp index c1bb066e65..c1816674b2 100644 --- a/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp +++ b/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp @@ -1,7 +1,8 @@ +#include "../Credits.func.hpp" + #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/Text/TextEditorState.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" -#include "OpenSHC/UI/MenuViews/Credits.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" #include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" From ea9fb67e55929800f2052a3869989ba1a63dbbd4 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Sun, 15 Nov 2026 20:50:56 -0500 Subject: [PATCH 6/8] loadCRTex: _ucrt_open takes char*, use the string macro for cr.tex Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Text/TextManager/loadCRTex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenSHC/Text/TextManager/loadCRTex.cpp b/src/OpenSHC/Text/TextManager/loadCRTex.cpp index ce897b6308..90c5e1db93 100644 --- a/src/OpenSHC/Text/TextManager/loadCRTex.cpp +++ b/src/OpenSHC/Text/TextManager/loadCRTex.cpp @@ -23,7 +23,7 @@ namespace Text { this->helpTextLinkActive = FALSE; this->textSurfaceTarget = Rendering::Enums::RT_SCREEN_MENU; this->field_0x1348 = 0; - int file = MACRO_CALL(OS_Func::_ucrt_open)(s_cr_tex_005a6334, _O_BINARY, 0); + int file = MACRO_CALL(OS_Func::_ucrt_open)(S_CR_TEX_005A6334, _O_BINARY, 0); if (file == -1) { return; } From 097b69dfd3a73545628c214df4fd56f56dbeeafa Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Mon, 16 Nov 2026 17:12:35 -0500 Subject: [PATCH 7/8] OS: _ucrt_open takes char const* like _open Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/OS.func.hpp | 2 +- src/OpenSHC/OS.hpp | 2 +- src/OpenSHC/OS/OS.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenSHC/OS.func.hpp b/src/OpenSHC/OS.func.hpp index efbddd61a4..6da9e9b130 100644 --- a/src/OpenSHC/OS.func.hpp +++ b/src/OpenSHC/OS.func.hpp @@ -136,7 +136,7 @@ namespace OS_Func { Address::SHC_3BB0A8C1_0x005815C6, &OpenSHC::OS::_ucrt_read) _ucrt_read; - MACRO_FUNCTION_RESOLVER(int(__cdecl*)(char* _Filename, int _OpenFlag, int _PMode), REIMPLEMENTED_CRT, + MACRO_FUNCTION_RESOLVER(int(__cdecl*)(char const* _Filename, int _OpenFlag, int _PMode), REIMPLEMENTED_CRT, Address::SHC_3BB0A8C1_0x005816C3, &OpenSHC::OS::_ucrt_open) _ucrt_open; diff --git a/src/OpenSHC/OS.hpp b/src/OpenSHC/OS.hpp index b419e05e28..cc2cd332c2 100644 --- a/src/OpenSHC/OS.hpp +++ b/src/OpenSHC/OS.hpp @@ -81,7 +81,7 @@ namespace OS { int __cdecl _ucrt_read(int fileDescriptor, void* destination, size_t size); - int __cdecl _ucrt_open(char* _Filename, int _OpenFlag, int _PMode); + int __cdecl _ucrt_open(char const* _Filename, int _OpenFlag, int _PMode); void __cdecl _srand(ulong param_1); diff --git a/src/OpenSHC/OS/OS.cpp b/src/OpenSHC/OS/OS.cpp index 686831bf59..0f85c5144a 100644 --- a/src/OpenSHC/OS/OS.cpp +++ b/src/OpenSHC/OS/OS.cpp @@ -111,7 +111,7 @@ namespace OS { } // STUB: STRONGHOLDCRUSADER 0x005816C3 - int _ucrt_open(char* _Filename, int _OpenFlag, int _PMode) { return _open(_Filename, _OpenFlag, _PMode); } + int _ucrt_open(char const* _Filename, int _OpenFlag, int _PMode) { return _open(_Filename, _OpenFlag, _PMode); } // STUB: STRONGHOLDCRUSADER 0x005816FB int _rand() { return rand(); } From 3a373f99487cc63448cb84ac7ea456a23752ecaa Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Mon, 16 Nov 2026 17:12:46 -0500 Subject: [PATCH 8/8] loadCRTex: cr.tex from string-literals Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/Text/TextManager/loadCRTex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenSHC/Text/TextManager/loadCRTex.cpp b/src/OpenSHC/Text/TextManager/loadCRTex.cpp index 90c5e1db93..ce897b6308 100644 --- a/src/OpenSHC/Text/TextManager/loadCRTex.cpp +++ b/src/OpenSHC/Text/TextManager/loadCRTex.cpp @@ -23,7 +23,7 @@ namespace Text { this->helpTextLinkActive = FALSE; this->textSurfaceTarget = Rendering::Enums::RT_SCREEN_MENU; this->field_0x1348 = 0; - int file = MACRO_CALL(OS_Func::_ucrt_open)(S_CR_TEX_005A6334, _O_BINARY, 0); + int file = MACRO_CALL(OS_Func::_ucrt_open)(s_cr_tex_005a6334, _O_BINARY, 0); if (file == -1) { return; }