diff --git a/cmake/compiler-flags-gl.txt b/cmake/compiler-flags-gl.txt index ea680bf4b3..7a4a662301 100644 --- a/cmake/compiler-flags-gl.txt +++ b/cmake/compiler-flags-gl.txt @@ -114,3 +114,4 @@ src/OpenSHC/UI/Rendering/RenderCurrentNotActiveButtonWithPossibleAlphaTexOnCurre src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_DrawbridgeOpenClose.cpp src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_GatehouseOpenClose.cpp src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_WorkshopWeaponSelection.cpp +src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface.cpp diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_CrusadeMapAndEndscreen.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_CrusadeMapAndEndscreen.cpp new file mode 100644 index 0000000000..e255516201 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_CrusadeMapAndEndscreen.cpp @@ -0,0 +1,66 @@ +#include "../General.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_SkirmishTrailRelated1.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/INT_00ed2bdc.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D8DF0 + void General::MenuItemRenderFunction_General_CrusadeMapAndEndscreen(int button, ...) + { + if (button == 1000) { + // the skip-mission button, with the number of skips (chickens) left + // cleared, then set when hovered (a copy of the hover flag: quick_diff 0.9464 -> 0.8000) + INT_00ed2bdc::instance = FALSE; + if (DAT_ButtonCurrentlyInteracting::instance) { + INT_00ed2bdc::instance = TRUE; + } + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)( + DAT_SkirmishTrailRelated1::instance, DAT_ButtonX::instance + 53, DAT_ButtonY::instance + 98, + OpenSHC::Text::TTA_RIGHT, OpenSHC::Rendering::Colors::COL_C2F0EB, 0, 15, FALSE, 0); + if (!INT_00ed2bdc::instance) { + return; + } + // hovered: a caption 400 and 583 pixels in from the menu's corner; the count is compared signed + // y then x, before the test (x first: quick_diff 0.9464 -> 0.8750) + int const textY = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 583; + int const textX = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 400; + // one call per caption, merged but for the index (an index local: quick_diff 0.9464 -> 0.8468) + if ((int)DAT_SkirmishTrailRelated1::instance > 0) { + // "Skip Current Mission" + 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_CHEATS, 0), + textX, textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 18, FALSE, 0); + return; + } + // "No Chickens Left" + 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_CHEATS, 1), + textX, textY, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 18, FALSE, 0); + return; + } + if (button == 10 || button == 11 || button == 99) { + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + } + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface.cpp new file mode 100644 index 0000000000..aa638e19cf --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface.cpp @@ -0,0 +1,63 @@ +#include "../General.func.hpp" + +#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/DAT_ButtonBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonPictureInGm.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UIButtonDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00463FF0 + void General::MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface() + { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .alphaGmIdUnk_0xc + != 0) { + // a button with an alpha GM is drawn blended, and not at all at blend strength 32 + if (DAT_ButtonBlendStrength::instance != 32) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithBlending, + DAT_TextureRenderCoreObject::ptr)((OpenSHC::IO::Graphics::GmID)DAT_UIButtonDefinedData::instance + .ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .gmId_0x0, + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::ButtonGmData_Func::getPictureNumberInGm, + &DAT_UIButtonDefinedData::instance + .ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance])( + DAT_ButtonCurrentlyInteracting::instance), + DAT_ButtonX::instance, DAT_ButtonY::instance, DAT_ButtonBlendStrength::instance); + } + DAT_CurrentButtonPictureInGm::instance + = DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .pictureInGm_0x4; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)((OpenSHC::DE::SHCDE::eGM)DAT_UIButtonDefinedData::instance + .ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .gmId_0x0, + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::ButtonGmData_Func::getPictureNumberInGm, + &DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance])( + DAT_ButtonCurrentlyInteracting::instance), + DAT_ButtonX::instance, DAT_ButtonY::instance); + DAT_CurrentButtonPictureInGm::instance + = DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .pictureInGm_0x4; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemRenderFunction_GreatestLord_Main.cpp b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemRenderFunction_GreatestLord_Main.cpp new file mode 100644 index 0000000000..ed5fcc325f --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/GreatestLord/MenuItemRenderFunction_GreatestLord_Main.cpp @@ -0,0 +1,49 @@ +#include "../GreatestLord.func.hpp" + +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" + +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_GreatestLordDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_UIButtonDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004AE720 + void GreatestLord::MenuItemRenderFunction_GreatestLord_Main(int button, ...) + { + // the header of the column the table is sorted by (11 for 1, 12 for 0, 10 for -1) gets its own picture + if ((button == 11 && DAT_GreatestLordDefinedData::instance.tableSortBy == 1) + || (button == 12 && DAT_GreatestLordDefinedData::instance.tableSortBy == 0) + || (button == 10 && DAT_GreatestLordDefinedData::instance.tableSortBy == -1)) { + // 14 pictures on from the hovered one, 1 for header 12 + int pictureOffset = 14; + if (button == 12) { + pictureOffset = 1; + } + DAT_ButtonCurrentlyInteracting::instance = TRUE; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)((OpenSHC::DE::SHCDE::eGM)DAT_UIButtonDefinedData::instance + .ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance] + .gmId_0x0, + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::ButtonGmData_Func::getPictureNumberInGm, + &DAT_UIButtonDefinedData::instance.ButtonGmDataArray[DAT_CurrentButtonGmDataIndex::instance])( + TRUE) + + pictureOffset, + DAT_ButtonX::instance, DAT_ButtonY::instance); + return; + } + MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderButtonImageWithBlending)(); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_TriggerPlaceWallCommand.cpp b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_TriggerPlaceWallCommand.cpp new file mode 100644 index 0000000000..0218d20296 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/InGameMenu/MenuItemActionHandler_InGameMenu_TriggerPlaceWallCommand.cpp @@ -0,0 +1,111 @@ +#include "../InGameMenu.func.hpp" + +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/TileMapState.func.hpp" +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" +#include "OpenSHC/Commands/GameCommandType.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" +#include "OpenSHC/Map/Buildings/BuildingFailReasonEnum.hpp" + +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_ScrollingHandler.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x00437ED0 + void InGameMenu::MenuItemActionHandler_InGameMenu_TriggerPlaceWallCommand() + { + if (DAT_GameSynchronyState::instance.syncStatus != 0) { + return; + } + if (DAT_GameSynchronyState::instance.saveRelated != 0) { + return; + } + // only for the wall, wooden wall, stairs and crenel tools + if (DAT_TileMapState::instance.currentMapperCommand != OpenSHC::Commands::M_MAPPER_WALL + && DAT_TileMapState::instance.currentMapperCommand != OpenSHC::Commands::M_MAPPER_WOODWALL + && DAT_TileMapState::instance.currentMapperCommand != OpenSHC::Commands::M_MAPPER_STAIR + && DAT_TileMapState::instance.currentMapperCommand != OpenSHC::Commands::M_MAPPER_CRENAL) { + return; + } + if (!DAT_ViewportRenderState::instance.viewportState.field_0x0) { + return; + } + DAT_MouseState::instance.field_0x1dc = 1000; + // the tile under the mouse + if (DAT_TileMapState::instance.flatViewToggleValue1) { + MACRO_CALL_MEMBER( + OpenSHC::Rendering::ViewportRenderState_Func::setupMouseTileXY2, DAT_ViewportRenderState::ptr)(); + } else { + MACRO_CALL_MEMBER( + OpenSHC::Rendering::ViewportRenderState_Func::setupMouseTileXY, DAT_ViewportRenderState::ptr)(); + } + // a click starts the drag, a held button or a finished drag moves its end, no button puts both ends here + if (DAT_MouseState::instance.leftClickStart) { + DAT_TileMapState::instance.dragStartX = DAT_ViewportRenderState::instance.viewportState.mouseTileX; + DAT_TileMapState::instance.dragStartY = DAT_ViewportRenderState::instance.viewportState.mouseTileY; + } else if (DAT_MouseState::instance.draggingStopped || DAT_MouseState::instance.leftClickState) { + DAT_TileMapState::instance.dragEndX = DAT_ViewportRenderState::instance.viewportState.mouseTileX; + DAT_TileMapState::instance.dragEndY = DAT_ViewportRenderState::instance.viewportState.mouseTileY; + } else { + if (DAT_ScrollingHandler::instance.isScrolling_0x0) { + return; + } + DAT_TileMapState::instance.dragStartX = DAT_ViewportRenderState::instance.viewportState.mouseTileX; + DAT_TileMapState::instance.dragStartY = DAT_ViewportRenderState::instance.viewportState.mouseTileY; + DAT_TileMapState::instance.dragEndX = DAT_ViewportRenderState::instance.viewportState.mouseTileX; + DAT_TileMapState::instance.dragEndY = DAT_ViewportRenderState::instance.viewportState.mouseTileY; + } + DAT_TileMapState::instance.buildingPlacementFailReason + = OpenSHC::Map::Buildings::BFRE_DEFAULT_CANT_PLACE_THAT_THERE; + DAT_TileMapState::instance.wallPlacementCost = 0; + DAT_TileMapState::instance.constructionTileCount = MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::getWallTilesThatCanBeBuilt, DAT_GameState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, OpenSHC::Game::Resources::RT_STONE); + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::validateWallBuildPath, DAT_TileMapState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, DAT_TileMapState::instance.dragStartX, + DAT_TileMapState::instance.dragStartY, DAT_TileMapState::instance.dragEndX, + DAT_TileMapState::instance.dragEndY, (ushort)DAT_TileMapState::instance.currentMapperCommand); + // until the drag stops, only the preview is drawn + if (!DAT_MouseState::instance.draggingStopped) { + DAT_TileMapState::instance.wallDragButtonUp = !DAT_MouseState::instance.leftClickState; + MACRO_CALL_MEMBER(OpenSHC::Map::TileMapState_Func::renderWallDragPreview, DAT_TileMapState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, DAT_TileMapState::instance.dragStartX, + DAT_TileMapState::instance.dragStartY, DAT_TileMapState::instance.dragEndX, + DAT_TileMapState::instance.dragEndY, (ushort)DAT_TileMapState::instance.currentMapperCommand); + return; + } + if (DAT_TileMapState::instance.illegalBuild) { + // the panel feedback text with the fail reason's number + if (DAT_TileMapState::instance.buildingPlacementFailReason + != OpenSHC::Map::Buildings::BFRE_DEFAULT_CANT_PLACE_THAT_THERE) { + MACRO_CALL_MEMBER(OpenSHC::UI::BottomLeftTextDisplayState_Func::setBottomLeftTextDisplayText, + DAT_BottomLeftTextDisplayState::ptr)(1, OpenSHC::DE::SHCDE::TEXT_PANEL_FEEDBACK, + DAT_TileMapState::instance.buildingPlacementFailReason, 0, 100, 6000); + } + return; + } + DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = DAT_TileMapState::instance.dragStartX; + DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = DAT_TileMapState::instance.dragStartY; + DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = DAT_TileMapState::instance.dragEndX; + DAT_GameSynchronyState::instance.DAT_GameCommandParam3 = DAT_TileMapState::instance.dragEndY; + DAT_GameSynchronyState::instance.DAT_GameCommandParam4 = DAT_TileMapState::instance.currentMapperCommand; + DAT_GameSynchronyState::instance.DAT_GameCommandParam5 = DAT_TileMapState::instance.constructionTileCount; + MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)( + OpenSHC::Commands::GCT_PLACE_WALL); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Main.cpp b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Main.cpp new file mode 100644 index 0000000000..8f3d1ff79c --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/RankingGames/MenuItemActionHandler_RankingGames_Main.cpp @@ -0,0 +1,139 @@ +// disable deprecation warnings for strcpy +#pragma warning(disable : 4996) + +#include "../RankingGames.func.hpp" + +#include "OpenSHC/Game/GameCore.func.hpp" +#include "OpenSHC/Game/Skirmish.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/UI/Enums/MenuViewType.hpp" +#include "OpenSHC/string-macros.hpp" + +#include "OpenSHC/Globals/CHAR_ARRAY_00eb9ac8.hpp" +#include "OpenSHC/Globals/DAT_00ed2788.hpp" +#include "OpenSHC/Globals/DAT_00ed3124.hpp" +#include "OpenSHC/Globals/DAT_CurrentMenuID_3.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MissionDefinedData.hpp" +#include "OpenSHC/Globals/DAT_SkMasters2DataArray.hpp" +#include "OpenSHC/Globals/DAT_StoredGameMode.hpp" +#include "OpenSHC/Globals/INT_00eb9b60.hpp" +#include "OpenSHC/Globals/INT_00ed3120.hpp" +#include "OpenSHC/Globals/INT_ARRAY_00eb96d8.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x004D9730 + void RankingGames::MenuItemActionHandler_RankingGames_Main(int button, ...) + { + // buttons -10 and -11 scroll the list, which shows 8 rows + if (button == -10) { + if (INT_00ed3120::instance > 0) { + --INT_00ed3120::instance; + } + return; + } + if (button == -11) { + if (INT_00ed3120::instance < INT_00eb9b60::instance - 8) { + ++INT_00ed3120::instance; + } + return; + } + // buttons 0 to 7 are the rows: a row shows that game's end screen + if (button < 8 && INT_00ed3120::instance + button < INT_00eb9b60::instance) { + int const game = INT_ARRAY_00eb96d8::instance[INT_00ed3120::instance + button]; + DAT_GameSynchronyState::instance.finalResults = DAT_SkMasters2DataArray::instance[game].results; + DAT_GameCore::instance.gameMode_2 = OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER; + DAT_GameSynchronyState::instance.currentGameMode = OpenSHC::Game::GM_SKIRMISH_END_OF_GAME_SINGLE_PLAYER; + if (DAT_SkMasters2DataArray::instance[game].aliveArray[1] != 0) { + // "win_screen_crusader.tgx" + strcpy(CHAR_ARRAY_00eb9ac8::instance, S_WIN_SCREEN_CRUSADER_TGX_005AB024); + if (DAT_SkMasters2DataArray::instance[game].lordType != 0) { + // "win_screen_arab.tgx" + strcpy(CHAR_ARRAY_00eb9ac8::instance, S_WIN_SCREEN_ARAB_TGX_005AB010); + } + } else { + // "lose_screen_crusader.tgx" + strcpy(CHAR_ARRAY_00eb9ac8::instance, S_LOSE_SCREEN_CRUSADER_TGX_005AAFF4); + if (DAT_SkMasters2DataArray::instance[game].lordType != 0) { + // "lose_screen_arab.tgx" + strcpy(CHAR_ARRAY_00eb9ac8::instance, S_LOSE_SCREEN_ARAB_TGX_005AAFDC); + } + } + DAT_GameCore::instance.skipStoreSKMasters = 1; + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_MISSION_FINISHED_TRANSITION, 0); + } + // buttons from 40 on delete the game in that row, after asking + if (button >= 40 && INT_00ed3120::instance + button - 40 < INT_00eb9b60::instance) { + DAT_00ed2788::instance = INT_ARRAY_00eb96d8::instance[INT_00ed3120::instance + button - 40]; + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_DELETE_GAME_RECORD, FALSE); + } + // button 11 goes back where the rankings were opened from + if (button == 11) { + if (DAT_CurrentMenuID_3::instance == OpenSHC::UI::Enums::MVT_CRUSADE_MAP) { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_CRUSADE_MAP, 0); + } else { + MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)( + OpenSHC::UI::Enums::MVT_LOBBY_MENU, 0); + } + DAT_GameSynchronyState::instance.currentGameMode = DAT_StoredGameMode::instance; + return; + } + // headers 20 to 29 sort by columns 1 to 10: again on the same column turns the order round + if (button >= 20 && button <= 29) { + if (DAT_MissionDefinedData::instance.sortColumn != button - 19) { + DAT_MissionDefinedData::instance.sortColumn = button - 19; + DAT_MissionDefinedData::instance.descending = TRUE; + } else { + // (!descending: quick_diff 0.9506 -> 0.9354) + DAT_MissionDefinedData::instance.descending = 1 - DAT_MissionDefinedData::instance.descending; + } + MACRO_CALL(OpenSHC::Game::Skirmish_Func::Skirmish_PrepareLeaderboardView)(); + int lastFirstRow = INT_00eb9b60::instance - 8; + if (lastFirstRow < 0) { + lastFirstRow = 0; + } + if (INT_00ed3120::instance > lastFirstRow) { + INT_00ed3120::instance = lastFirstRow; + } + } + // headers 30 and 31 turn the "Crusader Trail Only" (1) and "Custom Games Only" (2) filters on and off; 0 is + // "All Games" + if (button == 30) { + if (DAT_00ed3124::instance != 1) { + DAT_00ed3124::instance = 1; + } else { + DAT_00ed3124::instance = 0; + } + } else if (button == 31) { + if (DAT_00ed3124::instance != 2) { + DAT_00ed3124::instance = 2; + } else { + DAT_00ed3124::instance = 0; + } + } else { + return; + } + MACRO_CALL(OpenSHC::Game::Skirmish_Func::Skirmish_PrepareLeaderboardView)(); + int lastFirstRow = INT_00eb9b60::instance - 8; + if (lastFirstRow < 0) { + lastFirstRow = 0; + } + if (INT_00ed3120::instance > lastFirstRow) { + INT_00ed3120::instance = lastFirstRow; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index d195ecb365..dfddd24a25 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -12677,7 +12677,7 @@ SHC_3BB0A8C1_0x00437CB0 | 0.0% | Pending SHC_3BB0A8C1_0x00437CC0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00437ED0 | 0.0% | Pending +SHC_3BB0A8C1_0x00437ED0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004380E0 | 100.0% | Reimplemented @@ -19751,7 +19751,7 @@ SHC_3BB0A8C1_0x00463A00 | 0.0% | Pending SHC_3BB0A8C1_0x00463A90 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00463FF0 | 0.0% | Pending +SHC_3BB0A8C1_0x00463FF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004640D0 | 100.0% | Reimplemented @@ -25869,7 +25869,7 @@ SHC_3BB0A8C1_0x004AE0F0 | 0.0% | Pending SHC_3BB0A8C1_0x004AE4F0 | 0.0% | Pending -SHC_3BB0A8C1_0x004AE720 | 0.0% | Pending +SHC_3BB0A8C1_0x004AE720 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004AE7C0 | 100.0% | Reimplemented @@ -36011,7 +36011,7 @@ SHC_3BB0A8C1_0x004D8CB0 | 0.0% | Pending SHC_3BB0A8C1_0x004D8DC0 | 0.0% | Pending -SHC_3BB0A8C1_0x004D8DF0 | 0.0% | Pending +SHC_3BB0A8C1_0x004D8DF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D8EC0 | 0.0% | Pending @@ -36029,7 +36029,7 @@ SHC_3BB0A8C1_0x004D9520 | 0.0% | Pending SHC_3BB0A8C1_0x004D9700 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004D9730 | 0.0% | Pending +SHC_3BB0A8C1_0x004D9730 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004D99F0 | 0.0% | Pending