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/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(); } diff --git a/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp new file mode 100644 index 0000000000..5f305ddd5b --- /dev/null +++ b/src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp @@ -0,0 +1,18 @@ +#include "../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..386fec595c --- /dev/null +++ b/src/OpenSHC/Rendering/InitializeColors.cpp @@ -0,0 +1,72 @@ +#include "../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 = 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 = 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 = 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 = 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..ce897b6308 --- /dev/null +++ b/src/OpenSHC/Text/TextManager/loadCRTex.cpp @@ -0,0 +1,87 @@ +#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/string-literals.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)(s_cr_tex_005a6334, _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)(s_polish_005a632c, + 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)(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)(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)(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)(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)(s_italian_005a6300, + 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..5c918f742d --- /dev/null +++ b/src/OpenSHC/UI/BottomLeftTextDisplayState/renderCurrentlyDisplayedTextConstructionCost.cpp @@ -0,0 +1,601 @@ +#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/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" +#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 == Enums::MVT_BUILDING_AND_STATUS_MENU + && (activeMenuTab == Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM + || activeMenuTab == Enums::BASMTT_MERCENARYPOST)) { + 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 == Enums::MVT_BUILD_MENU && activeMenuTab == Enums::BMTT_SOLDIERS) { + 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, 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, 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, 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, + 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, OpenSHC::Rendering::Colors::COL_B8EEFB, 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, 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, + 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, 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, + DAT_TextManagerObject::instance.currentXOffset_0x0 + DAT_ButtonX::instance + 20, + DAT_ButtonY::instance + 152); + break; + case 13: + 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, 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, OpenSHC::Rendering::Colors::COL_B8EEFB, 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, 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, OpenSHC::Rendering::Colors::COL_B8EEFB, 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, OpenSHC::Rendering::Colors::COL_B8EEFB, 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, 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, OpenSHC::Rendering::Colors::COL_CCFAFF, + 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, 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, OpenSHC::Rendering::Colors::COL_CCFAFF, 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, + OpenSHC::Rendering::Colors::COL_B8EEFB, 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 == Game::GM_EDITOR) { + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + OpenSHC::Rendering::Colors::COL_B8EEFB, 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, + 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, + 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, 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, 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, + 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, + 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, + 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, 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, + OpenSHC::Rendering::Colors::COL_B8EEFB, 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, + 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, + 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, 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, + OpenSHC::Rendering::Colors::COL_B8EEFB, 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, OpenSHC::Rendering::Colors::COL_B8EEFB, 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, OpenSHC::Rendering::Colors::COL_B8EEFB, 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + OpenSHC::Rendering::Colors::COL_B8EEFB, 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..6a1f2750fe --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoCommand.cpp @@ -0,0 +1,28 @@ +#include "../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 < countof(DAT_ARRAY_00eb9b68::instance)) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 12; + 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; + 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..08d76261f0 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsBinkVideoWithAudioCommand.cpp @@ -0,0 +1,26 @@ +#include "../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 < countof(DAT_ARRAY_00eb9b68::instance)) { + DAT_ARRAY_00eb9b68::instance[DAT_UnknownBinkCount::instance].commandType = 13; + 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); + 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..1393ca1b25 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsFixedImageCommand.cpp @@ -0,0 +1,31 @@ +#include "../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 < 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; + 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..3c45068a54 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsImageEndCommand.cpp @@ -0,0 +1,23 @@ +#include "../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 < 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 new file mode 100644 index 0000000000..3ebfee7d9d --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsImageTransitionCommand.cpp @@ -0,0 +1,38 @@ +#include "../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 < 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; + 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..d800924367 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsShowImageCommand.cpp @@ -0,0 +1,31 @@ +#include "../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 < 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; + 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..f55659a0de --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsSoundEntry.cpp @@ -0,0 +1,23 @@ +#include "../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 < 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; + 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..77029f7b78 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsTextCommand.cpp @@ -0,0 +1,37 @@ +#include "../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 < 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; + 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..e60067a622 --- /dev/null +++ b/src/OpenSHC/UI/Credits/AppendCreditsTextEndCommand.cpp @@ -0,0 +1,24 @@ +#include "../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 < 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/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) diff --git a/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp b/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp new file mode 100644 index 0000000000..02677b518f --- /dev/null +++ b/src/OpenSHC/UI/Credits/EndCreditsSegmentAndAdvanceToNext.cpp @@ -0,0 +1,65 @@ +#include "../Credits.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/Rendering/Bink/BinkControlClass.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..a14c0b2c65 --- /dev/null +++ b/src/OpenSHC/UI/Credits/InsertElementIntoAnArrayAt_ec0348.cpp @@ -0,0 +1,45 @@ +#include "../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..b1cfa2effb --- /dev/null +++ b/src/OpenSHC/UI/Credits/InsertElementIntoArrayAt_ec0348_3.cpp @@ -0,0 +1,39 @@ +#include "../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..15295bcd24 --- /dev/null +++ b/src/OpenSHC/UI/Credits/RenderScrollingCreditsTextFrame.cpp @@ -0,0 +1,52 @@ +#include "../Credits.func.hpp" + +#include "OpenSHC/Text/TextManager.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..8c091fa0cb --- /dev/null +++ b/src/OpenSHC/UI/Credits/ResetCredits.cpp @@ -0,0 +1,39 @@ +#include "../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/FLOAT_00ec083c.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 { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DA300 + void ResetCredits() + { + for (int i = 0; i < 24; i++) { + DAT_ARRAY_00ec0348::instance[i].type = 0; + } + DAT_UnknownBinkCount::instance = 0; + FLOAT_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..dac2514f8d --- /dev/null +++ b/src/OpenSHC/UI/Menu/loadMenuElements.cpp @@ -0,0 +1,23 @@ +#include "../Menu.func.hpp" + +#include "OpenSHC/UI/UCPointerStruct.func.hpp" + +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004F69D0 + void Menu::loadMenuElements(int ucPositionIndex) + { + for (MenuItem* item = this->menuItemArray; item->menuItemType != 102; ++item) { + if (item->ucID >= 0) { + 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 new file mode 100644 index 0000000000..f7f974204c --- /dev/null +++ b/src/OpenSHC/UI/MenuHandlerState/initializeUI.cpp @@ -0,0 +1,29 @@ +#include "../MenuHandlerState.func.hpp" + +#include "OpenSHC/UI/Menu.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..c1816674b2 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/Credits/MenuView_Credits_DoEveryFrame.cpp @@ -0,0 +1,113 @@ +#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/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/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) diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 3a97b43162..0d274cc21c 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