From be34b03df1b62144f0cd3cf34df4bfa90b2271bc Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Fri, 13 Nov 2026 16:42:29 -0500 Subject: [PATCH 1/4] Reimplement 18 functions that differ from the original only in symbol names Co-Authored-By: Claude Opus 5.5 --- .../Global/DetectDXVersionByLoadingDDRAW.cpp | 40 ++ src/OpenSHC/Global/TestOSVersion.cpp | 25 + .../Entities/EntityState/computeVelocity.cpp | 21 + .../Entities/EntityState/createSeagull.cpp | 85 +++ .../Map/Entities/SomeFireSpreadFunction.cpp | 78 +++ .../setStartingYearAndStartingResources.cpp | 50 ++ ...ventYearsAndCommitBuildingAvailability.cpp | 48 ++ .../updateMilitaryCampaignMissionState.cpp | 520 ++++++++++++++++++ .../Synchrony/InitSkirmishLobbyData.cpp | 77 +++ ...Handler_FindingNetworkSessions_Buttons.cpp | 117 ++++ ...ionHandler_General_AdvancedGameOptions.cpp | 435 +++++++++++++++ ...mActionHandler_NewInvasion_UnitButtons.cpp | 119 ++++ ..._SiegeAttackingForceAndStartGoods_Main.cpp | 110 ++++ ...ItemActionHandler_TriggerInvasion_Main.cpp | 117 ++++ ...nHandler_WaitingForHost_ConnectToLobby.cpp | 86 +++ ...iew_HistoricCampaignIntro_DoEveryFrame.cpp | 117 ++++ ...iew_HistoricCampaignOutro_DoEveryFrame.cpp | 113 ++++ ...ew_HistoricMissionPicture_DoEveryFrame.cpp | 84 +++ status/addresses-SHC-3BB0A8C1.txt | 36 +- 19 files changed, 2260 insertions(+), 18 deletions(-) create mode 100644 src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp create mode 100644 src/OpenSHC/Global/TestOSVersion.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/computeVelocity.cpp create mode 100644 src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp create mode 100644 src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp create mode 100644 src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp create mode 100644 src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp create mode 100644 src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp create mode 100644 src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp create mode 100644 src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp create mode 100644 src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp create mode 100644 src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp create mode 100644 src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp create mode 100644 src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp create mode 100644 src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp diff --git a/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp b/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp new file mode 100644 index 0000000000..afb5964d83 --- /dev/null +++ b/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp @@ -0,0 +1,40 @@ +#include "OpenSHC/Global.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/IID_IDirectDraw7.hpp" + +namespace OpenSHC { + +typedef HRESULT(WINAPI* DirectDrawCreateExFunc)(GUID* guid, void** directDraw, REFIID iid, IUnknown* unkOuter); + +// FUNCTION: STRONGHOLDCRUSADER 0x0046F4F0 +Global::DirectDrawStatus Global::DetectDXVersionByLoadingDDRAW() +{ + // "DDRAW.DLL" + HMODULE const ddrawModule = LoadLibraryA(s_DDRAW_DLL_005a61ec); + if (ddrawModule == NULL) { + return Rendering::Enums::DD7_NOT_LOADED; + } + IUnknown* directDraw; + // "DirectDrawCreate" + if (GetProcAddress(ddrawModule, s_DirectDrawCreate_005a61d8) == NULL) { + FreeLibrary(ddrawModule); + return Rendering::Enums::DD7_NOT_LOADED; + } + // "DirectDrawCreateEx" + DirectDrawCreateExFunc const directDrawCreateEx + = (DirectDrawCreateExFunc)GetProcAddress(ddrawModule, s_DirectDrawCreateEx_005a61c4); + if (directDrawCreateEx == NULL) { + FreeLibrary(ddrawModule); + return Rendering::Enums::DD7_NOT_LOADED; + } + if (directDrawCreateEx(NULL, (void**)&directDraw, IID_IDirectDraw7::instance, NULL) < 0) { + FreeLibrary(ddrawModule); + return Rendering::Enums::DD7_NOT_LOADED; + } + directDraw->Release(); + FreeLibrary(ddrawModule); + return Rendering::Enums::DD7_LOADED; +} + +} diff --git a/src/OpenSHC/Global/TestOSVersion.cpp b/src/OpenSHC/Global/TestOSVersion.cpp new file mode 100644 index 0000000000..c05619ca6d --- /dev/null +++ b/src/OpenSHC/Global/TestOSVersion.cpp @@ -0,0 +1,25 @@ +#include "OpenSHC/Global.func.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x0046F570 +byte Global::TestOSVersion() +{ + byte isSupported = 0; + OSVERSIONINFOEXA versionInfo; + memset(&versionInfo, 0, sizeof(versionInfo)); + versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); + GetVersionExA((OSVERSIONINFOA*)&versionInfo); + if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && versionInfo.dwMajorVersion > 4) { + if (versionInfo.dwMajorVersion == 6) { + if (versionInfo.dwMinorVersion >= 2) { + isSupported = 1; + } + } else if (versionInfo.dwMajorVersion > 6) { + isSupported = 1; + } + } + return isSupported; +} + +} diff --git a/src/OpenSHC/Map/Entities/EntityState/computeVelocity.cpp b/src/OpenSHC/Map/Entities/EntityState/computeVelocity.cpp new file mode 100644 index 0000000000..2e4d4a3393 --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/computeVelocity.cpp @@ -0,0 +1,21 @@ +#include "../EntityState.func.hpp" + +#include "math.h" + +namespace OpenSHC { +namespace Map { + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x00402DA0 + int EntityState::computeVelocity(int param_2, double angleDegrees, int distance, int heightDifference) + { + double const angle = angleDegrees * 3.1415926535 / 180.0; + double const range = distance * 2; + double const cosAngle = cos(angle); + double const scaledGravity = 9.812 * range * range / (cosAngle * cosAngle); + return (int)sqrt(scaledGravity / (tan(angle) * range - heightDifference / 4)); + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp b/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp new file mode 100644 index 0000000000..ad50518eef --- /dev/null +++ b/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp @@ -0,0 +1,85 @@ +#include "../EntityState.func.hpp" + +#include "OpenSHC/IO/LowLevelMemory.func.hpp" +#include "OpenSHC/Random/RNG.func.hpp" + +#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" +#include "OpenSHC/Globals/SEC_RNG.hpp" + +#include "math.h" + +namespace OpenSHC { +namespace Map { + namespace Entities { + + // FUNCTION: STRONGHOLDCRUSADER 0x00406650 + int EntityState::createSeagull(int x, int y) + { + int seagullID = 1; + for (; seagullID < 100; ++seagullID) { + if (this->seagullArray[seagullID].field_0x8 == 0) { + break; + } + if (this->seagullArray[seagullID].entityUID + != this->entityArray[this->seagullArray[seagullID].entityID].uid) { + MACRO_CALL_MEMBER(IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( + sizeof(this->seagullArray[seagullID]), 0, &this->seagullArray[seagullID]); + } + if (seagullID >= 99) { + return 0; + } + } + this->seagullArray[seagullID].field_0x8 = 2; + this->seagullArray[seagullID].field_0xa = 0; + this->seagullArray[seagullID].someCountDown = 0; + this->seagullArray[seagullID].x = x; + this->seagullArray[seagullID].x_2 = x; + this->seagullArray[seagullID].y = y; + this->seagullArray[seagullID].y_2 = y; + this->seagullArray[seagullID].angle = SEC_RNG::instance.currentNumber2 % 360; + this->seagullArray[seagullID].angle_2 = (char)(SEC_RNG::instance.currentNumber2 >> 8) % 360; + MACRO_CALL_MEMBER(Random::RNG_Func::nextRandomNumber2, SEC_RNG::ptr)(); + this->seagullArray[seagullID].unknownCounter_0x16 = SEC_RNG::instance.currentNumber2 % 16 + 24; + this->seagullArray[seagullID].numberBetween60And100 + = (char)(SEC_RNG::instance.currentNumber2 >> 8) % 40 + 60; + MACRO_CALL_MEMBER(Random::RNG_Func::nextRandomNumber2, SEC_RNG::ptr)(); + if (SEC_RNG::instance.currentNumber2 & 1) { + this->seagullArray[seagullID].someAngle = 1; + } else { + this->seagullArray[seagullID].someAngle = -1; + } + if (SEC_RNG::instance.currentNumber2 & 2) { + this->seagullArray[seagullID].angleStep = 1; + } else { + this->seagullArray[seagullID].angleStep = -1; + } + double const angle = (this->seagullArray[seagullID].angle - 180) * 3.1415926535 / 180.0; + this->seagullArray[seagullID].angle += this->seagullArray[seagullID].someAngle * 20; + // fixme: the original adds 360 when the angle is too big and subtracts it when it is negative + if (this->seagullArray[seagullID].angle >= 360) { + this->seagullArray[seagullID].angle += 360; + } + if (this->seagullArray[seagullID].angle < 0) { + this->seagullArray[seagullID].angle -= 360; + } + this->seagullArray[seagullID].field_0x1a = -20; + int const offsetX = (int)(sin(angle) * this->seagullArray[seagullID].unknownCounter_0x16); + int const offsetY = (int)(cos(angle) * this->seagullArray[seagullID].unknownCounter_0x16); + this->seagullArray[seagullID].rngMax799_countdown = 400; + this->seagullArray[seagullID].x_3 = x; + this->seagullArray[seagullID].y_3 = y; + MACRO_CALL_MEMBER(EntityState_Func::initializeSeagullMovementVector, this)(seagullID, + this->seagullArray[seagullID].x, this->seagullArray[seagullID].y, this->seagullArray[seagullID].x_3, + this->seagullArray[seagullID].y_3); + this->seagullArray[seagullID].pathStepDelay = 5; + this->seagullArray[seagullID].entityID = MACRO_CALL_MEMBER(EntityState_Func::spawnProjectileEntity, this)( + seagullID, 0, 0, x, y, 250, x + offsetX, y + offsetY, 250, ET_SEAGULLUnk, 0); + this->seagullArray[seagullID].entityUID = this->entityArray[this->seagullArray[seagullID].entityID].uid; + this->seagullArray[seagullID].randomNumber = SEC_RNG::instance.currentNumber2; + MACRO_CALL_MEMBER(Random::RNG_Func::nextRandomNumber2, SEC_RNG::ptr)(); + return seagullID; + } + + } +} +} diff --git a/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp b/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp new file mode 100644 index 0000000000..aed3e13b08 --- /dev/null +++ b/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp @@ -0,0 +1,78 @@ +#include "../Entities.func.hpp" + +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/Entities/EntityState.func.hpp" +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/Random/RNG.func.hpp" +#include "OpenSHC/Map/LogicHelpers/Logic1.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_EntityDefinedData.hpp" +#include "OpenSHC/Globals/DAT_EntityState.hpp" +#include "OpenSHC/Globals/DAT_LandscapeState.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" +#include "OpenSHC/Globals/SEC_RNG.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x00405130 + uint Entities::SomeFireSpreadFunction(int playerID, int x, int y, int height, int fireStrength) + { + int const random = SEC_RNG::instance.currentNumber2; + MACRO_CALL_MEMBER(Random::RNG_Func::nextRandomNumber2, SEC_RNG::ptr)(); + x += DAT_EntityDefinedData::instance.XYOffsetsInAllDirections[random & 0x3f][0]; + y += DAT_EntityDefinedData::instance.XYOffsetsInAllDirections[random & 0x3f][1]; + uint const tileX = x / 8; + uint const tileY = y / 8; + bool const onMap = tileX <= 399 && tileY <= 399 + && DAT_ViewportRenderState::instance.DAT_BinaryTileMap400x400[tileY * 400 + tileX] != 0; + if (!onMap) { + return 0; + } + int const tile = DAT_ViewportRenderState::instance.translationMatrix[tileY].addXgetTile + tileX; + int const logic = DAT_TileMapState::instance.LogicLayer[tile]; + if (logic + & (LogicHelpers::L_SEA | LogicHelpers::L_BORDER | LogicHelpers::L_BORDER_EDGE + | LogicHelpers::L_WALL_OR_GATEHOUSE | LogicHelpers::L_RIVER | LogicHelpers::L_FORD + | LogicHelpers::L_KEEP_NON_MANOR_HOUSE)) { + return 0; + } + short const buildingID = DAT_TileMapState::instance.BuildingLayer[tile]; + if (buildingID != 0) { + int const buildingType = DAT_BuildingsState::instance.buildings[buildingID].buildingType; + if (buildingType != Buildings::BT_TUNNEL && buildingType != Buildings::BT_KILLINGPIT + && buildingType != Buildings::BT_UNKNOWN4) { + MACRO_CALL_MEMBER(Buildings::BuildingsState_Func::lightUpBuilding, DAT_BuildingsState::ptr)( + buildingID, playerID, 0); + return 0; + } + } + int const fireID + = MACRO_CALL_MEMBER(Entities::EntityState_Func::getFireEntityIDAtTile, DAT_EntityState::ptr)(tile); + if (fireID != 0) { + DAT_EntityState::instance.entityArray[fireID].someTracker = 0; + if (fireStrength > DAT_EntityState::instance.entityArray[fireID].fireParameter_0xb6) { + DAT_EntityState::instance.entityArray[fireID].fireParameter_0xb6 = fireStrength; + } + DAT_EntityState::instance.entityArray[fireID].unknownAnimationFrameRelated = 0; + return 0; + } + if (logic & LogicHelpers::L_TREE) { + MACRO_CALL_MEMBER(LandscapeState_Func::lightUpTree, DAT_LandscapeState::ptr)(tile, playerID); + } + uint const newFireID = MACRO_CALL_MEMBER(Entities::EntityState_Func::spawnProjectileEntity, + DAT_EntityState::ptr)(0, playerID, 0, x, y, height, 0, 0, 0, Entities::ET_FIRE, 0); + if (fireStrength >= 3 && (DAT_TileMapState::instance.RandomLayer[tile] & 3) == 0) { + MACRO_CALL_MEMBER(Entities::EntityState_Func::spawnProjectileEntity, DAT_EntityState::ptr)( + 0, playerID, 0, x, y, height, 0, 0, 0, Entities::EntityTypeInt__ET_EXPLOSION, 0); + } + if (newFireID != 0) { + DAT_EntityState::instance.entityArray[newFireID].fireParameter_0xb6 = fireStrength; + } + return newFireID; + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp b/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp new file mode 100644 index 0000000000..58c85d9f1e --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp @@ -0,0 +1,50 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004BE590 + void MapPropertiesState::setStartingYearAndStartingResources() + { + DAT_MapPropertiesState::instance.SEC_StartingYear = 1181; + DAT_GameState::instance.mapAndTime.year = 1181; + for (int i = 0; i < 25; ++i) { + DAT_MapPropertiesState::instance.SEC_StartingResources[i] = 0; + } + for (int i = 0; i < 25; ++i) { + DAT_MapPropertiesState::instance.SEC_Section1065.tradeabilityArray[i] = 1; + } + DAT_MapPropertiesState::instance.SEC_StartingMonth = 0; + DAT_GameState::instance.mapAndTime.month = 0; + DAT_MapPropertiesState::instance.eventsCount = 0; + // the siege information is a block of 20 unit counts + for (int i = 0; i < 20; ++i) { + DAT_MapPropertiesState::instance.SEC_SiegeInformation[i] = 0; + } + for (int i = 0; i < 6; ++i) { + DAT_MapPropertiesState::instance.SEC_Section1067.siegeEngineCounts[i] = 0; + } + DAT_MapPropertiesState::instance.SEC_StartingPopularity = 100; + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(10); + char yearText[12]; + // "%d" + MACRO_CALL(OS_Func::_sprintf)(yearText, s__d_005aa7f0, DAT_MapPropertiesState::instance.SEC_StartingYear); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(yearText); + DAT_MapPropertiesState::instance.eventListSelection = -1; + DAT_MapPropertiesState::instance.eventListScrollOffset = 0; + for (int i = 0; i < 100; ++i) { + this->buildingAvailability[i] = 1; + } + MACRO_CALL_MEMBER(MapPropertiesState_Func::commitBuildingAvailability, this)(); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(9); + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp b/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp new file mode 100644 index 0000000000..d57515beb9 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp @@ -0,0 +1,48 @@ +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004BEB20 + void MapPropertiesState::updateEventYearsAndCommitBuildingAvailability() + { + if (DAT_MapPropertiesState::instance.SEC_StartingYear < 1000) { + DAT_MapPropertiesState::instance.SEC_StartingYear = 1181; + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(10); + char yearText[12]; + // "%d" + MACRO_CALL(OS_Func::_sprintf)(yearText, s__d_005aa7f0, this->SEC_StartingYear); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(yearText); + DAT_MapPropertiesState::instance.eventListSelection = -1; + DAT_MapPropertiesState::instance.eventListScrollOffset = 0; + this->year_copy = this->SEC_StartingYear; + for (int i = 0; i < this->eventsCount; ++i) { + if (DAT_GameState::instance.mapAndTime.year < this->scenarioEvents[i].header.year) { + continue; + } + if (DAT_GameState::instance.mapAndTime.year == this->scenarioEvents[i].header.year + && DAT_GameState::instance.mapAndTime.month >= this->scenarioEvents[i].header.month) { + continue; + } + if (this->scenarioEvents[i].header.tl_type == 1 + && this->scenarioEvents[i].data.invasion.repeatMonths != 0) { + if (this->scenarioEvents[i].data.invasion.messageYear != 0) { + this->scenarioEvents[i].header.year = this->scenarioEvents[i].data.invasion.messageYear; + } else { + this->scenarioEvents[i].data.invasion.messageYear = this->scenarioEvents[i].header.year; + } + } + } + MACRO_CALL_MEMBER(MapPropertiesState_Func::commitBuildingAvailability, this)(); + } + +} +} diff --git a/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp b/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp new file mode 100644 index 0000000000..b74f9b97f8 --- /dev/null +++ b/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp @@ -0,0 +1,520 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/DisplayElements.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.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_MouseState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x004C2280 + void MapPropertiesState::updateMilitaryCampaignMissionState() + { + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .playerDeathRelated + != 0) { + if (DAT_BinkControlState::instance.binkObjPtrArray[1] == 0 + && DAT_VideoBikQueue::instance.storedMessages_0x924 == 0) { + DAT_GameState::instance.mapAndTime.unknownCountdown01 -= 1; + } + if (DAT_GameState::instance.mapAndTime.unknownCountdown01 == 0) { + DAT_VideoBikQueue::instance.storedMessages_0x924 = 0; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition2::ptr)( + UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition3::ptr)( + UI::Enums::MMT_NONE, FALSE); + DAT_MenuTextInputState::instance.DAT_SomeTextArrayIndex = 9; + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + if (DAT_GameCore::instance.gameMode_2 == 0) { + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .playerDeathRelated + == 1) { + MACRO_CALL_MEMBER(Game::GameCore_Func::incrementMissionProgress, DAT_GameCore::ptr)(); + DAT_GameCore::instance.section1066 = 2; + } + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .playerDeathRelated + == 2) { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_GAME_LOSTUnk, 0); + DAT_GameCore::instance.section1066 = 0; + } + MACRO_CALL(UI::DisplayElements_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)( + UI::Enums::DEID_MISSION_WIN_DEFEAT_BANNER, 0); + } + MACRO_CALL(UI::DisplayElements_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)( + UI::Enums::DEID_MISSION_WIN_DEFEAT_BANNER, 0); + } + return; + } + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .lordKilledByPlayerID + != 0) { + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .playerDeathRelated = 2; + MACRO_CALL_MEMBER(Map::Units::UnitsState_Func::setAIControlStatusTo100000, DAT_UnitsState::ptr)(); + DAT_GameState::instance.mapAndTime.unknownCountdown01 = 240; + if (DAT_GameCore::instance.gameMode_2 == 2 && DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == 0) { + DAT_GameState::instance.mapAndTime.unknownCountdown01 = 640; + } + MACRO_CALL(UI::DisplayElements_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)( + UI::Enums::DEID_MISSION_WIN_DEFEAT_BANNER, 2); + if (DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab == UI::Enums::BMTT_SOLDIERS + || DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab == 62) { + DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab + = DAT_GameCore::instance.tabTypeSiegeSubset; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_BUILD_MENU, 0); + } + DAT_TileMapState::instance.currentMapperCommand = Commands::M_MAPPER_NULL; + if (DAT_UnitsState::instance.totalUnitsInSelection > 0) { + MACRO_CALL_MEMBER(Map::Units::UnitsState_Func::deselectAllUnitsOneByOne, DAT_UnitsState::ptr)(); + MACRO_CALL_MEMBER(Map::Units::UnitsState_Func::queueEscapeCommand, DAT_UnitsState::ptr)(); + MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseCursorState, DAT_MouseState::ptr)(); + } + return; + } + if (DAT_GameCore::instance.missionNumber1to20 == 16) { + if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 0) { + int hits = 0; + for (int i = 1; i < 9; ++i) { + hits += DAT_GameState::instance.mapAndTime.emenyHitArray[i]; + } + if (hits >= 8) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 1; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 1), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit21_wav_005aaa58); + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 3; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 1) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 2; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 2), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit22_wav_005aaa48); + MACRO_CALL_MEMBER(MapPropertiesState_Func::spawnAttackWaveForPlayer, this)(2, 24, 5, 75, 10, 3); + DAT_GameState::instance.playerDataArray[2].currentWaveRandomAttackingStrength = 0; + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 2) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 3), + (char*)s_bad_arab_taunt_bik_005a7d2c, (char*)s_Ap_Milit23_wav_005aaa38); + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 4) { + if ((DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) + || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + goto missionWon; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 3) { + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 4; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 4), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit24_wav_005aaa28); + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + } + } else if (DAT_GameCore::instance.missionNumber1to20 == 17) { + if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 0) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 1; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 5), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit25_wav_005aaa00); + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 2; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 1) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 2; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 6), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit26_wav_005aa9f0); + MACRO_CALL_MEMBER(MapPropertiesState_Func::spawnAttackWaveForPlayer, this)(2, 72, 50, 71, 20, 3); + DAT_GameState::instance.playerDataArray[2].currentWaveRandomAttackingStrength = 0; + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 2) { + if (DAT_GameState::instance.playerDataArray[2].aiPlayerState == 4) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 7), + (char*)s_bad_soldier_taunt_bik_005a7824, (char*)s_Ap_Milit27_wav_005aa9e0); + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 3) { + if (DAT_GameState::instance.playerDataArray[2].aiPlayerState == 8 + || DAT_GameState::instance.playerDataArray[2].aiPlayerState == 9) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 4; + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 2; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 4) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 8), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit28_wav_005aa9d0); + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 6) { + if ((DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) + || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 7; + goto missionWon; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 5) { + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 6; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 9), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit29_wav_005aa9c0); + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + } + } else if (DAT_GameCore::instance.missionNumber1to20 == 18) { + if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 0) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.playerDataArray[2].currentWaveRandomAttackingStrength = 0; + DAT_GameState::instance.playerDataArray[3].currentWaveRandomAttackingStrength = 0; + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 1; + DAT_GameState::instance.playerDataArray[2].aiAttackCoordinationLevel = 1; + DAT_GameState::instance.playerDataArray[3].aiAttackCoordinationLevel = 1; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 1) { + if (DAT_GameState::instance.playerDataArray[2].aiPlayerState >= 2 + && DAT_GameState::instance.playerDataArray[3].aiPlayerState >= 2) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 2; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 10), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit30_wav_005aa9b0); + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + && DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 2) { + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + || DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 12), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit32_wav_005aa9a0); + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 3) { + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + && DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 4; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 13), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit33_wav_005aa990); + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 4) { + if ((DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) + || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + goto missionWon; + } + } + } else if (DAT_GameCore::instance.missionNumber1to20 == 19) { + if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 0) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 1; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 14), + (char*)s_bad_soldier_taunt_bik_005a7824, (char*)s_Ap_Milit34_wav_005aa980); + MACRO_CALL_MEMBER(MapPropertiesState_Func::spawnAttackWaveForPlayer, this)(2, 70, 8, 72, 22, 2); + DAT_GameState::instance.playerDataArray[2].currentWaveRandomAttackingStrength = 0; + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + && DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 1) { + if (DAT_GameState::instance.playerDataArray[2].aiPlayerState >= 2) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 2; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 15), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit35_wav_005aa970); + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + && DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 2) { + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 3; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 16), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit36_wav_005aa960); + DAT_GameState::instance.mapAndTime.emenyHitArray[3] = 0; + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + && DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 3) { + if (DAT_GameState::instance.mapAndTime.emenyHitArray[3] >= 15) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 4; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 17), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit37_wav_005aa950); + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 18), + (char*)s_bad_soldier_taunt_bik_005a7824, (char*)s_Ap_Milit38_wav_005aa940); + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0 + && DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 4) { + if (DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 5) { + if ((DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) + || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 6; + goto missionWon; + } + } + } else if (DAT_GameCore::instance.missionNumber1to20 == 20) { + BOOLEnum enemy3Down = FALSE; + BOOLEnum enemy2Down = FALSE; + BOOLEnum enemy4Down = FALSE; + if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 0) { + if (DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage = 1; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 19), + (char*)s_good_soldier_nervous_bik_005aa81c, (char*)s_Ap_Milit39_wav_005aa930); + } + } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 1) { + if (DAT_GameState::instance.playerDataArray[3].lordKilledByPlayerID != 0) { + enemy3Down = TRUE; + if ((1 & DAT_GameState::instance.mapAndTime.militaryCampaignFlags) == 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignFlags |= 1; + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } else if ((DAT_GameState::instance.mapAndTime.militaryCampaignFlags & 16) == 0 + && DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + MACRO_CALL_MEMBER( + Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 20), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit40_wav_005aa920); + DAT_GameState::instance.mapAndTime.militaryCampaignFlags |= 16; + } + } + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { + enemy2Down = TRUE; + if ((2 & DAT_GameState::instance.mapAndTime.militaryCampaignFlags) == 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignFlags |= 2; + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } else if ((DAT_GameState::instance.mapAndTime.militaryCampaignFlags & 32) == 0 + && DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + if (DAT_GameState::instance.playerDataArray[4].lordKilledByPlayerID == 0) { + MACRO_CALL_MEMBER( + Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 21), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit41_wav_005aa910); + } + DAT_GameState::instance.mapAndTime.militaryCampaignFlags |= 32; + } + } + if (DAT_GameState::instance.playerDataArray[4].lordKilledByPlayerID != 0) { + enemy4Down = TRUE; + if ((4 & DAT_GameState::instance.mapAndTime.militaryCampaignFlags) == 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignFlags |= 4; + DAT_GameState::instance.mapAndTime.yearCopy = DAT_GameState::instance.mapAndTime.year; + DAT_GameState::instance.mapAndTime.monthCopy = DAT_GameState::instance.mapAndTime.month + 1; + if (DAT_GameState::instance.mapAndTime.month >= 12) { + DAT_GameState::instance.mapAndTime.month -= 12; + DAT_GameState::instance.mapAndTime.year += 1; + } + } else if ((DAT_GameState::instance.mapAndTime.militaryCampaignFlags & 64) == 0 + && DAT_GameState::instance.mapAndTime.month == DAT_GameState::instance.mapAndTime.monthCopy + && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) { + if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID == 0) { + MACRO_CALL_MEMBER( + Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 21), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit41_wav_005aa910); + } + DAT_GameState::instance.mapAndTime.militaryCampaignFlags |= 64; + } + } + if (DAT_GameState::instance.playerDataArray[5].aiPlayerState >= 2 + && DAT_GameState::instance.mapAndTime.field3183_0x27dc == 0) { + DAT_GameState::instance.mapAndTime.field3183_0x27dc = 1; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 22), + (char*)s_good_soldier_taunt_bik_005aaa10, (char*)s_Ap_Milit42_wav_005aa900); + } + if (enemy3Down && enemy2Down && enemy4Down + && DAT_GameState::instance.playerDataArray[5].lordKilledByPlayerID != 0) { + DAT_GameState::instance.mapAndTime.militaryCampaignStage += 1; + MACRO_CALL_MEMBER(Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 23), + (char*)s__005a5339, (char*)s__005a5339); + goto missionWon; + } + } + } + return; + + missionWon: + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID].playerDeathRelated + = 1; + DAT_GameState::instance.mapAndTime.unknownCountdown01 = 240; + MACRO_CALL(UI::DisplayElements_Func::CheckDisplayElementByIDAndSetForUnlimitedDisplay)( + UI::Enums::DEID_MISSION_WIN_DEFEAT_BANNER, 1); + if (DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab == UI::Enums::BMTT_SOLDIERS + || DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab == 62) { + DAT_GameCore::instance.buildmenuMenuTabToSwitchTo.buildMenuTab = DAT_GameCore::instance.tabTypeSiegeSubset; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(UI::Enums::MVT_BUILD_MENU, 0); + } + DAT_TileMapState::instance.currentMapperCommand = Commands::M_MAPPER_NULL; + if (DAT_UnitsState::instance.totalUnitsInSelection > 0) { + MACRO_CALL_MEMBER(Map::Units::UnitsState_Func::deselectAllUnitsOneByOne, DAT_UnitsState::ptr)(); + MACRO_CALL_MEMBER(Map::Units::UnitsState_Func::queueEscapeCommand, DAT_UnitsState::ptr)(); + MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseCursorState, DAT_MouseState::ptr)(); + } + } + +} +} diff --git a/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp b/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp new file mode 100644 index 0000000000..e678f28995 --- /dev/null +++ b/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp @@ -0,0 +1,77 @@ +#include "../Synchrony.func.hpp" + +#include "OpenSHC/AI/AIVState.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" + +#include "OpenSHC/Globals/DAT_00b960dc.hpp" +#include "OpenSHC/Globals/DAT_00b960f8.hpp" +#include "OpenSHC/Globals/DAT_AIVState.hpp" +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DWORD_00b95b1c.hpp" +#include "OpenSHC/Globals/INT_00b95950.hpp" +#include "OpenSHC/Globals/INT_00b95958.hpp" +#include "OpenSHC/Globals/INT_00b95960.hpp" +#include "OpenSHC/Globals/INT_00b95ab8.hpp" +#include "OpenSHC/Globals/INT_00b960b0.hpp" + +namespace OpenSHC { + +// FUNCTION: STRONGHOLDCRUSADER 0x004274F0 +void Synchrony::InitSkirmishLobbyData() +{ + MACRO_CALL_MEMBER(AI::AIVState_Func::hostChecksLobbyAIVAvailability, DAT_AIVState::ptr)(); + DAT_GameSynchronyState::instance.skirmishRelated1 = -1; + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = -1; + DAT_GameSynchronyState::instance.reparseMaps = TRUE; + DAT_GameSynchronyState::instance.mapExistenceAckCountdown = 0; + DAT_GameCore::instance.mapU4Int0 = 0; + MACRO_CALL_MEMBER(Map::TileMapState_Func::setupAllMapSections, DAT_TileMapState::ptr)(); + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::resetTeams, DAT_GameState::ptr)(); + DAT_GameSynchronyState::instance.mapName[0] = '\0'; + DAT_GameCore::instance.mapDescription[0] = '\0'; + DAT_GameCore::instance.mapDescUseStringTableIndex = 0; + memset(DAT_MinimapViewState::instance.loadedMiniMap, 0, sizeof(DAT_MinimapViewState::instance.loadedMiniMap)); + DAT_ButtonBackgroundBlendStrength::instance = 32; + DAT_00b960dc::instance = -3; + DWORD_00b95b1c::instance = timeGetTime(); + memset(DAT_GameSynchronyState::instance.playerPositionsArray, -10, + sizeof(DAT_GameSynchronyState::instance.playerPositionsArray)); + INT_00b95960::instance = -1; + INT_00b95950::instance = -1; + INT_00b960b0::instance = -1; + DAT_GameCore::instance.gameMode_2 = Game::GM_SKIRMISH_AND_MULTIPLAYER; + DAT_GameSynchronyState::instance.lobbyMapSortOrder = 6; + INT_00b95ab8::instance = 0; + for (int i = 0; i < 20; ++i) { + DAT_GameSynchronyState::instance.skirmishIntensityRelatedArray[i] + = DAT_RenderingDefinedData::instance + .SkirmishIntensityRelatedArray[0][DAT_GameSynchronyState::instance.skirmishTechLevel][i]; + } + for (int i = 0; i < 10; ++i) { + DAT_GameSynchronyState::instance.skirmishBalanceRelatedArrayUnk1[i] + = DAT_RenderingDefinedData::instance + .SkirmishIntensityRelatedArray2[DAT_GameSynchronyState::instance.skirmishTechLevel][i]; + } + DAT_GameSynchronyState::instance.skirmishStartGold + = DAT_RenderingDefinedData::instance.StartGold[DAT_GameSynchronyState::instance.skirmishTechLevel / 2]; + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + if (DAT_GameSynchronyState::instance.isHost) { + memset(DAT_GameSynchronyState::instance.DAT_PlayerGroupArray, -1, + sizeof(DAT_GameSynchronyState::instance.DAT_PlayerGroupArray)); + MACRO_CALL_MEMBER(GameSynchronyState_Func::reorderTeamsAndPositions, DAT_GameSynchronyState::ptr)(); + } + INT_00b95958::instance = 0; + DAT_00b960f8::instance = 0; +} + +} diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp new file mode 100644 index 0000000000..7e669fac40 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp @@ -0,0 +1,117 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Synchrony.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/MenuItems/FindingNetworkSessions.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/DirectPlay/EnumSessionsFlagsEnum.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DPLAY_CurrentSessionGUID.hpp" +#include "OpenSHC/Globals/GUID_APP.hpp" +#include "OpenSHC/Globals/Menu_LobbyMenu.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + namespace FindingNetworkSessions { + + // FUNCTION: STRONGHOLDCRUSADER 0x00490D90 + void __cdecl MenuItemActionHandler_FindingNetworkSessions_Buttons( + FindingNetworkSessions_ButtonParameters param_1, ...) + { + switch ((int)param_1) { + case -2: + if (DAT_GameSynchronyState::instance.scrollBarItemOffset + < DAT_GameSynchronyState::instance.DPLAY_SessionsCount - 10) { + DAT_GameSynchronyState::instance.scrollBarItemOffset += 1; + } + break; + case -1: + if (DAT_GameSynchronyState::instance.scrollBarItemOffset > 0) { + DAT_GameSynchronyState::instance.scrollBarItemOffset -= 1; + } + break; + case -10000: + case 3: { + DPSESSIONDESC2 description; + MACRO_CALL(OpenSHC::OS_Func::_memset)(&description, 0, sizeof(description)); + description.dwSize = sizeof(description); + description.guidApplication = GUID_APP::instance; + if (DAT_GameSynchronyState::instance.DPLAYX_4A != NULL) { + DAT_GameSynchronyState::instance.DPLAYX_4A->EnumSessions(&description, 0, + MACRO_CALL(OpenSHC::Synchrony_Func::EnumSessionsCallback_addSession_async), NULL, + OpenSHC::DirectPlay::ESFE_ASYNC_ENUMERATION_STOP); + } + MACRO_CALL_MEMBER( + OpenSHC::Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::initializeMultiplayerLobby, + DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_CHOOSE_NETWORK_SERVICE_PROVIDER, FALSE); + break; + } + case OpenSHC::UI::Multiplayer::FNSBP_JOIN: + if (DAT_GameSynchronyState::instance.scrollBarIndex == -1) { + break; + } + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::fetchSessionGUID, + DAT_GameSynchronyState::ptr)(&DPLAY_CurrentSessionGUID::instance); + if (MACRO_CALL_MEMBER( + OpenSHC::Synchrony::GameSynchronyState_Func::initializeDirectPlayAndCreateOrJoinSession, + DAT_GameSynchronyState::ptr)(TRUE) + >= 0) { + DPSESSIONDESC2 description; + MACRO_CALL(OpenSHC::OS_Func::_memset)(&description, 0, sizeof(description)); + description.dwSize = sizeof(description); + description.guidApplication = GUID_APP::instance; + DAT_GameSynchronyState::instance.DPLAYX_4A->EnumSessions(&description, 0, + MACRO_CALL(OpenSHC::Synchrony_Func::EnumSessionsCallback_addSession_async), NULL, + OpenSHC::DirectPlay::ESFE_ASYNC_ENUMERATION_STOP); + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + DAT_GameSynchronyState::instance.field_0x106ee4 = 1; + DAT_GameCore::instance.menuTabToSwitchTo.tabType = 0; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_LOBBY_MENU, 0); + MACRO_CALL(OpenSHC::Synchrony_Func::InitSkirmishLobbyData)(); + Menu_LobbyMenu::instance.thousand = 0; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::waitForMultiplayerHost, + DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ASK_FOR_SLOT_ASSIGNMENT); + MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + } else { + DPSESSIONDESC2 description; + MACRO_CALL(OpenSHC::OS_Func::_memset)(&description, 0, sizeof(description)); + description.dwSize = sizeof(description); + description.guidApplication = GUID_APP::instance; + if (DAT_GameSynchronyState::instance.DPLAYX_4A != NULL) { + DAT_GameSynchronyState::instance.DPLAYX_4A->EnumSessions(&description, 0, + MACRO_CALL(OpenSHC::Synchrony_Func::EnumSessionsCallback_addSession_async), NULL, + OpenSHC::DirectPlay::ESFE_ASYNC_ENUMERATION_STOP); + } + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::disconnectDPlay, + DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::initializeMultiplayerLobby, + DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)( + OpenSHC::UI::Enums::MMT_CHOOSE_NETWORK_SERVICE_PROVIDER, FALSE); + MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + } + break; + } + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp new file mode 100644 index 0000000000..383f268ffb --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp @@ -0,0 +1,435 @@ +#pragma warning(disable : 4996) + +#include "../General.func.hpp" + +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/Synchrony/Commands.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" + +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" +#include "OpenSHC/Globals/INT_00b960cc.hpp" + +#include + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00429a40 + void __cdecl General::MenuItemActionHandler_General_AdvancedGameOptions(int param_1, ...) + { + if (DAT_GameSynchronyState::instance.isHost == 0) { + return; + } + int activeDialog = DAT_MenuModalComposition1::instance.activeModalDialogID; + if (activeDialog == 42 || activeDialog == 43) { + return; + } + if (activeDialog == 37 && param_1 != -1000 && param_1 != -10 && param_1 != -11 && param_1 != -12 + && param_1 != -13 && param_1 != -14 && param_1 != 99 && param_1 != 100 && param_1 != 83 + && param_1 != 109 && param_1 != 82 && param_1 != 94) { + return; + } + if (DAT_GameSynchronyState::instance.currentGameMode == 99 && (param_1 == 93 || param_1 == 31)) { + return; + } + if (activeDialog == 120 || activeDialog == 118 || activeDialog == 119) { + return; + } + if (param_1 == 14) { + if (DAT_MenuModalComposition2::instance.activeModalDialogID == -1 || INT_00b960cc::instance != 1) { + INT_00b960cc::instance = 1; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, + DAT_MenuModalComposition2::ptr)(0, 10000, DAT_GameSynchronyState::instance.skirmishStartGold, + (undefined*)&DAT_GameSynchronyState::instance.skirmishStartGold, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL( + Synchrony::Commands_Func::QueueChangeGameIntensityOrBalance)); + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + (UI::Enums::MenuModalType)23, DAT_ButtonX::instance + 72, DAT_ButtonY::instance + 4); + } + } else if (param_1 == 15) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, DAT_MenuModalComposition2::ptr)(0, + 100, DAT_GameSynchronyState::instance.skirmishDefaultPopularity, + (undefined*)&DAT_GameSynchronyState::instance.skirmishDefaultPopularity, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL( + Synchrony::Commands_Func::QueueChangeGameIntensityOrBalance)); + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + (UI::Enums::MenuModalType)23, DAT_ButtonX::instance + 23, DAT_ButtonY::instance + 35); + } else if (param_1 == 82) { + if (DAT_MenuModalComposition2::instance.activeModalDialogID == -1 || INT_00b960cc::instance != 2) { + INT_00b960cc::instance = 2; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, + DAT_MenuModalComposition2::ptr)(20, 90, DAT_GameSynchronyState::instance.skirmishGameSpeedLevel, + (undefined*)&DAT_GameSynchronyState::instance.skirmishGameSpeedLevel, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL( + UI::Helpers_Func::CallbackSetMultiplayerSpeedLevel)); + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + (UI::Enums::MenuModalType)23, DAT_ButtonX::instance + 72, DAT_ButtonY::instance + 4); + } + } else if (param_1 == 31) { + DAT_GameSynchronyState::instance.skirmishTechLevel += 2; + if (DAT_GameSynchronyState::instance.skirmishTechLevel > 5) { + DAT_GameSynchronyState::instance.skirmishTechLevel = 0; + } + MACRO_CALL(Game::Skirmish_Func::SetupSkirmishBalanceAndOrIntensity)(); + } else if (param_1 == 36) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setModalSliderParameters, + DAT_MenuModalComposition1::ptr)(79, 51, 2, DAT_GameSynchronyState::instance.skirmishWinCondition, + (int*)&DAT_GameSynchronyState::instance.skirmishWinCondition, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL( + Synchrony::Commands_Func::QueueChangeGameIntensityOrBalance)); + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition1::ptr)( + (UI::Enums::MenuModalType)24, DAT_ButtonX::instance + 5, DAT_ButtonY::instance + 35); + } else if (param_1 == 83) { + DAT_GameSynchronyState::instance.skirmishTroopsCostGold ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + } else if (param_1 == 109) { + DAT_GameState::instance.mapAndTime.skirmishFogOfWar += 1; + if (DAT_GameState::instance.mapAndTime.skirmishFogOfWar == 3) { + DAT_GameState::instance.mapAndTime.skirmishFogOfWar = 0; + } + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + } else if (param_1 == 93) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + (UI::Enums::MenuModalType)32, FALSE); + } else if (param_1 == 103) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + (UI::Enums::MenuModalType)37, FALSE); + } else if (param_1 == 94) { + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 0) { + DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes = 5; + } else if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 5) { + DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes = 10; + } else if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 10) { + DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes = 20; + } else if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 20) { + DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes = 0; + } + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 0) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + } + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 5) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 96)); + } + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 10) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 97)); + } + if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 20) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 98)); + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } else if (param_1 == 99) { + DAT_GameSynchronyState::instance.skirmishStrongWalls ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)79, 99), + DAT_GameSynchronyState::instance.skirmishStrongWalls != 0 + ? MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13) + : MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } else if (param_1 == 100) { + DAT_GameSynchronyState::instance.skirmishAlliances ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + } else if (param_1 == -1000) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + (UI::Enums::MenuModalType)-1, FALSE); + } else if (param_1 == -1) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, DAT_MenuModalComposition2::ptr)( + 2000, 150000, DAT_GameSynchronyState::instance.skirmishPoints, + (undefined*)&DAT_GameSynchronyState::instance.skirmishPoints, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL( + Synchrony::Commands_Func::QueueChangeGameIntensityOrBalance)); + DAT_MenuModalComposition2::instance.textGroup = 79; + DAT_MenuModalComposition2::instance.textIndex = 88; + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + (UI::Enums::MenuModalType)23, DAT_ButtonX::instance - 23, DAT_ButtonY::instance + 63); + } else if (param_1 == -10) { + DAT_GameSynchronyState::instance.skirmishNoCowThrowing ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)252, 5), + DAT_GameSynchronyState::instance.skirmishNoCowThrowing != 0 + ? MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13) + : MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } else if (param_1 == -11) { + DAT_GameSynchronyState::instance.skirmishNoDogs ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + if (DAT_GameSynchronyState::instance.skirmishNoDogs != 0) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 6), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13)); + } else { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 6), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } else if (param_1 == -13) { + DAT_GameSynchronyState::instance.skirmishExtremeMode ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + if (DAT_GameSynchronyState::instance.skirmishExtremeMode != 0) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 13), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13)); + } else { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 13), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } else if (param_1 == -14) { + DAT_GameSynchronyState::instance.skirmishExtremeMode2 ^= 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + if (DAT_GameSynchronyState::instance.skirmishExtremeMode != 0) { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 14), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13)); + } else { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 14), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } else if (param_1 == -12) { + DAT_GameSynchronyState::instance.skirmishNoRushSetting += 1; + if ((int)DAT_GameSynchronyState::instance.skirmishNoRushSetting >= 6) { + DAT_GameSynchronyState::instance.skirmishNoRushSetting = 0; + } + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)52); + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 0) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)79, 95, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, + (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 1) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)79, 96, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, + (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 2) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)79, 97, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, + (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 3) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)79, 98, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, + (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 4) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)252, 8, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, + (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + } + if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 5) { + MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( + (DE::SHCDE::eTextSections)252, 9, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, + (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + } + switch (DAT_GameSynchronyState::instance.skirmishNoRushSetting) { + case 0: { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + break; + } + case 1: { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 96)); + break; + } + case 2: { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 97)); + break; + } + case 3: { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 98)); + break; + } + case 4: { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 8)); + break; + } + case 5: { + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 9)); + break; + } + } + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( + DAT_GameSynchronyState::instance.receivedChatMessage); + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + DAT_GameSynchronyState::instance + .DAT_ChatMessageReceiverArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] = 0; + DAT_GameSynchronyState::instance.DAT_ChatTauntOrMessage = 10000; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + (Commands::GameCommandType)14); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( + DAT_UserTextHandlerState::instance.textArrayIndex); + } + for (int i = 0; i < 9; ++i) { + DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; + } + } + + } // namespace MenuItems +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp new file mode 100644 index 0000000000..7476611fd0 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp @@ -0,0 +1,119 @@ +#include "../NewInvasion.func.hpp" + +#include "OpenSHC/Global.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_MissionAestheticsDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004b9110 + void __cdecl NewInvasion::MenuItemActionHandler_NewInvasion_UnitButtons(int unitTypeMenuID, ...) + { + int textIndex = 0; + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::sumUnitCounts, DAT_MapPropertiesState::ptr)(); + int* countPtr + = &DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.invasion.unitCountsPerUnitType[unitTypeMenuID]; + // the slider maximum is a min() of the unit limit and the room left below 500 units: written as the + // expanded macro (both operands repeated), which gives the original's register choice + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, DAT_MenuModalComposition2::ptr)(0, + DAT_MissionAestheticsDefinedData::instance.InvasionUnitLimits[unitTypeMenuID] + < *countPtr - (int)DAT_MapPropertiesState::instance.DAT_InvasionEventItemUnitCountSum + 500 + ? DAT_MissionAestheticsDefinedData::instance.InvasionUnitLimits[unitTypeMenuID] + : *countPtr - (int)DAT_MapPropertiesState::instance.DAT_InvasionEventItemUnitCountSum + 500, + *countPtr, (undefined*)countPtr, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL(Global_Func::DoNothing)); + + switch (unitTypeMenuID) { + case 0: + textIndex = 91; + break; + case 1: + textIndex = 92; + break; + case 2: + textIndex = 93; + break; + case 3: + textIndex = 94; + break; + case 4: + textIndex = 95; + break; + case 5: + textIndex = 96; + break; + case 6: + textIndex = 97; + break; + case 7: + textIndex = 98; + break; + case 8: + textIndex = 99; + break; + case 9: + textIndex = 157; + break; + case 10: + textIndex = 158; + break; + case 11: + textIndex = 159; + break; + case 12: + textIndex = 160; + break; + case 13: + textIndex = 161; + break; + case 14: + textIndex = 162; + break; + case 15: + textIndex = 170; + break; + case 16: + textIndex = 213; + break; + case 17: + textIndex = 214; + break; + case 18: + textIndex = 215; + break; + case 19: + textIndex = 216; + break; + case 20: + textIndex = 217; + break; + case 21: + textIndex = 218; + break; + case 22: + textIndex = 219; + break; + case 23: + textIndex = 220; + break; + } + + DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textIndex = textIndex; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 62, DAT_ButtonY::instance + 25); + } + + } // namespace MenuItems +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp b/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp new file mode 100644 index 0000000000..34e493190a --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp @@ -0,0 +1,110 @@ +#include "../SiegeAttackingForceAndStartGoods.func.hpp" + +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_MissionAestheticsDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004ba5c0 + void __cdecl SiegeAttackingForceAndStartGoods::MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main( + int param_1, ...) + { + if (param_1 < 0) { + int idx = -1 - param_1; + if (idx < 20) { + if (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == 0) { + return; + } + } else if (idx < 30) { + if (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 != 0) { + return; + } + } + DAT_MapPropertiesState::instance.indexStored = idx; + if (idx < 20) { + int resIdx = DAT_MissionAestheticsDefinedData::instance.field_0x345c[idx]; + int maxVal = DAT_MissionAestheticsDefinedData::instance.field_0x34b4[idx]; + int* resPtr = &DAT_MapPropertiesState::instance.SEC_StartingResources[resIdx]; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, + DAT_MenuModalComposition2::ptr)(0, maxVal, *resPtr, (undefined*)resPtr, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL(UI::Helpers_Func::SumUnitPoints)); + DAT_MenuModalComposition2::instance.textIndex + = DAT_MissionAestheticsDefinedData::instance + .field_0x3554[DAT_MapPropertiesState::instance.indexStored]; + DAT_MenuModalComposition2::instance.textGroup = 199; + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 37, DAT_ButtonY::instance + 25); + return; + } + // slider maximum = min(unit limit, room left below 500 points), written as the expanded macro with + // indexStored re-read each time: that gives the original's register choice + if (idx < 30) { + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::sumUnitPoints, DAT_MapPropertiesState::ptr)(); + int* countPtr = &DAT_MapPropertiesState::instance + .SEC_StartingResources[DAT_MapPropertiesState::instance.indexStored + 5]; + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setSliderParameters, DAT_MenuModalComposition2::ptr)(0, + DAT_MissionAestheticsDefinedData::instance + .field_0x3554[DAT_MapPropertiesState::instance.indexStored] + < *countPtr - (int)DAT_MapPropertiesState::instance.DAT_MapEditorUnitPointsSum + 500 + ? DAT_MissionAestheticsDefinedData::instance + .field_0x3554[DAT_MapPropertiesState::instance.indexStored] + : *countPtr - (int)DAT_MapPropertiesState::instance.DAT_MapEditorUnitPointsSum + 500, + *countPtr, (undefined*)countPtr, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL(UI::Helpers_Func::SumUnitPoints)); + DAT_MenuModalComposition2::instance.textIndex + = DAT_MissionAestheticsDefinedData::instance + .InvasionUnitLimits[DAT_MapPropertiesState::instance.indexStored + 4]; + DAT_MenuModalComposition2::instance.textGroup = 199; + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 37, DAT_ButtonY::instance + 25); + } else { + if (idx == 30) { + return; + } + if (idx < 40 || idx >= 50) { + return; + } + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::sumUnitPoints, DAT_MapPropertiesState::ptr)(); + int* countPtr = &DAT_MapPropertiesState::instance + .SEC_StartingResources[DAT_MapPropertiesState::instance.indexStored + 5]; + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setSliderParameters, DAT_MenuModalComposition2::ptr)(0, + (int)DAT_MissionAestheticsDefinedData::instance + .field_0x184[30][11 + DAT_MapPropertiesState::instance.indexStored] + < *countPtr - (int)DAT_MapPropertiesState::instance.DAT_MapEditorUnitPointsSum + 500 + ? (int)DAT_MissionAestheticsDefinedData::instance + .field_0x184[30][11 + DAT_MapPropertiesState::instance.indexStored] + : *countPtr - (int)DAT_MapPropertiesState::instance.DAT_MapEditorUnitPointsSum + 500, + *countPtr, (undefined*)countPtr, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL(UI::Helpers_Func::SumUnitPoints)); + DAT_MenuModalComposition2::instance.textIndex + = (int)DAT_MissionAestheticsDefinedData::instance + .field_0xa64[30][11 + DAT_MapPropertiesState::instance.indexStored]; + DAT_MenuModalComposition2::instance.textGroup = 199; + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 37, DAT_ButtonY::instance + 25); + } + } else if (param_1 == 37) { + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_NONE, FALSE); + } + } + + } // namespace MenuItems +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp b/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp new file mode 100644 index 0000000000..b9b0e2619b --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp @@ -0,0 +1,117 @@ +#include "../TriggerInvasion.func.hpp" + +#include "OpenSHC/Global.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp" +#include "OpenSHC/Globals/DAT_MissionAestheticsDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004bbd90 + void __cdecl TriggerInvasion::MenuItemActionHandler_TriggerInvasion_Main(int param_1, ...) + { + int textIndex = 0; + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::sumInvasionEventUnitCount, DAT_MapPropertiesState::ptr)(); + int* countPtr = &DAT_MapPropertiesState::instance.invasionEventContent.unitCountsPerUnitType[param_1]; + // the slider maximum is a min() of the unit limit and the room left below 500 units: written as the + // expanded macro (both operands repeated), which gives the original's register choice + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setSliderParameters, DAT_MenuModalComposition2::ptr)(0, + DAT_MissionAestheticsDefinedData::instance.InvasionUnitLimits[param_1] + < *countPtr - (int)DAT_MapPropertiesState::instance.DAT_InvasionEventItemUnitCountSum + 500 + ? DAT_MissionAestheticsDefinedData::instance.InvasionUnitLimits[param_1] + : *countPtr - (int)DAT_MapPropertiesState::instance.DAT_InvasionEventItemUnitCountSum + 500, + *countPtr, (undefined*)countPtr, + (Util::FunctionTypes::NoArgCallback*)MACRO_CALL(Global_Func::DoNothing)); + + switch (param_1) { + case 0: + textIndex = 91; + break; + case 1: + textIndex = 92; + break; + case 2: + textIndex = 93; + break; + case 3: + textIndex = 94; + break; + case 4: + textIndex = 95; + break; + case 5: + textIndex = 96; + break; + case 6: + textIndex = 97; + break; + case 7: + textIndex = 98; + break; + case 8: + textIndex = 99; + break; + case 9: + textIndex = 157; + break; + case 10: + textIndex = 158; + break; + case 11: + textIndex = 159; + break; + case 12: + textIndex = 160; + break; + case 13: + textIndex = 161; + break; + case 14: + textIndex = 162; + break; + case 15: + textIndex = 170; + break; + case 16: + textIndex = 213; + break; + case 17: + textIndex = 214; + break; + case 18: + textIndex = 215; + break; + case 19: + textIndex = 216; + break; + case 20: + textIndex = 217; + break; + case 21: + textIndex = 218; + break; + case 22: + textIndex = 219; + break; + case 23: + textIndex = 220; + break; + } + + DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textIndex = textIndex; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( + UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 62, DAT_ButtonY::instance + 25); + } + + } // namespace MenuItems +} // namespace UI +} // namespace OpenSHC diff --git a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp new file mode 100644 index 0000000000..f35c74d2e0 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp @@ -0,0 +1,86 @@ +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Synchrony.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/MenuItems/WaitingForHost.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/DirectPlay/EnumSessionsFlagsEnum.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/wstring-literals.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DPLAY_CurrentSessionGUID.hpp" +#include "OpenSHC/Globals/GUID_APP.hpp" +#include "OpenSHC/Globals/Menu_LobbyMenu.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + namespace WaitingForHost { + + // FUNCTION: STRONGHOLDCRUSADER 0x004914D0 + void __cdecl MenuItemActionHandler_WaitingForHost_ConnectToLobby() + { + DAT_GameSynchronyState::instance.scrollBarItemOffset = 0; + if (DAT_GameSynchronyState::instance.multiplayerJoinStep == 0) { + if (MACRO_CALL_MEMBER( + OpenSHC::Synchrony::GameSynchronyState_Func::initializeDirectPlayAndCreateOrJoinSession, + DAT_GameSynchronyState::ptr)(FALSE) + >= 0) { + DAT_GameSynchronyState::instance.multiplayerJoinStep = 1; + DAT_GameSynchronyState::instance.unkEnumerationRelatedBool = false; + DAT_GameSynchronyState::instance.scrollBarIndex = -1; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::restartDPlaySessionEnumeration, + DAT_GameSynchronyState::ptr)(FALSE); + } + } + if (DAT_GameSynchronyState::instance.multiplayerJoinStep != 1) { + return; + } + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::restartDPlaySessionEnumeration, + DAT_GameSynchronyState::ptr)(TRUE); + for (int i = 0; i < DAT_GameSynchronyState::instance.DPLAY_SessionsCount; ++i) { + // The wide string literal is the session name "Crusader" + if (MACRO_CALL(OpenSHC::OS_Func::__wcsicmp)( + u_Crusader_005a6f40, DAT_GameSynchronyState::instance.DPLAY_SessionNames[i]) + != 0) { + continue; + } + DPLAY_CurrentSessionGUID::instance = *DAT_GameSynchronyState::instance.DPLAY_SessionGUIDs[i]; + if (MACRO_CALL_MEMBER( + OpenSHC::Synchrony::GameSynchronyState_Func::initializeDirectPlayAndCreateOrJoinSession, + DAT_GameSynchronyState::ptr)(TRUE) + < 0) { + continue; + } + DPSESSIONDESC2 description; + MACRO_CALL(OpenSHC::OS_Func::_memset)(&description, 0, sizeof(description)); + description.dwSize = sizeof(description); + description.guidApplication = GUID_APP::instance; + DAT_GameSynchronyState::instance.DPLAYX_4A->EnumSessions(&description, 0, + MACRO_CALL(OpenSHC::Synchrony_Func::EnumSessionsCallback_addSession_async), NULL, + OpenSHC::DirectPlay::ESFE_ASYNC_ENUMERATION_STOP); + DAT_GameSynchronyState::instance.field_0x106ee4 = 1; + DAT_GameCore::instance.menuTabToSwitchTo.tabType = 0; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_LOBBY_MENU, 0); + MACRO_CALL(OpenSHC::Synchrony_Func::InitSkirmishLobbyData)(); + Menu_LobbyMenu::instance.thousand = 0; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::waitForMultiplayerHost, + DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_ASK_FOR_SLOT_ASSIGNMENT); + DAT_GameSynchronyState::instance.multiplayerJoinStep = 2; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + } + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp new file mode 100644 index 0000000000..ea575a9279 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp @@ -0,0 +1,117 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Audio/mss/SoundSystem.func.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuViews/HistoricCampaignIntro.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_00eb0b20.hpp" +#include "OpenSHC/Globals/DAT_00ed2780.hpp" +#include "OpenSHC/Globals/DAT_ArrayOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/FLOAT_00ec0834.hpp" +#include "OpenSHC/Globals/FLOAT_Between1And5.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace HistoricCampaignIntro { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DBBC0 + void MenuView_HistoricCampaignIntro_DoEveryFrame() + { + if (!MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::isSampleOrStreamPlaying, + DAT_SoundSystemState::ptr)(Audio::MSS::enums::SND_STR_SFX_1Unk)) { + MACRO_CALL_MEMBER(Audio::SFX::SFXState_Func::playAmbientSoundStreamUnk, DAT_SFXState::ptr)( + Audio::SFX::ASFXT_WIND_0); + } + if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_00ed2780::instance == 0) { + FLOAT_00ec0834::instance = 0.0f; + DAT_00ed2780::instance = 2; + } else if (DAT_00ed2780::instance == 1) { + FLOAT_00ec0834::instance = 31.0 - FLOAT_00ec0834::instance; + DAT_00ed2780::instance = 2; + } + } + if (MACRO_CALL(UI::Helpers_Func::TicksSinceCounterStart)() == 0) { + return; + } + MACRO_CALL(UI::Rendering_Func::RenderGfxHelperUnk)(0, 0, 0); + MACRO_CALL(UI::Rendering_Func::RenderHistoryBookEdgeUnk)(); + int blendStrength = 0; + if (DAT_00ed2780::instance == 1) { + blendStrength = 31 - (int)FLOAT_00ec0834::instance; + } else if (DAT_00ed2780::instance == 2) { + blendStrength = (int)FLOAT_00ec0834::instance; + } + MACRO_CALL(UI::Rendering_Func::DrawLoadedMenuStringHelperWithBlending)( + 0, 280, 150, 600, 0, 17, FALSE, blendStrength); + MACRO_CALL_MEMBER(Text::TextManager_Func::renderMultilineText5Unk, DAT_TextManagerObject::ptr)( + DAT_ArrayOfStoredMenuStrings::instance[1], + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 30, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 280, 740, 0, 17, blendStrength); + if (DAT_00ed2780::instance == 0) { + MACRO_CALL(UI::Rendering_Func::RenderGfxHelperUnk)(DAT_00eb0b20::instance, 43, 63); + } + if (DAT_00ed2780::instance != 0) { + MACRO_CALL(UI::Rendering_Func::RenderMenuGfxHelper)(DAT_00eb0b20::instance, 43, 63, blendStrength); + } + if (DAT_00ed2780::instance == 0 && FLOAT_00ec0834::instance > 0.0f) { + FLOAT_00ec0834::instance -= FLOAT_Between1And5::instance; + if (FLOAT_00ec0834::instance <= 0.0f) { + switch (DAT_GameCore::instance.historicCampaignNumber) { + case 1: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\intro_01.wav", 1); + break; + case 2: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\intro_02.wav", 1); + break; + case 3: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\intro_03.wav", 1); + break; + case 4: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\intro_04.wav", 1); + break; + } + } + } + if (DAT_00ed2780::instance == 0) { + return; + } + FLOAT_00ec0834::instance += FLOAT_Between1And5::instance; + if (FLOAT_00ec0834::instance >= 32.0f) { + if (DAT_00ed2780::instance == 2) { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_PICTURE, 0); + FLOAT_00ec0834::instance = 31.0f; + DAT_SoundSystemState::instance + .streamFlagsUnkAndLoopCount_0x34[Audio::MSS::enums::SND_STR_SPEECH_2] = 0; + DAT_SoundSystemState::instance + .streamFlagsUnkAndLoopCount_0x34[Audio::MSS::enums::SND_STR_SPEECH_1] = 0; + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + Audio::MSS::enums::SND_STR_SPEECH_1); + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + Audio::MSS::enums::SND_STR_SPEECH_2); + return; + } + DAT_00ed2780::instance = 0; + FLOAT_00ec0834::instance = 60.0f; + } + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp new file mode 100644 index 0000000000..16bafb76d2 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp @@ -0,0 +1,113 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Audio/mss/SoundSystem.func.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuViews/HistoricCampaignOutro.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_00eb0b20.hpp" +#include "OpenSHC/Globals/DAT_00ed2780.hpp" +#include "OpenSHC/Globals/DAT_ArrayOfStoredMenuStrings.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/FLOAT_00ec0834.hpp" +#include "OpenSHC/Globals/FLOAT_Between1And5.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace HistoricCampaignOutro { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DBF00 + void MenuView_HistoricCampaignOutro_DoEveryFrame() + { + if (!MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::isSampleOrStreamPlaying, + DAT_SoundSystemState::ptr)(Audio::MSS::enums::SND_STR_SFX_1Unk)) { + MACRO_CALL_MEMBER(Audio::SFX::SFXState_Func::playAmbientSoundStreamUnk, DAT_SFXState::ptr)( + Audio::SFX::ASFXT_WIND_0); + } + if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_00ed2780::instance == 0) { + FLOAT_00ec0834::instance = 0.0f; + DAT_00ed2780::instance = 2; + } else if (DAT_00ed2780::instance == 1) { + FLOAT_00ec0834::instance = 31.0 - FLOAT_00ec0834::instance; + DAT_00ed2780::instance = 2; + } + } + if (MACRO_CALL(UI::Helpers_Func::TicksSinceCounterStart)() == 0) { + return; + } + MACRO_CALL(UI::Rendering_Func::RenderGfxHelperUnk)(0, 0, 0); + MACRO_CALL(UI::Rendering_Func::RenderHistoryBookEdgeUnk)(); + int blendStrength = 0; + if (DAT_00ed2780::instance == 1) { + blendStrength = 31 - (int)FLOAT_00ec0834::instance; + } else if (DAT_00ed2780::instance == 2) { + blendStrength = (int)FLOAT_00ec0834::instance; + } + MACRO_CALL(UI::Rendering_Func::DrawLoadedMenuStringHelperWithBlending)( + 0, 300, 150, 600, 0, 15, FALSE, blendStrength); + MACRO_CALL_MEMBER(Text::TextManager_Func::renderMultilineText5Unk, DAT_TextManagerObject::ptr)( + DAT_ArrayOfStoredMenuStrings::instance[1], + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 30, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 280, 740, 0, 17, blendStrength); + if (DAT_00ed2780::instance == 0) { + MACRO_CALL(UI::Rendering_Func::RenderGfxHelperUnk)(DAT_00eb0b20::instance, 43, 63); + } + if (DAT_00ed2780::instance != 0) { + MACRO_CALL(UI::Rendering_Func::RenderMenuGfxHelper)(DAT_00eb0b20::instance, 43, 63, blendStrength); + } + if (DAT_00ed2780::instance == 0) { + return; + } + FLOAT_00ec0834::instance += FLOAT_Between1And5::instance; + if (FLOAT_00ec0834::instance >= 32.0f) { + if (DAT_00ed2780::instance == 2) { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAIN_MENU, 0); + FLOAT_00ec0834::instance = 31.0f; + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + Audio::MSS::enums::SND_STR_SFX_1Unk); + DAT_SoundSystemState::instance + .streamFlagsUnkAndLoopCount_0x34[Audio::MSS::enums::SND_STR_SPEECH_2] = 0; + DAT_SoundSystemState::instance + .streamFlagsUnkAndLoopCount_0x34[Audio::MSS::enums::SND_STR_SPEECH_1] = 0; + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + Audio::MSS::enums::SND_STR_SPEECH_1); + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + Audio::MSS::enums::SND_STR_SPEECH_2); + return; + } + DAT_00ed2780::instance = 0; + switch (DAT_GameCore::instance.historicCampaignNumber) { + case 1: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\after_01.wav", 1); + break; + case 2: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\after_02.wav", 1); + break; + case 3: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\after_03.wav", 1); + break; + case 4: + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, + DAT_SoundSystemState::ptr)("fx\\speech\\after_04.wav", 1); + break; + } + } + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp new file mode 100644 index 0000000000..f5ba150e4a --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp @@ -0,0 +1,84 @@ +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Audio/mss/SoundSystem.func.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuViews/HistoricMissionPicture.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_00eb0b20.hpp" +#include "OpenSHC/Globals/DAT_00ed2780.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/FLOAT_00ec0834.hpp" +#include "OpenSHC/Globals/FLOAT_Between1And5.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace HistoricMissionPicture { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DB600 + void MenuView_HistoricMissionPicture_DoEveryFrame() + { + if (!MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::isSampleOrStreamPlaying, + DAT_SoundSystemState::ptr)(Audio::MSS::enums::SND_STR_SFX_1Unk)) { + MACRO_CALL_MEMBER(Audio::SFX::SFXState_Func::playAmbientSoundStreamUnk, DAT_SFXState::ptr)( + Audio::SFX::ASFXT_WIND_0); + } + if (DAT_MouseState::instance.leftClickStart != 0) { + if (DAT_00ed2780::instance == 0) { + FLOAT_00ec0834::instance = 0.0f; + DAT_00ed2780::instance = 2; + } else if (DAT_00ed2780::instance == 1) { + FLOAT_00ec0834::instance = 31.0 - FLOAT_00ec0834::instance; + DAT_00ed2780::instance = 2; + } + } + if (MACRO_CALL(UI::Helpers_Func::TicksSinceCounterStart)() == 0) { + return; + } + MACRO_CALL(UI::Rendering_Func::RenderGfxHelperUnk)(0, 0, 0); + MACRO_CALL(UI::Rendering_Func::RenderHistoryBookEdgeUnk)(); + if (DAT_00ed2780::instance == 0) { + MACRO_CALL(UI::Rendering_Func::RenderGfxHelperUnk)(DAT_00eb0b20::instance, 62, 103); + } + if (DAT_00ed2780::instance == 1) { + MACRO_CALL(UI::Rendering_Func::RenderMenuGfxHelper)( + DAT_00eb0b20::instance, 62, 103, 31 - (int)FLOAT_00ec0834::instance); + } + if (DAT_00ed2780::instance == 2) { + MACRO_CALL(UI::Rendering_Func::RenderMenuGfxHelper)( + DAT_00eb0b20::instance, 62, 103, (int)FLOAT_00ec0834::instance); + } + int blendStrength = 0; + if (DAT_00ed2780::instance == 1) { + blendStrength = 31 - (int)FLOAT_00ec0834::instance; + } else if (DAT_00ed2780::instance == 2) { + blendStrength = (int)FLOAT_00ec0834::instance; + } + MACRO_CALL(UI::Rendering_Func::DrawLoadedMenuStringHelperWithBlending)( + 0, 400, 70, 0, 0, 16, TRUE, blendStrength); + MACRO_CALL(UI::Rendering_Func::DrawLoadedMenuStringHelperWithBlending)( + 1, 400, 110, 0, 0, 16, TRUE, blendStrength); + if (DAT_00ed2780::instance == 0) { + return; + } + FLOAT_00ec0834::instance += FLOAT_Between1And5::instance; + if (FLOAT_00ec0834::instance >= 32.0f) { + if (DAT_00ed2780::instance == 2) { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_INTRO, 0); + FLOAT_00ec0834::instance = 31.0f; + return; + } + DAT_00ed2780::instance = 0; + } + } + + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 507eed8917..f43f70c452 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -521,7 +521,7 @@ SHC_3BB0A8C1_0x00402BD0 | 0.0% | Pending SHC_3BB0A8C1_0x00402C50 | 0.0% | Pending -SHC_3BB0A8C1_0x00402DA0 | 0.0% | Pending +SHC_3BB0A8C1_0x00402DA0 | 100.0% | Reimplemented (counted: only float constant names and the CRT math helpers (_CIcos, _CItan, _CIsqrt) differ) SHC_3BB0A8C1_0x00402E20 | 0.0% | Pending @@ -1621,7 +1621,7 @@ SHC_3BB0A8C1_0x00405124 | 0.0% | Pending SHC_3BB0A8C1_0x00405125 | 0.0% | Pending -SHC_3BB0A8C1_0x00405130 | 0.0% | Pending +SHC_3BB0A8C1_0x00405130 | 100.0% | Reimplemented (counted: only the constant 0x10300131 is shown as an address label in ours) SHC_3BB0A8C1_0x004052E0 | 0.0% | Pending @@ -2341,7 +2341,7 @@ SHC_3BB0A8C1_0x00406640 | 0.0% | Pending SHC_3BB0A8C1_0x00406648 | 0.0% | Pending -SHC_3BB0A8C1_0x00406650 | 0.0% | Pending +SHC_3BB0A8C1_0x00406650 | 100.0% | Reimplemented (counted: only float constant names and the CRT math helpers (_CIsin, _CIcos, _ftol2_sse) differ) SHC_3BB0A8C1_0x00406900 | 0.0% | Pending @@ -6813,7 +6813,7 @@ SHC_3BB0A8C1_0x004272C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00427320 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004274F0 | 0.0% | Pending +SHC_3BB0A8C1_0x004274F0 | 100.0% | Reimplemented (counted: only the memset symbol name differs) SHC_3BB0A8C1_0x004276F0 | 100.0% | Reimplemented @@ -6919,7 +6919,7 @@ SHC_3BB0A8C1_0x00429A38 | 0.0% | Pending SHC_3BB0A8C1_0x00429A3C | 0.0% | Pending -SHC_3BB0A8C1_0x00429A40 | 0.0% | Pending +SHC_3BB0A8C1_0x00429A40 | 100.0% | Reimplemented (counted: only callback trampolines, sprintf, the jump-table label and the 0xB8E6F5 buffer label differ) SHC_3BB0A8C1_0x0042A380 | 0.0% | Pending @@ -21177,7 +21177,7 @@ SHC_3BB0A8C1_0x0046F4E1 | 0.0% | Pending SHC_3BB0A8C1_0x0046F4E2 | 0.0% | Pending -SHC_3BB0A8C1_0x0046F4F0 | 0.0% | Pending +SHC_3BB0A8C1_0x0046F4F0 | 100.0% | Reimplemented (counted: only the GetProcAddress import name differs) SHC_3BB0A8C1_0x0046F513 | 0.0% | Pending @@ -21187,7 +21187,7 @@ SHC_3BB0A8C1_0x0046F533 | 0.0% | Pending SHC_3BB0A8C1_0x0046F550 | 0.0% | Pending -SHC_3BB0A8C1_0x0046F570 | 0.0% | Pending +SHC_3BB0A8C1_0x0046F570 | 100.0% | Reimplemented (counted: only the security cookie and memset symbols differ) SHC_3BB0A8C1_0x0046F610 | 0.0% | Pending @@ -23387,7 +23387,7 @@ SHC_3BB0A8C1_0x004909E0 | 0.0% | Pending SHC_3BB0A8C1_0x00490C20 | 0.0% | Pending -SHC_3BB0A8C1_0x00490D90 | 0.0% | Pending +SHC_3BB0A8C1_0x00490D90 | 100.0% | Reimplemented (counted: only the security cookie and callback trampolines differ) SHC_3BB0A8C1_0x0049102D | 0.0% | Pending @@ -23401,7 +23401,7 @@ SHC_3BB0A8C1_0x00491130 | 0.0% | Pending SHC_3BB0A8C1_0x00491270 | 0.0% | Pending -SHC_3BB0A8C1_0x004914D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004914D0 | 100.0% | Reimplemented (counted: only the security cookie and a callback trampoline differ) SHC_3BB0A8C1_0x00491680 | 100.0% | Reimplemented @@ -27527,7 +27527,7 @@ SHC_3BB0A8C1_0x004B9020 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B9060 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B9110 | 0.0% | Pending +SHC_3BB0A8C1_0x004B9110 | 100.0% | Reimplemented (counted: only the pushed DoNothing callback (trampoline) and the jump-table label differ) SHC_3BB0A8C1_0x004B9264 | 0.0% | Pending @@ -29081,7 +29081,7 @@ SHC_3BB0A8C1_0x004BA559 | 0.0% | Pending SHC_3BB0A8C1_0x004BA560 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004BA5C0 | 0.0% | Pending +SHC_3BB0A8C1_0x004BA5C0 | 100.0% | Reimplemented (counted: only the pushed SumUnitPoints callback (trampoline) differs) SHC_3BB0A8C1_0x004BA780 | 100.0% | Reimplemented @@ -29781,7 +29781,7 @@ SHC_3BB0A8C1_0x004BBD83 | 0.0% | Pending SHC_3BB0A8C1_0x004BBD84 | 0.0% | Pending -SHC_3BB0A8C1_0x004BBD90 | 0.0% | Pending +SHC_3BB0A8C1_0x004BBD90 | 100.0% | Reimplemented (counted: only the pushed DoNothing callback (trampoline) and the jump-table label differ) SHC_3BB0A8C1_0x004BBED8 | 0.0% | Pending @@ -30477,7 +30477,7 @@ SHC_3BB0A8C1_0x004BE585 | 0.0% | Pending SHC_3BB0A8C1_0x004BE586 | 0.0% | Pending -SHC_3BB0A8C1_0x004BE590 | 0.0% | Pending +SHC_3BB0A8C1_0x004BE590 | 100.0% | Reimplemented (counted: only the security cookie symbols differ) SHC_3BB0A8C1_0x004BE7E0 | 100.0% | Reimplemented @@ -30489,7 +30489,7 @@ SHC_3BB0A8C1_0x004BEA20 | 0.0% | Pending SHC_3BB0A8C1_0x004BEA90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004BEB20 | 0.0% | Pending +SHC_3BB0A8C1_0x004BEB20 | 100.0% | Reimplemented (counted: only the security cookie symbols differ) SHC_3BB0A8C1_0x004BEC10 | 100.0% | Reimplemented @@ -33897,7 +33897,7 @@ SHC_3BB0A8C1_0x004C226F | 0.0% | Pending SHC_3BB0A8C1_0x004C2270 | 0.0% | Pending -SHC_3BB0A8C1_0x004C2280 | 0.0% | Pending +SHC_3BB0A8C1_0x004C2280 | 100.0% | Reimplemented (counted: only the resetMouseCursorState tail-jump target differs; it goes through main's trampoline) SHC_3BB0A8C1_0x004C3110 | 0.0% | Pending @@ -36203,7 +36203,7 @@ SHC_3BB0A8C1_0x004DB4F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DB5C0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004DB600 | 0.0% | Pending +SHC_3BB0A8C1_0x004DB600 | 100.0% | Reimplemented (counted: only float constant names and _ftol2_sse differ) SHC_3BB0A8C1_0x004DB7B0 | 100.0% | Reimplemented @@ -36219,7 +36219,7 @@ SHC_3BB0A8C1_0x004DBBAC | 0.0% | Pending SHC_3BB0A8C1_0x004DBBB0 | 0.0% | Pending -SHC_3BB0A8C1_0x004DBBC0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DBBC0 | 100.0% | Reimplemented (counted: only float constant names, _ftol2_sse and the intro_04.wav string label differ) SHC_3BB0A8C1_0x004DBE20 | 0.0% | Pending @@ -36239,7 +36239,7 @@ SHC_3BB0A8C1_0x004DBEEC | 0.0% | Pending SHC_3BB0A8C1_0x004DBEF0 | 0.0% | Pending -SHC_3BB0A8C1_0x004DBF00 | 0.0% | Pending +SHC_3BB0A8C1_0x004DBF00 | 100.0% | Reimplemented (counted: only float constant names and _ftol2_sse differ) SHC_3BB0A8C1_0x004DC12C | 0.0% | Pending From 6707f8261bb9409439cd0a92b51b58fe1dda8c60 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Sun, 15 Nov 2026 20:51:15 -0500 Subject: [PATCH 2/4] string literals: add fx\speech\intro_04.wav (0x5AB0FC) Co-Authored-By: Claude Opus 5.5 --- src/OpenSHC/string-literals.hpp | 3 +++ src/OpenSHC/string-macros.hpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/OpenSHC/string-literals.hpp b/src/OpenSHC/string-literals.hpp index d2438aa321..8830b1ea64 100644 --- a/src/OpenSHC/string-literals.hpp +++ b/src/OpenSHC/string-literals.hpp @@ -8231,6 +8231,9 @@ char const* const s_c2pic_tgx_005ab0e0 = S_C2PIC_TGX_005AB0E0; // 0x005ab0ec char const* const s_c1pic_tgx_005ab0ec = S_C1PIC_TGX_005AB0EC; +// 0x005ab0fc +char const* const s_fx_speech_intro_04_wav_005ab0fc = S_FX_SPEECH_INTRO_04_WAV_005AB0FC; + // 0x005ab114 char const* const s_fx_speech_intro_03_wav_005ab114 = S_FX_SPEECH_INTRO_03_WAV_005AB114; diff --git a/src/OpenSHC/string-macros.hpp b/src/OpenSHC/string-macros.hpp index 2900831ae6..754d824d56 100644 --- a/src/OpenSHC/string-macros.hpp +++ b/src/OpenSHC/string-macros.hpp @@ -8235,6 +8235,9 @@ // STRING: STRONGHOLDCRUSADER 0x005ab0ec #define S_C1PIC_TGX_005AB0EC "c1pic.tgx" +// STRING: STRONGHOLDCRUSADER 0x005ab0fc +#define S_FX_SPEECH_INTRO_04_WAV_005AB0FC "fx\\speech\\intro_04.wav" + // STRING: STRONGHOLDCRUSADER 0x005ab114 #define S_FX_SPEECH_INTRO_03_WAV_005AB114 "fx\\speech\\intro_03.wav" From 937b0bcda42e632e5994de20dc8493c751b40562 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Sun, 15 Nov 2026 20:55:14 -0500 Subject: [PATCH 3/4] Review: relative main includes first, countof bounds, MapConstants, string literals for the speech files, enum names for text groups and the option colour, no goto in updateMilitaryCampaignMissionState Co-Authored-By: Claude Opus 5.5 --- .../Global/DetectDXVersionByLoadingDDRAW.cpp | 3 +- src/OpenSHC/Global/TestOSVersion.cpp | 2 +- .../Entities/EntityState/createSeagull.cpp | 4 +- .../Map/Entities/SomeFireSpreadFunction.cpp | 5 +- .../setStartingYearAndStartingResources.cpp | 13 +- ...ventYearsAndCommitBuildingAvailability.cpp | 3 +- .../updateMilitaryCampaignMissionState.cpp | 22 +-- .../Synchrony/InitSkirmishLobbyData.cpp | 6 +- ...Handler_FindingNetworkSessions_Buttons.cpp | 3 +- ...ionHandler_General_AdvancedGameOptions.cpp | 136 +++++++++--------- ...mActionHandler_NewInvasion_UnitButtons.cpp | 3 +- ..._SiegeAttackingForceAndStartGoods_Main.cpp | 7 +- ...ItemActionHandler_TriggerInvasion_Main.cpp | 3 +- ...nHandler_WaitingForHost_ConnectToLobby.cpp | 3 +- ...iew_HistoricCampaignIntro_DoEveryFrame.cpp | 12 +- ...iew_HistoricCampaignOutro_DoEveryFrame.cpp | 12 +- ...ew_HistoricMissionPicture_DoEveryFrame.cpp | 3 +- 17 files changed, 129 insertions(+), 111 deletions(-) diff --git a/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp b/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp index afb5964d83..aa9e4a7755 100644 --- a/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp +++ b/src/OpenSHC/Global/DetectDXVersionByLoadingDDRAW.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Global.func.hpp" +#include "../Global.func.hpp" + #include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/IID_IDirectDraw7.hpp" diff --git a/src/OpenSHC/Global/TestOSVersion.cpp b/src/OpenSHC/Global/TestOSVersion.cpp index c05619ca6d..ba688aa5e0 100644 --- a/src/OpenSHC/Global/TestOSVersion.cpp +++ b/src/OpenSHC/Global/TestOSVersion.cpp @@ -1,4 +1,4 @@ -#include "OpenSHC/Global.func.hpp" +#include "../Global.func.hpp" namespace OpenSHC { diff --git a/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp b/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp index ad50518eef..c427eb4b49 100644 --- a/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp +++ b/src/OpenSHC/Map/Entities/EntityState/createSeagull.cpp @@ -16,7 +16,7 @@ namespace Map { int EntityState::createSeagull(int x, int y) { int seagullID = 1; - for (; seagullID < 100; ++seagullID) { + for (; seagullID < countof(this->seagullArray); ++seagullID) { if (this->seagullArray[seagullID].field_0x8 == 0) { break; } @@ -25,7 +25,7 @@ namespace Map { MACRO_CALL_MEMBER(IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( sizeof(this->seagullArray[seagullID]), 0, &this->seagullArray[seagullID]); } - if (seagullID >= 99) { + if (seagullID >= countof(this->seagullArray) - 1) { return 0; } } diff --git a/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp b/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp index aed3e13b08..9bc91fad69 100644 --- a/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp +++ b/src/OpenSHC/Map/Entities/SomeFireSpreadFunction.cpp @@ -5,6 +5,7 @@ #include "OpenSHC/Map/LandscapeState.func.hpp" #include "OpenSHC/Random/RNG.func.hpp" #include "OpenSHC/Map/LogicHelpers/Logic1.hpp" +#include "OpenSHC/Map/MapConstants.hpp" #include "OpenSHC/Globals/DAT_BuildingsState.hpp" #include "OpenSHC/Globals/DAT_EntityDefinedData.hpp" @@ -26,8 +27,8 @@ namespace Map { y += DAT_EntityDefinedData::instance.XYOffsetsInAllDirections[random & 0x3f][1]; uint const tileX = x / 8; uint const tileY = y / 8; - bool const onMap = tileX <= 399 && tileY <= 399 - && DAT_ViewportRenderState::instance.DAT_BinaryTileMap400x400[tileY * 400 + tileX] != 0; + bool const onMap = tileX <= MC_MAP_XY_LIMIT_INCLUSIVE && tileY <= MC_MAP_XY_LIMIT_INCLUSIVE + && DAT_ViewportRenderState::instance.DAT_BinaryTileMap400x400[tileY * MC_MAP_XY_LIMIT + tileX] != 0; if (!onMap) { return 0; } diff --git a/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp b/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp index 58c85d9f1e..e3db3cb27c 100644 --- a/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/setStartingYearAndStartingResources.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "../MapPropertiesState.func.hpp" + #include "OpenSHC/OS.func.hpp" #include "OpenSHC/Text/UserTextHandler.func.hpp" #include "OpenSHC/string-literals.hpp" @@ -15,20 +16,20 @@ namespace Map { { DAT_MapPropertiesState::instance.SEC_StartingYear = 1181; DAT_GameState::instance.mapAndTime.year = 1181; - for (int i = 0; i < 25; ++i) { + for (int i = 0; i < countof(DAT_MapPropertiesState::instance.SEC_StartingResources); ++i) { DAT_MapPropertiesState::instance.SEC_StartingResources[i] = 0; } - for (int i = 0; i < 25; ++i) { + for (int i = 0; i < countof(DAT_MapPropertiesState::instance.SEC_Section1065.tradeabilityArray); ++i) { DAT_MapPropertiesState::instance.SEC_Section1065.tradeabilityArray[i] = 1; } DAT_MapPropertiesState::instance.SEC_StartingMonth = 0; DAT_GameState::instance.mapAndTime.month = 0; DAT_MapPropertiesState::instance.eventsCount = 0; // the siege information is a block of 20 unit counts - for (int i = 0; i < 20; ++i) { + for (int i = 0; i < countof(DAT_MapPropertiesState::instance.SEC_SiegeInformation); ++i) { DAT_MapPropertiesState::instance.SEC_SiegeInformation[i] = 0; } - for (int i = 0; i < 6; ++i) { + for (int i = 0; i < countof(DAT_MapPropertiesState::instance.SEC_Section1067.siegeEngineCounts); ++i) { DAT_MapPropertiesState::instance.SEC_Section1067.siegeEngineCounts[i] = 0; } DAT_MapPropertiesState::instance.SEC_StartingPopularity = 100; @@ -39,7 +40,7 @@ namespace Map { MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)(yearText); DAT_MapPropertiesState::instance.eventListSelection = -1; DAT_MapPropertiesState::instance.eventListScrollOffset = 0; - for (int i = 0; i < 100; ++i) { + for (int i = 0; i < countof(this->buildingAvailability); ++i) { this->buildingAvailability[i] = 1; } MACRO_CALL_MEMBER(MapPropertiesState_Func::commitBuildingAvailability, this)(); diff --git a/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp b/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp index d57515beb9..b3083e80ef 100644 --- a/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/updateEventYearsAndCommitBuildingAvailability.cpp @@ -1,4 +1,5 @@ -#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "../MapPropertiesState.func.hpp" + #include "OpenSHC/OS.func.hpp" #include "OpenSHC/Text/UserTextHandler.func.hpp" #include "OpenSHC/string-literals.hpp" diff --git a/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp b/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp index b74f9b97f8..644d4a021f 100644 --- a/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp +++ b/src/OpenSHC/Map/MapPropertiesState/updateMilitaryCampaignMissionState.cpp @@ -1,6 +1,7 @@ +#include "../MapPropertiesState.func.hpp" + #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/Input/MouseState.func.hpp" -#include "OpenSHC/Map/MapPropertiesState.func.hpp" #include "OpenSHC/Map/Units/UnitsState.func.hpp" #include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" #include "OpenSHC/Text/TextManager.func.hpp" @@ -97,10 +98,11 @@ namespace Map { } return; } + bool missionWon = false; if (DAT_GameCore::instance.missionNumber1to20 == 16) { if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 0) { int hits = 0; - for (int i = 1; i < 9; ++i) { + for (int i = 1; i < countof(DAT_GameState::instance.mapAndTime.emenyHitArray); ++i) { hits += DAT_GameState::instance.mapAndTime.emenyHitArray[i]; } if (hits >= 8) { @@ -156,7 +158,7 @@ namespace Map { && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; - goto missionWon; + missionWon = true; } } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 3) { if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { @@ -248,7 +250,7 @@ namespace Map { && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { DAT_GameState::instance.mapAndTime.militaryCampaignStage = 7; - goto missionWon; + missionWon = true; } } else if (DAT_GameState::instance.mapAndTime.militaryCampaignStage == 5) { if (DAT_GameState::instance.playerDataArray[2].lordKilledByPlayerID != 0) { @@ -317,7 +319,7 @@ namespace Map { && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { DAT_GameState::instance.mapAndTime.militaryCampaignStage = 5; - goto missionWon; + missionWon = true; } } } else if (DAT_GameCore::instance.missionNumber1to20 == 19) { @@ -392,7 +394,7 @@ namespace Map { && DAT_GameState::instance.mapAndTime.year == DAT_GameState::instance.mapAndTime.yearCopy) || DAT_GameState::instance.mapAndTime.year > DAT_GameState::instance.mapAndTime.yearCopy) { DAT_GameState::instance.mapAndTime.militaryCampaignStage = 6; - goto missionWon; + missionWon = true; } } } else if (DAT_GameCore::instance.missionNumber1to20 == 20) { @@ -491,13 +493,13 @@ namespace Map { MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_NEW_TEXT2, 23), (char*)s__005a5339, (char*)s__005a5339); - goto missionWon; + missionWon = true; } } } - return; - - missionWon: + if (!missionWon) { + return; + } DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID].playerDeathRelated = 1; DAT_GameState::instance.mapAndTime.unknownCountdown01 = 240; diff --git a/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp b/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp index e678f28995..ac97da4bdf 100644 --- a/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp +++ b/src/OpenSHC/Synchrony/InitSkirmishLobbyData.cpp @@ -50,19 +50,19 @@ void Synchrony::InitSkirmishLobbyData() DAT_GameCore::instance.gameMode_2 = Game::GM_SKIRMISH_AND_MULTIPLAYER; DAT_GameSynchronyState::instance.lobbyMapSortOrder = 6; INT_00b95ab8::instance = 0; - for (int i = 0; i < 20; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.skirmishIntensityRelatedArray); ++i) { DAT_GameSynchronyState::instance.skirmishIntensityRelatedArray[i] = DAT_RenderingDefinedData::instance .SkirmishIntensityRelatedArray[0][DAT_GameSynchronyState::instance.skirmishTechLevel][i]; } - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.skirmishBalanceRelatedArrayUnk1); ++i) { DAT_GameSynchronyState::instance.skirmishBalanceRelatedArrayUnk1[i] = DAT_RenderingDefinedData::instance .SkirmishIntensityRelatedArray2[DAT_GameSynchronyState::instance.skirmishTechLevel][i]; } DAT_GameSynchronyState::instance.skirmishStartGold = DAT_RenderingDefinedData::instance.StartGold[DAT_GameSynchronyState::instance.skirmishTechLevel / 2]; - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } if (DAT_GameSynchronyState::instance.isHost) { diff --git a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp index 7e669fac40..df69ea201e 100644 --- a/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp +++ b/src/OpenSHC/UI/MenuItems/FindingNetworkSessions/MenuItemActionHandler_FindingNetworkSessions_Buttons.cpp @@ -1,9 +1,10 @@ +#include "../FindingNetworkSessions.func.hpp" + #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/Input/MouseState.func.hpp" #include "OpenSHC/OS.func.hpp" #include "OpenSHC/Synchrony.func.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" -#include "OpenSHC/UI/MenuItems/FindingNetworkSessions.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" #include "OpenSHC/DirectPlay/EnumSessionsFlagsEnum.hpp" diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp index 383f268ffb..7b8aa57fbe 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp @@ -1,7 +1,7 @@ -#pragma warning(disable : 4996) - #include "../General.func.hpp" +#pragma warning(disable : 4996) + #include "OpenSHC/Game/Skirmish.func.hpp" #include "OpenSHC/Synchrony/Commands.func.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" @@ -9,6 +9,8 @@ #include "OpenSHC/Text/UserTextHandler.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" #include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" #include "OpenSHC/Globals/DAT_ButtonW.hpp" @@ -129,34 +131,34 @@ namespace UI { if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 0) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); } if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 5) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 96)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 96)); } if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 10) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 97)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 97)); } if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 20) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 94), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 98)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 98)); } MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -172,15 +174,15 @@ namespace UI { (Commands::GameCommandType)52); sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)79, 99), + DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 99), DAT_GameSynchronyState::instance.skirmishStrongWalls != 0 ? MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13) + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13) : MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -203,7 +205,7 @@ namespace UI { (undefined*)&DAT_GameSynchronyState::instance.skirmishPoints, (Util::FunctionTypes::NoArgCallback*)MACRO_CALL( Synchrony::Commands_Func::QueueChangeGameIntensityOrBalance)); - DAT_MenuModalComposition2::instance.textGroup = 79; + DAT_MenuModalComposition2::instance.textGroup = DE::SHCDE::TEXT_XPLAY_WAITING_ROOM; DAT_MenuModalComposition2::instance.textIndex = 88; MACRO_CALL_MEMBER( UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( @@ -214,15 +216,15 @@ namespace UI { (Commands::GameCommandType)52); sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)252, 5), + DE::SHCDE::TEXT_SKIRMISH_MISC, 5), DAT_GameSynchronyState::instance.skirmishNoCowThrowing != 0 ? MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13) + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13) : MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -239,19 +241,19 @@ namespace UI { if (DAT_GameSynchronyState::instance.skirmishNoDogs != 0) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 6), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 6), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13)); } else { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 6), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 6), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); } MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -268,19 +270,19 @@ namespace UI { if (DAT_GameSynchronyState::instance.skirmishExtremeMode != 0) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 13), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 13), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13)); } else { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 13), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 13), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); } MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -297,19 +299,19 @@ namespace UI { if (DAT_GameSynchronyState::instance.skirmishExtremeMode != 0) { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 14), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 14), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)74, 13)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13)); } else { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 14), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 14), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); } MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -328,93 +330,93 @@ namespace UI { (Commands::GameCommandType)52); if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 0) { MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)79, 95, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, - DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, - (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, + FALSE, (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); } if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 1) { MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)79, 96, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, - DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, - (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 96, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, + FALSE, (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); } if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 2) { MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)79, 97, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, - DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, - (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 97, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, + FALSE, (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); } if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 3) { MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)79, 98, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, - DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, - (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 98, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, + FALSE, (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); } if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 4) { MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)252, 8, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, - DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, - (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + DE::SHCDE::TEXT_SKIRMISH_MISC, 8, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, + FALSE, (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); } if (DAT_GameSynchronyState::instance.skirmishNoRushSetting == 5) { MACRO_CALL_MEMBER(Text::TextManager_Func::renderInGameText2, DAT_TextManagerObject::ptr)( - (DE::SHCDE::eTextSections)252, 9, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, - DAT_ButtonY::instance + 7, Text::TTA_RIGHT, 12117749, 0, 18, FALSE, - (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); + DE::SHCDE::TEXT_SKIRMISH_MISC, 9, DAT_ButtonX::instance + DAT_ButtonW::instance - 20, + DAT_ButtonY::instance + 7, Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_B8E6F5, 0, 18, + FALSE, (((int)DAT_ButtonBackgroundBlendStrength::instance - 32) * 32) / 32 + 32); } switch (DAT_GameSynchronyState::instance.skirmishNoRushSetting) { case 0: { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 95)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); break; } case 1: { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 96)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 96)); break; } case 2: { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 97)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 97)); break; } case 3: { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)79, 98)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 98)); break; } case 4: { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 8)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 8)); break; } case 5: { sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 7), + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, - DAT_TextManagerObject::ptr)((DE::SHCDE::eTextSections)252, 9)); + DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 9)); break; } } MACRO_CALL_MEMBER(Text::UserTextHandler_Func::copyIntoTextArray, DAT_UserTextHandlerState::ptr)( DAT_GameSynchronyState::instance.receivedChatMessage); - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } DAT_GameSynchronyState::instance @@ -425,7 +427,7 @@ namespace UI { MACRO_CALL_MEMBER(Text::UserTextHandler_Func::clearEntry, DAT_UserTextHandlerState::ptr)( DAT_UserTextHandlerState::instance.textArrayIndex); } - for (int i = 0; i < 9; ++i) { + for (int i = 0; i < countof(DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray); ++i) { DAT_GameSynchronyState::instance.DAT_ChatMessageReceiverArray[i] = 1; } } diff --git a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp index 7476611fd0..cfdc81b6e4 100644 --- a/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp +++ b/src/OpenSHC/UI/MenuItems/NewInvasion/MenuItemActionHandler_NewInvasion_UnitButtons.cpp @@ -3,6 +3,7 @@ #include "OpenSHC/Global.func.hpp" #include "OpenSHC/Map/MapPropertiesState.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -108,7 +109,7 @@ namespace UI { break; } - DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textGroup = DE::SHCDE::TEXT_SCENARIO; DAT_MenuModalComposition2::instance.textIndex = textIndex; MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 62, DAT_ButtonY::instance + 25); diff --git a/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp b/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp index 34e493190a..9f72d9831f 100644 --- a/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/SiegeAttackingForceAndStartGoods/MenuItemActionHandler_SiegeAttackingForceAndStartGoods_Main.cpp @@ -3,6 +3,7 @@ #include "OpenSHC/Map/MapPropertiesState.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -42,7 +43,7 @@ namespace UI { DAT_MenuModalComposition2::instance.textIndex = DAT_MissionAestheticsDefinedData::instance .field_0x3554[DAT_MapPropertiesState::instance.indexStored]; - DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textGroup = DE::SHCDE::TEXT_SCENARIO; MACRO_CALL_MEMBER( UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 37, DAT_ButtonY::instance + 25); @@ -67,7 +68,7 @@ namespace UI { DAT_MenuModalComposition2::instance.textIndex = DAT_MissionAestheticsDefinedData::instance .InvasionUnitLimits[DAT_MapPropertiesState::instance.indexStored + 4]; - DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textGroup = DE::SHCDE::TEXT_SCENARIO; MACRO_CALL_MEMBER( UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 37, DAT_ButtonY::instance + 25); @@ -94,7 +95,7 @@ namespace UI { DAT_MenuModalComposition2::instance.textIndex = (int)DAT_MissionAestheticsDefinedData::instance .field_0xa64[30][11 + DAT_MapPropertiesState::instance.indexStored]; - DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textGroup = DE::SHCDE::TEXT_SCENARIO; MACRO_CALL_MEMBER( UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 37, DAT_ButtonY::instance + 25); diff --git a/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp b/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp index b9b0e2619b..cfdfd59c0f 100644 --- a/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp +++ b/src/OpenSHC/UI/MenuItems/TriggerInvasion/MenuItemActionHandler_TriggerInvasion_Main.cpp @@ -3,6 +3,7 @@ #include "OpenSHC/Global.func.hpp" #include "OpenSHC/Map/MapPropertiesState.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/UI/Enums/MenuModalType.hpp" #include "OpenSHC/Globals/DAT_ButtonX.hpp" @@ -106,7 +107,7 @@ namespace UI { break; } - DAT_MenuModalComposition2::instance.textGroup = 199; + DAT_MenuModalComposition2::instance.textGroup = DE::SHCDE::TEXT_SCENARIO; DAT_MenuModalComposition2::instance.textIndex = textIndex; MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::setExtraActiveModalDialog, DAT_MenuModalComposition2::ptr)( UI::Enums::MMT_OVERLAY_SLIDER, DAT_ButtonX::instance - 62, DAT_ButtonY::instance + 25); diff --git a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp index f35c74d2e0..f132f3f8a2 100644 --- a/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp +++ b/src/OpenSHC/UI/MenuItems/WaitingForHost/MenuItemActionHandler_WaitingForHost_ConnectToLobby.cpp @@ -1,8 +1,9 @@ +#include "../WaitingForHost.func.hpp" + #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/OS.func.hpp" #include "OpenSHC/Synchrony.func.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" -#include "OpenSHC/UI/MenuItems/WaitingForHost.func.hpp" #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/Commands/GameCommandType.hpp" #include "OpenSHC/DirectPlay/EnumSessionsFlagsEnum.hpp" diff --git a/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp index ea575a9279..501d52afc6 100644 --- a/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp +++ b/src/OpenSHC/UI/MenuViews/HistoricCampaignIntro/MenuView_HistoricCampaignIntro_DoEveryFrame.cpp @@ -1,11 +1,13 @@ +#include "../HistoricCampaignIntro.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" #include "OpenSHC/Audio/mss/SoundSystem.func.hpp" #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/UI/MenuViews/HistoricCampaignIntro.func.hpp" #include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_00eb0b20.hpp" #include "OpenSHC/Globals/DAT_00ed2780.hpp" @@ -70,19 +72,19 @@ namespace UI { switch (DAT_GameCore::instance.historicCampaignNumber) { case 1: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\intro_01.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_INTRO_01_WAV_005AB144, 1); break; case 2: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\intro_02.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_INTRO_02_WAV_005AB12C, 1); break; case 3: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\intro_03.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_INTRO_03_WAV_005AB114, 1); break; case 4: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\intro_04.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_INTRO_04_WAV_005AB0FC, 1); break; } } diff --git a/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp index 16bafb76d2..84f5cb6d2a 100644 --- a/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp +++ b/src/OpenSHC/UI/MenuViews/HistoricCampaignOutro/MenuView_HistoricCampaignOutro_DoEveryFrame.cpp @@ -1,11 +1,13 @@ +#include "../HistoricCampaignOutro.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" #include "OpenSHC/Audio/mss/SoundSystem.func.hpp" #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/Text/TextManager.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/UI/MenuViews/HistoricCampaignOutro.func.hpp" #include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_00eb0b20.hpp" #include "OpenSHC/Globals/DAT_00ed2780.hpp" @@ -89,19 +91,19 @@ namespace UI { switch (DAT_GameCore::instance.historicCampaignNumber) { case 1: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\after_01.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_AFTER_01_WAV_005AB1A4, 1); break; case 2: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\after_02.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_AFTER_02_WAV_005AB18C, 1); break; case 3: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\after_03.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_AFTER_03_WAV_005AB174, 1); break; case 4: MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::playSoundOnStream3Unk, - DAT_SoundSystemState::ptr)("fx\\speech\\after_04.wav", 1); + DAT_SoundSystemState::ptr)(S_FX_SPEECH_AFTER_04_WAV_005AB15C, 1); break; } } diff --git a/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp index f5ba150e4a..1ea948e381 100644 --- a/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp +++ b/src/OpenSHC/UI/MenuViews/HistoricMissionPicture/MenuView_HistoricMissionPicture_DoEveryFrame.cpp @@ -1,8 +1,9 @@ +#include "../HistoricMissionPicture.func.hpp" + #include "OpenSHC/Audio/SFX/SFXState.func.hpp" #include "OpenSHC/Audio/mss/SoundSystem.func.hpp" #include "OpenSHC/Game/GameCore.func.hpp" #include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/UI/MenuViews/HistoricMissionPicture.func.hpp" #include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/UI/Enums/MenuViewType.hpp" From 0de57e74cf293f0dcce8b3bee9e2be4ef2e17828 Mon Sep 17 00:00:00 2001 From: Jake Vawter Date: Mon, 16 Nov 2026 17:12:13 -0500 Subject: [PATCH 4/4] MenuItemActionHandler_General_AdvancedGameOptions: pragma first, chat format string from string-literals Co-Authored-By: Claude Opus 5.5 --- ...ionHandler_General_AdvancedGameOptions.cpp | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp index 7b8aa57fbe..5c2a7f791a 100644 --- a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_AdvancedGameOptions.cpp @@ -1,7 +1,7 @@ -#include "../General.func.hpp" - #pragma warning(disable : 4996) +#include "../General.func.hpp" + #include "OpenSHC/Game/Skirmish.func.hpp" #include "OpenSHC/Synchrony/Commands.func.hpp" #include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" @@ -11,6 +11,7 @@ #include "OpenSHC/UI/MenuModalComposition.func.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/string-literals.hpp" #include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" #include "OpenSHC/Globals/DAT_ButtonW.hpp" @@ -129,28 +130,28 @@ namespace UI { MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( (Commands::GameCommandType)52); if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 0) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 95)); } if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 5) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 96)); } if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 10) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 97)); } if (DAT_GameSynchronyState::instance.skirmishAutoSaveEveryMinutes == 20) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 94), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -172,7 +173,7 @@ namespace UI { DAT_GameSynchronyState::instance.skirmishStrongWalls ^= 1; MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( (Commands::GameCommandType)52); - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 99), DAT_GameSynchronyState::instance.skirmishStrongWalls != 0 @@ -214,7 +215,7 @@ namespace UI { DAT_GameSynchronyState::instance.skirmishNoCowThrowing ^= 1; MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( (Commands::GameCommandType)52); - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)( DE::SHCDE::TEXT_SKIRMISH_MISC, 5), DAT_GameSynchronyState::instance.skirmishNoCowThrowing != 0 @@ -239,13 +240,13 @@ namespace UI { MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( (Commands::GameCommandType)52); if (DAT_GameSynchronyState::instance.skirmishNoDogs != 0) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 6), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13)); } else { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 6), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -268,13 +269,13 @@ namespace UI { MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( (Commands::GameCommandType)52); if (DAT_GameSynchronyState::instance.skirmishExtremeMode != 0) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 13), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13)); } else { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 13), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -297,13 +298,13 @@ namespace UI { MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( (Commands::GameCommandType)52); if (DAT_GameSynchronyState::instance.skirmishExtremeMode != 0) { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 14), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_GAME_OPTIONS, 13)); } else { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 14), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -366,7 +367,7 @@ namespace UI { } switch (DAT_GameSynchronyState::instance.skirmishNoRushSetting) { case 0: { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -374,7 +375,7 @@ namespace UI { break; } case 1: { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -382,7 +383,7 @@ namespace UI { break; } case 2: { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -390,7 +391,7 @@ namespace UI { break; } case 3: { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -398,7 +399,7 @@ namespace UI { break; } case 4: { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, @@ -406,7 +407,7 @@ namespace UI { break; } case 5: { - sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, "%s :%s", + sprintf(DAT_GameSynchronyState::instance.receivedChatMessage, s__s__s_005a228c, MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset, DAT_TextManagerObject::ptr)(DE::SHCDE::TEXT_SKIRMISH_MISC, 7), MACRO_CALL_MEMBER(Text::TextManager_Func::getTextStringInGroupAtOffset,