Skip to content
Merged
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,60 @@
#include "../AlliesOrder.func.hpp"

#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp"
#include "OpenSHC/UI/MenuModalComposition.func.hpp"
#include "OpenSHC/Commands/GameCommandType.hpp"
#include "OpenSHC/UI/Enums/MenuModalType.hpp"

#include "OpenSHC/Globals/DAT_EnemyArrayIndex.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_LastTeamMemberIndex.hpp"
#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp"
#include "OpenSHC/Globals/DAT_RequestedGoodsByWhoArray.hpp"
#include "OpenSHC/Globals/DAT_SomeTeamMemberPlayerIDArray.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004B1410
void AlliesOrder::MenuItemActionHandler_AlliesOrder_Main(int button, ...)
{
// -2 shows the allies dialog again
if (button == -2) {
MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog,
DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_ALLIES, FALSE);
return;
}
// buttons 1 to 6 name an enemy from the list BuildEnemyPlayerList made
if (button <= 6 && button - 1 >= DAT_EnemyArrayIndex::instance) {
return;
}
int const allyPlayerID = DAT_SomeTeamMemberPlayerIDArray::instance[DAT_LastTeamMemberIndex::instance];
if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[allyPlayerID] == -1
&& DAT_GameSynchronyState::instance.currentAIArray[allyPlayerID] == 0) {
return;
}
DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = 0;
if (button <= 6) {
DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = DAT_RequestedGoodsByWhoArray::instance[button];
} else {
DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = 0;
}
DAT_GameSynchronyState::instance.DAT_GameCommandParam2 = allyPlayerID;
DAT_GameSynchronyState::instance.DAT_GameCommandParam3
= DAT_GameSynchronyState::instance.currentPlayerSlotID;
DAT_GameSynchronyState::instance.DAT_GameCommandParam4 = button;
MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(
OpenSHC::Commands::GCT_SEND_PLAYER_TO_PLAYER_REQUEST);
// 10 shows the allies dialog again after its order, the others close it
if (button == 10) {
MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog,
DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_ALLIES, FALSE);
} else {
DAT_MenuModalComposition1::instance.activeModalDialogID = OpenSHC::UI::Enums::MMT_NONE;
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#include "../General.func.hpp"

#include "OpenSHC/Text/TextManager.func.hpp"
#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp"
#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/Game/ScenarioEvents/Enums/ScenarioEventType.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/AlphaAndButtonSurfaceObj.hpp"
#include "OpenSHC/Globals/COL_DARK_LIME.hpp"
#include "OpenSHC/Globals/COL_GREYISH_YELLOW.hpp"
#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.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_MapPropertiesState.hpp"
#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"
#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004BA3C0
void General::MenuItemRenderFunction_General_EventSlider(
int slider, int thumbYPos, int value, int thumbHeight, BOOL isDragged)
{
switch (slider) {
case -2:
case -1:
// these two sliders belong to the events that have a duration
switch (DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID]
.data.scenario.ScenarioEventType) {
case OpenSHC::Game::ScenarioEvents::Enums::SET_TRAVELING_FAIR:
case OpenSHC::Game::ScenarioEvents::Enums::SET_PLAGUE:
case OpenSHC::Game::ScenarioEvents::Enums::SET_WHEAT_DISEASE:
case OpenSHC::Game::ScenarioEvents::Enums::SET_HOPS_WEEVIL:
case OpenSHC::Game::ScenarioEvents::Enums::SET_APPLE_BLIGHT:
case OpenSHC::Game::ScenarioEvents::Enums::SET_TREE_FUNGUS:
case OpenSHC::Game::ScenarioEvents::Enums::SET_RABBIT_EXPLOSION:
case OpenSHC::Game::ScenarioEvents::Enums::SET_LION_ATTACK:
case OpenSHC::Game::ScenarioEvents::Enums::SET_BANDITS:
case OpenSHC::Game::ScenarioEvents::Enums::SET_MAD_COWS:
case OpenSHC::Game::ScenarioEvents::Enums::SET_ARCHERS:
case OpenSHC::Game::ScenarioEvents::Enums::SET_THEFT_FROM_GRANARY:
case OpenSHC::Game::ScenarioEvents::Enums::SET_FIRE:
break;
default:
return;
}
break;
case 5:
case 12:
case 18:
case 19:
case 21:
// the other sliders belong to the event one below their number
if (DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID]
.data.scenario.ScenarioEventType
!= slider - 1) {
return;
}
break;
}
DAT_ButtonCurrentlyInteracting::instance = FALSE;
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton,
AlphaAndButtonSurfaceObj::ptr)(-1, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED);
if (!isDragged) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox,
DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance + thumbYPos + 1, DAT_ButtonY::instance + 2,
DAT_ButtonX::instance + thumbYPos + thumbHeight - 2,
DAT_ButtonY::instance + DAT_ButtonH::instance - 4, COL_GREYISH_YELLOW::instance.shortValue);
} else {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox,
DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance + thumbYPos + 1, DAT_ButtonY::instance + 2,
DAT_ButtonX::instance + thumbYPos + thumbHeight - 2,
DAT_ButtonY::instance + DAT_ButtonH::instance - 4, COL_DARK_LIME::instance.shortValue);
}
if (slider == -2 && value == 10) {
// "-"
MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow,
DAT_TextManagerObject::ptr)(s___005a2280, DAT_ButtonX::instance + DAT_ButtonW::instance + 12,
DAT_ButtonY::instance + 6, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18,
FALSE, 0);
return;
}
MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderNumber2, DAT_TextManagerObject::ptr)(value,
DAT_ButtonX::instance + DAT_ButtonW::instance + 12, DAT_ButtonY::instance + 6,
OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18, FALSE, 0);
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "../InGameMenu.func.hpp"

#include "OpenSHC/Input/MouseState.func.hpp"
#include "OpenSHC/Commands/MappersEnum.hpp"
#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_MouseState.hpp"
#include "OpenSHC/Globals/DAT_TileMapState.hpp"
#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00438B60
void InGameMenu::MenuItemActionHandler_InGameMenu_RightClickMenuAndMaybeResets(int unused, ...)
{
DAT_MouseState::instance.mouseBasedEvent = 0;
if (!DAT_ViewportRenderState::instance.viewportState.field_0x0) {
return;
}
if (!DAT_MouseState::instance.rightClickStart
|| (DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU
&& (DAT_GameCore::instance.activeMenuTab.tabType
== OpenSHC::UI::Enums::BASMTT_SIEGETENT_BATTERINGRAM
|| DAT_GameCore::instance.activeMenuTab.tabType
== OpenSHC::UI::Enums::BASMTT_SIEGETENT_SHIELD))) {
if (DAT_MouseState::instance.rightClickState && DAT_MouseState::instance.previewEnabled) {
MACRO_CALL_MEMBER(
OpenSHC::Input::MouseState_Func::updateRightDragCameraControl, DAT_MouseState::ptr)();
return;
}
} else if (DAT_TileMapState::instance.currentMapperCommand == OpenSHC::Commands::M_MAPPER_NULL) {
MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::storeXYAndResetMouseState, DAT_MouseState::ptr)();
DAT_MouseState::instance.previewEnabled = 1;
DAT_GameSynchronyState::instance.editorPlacementPlayerID = 1;
return;
}
DAT_MouseState::instance.previewEnabled = 0;
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#include "../MissionEndscreen.func.hpp"

#include "OpenSHC/UI/MenuItems/General.func.hpp"
#include "OpenSHC/UI/Rendering/ButtonGmData.func.hpp"
#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/Game/GameMode2.hpp"
#include "OpenSHC/Rendering/Enums/RenderTarget.hpp"

#include "OpenSHC/Globals/CHAR_00eb0e44.hpp"
#include "OpenSHC/Globals/DAT_00eb9af8.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_CurrentButtonGmDataIndex.hpp"
#include "OpenSHC/Globals/DAT_FinalResultsOrderByColumn.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"
#include "OpenSHC/Globals/DAT_UIButtonDefinedData.hpp"
#include "OpenSHC/Globals/INT_00ec082c.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004D6D20
void MissionEndscreen::MenuItemRenderFunction_MissionEndscreen_Main(int buttonID, ...)
{
DAT_ButtonUnknownZero::instance = TRUE;
if (DAT_GameCore::instance.gameMode_2 != OpenSHC::Game::GM_SKIRMISH_AND_MULTIPLAYER) {
return;
}
DAT_ButtonUnknownZero::instance = FALSE;
if (CHAR_00eb0e44::instance != 0 && (buttonID == -100 || buttonID == -101)) {
return;
}
if (buttonID == -2) {
return;
}
// tabs -100 and -101: the selected one (0 or 2 for -100, 1 or 3 for -101) is drawn pressed
if ((buttonID == -100 && (INT_00ec082c::instance == 0 || INT_00ec082c::instance == 2))
|| (buttonID == -101 && (INT_00ec082c::instance == 1 || INT_00ec082c::instance == 3))) {
DAT_ButtonUnknownZero::instance = TRUE;
DAT_ButtonCurrentlyInteracting::instance = FALSE;
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU;
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])(
FALSE)
+ 2,
DAT_ButtonX::instance, DAT_ButtonY::instance);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
if (buttonID >= 0 && buttonID <= 15) {
// the results table's column headers: the one the table is sorted by is drawn pressed
if (DAT_ButtonCurrentlyInteracting::instance) {
DAT_00eb9af8::instance = buttonID;
}
if (buttonID == DAT_FinalResultsOrderByColumn::instance) {
DAT_ButtonCurrentlyInteracting::instance = TRUE;
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_SCREEN_MENU;
if (DAT_FinalResultsOrderByColumn::instance < 13) {
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)
+ 14,
DAT_ButtonX::instance, DAT_ButtonY::instance);
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])(TRUE)
+ 1,
DAT_ButtonX::instance, DAT_ButtonY::instance);
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue
= OpenSHC::Rendering::Enums::RT_MAP_GAME;
return;
}
}
if (DAT_ButtonCurrentlyInteracting::instance) {
switch (buttonID) {
case -10:
DAT_00eb9af8::instance = 17;
break;
case -1:
DAT_00eb9af8::instance = 16;
break;
}
}
MACRO_CALL(General_Func::
MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)();
}

}
}
}
Loading
Loading