Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "../General.func.hpp"

#include "OpenSHC/Text/TextManager.func.hpp"
#include "OpenSHC/UI/Rendering.func.hpp"
#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"
#include "OpenSHC/Rendering/Colors/BGR24.hpp"
#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp"
#include "OpenSHC/Rendering/Enums/RenderTarget.hpp"
#include "OpenSHC/Text/TextAlignment.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp"
#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp"
#include "OpenSHC/Globals/DAT_ButtonW.hpp"
#include "OpenSHC/Globals/DAT_ButtonX.hpp"
#include "OpenSHC/Globals/DAT_ButtonY.hpp"
#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp"
#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

using OpenSHC::Rendering::Colors::BGR24;

// FUNCTION: STRONGHOLDCRUSADER 0x004BFFA0
void General::MenuItemRenderFunction_General_EventButtonAndData(int itemIndex, ...)
{
int month;
BGR24 color;
if (itemIndex != -1) {
MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderScenarioButtonWithText)(itemIndex);
return;
}
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton,
AlphaAndButtonSurfaceObj::ptr)(0, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED);
int const textX = DAT_ButtonW::instance / 2 + DAT_ButtonX::instance;
int const textY = DAT_ButtonY::instance + 6;
if (!DAT_ButtonCurrentlyInteracting::instance) {
month = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID]
.header.month;
color = OpenSHC::Rendering::Colors::COL_C2F0EB;
} else {
month = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID]
.header.month;
color = OpenSHC::Rendering::Colors::COL_CCFAFF;
}
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_MONTHS, month + 12),
textX, textY, OpenSHC::Text::TTA_CENTER, color, 18, FALSE, 0);
}

} // namespace MenuItems
} // namespace UI
} // namespace OpenSHC
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
#include "../Roundtable.func.hpp"

#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp"
#include "OpenSHC/Text/TextManager.func.hpp"
#include "OpenSHC/UI/MenuItems/General.func.hpp"
#include "OpenSHC/UI/Rendering.func.hpp"
#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eGM.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"
#include "OpenSHC/IO/Graphics/GmID.hpp"
#include "OpenSHC/Rendering/Enums/RenderTarget.hpp"
#include "OpenSHC/Text/TextAlignment.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_00df423c.hpp"
#include "OpenSHC/Globals/DAT_00df4288.hpp"
#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp"
#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp"
#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp"
#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp"
#include "OpenSHC/Globals/DAT_ButtonX.hpp"
#include "OpenSHC/Globals/DAT_ButtonY.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_MouseState.hpp"
#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"
#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp"
#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"
#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004AEF70
void Roundtable::MenuItemRenderFunction_Roundtable_Main(int itemIndex, ...)
{
int aiType = 0;
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU;
if (itemIndex <= 8) {
int const playerID = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[itemIndex];
if (playerID <= 0) {
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
int const group = DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[playerID];
DAT_ButtonUnknownZero::instance = 1;
if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] != -1
|| DAT_GameSynchronyState::instance.currentAIArray[playerID] != 0) {
if (DAT_GameSynchronyState::instance.isHost) {
DAT_ButtonUnknownZero::instance = 0;
}
if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] == -1) {
aiType = DAT_GameSynchronyState::instance.currentAIArray[playerID];
}
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, playerID + 546,
DAT_ButtonX::instance, DAT_ButtonY::instance);
if (aiType == 0) {
if (DAT_GameCore::instance.lordIcons[playerID] == 0) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 539,
DAT_ButtonX::instance, DAT_ButtonY::instance);
} else if (DAT_GameCore::instance.lordIcons[playerID] == 1) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 540,
DAT_ButtonX::instance, DAT_ButtonY::instance);
} else if (DAT_TextureRenderCoreObject::instance.bitmapFaceSizes[playerID + 19] > 0) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 541,
DAT_ButtonX::instance, DAT_ButtonY::instance);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawBitmapFace,
DAT_TextureRenderCoreObject::ptr)(
playerID + 19, DAT_ButtonX::instance + 4, DAT_ButtonY::instance + 4);
}
} else {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, aiType + 522,
DAT_ButtonX::instance, DAT_ButtonY::instance);
}
if (DAT_00df423c::instance == itemIndex) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox,
DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance, DAT_ButtonY::instance,
DAT_ButtonX::instance + 71, DAT_ButtonY::instance + 71);
}
if (DAT_ButtonCurrentlyInteracting::instance) {
if (DAT_00df423c::instance == 0) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 514,
DAT_ButtonX::instance - 6, DAT_ButtonY::instance - 6,
OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 513, 0);
}
if (DAT_ButtonCurrentlyInteracting::instance) {
DAT_00df4288::instance = 1;
}
}
if (group != 0) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, group * 2 + 493,
DAT_ButtonX::instance - 10, DAT_ButtonY::instance - 8);
}
if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] != -1) {
MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow,
DAT_TextManagerObject::ptr)(DAT_GameSynchronyState::instance.DAT_PlayerNames[playerID],
DAT_ButtonX::instance + 32, DAT_ButtonY::instance + 80, OpenSHC::Text::TTA_CENTER,
DAT_RenderingDefinedData::instance
.ColorTable1[DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[playerID]],
0, 19, FALSE, 0);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
MACRO_CALL_MEMBER(
OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)(
MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset,
DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM,
DAT_GameSynchronyState::instance.currentAIArray[playerID] * 9 + 231
+ DAT_GameSynchronyState::instance.aiVariationArray[playerID]),
DAT_ButtonX::instance + 32, DAT_ButtonY::instance + 80, OpenSHC::Text::TTA_CENTER,
DAT_RenderingDefinedData::instance
.ColorTable1[DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[playerID]],
0, 18, FALSE, 0);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
} else {
if (itemIndex <= 18) {
int const playerID = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[itemIndex - 10];
if (playerID > 0 && DAT_00df423c::instance != 0 && DAT_ButtonCurrentlyInteracting::instance
&& itemIndex - 10 != DAT_00df423c::instance
&& (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] != -1
|| MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::isAIPlayer,
DAT_GameSynchronyState::ptr)(playerID))) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 514,
DAT_ButtonX::instance + 62, DAT_ButtonY::instance - 1,
OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 513, 0);
}
}
if (itemIndex == 20) {
if (DAT_ButtonCurrentlyInteracting::instance) {
DAT_00df4288::instance = 1;
if (DAT_00df423c::instance == 0) {
DAT_ButtonCurrentlyInteracting::instance = FALSE;
}
}
MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderCurrentButtonToScreenMenuWithBlendingUnk)(
(DAT_ButtonBackgroundBlendStrength::instance - 32) * 32 / 32 + 32);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
if (itemIndex == 100 || itemIndex == 101) {
DAT_ButtonUnknownZero::instance = DAT_00df423c::instance != 0;
if (DAT_GameSynchronyState::instance.isHost) {
MACRO_CALL(OpenSHC::UI::MenuItems::General_Func::
MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)();
if (DAT_ButtonCurrentlyInteracting::instance) {
DAT_00df4288::instance = 1;
}
} else {
DAT_ButtonUnknownZero::instance = 1;
}
}
if (itemIndex == 200) {
aiType = 0;
if (DAT_00df423c::instance != 0 && DAT_GameSynchronyState::instance.isHost) {
if (DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[DAT_00df423c::instance] == 0) {
DAT_00df423c::instance = 0;
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
int const playerID
= DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[DAT_00df423c::instance];
if (playerID >= 1) {
int x = DAT_MouseState::instance.screenSpaceX
- DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth;
int y = DAT_MouseState::instance.screenSpaceY
- DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight;
if (y < 4) {
y = 4;
} else if (y > 364) {
y = 364;
}
if (x < 4) {
x = 4;
} else if (x > 724) {
x = 724;
}
if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] == -1) {
aiType = DAT_GameSynchronyState::instance.currentAIArray[playerID];
}
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2,
playerID + 546, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x,
DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y);
if (aiType == 0) {
if (DAT_GameCore::instance.lordIcons[playerID] == 0) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 539,
DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x,
DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y);
} else if (DAT_GameCore::instance.lordIcons[playerID] == 1) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 540,
DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x,
DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y);
} else if (DAT_TextureRenderCoreObject::instance.bitmapFaceSizes[playerID + 19] > 0) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 541,
DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x,
DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawBitmapFace,
DAT_TextureRenderCoreObject::ptr)(playerID + 19,
DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x + 4,
DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y + 4);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
} else {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2,
aiType + 522, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x,
DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y);
}
}
}
}
}
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME;
}

} // namespace MenuItems
} // namespace UI
} // namespace OpenSHC
Loading
Loading