Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)(
Expand Down
11 changes: 5 additions & 6 deletions src/OpenSHC/Rendering/Bink/BinkControlClass/playBINK.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
118 changes: 118 additions & 0 deletions src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_Prepare.cpp
Original file line number Diff line number Diff line change
@@ -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)();
}

}
}
}
Original file line number Diff line number Diff line change
@@ -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)();
}

}
}
}
Original file line number Diff line number Diff line change
@@ -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)();
}

}
}
}
Original file line number Diff line number Diff line change
@@ -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)();
}

}
}
}
Loading
Loading