diff --git a/src/OpenSHC/UI/MenuViews/CrusadeMap/MenuView_CrusadeMap_Prepare.cpp b/src/OpenSHC/UI/MenuViews/CrusadeMap/MenuView_CrusadeMap_Prepare.cpp new file mode 100644 index 0000000000..059669669e --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/CrusadeMap/MenuView_CrusadeMap_Prepare.cpp @@ -0,0 +1,105 @@ +#include "../CrusadeMap.func.hpp" + +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/Game/TrailType.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_SkirmishTrailRelated1.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DWORD_00ed27a8.hpp" +#include "OpenSHC/Globals/DWORD_00ed311c.hpp" +#include "OpenSHC/Globals/INT_00eb9b48.hpp" +#include "OpenSHC/Globals/INT_00ed2bdc.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace CrusadeMap { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D8CB0 + void MenuView_CrusadeMap_Prepare() + { + DWORD_00ed311c::instance = 0; + // the trail's map (one totalLoadedGfx store after picking the name: quick_diff 0.9708 -> 0.9123) + if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_EXTREME) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "shcx_map.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_shcx_map_tgx_005aafcc); + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_WARCHEST) { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "skirmish_trail2.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_skirmish_trail2_tgx_005aafb8); + } else { + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "skirmish_trail.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_skirmish_trail_tgx_005aafa4); + } + MACRO_CALL(OpenSHC::UI::Helpers_Func::LoadTGX_shc_back)(); + // each trail's progress stays within its 50, 30 and 20 missions + if (DAT_GameCore::instance.skirmishTrailProgress > 49) { + DAT_GameCore::instance.skirmishTrailProgress = 49; + } + if (DAT_GameCore::instance.warchestTrailProgress > 29) { + DAT_GameCore::instance.warchestTrailProgress = 29; + } + // fixme: the original clamps the warchest progress here, not the extreme one + if (DAT_GameCore::instance.extremeTrailProgress > 19) { + DAT_GameCore::instance.warchestTrailProgress = 19; + } + INT_00eb9b48::instance = 1; + DWORD_00ed27a8::instance = timeGetTime(); + // three, less one for each mission of the trail skipped with the chicken (-1200), but not below 0 + DAT_SkirmishTrailRelated1::instance = 3; + if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_FIRST_EDITION) { + int const furthestMission = DAT_GameCore::instance.furthestSkirmishTrailMission; + // the counter outside the for (in it: quick_diff 0.9708 -> 0.9379) + int mission = 0; + if (furthestMission > 0) { + for (; mission < furthestMission; ++mission) { + if (DAT_GameCore::instance.skirmishTrailMonthsTakenOrChicken[mission] == -1200) { + --DAT_SkirmishTrailRelated1::instance; + } + } + if (DAT_SkirmishTrailRelated1::instance < 0) { + DAT_SkirmishTrailRelated1::instance = 0; + } + } + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_WARCHEST) { + int const furthestMission = DAT_GameCore::instance.furthestWarchestTrailMission; + int mission = 0; + if (furthestMission > 0) { + for (; mission < furthestMission; ++mission) { + if (DAT_GameCore::instance.warchestTrailMonthsTakenOrChicken[mission] == -1200) { + --DAT_SkirmishTrailRelated1::instance; + } + } + if (DAT_SkirmishTrailRelated1::instance < 0) { + DAT_SkirmishTrailRelated1::instance = 0; + } + } + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_EXTREME) { + int const furthestMission = DAT_GameCore::instance.furthestExtremeTrailMission; + int mission = 0; + if (furthestMission > 0) { + for (; mission < furthestMission; ++mission) { + if (DAT_GameCore::instance.extremeTrailMonthsTakenOrChicken[mission] == -1200) { + --DAT_SkirmishTrailRelated1::instance; + } + } + if (DAT_SkirmishTrailRelated1::instance < 0) { + DAT_SkirmishTrailRelated1::instance = 0; + } + } + } + INT_00ed2bdc::instance = FALSE; + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_DoEveryFrame.cpp new file mode 100644 index 0000000000..7d41dc1637 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/GameLost/MenuView_GameLost_DoEveryFrame.cpp @@ -0,0 +1,169 @@ +#include "../GameLost.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/Rendering/Bink/BinkControlClass.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/MenuItems/CustomScenarios.func.hpp" +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/UI/MenuItems/MainMenu.func.hpp" +#include "OpenSHC/UI/MenuItems/SelectCrusade.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Game/TrailType.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/BOOLEnum_00ed279c.hpp" +#include "OpenSHC/Globals/DAT_BinkControlState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DWORD_00ed27b4.hpp" +#include "OpenSHC/Globals/SEC_SkirmishLobbySetupStructure.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace GameLost { + + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004DC9E0 + void MenuView_GameLost_DoEveryFrame() + { + // the bink test first (the greatest-lord screen first: quick_diff 0.9221 -> 0.9026) + if (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) { + if (DAT_BinkControlState::instance.binkObjPtrArray[0] == NULL) { + DAT_MouseState::instance.draggingStopped = TRUE; + } + } else { + MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderGreatestLordScreen)(); + } + // in a campaign mission, leave 5 seconds after the first frame that gets here + BOOLEnum timedOut = FALSE; + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CAMPAIGN_MISSION + && DAT_GameSynchronyState::instance.currentGameMode + != OpenSHC::Game::GM_SKIRMISH_END_OF_GAME_SINGLE_PLAYER + && DAT_BinkControlState::instance.unknown02_zero[0] != 0) { + if (DWORD_00ed27b4::instance == 0) { + DWORD_00ed27b4::instance = timeGetTime(); + } else if (timeGetTime() - DWORD_00ed27b4::instance > 5000) { + timedOut = TRUE; + } + } + if (!timedOut + && (!DAT_MouseState::instance.draggingStopped + || DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) + && !BOOLEnum_00ed279c::instance) { + return; + } + + // SoundSystem::endSpeechStreamsAndResetLoopFlags (0x00424700), inlined + DAT_SoundSystemState::instance + .streamFlagsUnkAndLoopCount_0x34[OpenSHC::Audio::MSS::enums::SND_STR_SPEECH_2] = 0; + DAT_SoundSystemState::instance + .streamFlagsUnkAndLoopCount_0x34[OpenSHC::Audio::MSS::enums::SND_STR_SPEECH_1] = 0; + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + OpenSHC::Audio::MSS::enums::SND_STR_SPEECH_1); + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::endSoundStream, DAT_SoundSystemState::ptr)( + OpenSHC::Audio::MSS::enums::SND_STR_SPEECH_2); + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::BinkControlClass_Func::stopAllBinkPlayback, DAT_BinkControlState::ptr)(); + + // one shared store at the end, as MSVC copies it into each arm (per arm: quick_diff 0.9221 -> 0.6937) + if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) { + if (DAT_GameSynchronyState::instance.currentGameMode == OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER) { + // SKMasters slots: 0 custom skirmish, 1-50 skirmish trail, 51-80 warchest, 81-100 extreme + // SelectCrusade_Main: 1 skirmish trail, 2 custom skirmish, 3 warchest, 4 extreme + if (!DAT_GameCore::instance.isSkirmishTrail) { + if (!DAT_GameCore::instance.skipStoreSKMasters) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::StoreGameIntoSKMasters)(0); + } + MACRO_CALL( + OpenSHC::UI::MenuItems::SelectCrusade_Func::MenuItemActionHandler_SelectCrusade_Main)( + 2); + MACRO_CALL_MEMBER( + OpenSHC::Game::Skirmish::SkirmishLobbySetupStructure_Func::restoreSkirmishLobbySetup, + SEC_SkirmishLobbySetupStructure::ptr)(); + } + // compared with 1, as the original does + if (DAT_GameCore::instance.isSkirmishTrail == TRUE) { + if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_EXTREME) { + if (!DAT_GameCore::instance.skipStoreSKMasters) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::StoreGameIntoSKMasters)( + DAT_GameCore::instance.extremeTrailProgress + 81); + } + MACRO_CALL(OpenSHC::UI::MenuItems::SelectCrusade_Func:: + MenuItemActionHandler_SelectCrusade_Main)(4); + } else if (DAT_GameCore::instance.currentTrailType == OpenSHC::Game::TT_WARCHEST) { + if (!DAT_GameCore::instance.skipStoreSKMasters) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::StoreGameIntoSKMasters)( + DAT_GameCore::instance.warchestTrailProgress + 51); + } + MACRO_CALL(OpenSHC::UI::MenuItems::SelectCrusade_Func:: + MenuItemActionHandler_SelectCrusade_Main)(3); + } else { + if (!DAT_GameCore::instance.skipStoreSKMasters) { + MACRO_CALL(OpenSHC::Game::Skirmish_Func::StoreGameIntoSKMasters)( + DAT_GameCore::instance.skirmishTrailProgress + 1); + } + MACRO_CALL(OpenSHC::UI::MenuItems::SelectCrusade_Func:: + MenuItemActionHandler_SelectCrusade_Main)(1); + } + } + } else if (DAT_GameSynchronyState::instance.currentGameMode + == OpenSHC::Game::GM_SKIRMISH_END_OF_GAME_SINGLE_PLAYER) { + DAT_GameSynchronyState::instance.currentGameMode = OpenSHC::Game::GM_SKIRMISH_SINGLE_PLAYER; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_RANKING_GAMES, 0); + } else { + // 7 is the "Quit Mission" action + DAT_MenuTextInputState::instance.DAT_MenuOptionsActionParameter = 7; + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk)(22); + if (DAT_GameSynchronyState::instance.isHost) { + MACRO_CALL_MEMBER( + OpenSHC::Game::Skirmish::SkirmishLobbySetupStructure_Func::restoreSkirmishLobbySetup, + SEC_SkirmishLobbySetupStructure::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, + DAT_GameSynchronyState::ptr)(OpenSHC::Commands::GCT_HOST_SHARE_LOBBY_STATE); + } + } + } else if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CAMPAIGN_MISSION) { + MACRO_CALL_MEMBER( + OpenSHC::Game::GameCore_Func::switchToScenarioDescriptionMenuView, DAT_GameCore::ptr)(); + } else if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_ECONOMIC_CAMPAIGN_SH1) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::exitToScenarioDescriptionMenu, DAT_GameCore::ptr)(); + } else if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_BUILDERUnk) { + // a switch, as the original's sub / je (if / else: quick_diff 0.9221 -> 0.9121) + switch (DAT_MapPropertiesState::instance.SEC_U3_MapType2_1) { + case OpenSHC::Map::MT_ECONOMIC: + MACRO_CALL(OpenSHC::UI::MenuItems::MainMenu_Func::MenuItemActionHandler_MainMenu_Main)(3); + break; + default: + MACRO_CALL( + OpenSHC::UI::MenuItems::CustomScenarios_Func::MenuItemActionHandler_CustomScenarios_Main)( + 4); + break; + } + } else { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_MAIN_MENU, 0); + } + DAT_GameCore::instance.skipStoreSKMasters = 0; + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/MapEditorProperties/MenuView_MapEditorProperties_Prepare.cpp b/src/OpenSHC/UI/MenuViews/MapEditorProperties/MenuView_MapEditorProperties_Prepare.cpp new file mode 100644 index 0000000000..9a4a1bd77d --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/MapEditorProperties/MenuView_MapEditorProperties_Prepare.cpp @@ -0,0 +1,82 @@ +#include "../MapEditorProperties.func.hpp" + +#include "OpenSHC/Text/FontSizeClass.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/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextArrayIndexType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_00b960f4.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_MapEditorProperties_ClickedButton.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition3.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" +#include "OpenSHC/Globals/INT_00b95b74.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace MapEditorProperties { + + // FUNCTION: STRONGHOLDCRUSADER 0x0042DFD0 + void MenuView_MapEditorProperties_Prepare() + { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition3::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + DAT_GameCore::instance.currentlyInGameUnk_0xa4 = FALSE; + MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)( + OpenSHC::Text::TAIT_NINE__FILTER_B); + DAT_MapEditorProperties_ClickedButton::instance = 0; + DAT_TextureRenderCoreObject::instance.totalLoadedGfx = 0; + // "frontend_builder2.tgx" + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::loadGfxFile, + DAT_TextureRenderCoreObject::ptr)(s_frontend_builder2_tgx_005a206c); + if (DAT_GameCore::instance.U2_mapType_singleOrMulti != 0) { + // count the players with a first building and clear every player's start goods and the map's + DAT_GameCore::instance.mapU2PlayersCount = 0; + for (int player = 1; player < countof(DAT_GameState::instance.playerDataArray); ++player) { + if (DAT_GameState::instance.playerDataArray[player].buildingEntryInfos[0].id != 0) { + ++DAT_GameCore::instance.mapU2PlayersCount; + } + for (int good = 0; good < countof(DAT_GameState::instance.mapAndTime.startGoods); ++good) { + DAT_GameState::instance.playerDataArray[player].startResources[good] = 0; + DAT_GameState::instance.mapAndTime.startGoods[good] = 0; + } + } + } + INT_00b95b74::instance = 0; + DAT_00b960f4::instance = 0; + // the height of the map's description in pixels (mode 1 only measures) + if (DAT_GameCore::instance.mapLoadedForEditor) { + if (!DAT_GameCore::instance.descriptionUseStringTable) { + INT_00b95b74::instance + = MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::renderMultilineTextUnk, + &DAT_TextManagerObject::instance.fontSizeClassArray[19])( + DAT_GameCore::instance.temporaryTextBufferOfSize1000, 0, 0, 360, + OpenSHC::Rendering::Colors::COL_000000, 0, 1); + } else if (DAT_GameCore::instance.descriptionStringTableIndex != 0) { + INT_00b95b74::instance + = MACRO_CALL_MEMBER(OpenSHC::Text::FontSizeClass_Func::renderMultilineTextUnk, + &DAT_TextManagerObject::instance.fontSizeClassArray[19])( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_MAP_NAMES, + DAT_GameCore::instance.descriptionStringTableIndex), + 0, 0, 360, OpenSHC::Rendering::Colors::COL_000000, 0, 1); + } + } + MACRO_CALL(OpenSHC::UI::Helpers_Func::LoadTGX_shc_back)(); + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/NewMapMapsize/MenuView_NewMapMapsize_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/NewMapMapsize/MenuView_NewMapMapsize_DoEveryFrame.cpp new file mode 100644 index 0000000000..3c03c1c97f --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/NewMapMapsize/MenuView_NewMapMapsize_DoEveryFrame.cpp @@ -0,0 +1,161 @@ +#include "../NewMapMapsize.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MinimapViewState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Map/MapConstants.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace NewMapMapsize { + + // FUNCTION: STRONGHOLDCRUSADER 0x0042F3F0 + void MenuView_NewMapMapsize_DoEveryFrame() + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)(0, + (DAT_WindowAndDirectDraw::instance.resolutionX + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2, + (DAT_WindowAndDirectDraw::instance.resolutionY + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderBanner, DAT_PencilRenderCore::ptr)( + DAT_MenuHandlerState::instance.x + 100, DAT_MenuHandlerState::instance.y + 30, 600, 50); + // "Select New Map Size"; its position named, y first (inline: quick_diff 0.9760 -> 0.7200) + int const titleY = DAT_MenuHandlerState::instance.y + 59; + int const titleX = DAT_MenuHandlerState::instance.x + 400; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_MAPEDIT, 20), + titleX, titleY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 16, FALSE, 0); + + // the minimap preview, centred on (x, y) + int x = DAT_MenuHandlerState::instance.x + 600; + int y = DAT_MenuHandlerState::instance.y + 290; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + int mapSize = DAT_TileMapState::instance.mapSize; + if (mapSize == 0) { + mapSize = OpenSHC::Map::MC_MAP_SIZE_400; + } + int const centerX = x; + int const centerY = y; + DAT_MinimapViewState::instance.needsRedraw = TRUE; + char sizeText[20]; + // "%dx%d" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)(sizeText, s__dx_d_005a22fc, mapSize, mapSize); + // x and y move to the preview's top left corner + int previewSize; + switch (mapSize) { + case 100: + x -= 50; + y -= 50; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 100; + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + x -= 80; + y -= 80; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 160; + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 200; + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + // drawn at half size + x -= 75; + y -= 75; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 150, 150); + previewSize = 150; + break; + default: + // 400 is drawn at half size + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 200, 200); + previewSize = 200; + break; + } + + // a two-pixel black frame around the preview + // default first, as the original lays the arms out; a 100 map gets the default 200 frame + switch (mapSize) { + default: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 100, centerY - 100, centerX + 99, centerY + 100, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 101, centerY - 101, centerX + 100, centerY + 101, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 75, centerY - 75, centerX + 73, centerY + 74, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 76, centerY - 76, centerX + 74, centerY + 75, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 98, centerY - 99, centerX + 99, centerY + 99, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 99, centerY - 100, centerX + 100, centerY + 100, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 78, centerY - 79, centerX + 78, centerY + 77, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 79, centerY - 80, centerX + 79, centerY + 78, COL_BLACK::instance.shortValue); + break; + } + + // the size label at the top right (x += previewSize: quick_diff 0.9760 -> 0.8617) + int const labelX = x + previewSize; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + labelX + - MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::computeTextWidth, DAT_TextManagerObject::ptr)(sizeText, 19) + - 15, + y - 15, labelX, y); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(sizeText, labelX - 5, y - 11, OpenSHC::Text::TTA_RIGHT, + OpenSHC::Rendering::Colors::COL_C2F0EB, OpenSHC::Rendering::Colors::COL_000000, 19, FALSE, 0); + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/Unknown26/MenuView_Unknown26_CampaignRelatedUnk_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/Unknown26/MenuView_Unknown26_CampaignRelatedUnk_DoEveryFrame.cpp new file mode 100644 index 0000000000..196693a106 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/Unknown26/MenuView_Unknown26_CampaignRelatedUnk_DoEveryFrame.cpp @@ -0,0 +1,81 @@ +#include "../Unknown26.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Rendering.func.hpp" +#include "OpenSHC/UI/Credits.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkCount.hpp" +#include "OpenSHC/Globals/DAT_UnknownBinkIndex.hpp" +#include "OpenSHC/Globals/INT_00b95954.hpp" +#include "OpenSHC/Globals/INT_00ed3114.hpp" +#include "OpenSHC/Globals/INT_00ed3144.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace Unknown26 { + + // FUNCTION: STRONGHOLDCRUSADER 0x004E1E70 + void MenuView_Unknown26_CampaignRelatedUnk_DoEveryFrame() + { + if (!MACRO_CALL(OpenSHC::UI::Helpers_Func::TicksSinceCounterStart)()) { + return; + } + if (DAT_MouseState::instance.rightClickStop) { + MACRO_CALL(OpenSHC::UI::Credits_Func::StopCreditsPlaybackAndSounds)(); + } + if (DAT_MouseState::instance.leftClickStart) { + MACRO_CALL(OpenSHC::UI::Credits_Func::EndCreditsSegmentAndAdvanceToNext)(); + } + MACRO_CALL(OpenSHC::Rendering_Func::ProcessCreditsScriptCommands)(); + if (DAT_UnknownBinkIndex::instance < DAT_UnknownBinkCount::instance) { + MACRO_CALL(OpenSHC::Rendering_Func::RenderActiveCreditsElements)(); + } + ++INT_00ed3144::instance; + if (DAT_UnknownBinkIndex::instance < DAT_UnknownBinkCount::instance) { + return; + } + + // the sequence is over: on to the next view + // mission 1000: the intro sequence + if (DAT_GameCore::instance.missionNumber1to20 == 1000) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_INTRO_VIDEO, 0); + return; + } + if (DAT_GameCore::instance.section1066 == 2) { + // past mission 21 first (<= 21 first: quick_diff 0.9057 -> 0.8113) + if (DAT_GameCore::instance.missionNumber1to20 > 21) { + if (INT_00ed3114::instance != 0) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_UNKNOWN_27_CAMPAIGNUnk, 0); + return; + } + // the end credits (switchToMenuView then plays music 38 instead of 15) + INT_00b95954::instance = 1; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_CREDITS, 0); + return; + } + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_UNKNOWN_27_CAMPAIGNUnk, 0); + DAT_GameCore::instance.section1066 = 0; + return; + } + if (DAT_GameCore::instance.missionNumber1to20 == 1) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_UNKNOWN_27_CAMPAIGNUnk, 0); + return; + } + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_SCENARIO_DESCRIPTION, 0); + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/UnusedChooseAvailableKeeps/MenuView_UnusedChooseAvailableKeeps_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/UnusedChooseAvailableKeeps/MenuView_UnusedChooseAvailableKeeps_DoEveryFrame.cpp new file mode 100644 index 0000000000..72e348659c --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/UnusedChooseAvailableKeeps/MenuView_UnusedChooseAvailableKeeps_DoEveryFrame.cpp @@ -0,0 +1,161 @@ +#include "../UnusedChooseAvailableKeeps.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MinimapViewState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Map/MapConstants.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace UnusedChooseAvailableKeeps { + + // FUNCTION: STRONGHOLDCRUSADER 0x0042FAC0 + void MenuView_UnusedChooseAvailableKeeps_DoEveryFrame() + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)(0, + (DAT_WindowAndDirectDraw::instance.resolutionX + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2, + (DAT_WindowAndDirectDraw::instance.resolutionY + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderBanner, DAT_PencilRenderCore::ptr)( + DAT_MenuHandlerState::instance.x + 100, DAT_MenuHandlerState::instance.y + 30, 600, 50); + // "Select Keep Types"; its position named, y first (inline: quick_diff 0.9760 -> 0.7200) + int const titleY = DAT_MenuHandlerState::instance.y + 59; + int const titleX = DAT_MenuHandlerState::instance.x + 400; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_MAPEDIT, 21), + titleX, titleY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 16, FALSE, 0); + + // the minimap preview, centred on (x, y) + int x = DAT_MenuHandlerState::instance.x + 600; + int y = DAT_MenuHandlerState::instance.y + 290; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + int mapSize = DAT_TileMapState::instance.mapSize; + if (mapSize == 0) { + mapSize = OpenSHC::Map::MC_MAP_SIZE_400; + } + int const centerX = x; + int const centerY = y; + DAT_MinimapViewState::instance.needsRedraw = TRUE; + char sizeText[20]; + // "%dx%d" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)(sizeText, s__dx_d_005a22fc, mapSize, mapSize); + // x and y move to the preview's top left corner + int previewSize; + switch (mapSize) { + case 100: + x -= 50; + y -= 50; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 100; + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + x -= 80; + y -= 80; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 160; + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 200; + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + // drawn at half size + x -= 75; + y -= 75; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 150, 150); + previewSize = 150; + break; + default: + // 400 is drawn at half size + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 200, 200); + previewSize = 200; + break; + } + + // a two-pixel black frame around the preview + // default first, as the original lays the arms out; a 100 map gets the default 200 frame + switch (mapSize) { + default: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 100, centerY - 100, centerX + 99, centerY + 100, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 101, centerY - 101, centerX + 100, centerY + 101, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 75, centerY - 75, centerX + 73, centerY + 74, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 76, centerY - 76, centerX + 74, centerY + 75, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 98, centerY - 99, centerX + 99, centerY + 99, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 99, centerY - 100, centerX + 100, centerY + 100, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 78, centerY - 79, centerX + 78, centerY + 77, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 79, centerY - 80, centerX + 79, centerY + 78, COL_BLACK::instance.shortValue); + break; + } + + // the size label at the top right (x += previewSize: quick_diff 0.9760 -> 0.8617) + int const labelX = x + previewSize; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + labelX + - MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::computeTextWidth, DAT_TextManagerObject::ptr)(sizeText, 19) + - 15, + y - 15, labelX, y); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(sizeText, labelX - 5, y - 11, OpenSHC::Text::TTA_RIGHT, + OpenSHC::Rendering::Colors::COL_C2F0EB, OpenSHC::Rendering::Colors::COL_000000, 19, FALSE, 0); + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/UnusedChooseGameType/MenuView_UnusedChooseGameType_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/UnusedChooseGameType/MenuView_UnusedChooseGameType_DoEveryFrame.cpp new file mode 100644 index 0000000000..ba10435f94 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/UnusedChooseGameType/MenuView_UnusedChooseGameType_DoEveryFrame.cpp @@ -0,0 +1,161 @@ +#include "../UnusedChooseGameType.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MinimapViewState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Map/MapConstants.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace UnusedChooseGameType { + + // FUNCTION: STRONGHOLDCRUSADER 0x00430150 + void MenuView_UnusedChooseGameType_DoEveryFrame() + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)(0, + (DAT_WindowAndDirectDraw::instance.resolutionX + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2, + (DAT_WindowAndDirectDraw::instance.resolutionY + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderBanner, DAT_PencilRenderCore::ptr)( + DAT_MenuHandlerState::instance.x + 100, DAT_MenuHandlerState::instance.y + 30, 600, 50); + // "Select Game Type"; its position named, y first (inline: quick_diff 0.9760 -> 0.7200) + int const titleY = DAT_MenuHandlerState::instance.y + 59; + int const titleX = DAT_MenuHandlerState::instance.x + 400; + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_MAPEDIT, 27), + titleX, titleY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, 16, FALSE, 0); + + // the minimap preview, centred on (x, y) + int x = DAT_MenuHandlerState::instance.x + 600; + int y = DAT_MenuHandlerState::instance.y + 290; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + int mapSize = DAT_TileMapState::instance.mapSize; + if (mapSize == 0) { + mapSize = OpenSHC::Map::MC_MAP_SIZE_400; + } + int const centerX = x; + int const centerY = y; + DAT_MinimapViewState::instance.needsRedraw = TRUE; + char sizeText[20]; + // "%dx%d" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)(sizeText, s__dx_d_005a22fc, mapSize, mapSize); + // x and y move to the preview's top left corner + int previewSize; + switch (mapSize) { + case 100: + x -= 50; + y -= 50; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 100; + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + x -= 80; + y -= 80; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 160; + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 200; + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + // drawn at half size + x -= 75; + y -= 75; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 150, 150); + previewSize = 150; + break; + default: + // 400 is drawn at half size + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 200, 200); + previewSize = 200; + break; + } + + // a two-pixel black frame around the preview + // default first, as the original lays the arms out; a 100 map gets the default 200 frame + switch (mapSize) { + default: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 100, centerY - 100, centerX + 99, centerY + 100, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 101, centerY - 101, centerX + 100, centerY + 101, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 75, centerY - 75, centerX + 73, centerY + 74, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 76, centerY - 76, centerX + 74, centerY + 75, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 98, centerY - 99, centerX + 99, centerY + 99, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 99, centerY - 100, centerX + 100, centerY + 100, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 78, centerY - 79, centerX + 78, centerY + 77, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 79, centerY - 80, centerX + 79, centerY + 78, COL_BLACK::instance.shortValue); + break; + } + + // the size label at the top right (x += previewSize: quick_diff 0.9760 -> 0.8617) + int const labelX = x + previewSize; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + labelX + - MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::computeTextWidth, DAT_TextManagerObject::ptr)(sizeText, 19) + - 15, + y - 15, labelX, y); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(sizeText, labelX - 5, y - 11, OpenSHC::Text::TTA_RIGHT, + OpenSHC::Rendering::Colors::COL_C2F0EB, OpenSHC::Rendering::Colors::COL_000000, 19, FALSE, 0); + } + + } + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index bc8541dd21..c1aa4905bb 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8265,7 +8265,7 @@ SHC_3BB0A8C1_0x0042DEB0 | 0.0% | Pending SHC_3BB0A8C1_0x0042DF40 | 0.0% | Pending -SHC_3BB0A8C1_0x0042DFD0 | 0.0% | Pending +SHC_3BB0A8C1_0x0042DFD0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042E0D0 | 0.0% | Pending @@ -8743,7 +8743,7 @@ SHC_3BB0A8C1_0x0042F3C0 | 0.0% | Pending SHC_3BB0A8C1_0x0042F3D0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0042F3F0 | 0.0% | Pending +SHC_3BB0A8C1_0x0042F3F0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042F708 | 0.0% | Pending @@ -9165,7 +9165,7 @@ SHC_3BB0A8C1_0x0042FA10 | 0.0% | Pending SHC_3BB0A8C1_0x0042FAA0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x0042FAC0 | 0.0% | Pending +SHC_3BB0A8C1_0x0042FAC0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0042FDD8 | 0.0% | Pending @@ -9627,7 +9627,7 @@ SHC_3BB0A8C1_0x004300F4 | 0.0% | Pending SHC_3BB0A8C1_0x00430100 | 0.0% | Pending -SHC_3BB0A8C1_0x00430150 | 0.0% | Pending +SHC_3BB0A8C1_0x00430150 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00430468 | 0.0% | Pending @@ -36007,7 +36007,7 @@ SHC_3BB0A8C1_0x004D8BB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8C10 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004D8CB0 | 0.0% | Pending +SHC_3BB0A8C1_0x004D8CB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8DC0 | 0.0% | Pending @@ -36255,7 +36255,7 @@ SHC_3BB0A8C1_0x004DC1C0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DC500 | 0.0% | Pending -SHC_3BB0A8C1_0x004DC9E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DC9E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DCC70 | 100.0% | Reimplemented @@ -36385,7 +36385,7 @@ SHC_3BB0A8C1_0x004E1B30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004E1E30 | 0.0% | Pending -SHC_3BB0A8C1_0x004E1E70 | 0.0% | Pending +SHC_3BB0A8C1_0x004E1E70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004E1F50 | 0.0% | Pending