diff --git a/src/OpenSHC/Audio/SFX/SFXState/getSoundVolumeForFilename.cpp b/src/OpenSHC/Audio/SFX/SFXState/getSoundVolumeForFilename.cpp index b199481dd3..ced596d8c7 100644 --- a/src/OpenSHC/Audio/SFX/SFXState/getSoundVolumeForFilename.cpp +++ b/src/OpenSHC/Audio/SFX/SFXState/getSoundVolumeForFilename.cpp @@ -7,7 +7,7 @@ namespace Audio { namespace SFX { // FUNCTION: STRONGHOLDCRUSADER 0x0044A240 - int SFXState::getSoundVolumeForFilename(char* soundFileName) + int SFXState::getSoundVolumeForFilename(char const* soundFileName) { for (int _runCounter = 0; _runCounter < this->DAT_SoundTotalCount; ++_runCounter) { if (!MACRO_CALL(OpenSHC::OS_Func::__stricmp)( diff --git a/src/OpenSHC/Rendering/Bink/BinkControlClass/playBINK.cpp b/src/OpenSHC/Rendering/Bink/BinkControlClass/playBINK.cpp index 0165c26776..85027ee803 100644 --- a/src/OpenSHC/Rendering/Bink/BinkControlClass/playBINK.cpp +++ b/src/OpenSHC/Rendering/Bink/BinkControlClass/playBINK.cpp @@ -1,8 +1,8 @@ -#include "../../../Rendering.func.hpp" +#include "../BinkControlClass.func.hpp" #include "OpenSHC/Audio/SFX/SFXState.func.hpp" #include "OpenSHC/IO/ResourceManager.func.hpp" -#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/Rendering.func.hpp" #include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp" #include "OpenSHC/IO/FileResourceType.hpp" #include "OpenSHC/Rendering/Bink/UnsortedBinkFlag.hpp" @@ -23,11 +23,10 @@ namespace Rendering { // FUNCTION: STRONGHOLDCRUSADER 0x00408ED0 void BinkControlClass::playBINK( - int binkObjIndex, char* binkFileName, DWORD param_3, DWORD param_4, int xPos, int yPos, DWORD param_7) + int binkObjIndex, char const* binkFileName, DWORD param_3, DWORD param_4, int xPos, int yPos, DWORD param_7) { char* _videoFileName; HBINK _binkObjPtr; - int _fileSoundVolumne; MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::resolveResourceFileName, DAT_ResourceManager::ptr)( OpenSHC::IO::FRT_BINKS, (char const*)((int)(binkFileName))); if (this->binkObjPtrArray[binkObjIndex] != (HBINK)0x0) { @@ -49,9 +48,9 @@ namespace Rendering { } if ((DAT_SoundSystemState::instance.waveOutOpenUnk_0x8 != FALSE) && (DAT_SoundSystemState::instance.soundActiveUnk_0x0 != 0)) { - _fileSoundVolumne = MACRO_CALL_MEMBER( + int const fileSoundVolume = MACRO_CALL_MEMBER( OpenSHC::Audio::SFX::SFXState_Func::getSoundVolumeForFilename, DAT_SFXState::ptr)(binkFileName); - BinkSetVolume(this->binkObjPtrArray[binkObjIndex], 0, (long)((int)(_fileSoundVolumne * 250))); + BinkSetVolume(this->binkObjPtrArray[binkObjIndex], 0, (long)((int)(fileSoundVolume * 250))); } this->xPos[binkObjIndex] = xPos; this->yPos[binkObjIndex] = yPos; diff --git a/src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_Prepare.cpp b/src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_Prepare.cpp new file mode 100644 index 0000000000..6b6350a521 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_Prepare.cpp @@ -0,0 +1,118 @@ +#include "../GameLost.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Rendering/ScreenResolutionEnum.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/BOOLEnum_00ed279c.hpp" +#include "OpenSHC/Globals/CHAR_00eb0e44.hpp" +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_00eb9af8.hpp" +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_FinalResultsOrderByColumn.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition3.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/DWORD_00ed27b4.hpp" +#include "OpenSHC/Globals/INT_00ec082c.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D55D0 + void GameLost::MenuView_GameLost_Prepare() + { + DAT_GameCore::instance.gameDuration = timeGetTime() - DAT_GameCore::instance.timeSum_2; + BOOLEnum_00ed279c::instance = FALSE; + DAT_FinalResultsOrderByColumn::instance = 0; + DAT_00eb9af8::instance = 0; + CHAR_00eb0e44::instance = 0; + DAT_VideoBikQueue::instance.storedMessages_0x924 = 0; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition2::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition3::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_800x600) { + DAT_GameCore::instance.activeMenuTab.tabType = OpenSHC::UI::Enums::BASMTT_NONE; + INT_00ec082c::instance = 0; + } else { + DAT_GameCore::instance.activeMenuTab.tabType = OpenSHC::UI::Enums::BASMTT_KEEP_OR_MPMENU_IPX; + INT_00ec082c::instance = 2; + } + MACRO_CALL(OpenSHC::Game::Skirmish_Func::StoreLocalTime)(); + DWORD_00ed27b4::instance = 0; + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::setupLossMusic, DAT_SoundSystemState::ptr)(); + int const menuY = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + int const menuX = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + // currentMenu read once (read twice: quick_diff 0.9909 -> 0.9774) + Menu* const menu = DAT_MenuHandlerState::instance.currentMenu; + menu->xPosition = menuX; + menu->yPosition = menuY; + DAT_MenuHandlerState::instance.y = menuY; + DAT_MenuHandlerState::instance.x = menuX; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, DAT_PencilRenderCore::ptr)(0, + 0, DAT_WindowAndDirectDraw::instance.resolutionX, DAT_WindowAndDirectDraw::instance.resolutionY, + COL_BLACK::instance.shortValue); + // the defeat video unless at the skirmish end screen: Arabian for missions 6 to 10 or an Arabian lord + // four calls (one call after picking the file: quick_diff 0.9909 -> 0.7282) + if (DAT_GameSynchronyState::instance.currentGameMode + != OpenSHC::Game::GM_SKIRMISH_END_OF_GAME_SINGLE_PLAYER) { + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CAMPAIGN_MISSION) { + if (DAT_GameCore::instance.missionNumber1to20 >= 6 + && DAT_GameCore::instance.missionNumber1to20 <= 10) { + // "arabian_lose.bik" + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::playBINK, + DAT_BinkControlState::ptr)(0, s_arabian_lose_bik_005aaf04, 0, 0, + DAT_MenuHandlerState::instance.x + 80, DAT_MenuHandlerState::instance.y + 60, 2); + } else { + // "crusader_lose.bik" + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::playBINK, + DAT_BinkControlState::ptr)(0, s_crusader_lose_bik_005aaef0, 0, 0, + DAT_MenuHandlerState::instance.x + 80, DAT_MenuHandlerState::instance.y + 60, 2); + } + } else if (MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::getLordTypeForPlayer, + DAT_GameSynchronyState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID) + == 1) { + // "arabian_lose.bik" + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::playBINK, + DAT_BinkControlState::ptr)(0, s_arabian_lose_bik_005aaf04, 0, 0, + DAT_MenuHandlerState::instance.x + 80, DAT_MenuHandlerState::instance.y + 60, 2); + } else { + // "crusader_lose.bik" + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::playBINK, + DAT_BinkControlState::ptr)(0, s_crusader_lose_bik_005aaef0, 0, 0, + DAT_MenuHandlerState::instance.x + 80, DAT_MenuHandlerState::instance.y + 60, 2); + } + } + MACRO_CALL(OpenSHC::UI::Helpers_Func::LoadTGX_shc_back)(); + DAT_MenuTextInputState::instance.DAT_SomeTextArrayIndex = OpenSHC::Text::TAIT_NINE__FILTER_B; + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_Prepare.cpp b/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_Prepare.cpp new file mode 100644 index 0000000000..02722830d5 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_Prepare.cpp @@ -0,0 +1,65 @@ +#include "../HistoricCampaignOutro.func.hpp" + +#include "OpenSHC/Rendering.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_00eb0b20.hpp" +#include "OpenSHC/Globals/DAT_00ed2780.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/FLOAT_00ec0834.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DBE30 + void HistoricCampaignOutro::MenuView_HistoricCampaignOutro_Prepare() + { + MACRO_CALL(OpenSHC::UI::Helpers_Func::PrepareHistoryBook)(); + // the campaign's picture + switch (DAT_GameCore::instance.historicCampaignNumber) { + case 1: + // "c1pic.tgx" + DAT_00eb0b20::instance = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_c1pic_tgx_005ab0ec); + break; + case 2: + // "c2pic.tgx" + DAT_00eb0b20::instance = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_c2pic_tgx_005ab0e0); + break; + case 3: + // "c3pic.tgx" + DAT_00eb0b20::instance = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_c3pic_tgx_005ab0d4); + break; + case 4: + // "c4pic.tgx" + DAT_00eb0b20::instance = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_c4pic_tgx_005ab0c8); + break; + } + MACRO_CALL(OpenSHC::UI::Helpers_Func::LoadTGX_shc_back)(); + // "Aftermath" and the campaign's closing text, the last two of its six in TEXT_CAMPAIGN_INFO + DAT_NumberOfStoredMenuStrings::instance = 0; + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)(MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_CAMPAIGN_INFO, DAT_GameCore::instance.historicCampaignNumber * 6 - 2)); + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)(MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_CAMPAIGN_INFO, DAT_GameCore::instance.historicCampaignNumber * 6 - 1)); + FLOAT_00ec0834::instance = 0.0; + DAT_00ed2780::instance = 1; + MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/HistoricMissionIntro/MenuView_HistoricMissionIntro_Prepare.cpp b/src/OpenSHC/UI/MenuViews/HistoricMissionIntro/MenuView_HistoricMissionIntro_Prepare.cpp new file mode 100644 index 0000000000..f8e1fa6dd1 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/HistoricMissionIntro/MenuView_HistoricMissionIntro_Prepare.cpp @@ -0,0 +1,64 @@ +#include "../HistoricMissionIntro.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Rendering.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_00eb0b20.hpp" +#include "OpenSHC/Globals/DAT_00ed2780.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/FLOAT_00ec0834.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + using OpenSHC::DE::SHCDE::eTextSections; + + // FUNCTION: STRONGHOLDCRUSADER 0x004DB7B0 + void HistoricMissionIntro::MenuView_HistoricMissionIntro_Prepare() + { + MACRO_CALL(OpenSHC::UI::Helpers_Func::PrepareHistoryBook)(); + // the mission's map + char fileName[16]; + // "m%dmap.tgx" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)( + fileName, s_m_dmap_tgx_005ab0b8, DAT_GameCore::instance.missionNumber1to20); + DAT_00eb0b20::instance = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(fileName); + // the mission's story group: "Mission N", its title and the story + DAT_NumberOfStoredMenuStrings::instance = 0; + // three calls (a loop over the text number: quick_diff 0.9677 -> 0.6903) + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((eTextSections)((DAT_GameCore::instance.missionNumber1to20 - 1) * 4 + + OpenSHC::DE::SHCDE::TEXT_MISSION1_STORY), + 0)); + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((eTextSections)((DAT_GameCore::instance.missionNumber1to20 - 1) * 4 + + OpenSHC::DE::SHCDE::TEXT_MISSION1_STORY), + 1)); + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((eTextSections)((DAT_GameCore::instance.missionNumber1to20 - 1) * 4 + + OpenSHC::DE::SHCDE::TEXT_MISSION1_STORY), + 2)); + FLOAT_00ec0834::instance = 0.0; + DAT_00ed2780::instance = 1; + // the story (stored text 2), 740 wide in font size 17 + MACRO_CALL(OpenSHC::UI::Helpers_Func::TrimStoredMenuString)(2, 30, 380, 740, 0, 17); + MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); + MACRO_CALL(OpenSHC::UI::Helpers_Func::LoadTGX_shc_back)(); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_Prepare.cpp b/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_Prepare.cpp new file mode 100644 index 0000000000..8cf6086172 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_Prepare.cpp @@ -0,0 +1,56 @@ +#include "../HistoricMissionPicture.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Rendering.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_00eb0b20.hpp" +#include "OpenSHC/Globals/DAT_00ed2780.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_NumberOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/FLOAT_00ec0834.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + using OpenSHC::DE::SHCDE::eTextSections; + + // FUNCTION: STRONGHOLDCRUSADER 0x004DB4F0 + void HistoricMissionPicture::MenuView_HistoricMissionPicture_Prepare() + { + // the picture of the mission's campaign, five missions each: missions 1 to 5 show m1pic.tgx + char fileName[16]; + // "m%dpic.tgx" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)( + fileName, s_m_dpic_tgx_005ab0a0, (DAT_GameCore::instance.missionNumber1to20 - 1) / 5 + 1); + MACRO_CALL(OpenSHC::UI::Helpers_Func::PrepareHistoryBook)(); + DAT_00eb0b20::instance = MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(fileName); + // the mission's story group: "Mission N" and its title + DAT_NumberOfStoredMenuStrings::instance = 0; + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((eTextSections)((DAT_GameCore::instance.missionNumber1to20 - 1) * 4 + + OpenSHC::DE::SHCDE::TEXT_MISSION1_STORY), + 0)); + MACRO_CALL(OpenSHC::UI::Helpers_Func::StoreStringInMenuStringArray)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((eTextSections)((DAT_GameCore::instance.missionNumber1to20 - 1) * 4 + + OpenSHC::DE::SHCDE::TEXT_MISSION1_STORY), + 1)); + FLOAT_00ec0834::instance = 0.0; + DAT_00ed2780::instance = 1; + MACRO_CALL(OpenSHC::Rendering_Func::TicksStartCounter)(); + MACRO_CALL(OpenSHC::UI::Helpers_Func::LoadTGX_shc_back)(); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/MainMenu/MenuView_MainMenu_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/MainMenu/MenuView_MainMenu_DoEveryFrame.cpp new file mode 100644 index 0000000000..9393d9e2be --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/MainMenu/MenuView_MainMenu_DoEveryFrame.cpp @@ -0,0 +1,88 @@ +#include "../MainMenu.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Random/RNG.func.hpp" +#include "OpenSHC/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MainMenuSwingSwordBool.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UnknownGFXIndex.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/SEC_RNG.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + // FUNCTION: STRONGHOLDCRUSADER 0x00424DA0 + void MainMenu::MenuView_MainMenu_DoEveryFrame() + { + if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { + DAT_UnknownGFXIndex::instance = 0; + // fixme: a positive remainder is cleared too, so the sword swing below never starts from here + if (DAT_BinkControlState::instance.binkObjPtrArray[0] == NULL + && DAT_GameCore::instance.menuViewToSwitchTo == DAT_GameCore::instance.currentMenuViewType) { + if (DAT_MainMenuSwingSwordBool::instance) { + DAT_MainMenuSwingSwordBool::instance = 0; + } else { + DAT_MainMenuSwingSwordBool::instance = SEC_RNG::instance.currentNumber1 % 3; + if (DAT_MainMenuSwingSwordBool::instance > 0) { + DAT_MainMenuSwingSwordBool::instance = 0; + } + MACRO_CALL_MEMBER(OpenSHC::Random::RNG_Func::nextRandomNumber1, SEC_RNG::ptr)(); + } + // the idle video + if (!DAT_MainMenuSwingSwordBool::instance) { + // "richard_ambient.bik" + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::playBINK, + DAT_BinkControlState::ptr)(0, s_richard_ambient_bik_005a1fe4, 0, 0, + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 508, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 22, 0); + } + if (DAT_MainMenuSwingSwordBool::instance == 1) { + // "richard_swordswing.bik" + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::playBINK, + DAT_BinkControlState::ptr)(0, s_richard_swordswing_bik_005a1fc4, 0, 0, + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 508, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 22, 0); + } + } + } else { + DAT_UnknownGFXIndex::instance = 1; + if (DAT_BinkControlState::instance.binkObjPtrArray[0] != NULL) { + MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, + DAT_BinkControlState::ptr)(0); + } + } + // the background, centred + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)(DAT_UnknownGFXIndex::instance, + (DAT_WindowAndDirectDraw::instance.resolutionX + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[DAT_UnknownGFXIndex::instance].width) + / 2, + (DAT_WindowAndDirectDraw::instance.resolutionY + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[DAT_UnknownGFXIndex::instance].height) + / 2); + // the version, "V1.41", in the bottom left corner + char version[100]; + // "V1.%d" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)(version, s_V1_d_005a1fdc, 41); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)(version, + DAT_MenuHandlerState::instance.x + 2, DAT_MenuHandlerState::instance.y + 588, OpenSHC::Text::TTA_LEFT, + OpenSHC::Rendering::Colors::COL_7CAAAF, 19, FALSE, 0); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6e036f9340..3a83187b97 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6683,7 +6683,7 @@ SHC_3BB0A8C1_0x00424C40 | 0.0% | Pending SHC_3BB0A8C1_0x00424CD0 | 0.0% | Pending -SHC_3BB0A8C1_0x00424DA0 | 0.0% | Pending +SHC_3BB0A8C1_0x00424DA0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00424F50 | 0.0% | Pending @@ -35573,7 +35573,7 @@ SHC_3BB0A8C1_0x004D53A0 | 0.0% | Pending SHC_3BB0A8C1_0x004D53E0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004D55D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004D55D0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D5780 | 0.0% | Pending @@ -36199,13 +36199,13 @@ SHC_3BB0A8C1_0x004DB390 | 0.0% | Pending SHC_3BB0A8C1_0x004DB490 | 100.0% | Reimplemented, mismatches in float constants and functions -SHC_3BB0A8C1_0x004DB4F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DB4F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DB5C0 | 0.0% | Pending SHC_3BB0A8C1_0x004DB600 | 0.0% | Pending -SHC_3BB0A8C1_0x004DB7B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DB7B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DB8B0 | 0.0% | Pending @@ -36229,7 +36229,7 @@ SHC_3BB0A8C1_0x004DBE28 | 0.0% | Pending SHC_3BB0A8C1_0x004DBE2C | 0.0% | Pending -SHC_3BB0A8C1_0x004DBE30 | 0.0% | Pending +SHC_3BB0A8C1_0x004DBE30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DBEE4 | 0.0% | Pending