From f6bd683c3af886a29494fa5a3dc14132d9bf9822 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Sat, 21 Nov 2026 04:58:20 +0100 Subject: [PATCH] reimplement: SHC_3BB0A8C1_0x00494950 100.0% Reimplemented General::MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk, rewritten from the original's listing. gynt's draft is the file on his fork's reimpl/UI-MenuItems-development (first in 4e5711883, newest commit on it b3069fd30); his status line has no number for it. Our draft (791f92c57, then d79d89dc8; 64.2% in the draft PR #328) was his code with a mechanical pass and strcat for the map name's extension. The function answers the two buttons of a confirmation dialog: 22 carries out what the dialog asks (DAT_MenuOptionsActionParameter), 23 declines it. Every path ends in resetMouseState2 except a multiplayer game's return to its lobby. 22 is one switch over the question (-7, 7, 9, 30, 43, 44, 47, 49, 1000, 2000 and a default), dispatched through a compare tree, the byte table at 0x00495084 and the jump table at 0x00495070. One behaviour fix. Question -7 is asked by the scenario description's handler (it stores -7 into DAT_MenuOptionsActionParameter). The draft, like gynt's text, first tested the question with `< 44` on the field as the header types it (undefined4, unsigned) and compiled to an unsigned compare. So -7 never reached its case: it took the other side and ended in the default, and "yes" only closed the dialog. The original compares signed (jg at 0x004949E2) and has -7 in the jump table: it puts the player colours back to their defaults and then runs 7's and 1000's code, which for -7 ends in the single-player map choice. The fix comes from having one switch over all questions; the (int) makes its dispatch the original's. What decided the match, each measured with one thing changed (reccmp in the narrow build described below; the variants were built on the text before its last edits, which do not change the listing): - The switch is on (int) of the field. On the field as it is: 71.4% (26.0% normalized). Main has the same cast on the same field in MenuModalRenderFunction_YesNoDialog (0x00493390). - resetMouseState2 is called once, after the outer switch, and every path leaves by break. The original has a copy of it at every path's end and only the conditional jumps (button neither 22 nor 23, three trail tests) go to the last one. With `reset; return;` written out in every path, which also means the leaving code has to stand after the inner switch (two changes in this variant): 83.7% (71.5%). - The leaving code (7, 1000 and, after the colours, -7) stands inside `case 7: case 1000:`. The compiler puts its first test at 7's place and the rest after the last case, as in the original. - In that code the multiplayer exit tests the field and the local for the game mode is read after the test. Read before it, the game mode and the constant 1 swap esi and edi in the whole function: 95.8% (89.7%). Without a local: 85.4% (85.1%). - Case 30 is one if / else with one break after it. The currentModalDialog test at the end of the leaving code shares the call of clearAnyOtherModalDialogs with 43 (jne at 0x00495056 to 0x00494B4A); with a break in 30's first arm it shares 30's: 99.8% (95.2%). - Case 49 closes the dialog itself and default does the same in its own two lines. With 49 falling into a default written right after it, the compiler folds default's code into 2000's equal end, and default's three jumps and its table entry land after 2000's code (the original has them after 49's, 0x00494D78): 99.2% (95.2%). - In 44 the trail part is `if (isSkirmishTrail == TRUE) { the three trail tests }` with the lobby restore after it; the draft had `!= TRUE` with the restore first: 87.0% (73.5%). The original compares with 1 there (cmp with edi at 0x00494C2C); as a truth test: 99.6% (90.9%). - The menu to return to is chosen by nested if / else in the original's order, with switchToMenuView written in every arm; the compiler shares the call itself (pushes in the arms, one call at 0x00495046). The two mission select views as one call with ?: read 92.8% (79.3%). These compile to the same listing, and the plainer form stands: the three trail tests as one if / else-if chain with one break; `case 22` before `case 23`; gameMode_2 read from the field in 44; the inner cases in ascending order with default last (the compare tree decides where their code goes); no braces around case 22; Game::GameModeInt for the local; FALSE for field_0x6c; and the backup map's name as the string-macros.hpp macro, because the file uses a macro for strcat's inline copy and must not include string-literals.hpp beside it. Measured in a narrow build on main 3458fea34 of this file with the two finished functions it refers to in the sources list, their resolvers on: RenderLoadAndSaveBar (0x00493690), whose address it stores, and resetMouseState2 (0x004689D0), which every path but the multiplayer exit tail-calls. reccmp 100.0, normalized 100.0, and both of them stay at 100.0. Without resetMouseState2's file in the list the function reads 97.2% (100.0% normalized): each tail jump then shows as a trampoline. The draft read 58.3 (65.7 normalized) in the same build without resetMouseState2. Co-authored-by: Gynt Co-Authored-By: Claude Fable 5.2 --- ...General_LaunchOrQuitMultiplayerGameUnk.cpp | 335 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk.cpp new file mode 100644 index 0000000000..f628b09cf8 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk.cpp @@ -0,0 +1,335 @@ +// disable deprecation warnings for strcat +#pragma warning(disable : 4996) + +#include "../General.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/Game/Skirmish/SkirmishLobbySetupStructure.func.hpp" +#include "OpenSHC/IO/FilePackager.func.hpp" +#include "OpenSHC/IO/ResourceManager.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/Map.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/Actions.func.hpp" +#include "OpenSHC/UI/MenuItems/CustomScenarios.func.hpp" +#include "OpenSHC/UI/MenuItems/HistoricCampaignSelect.func.hpp" +#include "OpenSHC/UI/MenuItems/MainMenu.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/DE/SHCDE/eMusicIDs.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Game/GameModeInt.hpp" +#include "OpenSHC/Game/TrailType.hpp" +#include "OpenSHC/IO/FileResourceType.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/string-macros.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapDefinedData.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_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_ResourceManager.hpp" +#include "OpenSHC/Globals/DAT_SoundEffectsHelperData1.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/FilePackagerObj.hpp" +#include "OpenSHC/Globals/SEC_SkirmishLobbySetupStructure.hpp" +#include "OpenSHC/Globals/UI_MissionModeIntent.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00494950 + void General::MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk(int button, ...) + { + switch (button) { + // 22 carries out what the open dialog asks (DAT_MenuOptionsActionParameter), 23 declines it + case 22: + // (int): -7 is a case (on the unsigned field the dispatch has no entry for it) + switch ((int)DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter) { + // the player colours back to their defaults, then on into 7's and 1000's code + case -7: + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } + // leave the game: a multiplayer game for its lobby, the others for the menu they came from + case 7: + case 1000: { + // a local, read after this test (before it, two registers swap; without a local the match is lost) + if (DAT_GameSynchronyState::instance.currentGameMode == Game::GM_MULTIPLAYER) { + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::initMultiplayerLobbyState, + DAT_GameSynchronyState::ptr)(); + return; + } + Game::GameModeInt const gameMode = DAT_GameSynchronyState::instance.currentGameMode; + MACRO_CALL_MEMBER( + Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); + MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + 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); + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::stopAllActiveSounds, DAT_SoundSystemState::ptr)(); + DAT_GameCore::instance.currentlyInGameUnk_0xa4 = FALSE; + if (DAT_GameCore::instance.field_0x6c) { + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 31; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_PROGRESS_BAR_BOX, FALSE); + MACRO_CALL_MEMBER( + UI::MenuModalComposition_Func::renderMenuModal, DAT_MenuModalComposition1::ptr)(); + DAT_WindowAndDirectDraw::instance.pendingBltMode = 1; + MACRO_CALL_MEMBER( + UI::Rendering::WindowAndDirectDraw_Func::renderBltAndFlip, DAT_WindowAndDirectDraw::ptr)(0); + // "auto_backup_map.map" + MACRO_CALL_MEMBER(IO::ResourceManager_Func::resolveResourceFileName, DAT_ResourceManager::ptr)( + IO::FRT_MAPS, STR_AUTOBACKUPMAP); + FilePackagerObj::instance.loadAndSaveBarFunc + = MACRO_CALL(UI::Rendering_Func::RenderLoadAndSaveBar); + MACRO_CALL_MEMBER(IO::FilePackager_Func::readMapOrSavFile, FilePackagerObj::ptr)( + DAT_MapDefinedData::instance.MapSectionAddressArray); + MACRO_CALL_MEMBER(Map::TileMapState_Func::prepareMap, DAT_TileMapState::ptr)(); + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAP_EDITOR_PROPERTIES, 0); + DAT_GameCore::instance.field_0x6c = FALSE; + } else if (UI_MissionModeIntent::instance) { + if (DAT_GameCore::instance.gameMode_2 == Game::GM_CAMPAIGN_MISSION) { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_HISTORIC_MISSION_SELECT, 0); + } else { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_UNUSED_ECONOMIC_MISSION_SELECTUnk, 0); + } + } else if (DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter == 7) { + if (gameMode == Game::GM_SOLITARY) { + if (DAT_GameCore::instance.gameMode_2 == Game::GM_BUILDERUnk) { + if (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == Map::MT_INVASION) { + MACRO_CALL(UI::MenuItems::CustomScenarios_Func:: + MenuItemActionHandler_CustomScenarios_Main)(4); + } else { + MACRO_CALL(UI::MenuItems::MainMenu_Func::MenuItemActionHandler_MainMenu_Main)(3); + } + } else { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MAIN_MENU, 0); + } + } else if (gameMode == Game::GM_SKIRMISH_SINGLE_PLAYER) { + if (DAT_GameCore::instance.gameMode_2 == Game::GM_CAMPAIGN_MISSION) { + MACRO_CALL(UI::MenuItems::HistoricCampaignSelect_Func:: + MenuItemActionHandler_HistoricCampaignSelect_Main)(4); + } else if (!DAT_GameCore::instance.isSkirmishTrail) { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_UNKNOWN_61_RETURN_TO_SKIRMISH_MENUUnk, 0); + } else { + DAT_GameCore::instance.gameSuspended = 0; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_CRUSADE_MAP, 0); + } + } else { + DAT_GameSynchronyState::instance.nextModalDialog + = UI::Enums::MMT_CHOOSE_NETWORK_SERVICE_PROVIDER; + DAT_GameCore::instance.gameMode_2 = Game::GM_SKIRMISH_AND_MULTIPLAYER; + DAT_GameCore::instance.xbowProducible_logic = 1; + DAT_GameCore::instance.pikeProducible_logic = 1; + DAT_GameCore::instance.swordProducible_logic = 1; + DAT_GameCore::instance.bowProducible_logic = 1; + DAT_GameCore::instance.spearProducible_logic = 1; + DAT_GameCore::instance.maceProducible_logic = 1; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MP_CONNECTION, 0); + for (int i = 0; i < countof(DAT_BlendingDefinedData::instance.PlayerSlotUnitColor); ++i) { + DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[i] + = DAT_BlendingDefinedData::instance.DefaultPlayerSlotUnitColor[i]; + } + } + } else { + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_SINGLEPLAYER_MAP_CHOICE, 0); + } + if (DAT_MenuTextInputState::instance.currentModalDialog != UI::Enums::MMT_NO_MENU) { + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + } else { + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::meth_0x4917c0, DAT_MenuTextInputState::ptr)(); + } + break; + } + case 9: + MACRO_CALL_MEMBER( + Synchrony::GameSynchronyState_Func::disconnectDPlay, DAT_GameSynchronyState::ptr)(); + DAT_WindowAndDirectDraw::instance.postWindowCloseMessage = 1; + DAT_GameCore::instance.currentlyInGameUnk_0xa4 = FALSE; + break; + // one if / else, one break (with an early break the currentModalDialog test shares this call, not 43's) + case 30: + if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY + && DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SKIRMISH_SINGLE_PLAYER) { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = DAT_GameCore::instance.mapTimeInTicks; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 + = MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::computeSomeHashOnUnitArray, + DAT_GameSynchronyState::ptr)(); + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = 0; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(Commands::GCT_SAVE); + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + } else { + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 32; + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(UI::Enums::MMT_PROGRESS_BAR_BOX); + } + break; + case 43: + DAT_GameCore::instance.isTimeHalted2 = 0; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_CUSTOM_SCENARIOS, 0); + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + break; + // restart the game + case 44: + MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + 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); + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::stopAllActiveSounds, DAT_SoundSystemState::ptr)(); + DAT_SoundEffectsHelperData1::instance.SEC_Section1079.musicState = 1; + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::setSomeSoundTime, DAT_SoundSystemState::ptr)(); + MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::setupVolumeAndSoundID, DAT_SoundSystemState::ptr)( + DE::SHCDE::MUSIC_TUNE_NARR1); + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + if (DAT_GameSynchronyState::instance.currentGameMode == Game::GM_SKIRMISH_SINGLE_PLAYER) { + if (DAT_GameCore::instance.gameMode_2 != Game::GM_CAMPAIGN_MISSION) { + // compared with TRUE, as the original does (a truth test changes the compare) + if (DAT_GameCore::instance.isSkirmishTrail == TRUE) { + if (DAT_GameCore::instance.currentTrailType == Game::TT_EXTREME) { + if (DAT_GameCore::instance.extremeTrailProgress < 20) { + MACRO_CALL(Game::Skirmish_Func::SetupSkirmishMode)( + DAT_GameCore::instance.extremeTrailProgress); + } + } else if (DAT_GameCore::instance.currentTrailType == Game::TT_WARCHEST) { + if (DAT_GameCore::instance.warchestTrailProgress < 30) { + MACRO_CALL(Game::Skirmish_Func::SetupSkirmishMode)( + DAT_GameCore::instance.warchestTrailProgress); + } + } else if (DAT_GameCore::instance.skirmishTrailProgress < 50) { + MACRO_CALL(Game::Skirmish_Func::SetupSkirmishMode)( + DAT_GameCore::instance.skirmishTrailProgress); + } + break; + } + MACRO_CALL_MEMBER( + Game::Skirmish::SkirmishLobbySetupStructure_Func::restoreSkirmishLobbySetup, + SEC_SkirmishLobbySetupStructure::ptr)(); + MACRO_CALL(UI::Actions_Func::LaunchSkirmishGame)(0); + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_BUILD_MENU, 0); + break; + } + } else { + if (DAT_GameCore::instance.gameMode_2 == Game::GM_BUILDERUnk) { + DAT_GameCore::instance.currentMenuViewType = UI::Enums::MVT_UNKNOWN_49_DOES_NOTHINGUnk; + MACRO_CALL(Map_Func::ResetSomeValuesFunctionUnk)(); + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawColorBox, + DAT_PencilRenderCore::ptr)(0, 0, DAT_WindowAndDirectDraw::instance.resolutionX, + DAT_WindowAndDirectDraw::instance.resolutionY, COL_BLACK::instance.shortValue); + MACRO_CALL(UI::Actions_Func::LaunchSinglePlayerGameUnk)(1); + break; + } + if (DAT_GameCore::instance.gameMode_2 == Game::GM_CAMPAIGN_MISSION) { + MACRO_CALL_MEMBER( + Game::GameCore_Func::removeJesterAndLadyUnitsInCertainMissions, DAT_GameCore::ptr)(); + } + if (DAT_GameCore::instance.gameMode_2 == Game::GM_ECONOMIC_CAMPAIGN_SH1) { + MACRO_CALL_MEMBER(Game::GameCore_Func::removeLadyAndJester, DAT_GameCore::ptr)(); + } + } + DAT_GameCore::instance.gameSuspended = 0; + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); + break; + case 47: + MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + UI::Enums::MVT_MISSION_FINISHED_TRANSITION, 0); + MACRO_CALL_MEMBER( + UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + DAT_GameCore::instance.section1095 = 0; + break; + case 49: + MACRO_CALL_MEMBER( + Map::MapPropertiesState_Func::spawnInvasionEventAttackWave, DAT_MapPropertiesState::ptr)(); + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + break; + case 2000: + // ".map" + strcat(DAT_GameSynchronyState::instance.unknownMapName_01, S__MAP_005A2294); + MACRO_CALL_MEMBER(IO::ResourceManager_Func::resolveResourceFileName, DAT_ResourceManager::ptr)( + IO::FRT_MAPS, DAT_GameSynchronyState::instance.unknownMapName_01); + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + Commands::GCT_START_OR_STOP_SEND_MAP_FILEUnk); + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + break; + default: + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + break; + } + break; + case 23: + if (DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter == 2000) { + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 1; + MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + Commands::GCT_START_OR_STOP_SEND_MAP_FILEUnk); + } + if (DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter == 47) { + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .playerDeathRelated = 0; + MACRO_CALL_MEMBER( + Map::MapPropertiesState_Func::activateScenarioTypeEvents, DAT_MapPropertiesState::ptr)(); + MACRO_CALL_MEMBER( + Map::MapPropertiesState_Func::createScenarioEventForNextMonth, DAT_MapPropertiesState::ptr)(); + DAT_GameCore::instance.section1095 = 2; + } + MACRO_CALL_MEMBER(UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + break; + } + // one call for every path (written out in each path, the compiler merges the paths' ends) + MACRO_CALL_MEMBER(Input::MouseState_Func::resetMouseState2, DAT_MouseState::ptr)(); + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b62540e14f..5ccea97d14 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -24113,7 +24113,7 @@ SHC_3BB0A8C1_0x004948C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00494920 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00494950 | 0.0% | Pending +SHC_3BB0A8C1_0x00494950 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00494DB0 | 0.0% | Pending