diff --git a/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp b/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp new file mode 100644 index 0000000000..4872d04fa0 --- /dev/null +++ b/src/OpenSHC/UI/MenuModals/Roundtable/MenuModalRenderFunction_Roundtable.cpp @@ -0,0 +1,82 @@ +#include "../Roundtable.func.hpp" + +#include "OpenSHC/UI/BottomLeftTextDisplayState.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" + +#include "OpenSHC/Globals/DAT_00df4288.hpp" +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuModals { + + // FUNCTION: STRONGHOLDCRUSADER 0x004B1AC0 + void Roundtable::MenuModalRenderFunction_Roundtable(int x, int y, int width, int height) + { + if (DAT_MouseState::instance.rightClickStart) { + MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE); + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)(2, x + 8, y + 8); + // Players sit in their groups' order; each new group switches between the plain and the tinted shields + int tint = 1; + int group = 0; + // Each seat's shield position at the table, clockwise from the top left + int seatPositions[8][2] = { + { 12, 12 }, + { 216, 12 }, + { 398, 12 }, + { 397, 103 }, + { 398, 193 }, + { 216, 192 }, + { 12, 193 }, + { 12, 103 }, + }; + for (int seat = 1; seat < countof(DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray); ++seat) { + int const player = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[seat]; + if (player < 1 || DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[player] < 1) { + break; + } + if (DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[player] > group) { + ++group; + ++tint; + if (tint > 1) { + tint = 0; + } + } + if (tint == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, + DAT_TextureRenderCoreObject::ptr)( + seat + 2, seatPositions[seat - 1][0] + x, seatPositions[seat - 1][1] + y, 16); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGfxTgxWithBlending, + DAT_TextureRenderCoreObject::ptr)( + seat + 2 + tint * 8, seatPositions[seat - 1][0] + x, seatPositions[seat - 1][1] + y, 20); + } + } + DAT_ButtonX::instance = x + 24; + DAT_ButtonY::instance = y + 380; + DAT_ButtonW::instance = 380; + DAT_ButtonH::instance = 40; + if (DAT_00df4288::instance != 0) { + MACRO_CALL_MEMBER( + OpenSHC::UI::BottomLeftTextDisplayState_Func::renderCurrentlyDisplayedTextConstructionCost, + DAT_BottomLeftTextDisplayState::ptr)(0); + DAT_00df4288::instance = 0; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/RenderTextPageProgressBar.cpp b/src/OpenSHC/UI/Rendering/RenderTextPageProgressBar.cpp new file mode 100644 index 0000000000..5da0348dc0 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/RenderTextPageProgressBar.cpp @@ -0,0 +1,51 @@ +#include "../Rendering.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/WindowAndDirectDraw.func.hpp" + +#include "OpenSHC/Globals/DAT_00ed2784.hpp" +#include "OpenSHC/Globals/DAT_ARRAY_00ed26d0.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + + // FUNCTION: STRONGHOLDCRUSADER 0x004DAFB0 + void Rendering::RenderTextPageProgressBar() + { + DWORD elapsed = timeGetTime() - DAT_ARRAY_00ed26d0::instance[0].x; + if (elapsed > 1000000) { + elapsed = 0; + } + DAT_00ed2784::instance = elapsed / 80; + if (DAT_00ed2784::instance > 580) { + DAT_00ed2784::instance = 580; + } + RECT sourceRect; + sourceRect.left = 0; + sourceRect.right = 540; + sourceRect.top = DAT_00ed2784::instance; + sourceRect.bottom = DAT_00ed2784::instance + 220; + RECT destinationRect; + destinationRect.left = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 20; + destinationRect.top = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 20; + destinationRect.right = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + 560; + destinationRect.bottom = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + 240; + MACRO_CALL_MEMBER(UI::Rendering::WindowAndDirectDraw_Func::bltMapGameSurfaceToScreenMenuSurface, + DAT_WindowAndDirectDraw::ptr)(sourceRect, destinationRect); + // fade the top and bottom edges of the page + for (int i = 0; i < 30; ++i) { + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, DAT_PencilRenderCore::ptr)( + destinationRect.left, destinationRect.top + i * 2, destinationRect.left + 539, + destinationRect.top + i * 2 + 1, i + 2); + } + for (int i = 0; i < 30; ++i) { + int const y = destinationRect.top + 220 - i * 2; + MACRO_CALL_MEMBER(UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, DAT_PencilRenderCore::ptr)( + destinationRect.left, y, destinationRect.left + 539, y + 1, i + 2); + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b62540e14f..fd9a3880a7 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -25989,7 +25989,7 @@ SHC_3BB0A8C1_0x004B1990 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B19E0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B1AC0 | 0.0% | Pending +SHC_3BB0A8C1_0x004B1AC0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B1C30 | 100.0% | Reimplemented @@ -36185,7 +36185,7 @@ SHC_3BB0A8C1_0x004DAE90 | 0.0% | Pending SHC_3BB0A8C1_0x004DAF50 | 100.0% | Reimplemented, only the loop's end address resolves to the next symbol -SHC_3BB0A8C1_0x004DAFB0 | 0.0% | Pending +SHC_3BB0A8C1_0x004DAFB0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004DB0D0 | 100.0% | Reimplemented