Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6c48c8c
reimplement: SHC_3BB0A8C1_0x00434300 100.0% Reimplemented
gynt Nov 9, 2026
713edc4
reimplement: SHC_3BB0A8C1_0x004393C0 100.0% Reimplemented
gynt Nov 9, 2026
364e844
reimplement: SHC_3BB0A8C1_0x0043E490 100.0% Reimplemented
gynt Nov 9, 2026
c7f2e64
reimplement: SHC_3BB0A8C1_0x0043E4E0 100.0% Reimplemented
gynt Nov 9, 2026
2accd68
reimplement: SHC_3BB0A8C1_0x0043FBF0 100.0% Reimplemented
gynt Nov 9, 2026
b060a08
reimplement: SHC_3BB0A8C1_0x0043FCB0 100.0% Reimplemented
gynt Nov 9, 2026
2d71227
reimplement: SHC_3BB0A8C1_0x00440770 100.0% Reimplemented
gynt Nov 9, 2026
f17673e
reimplement: SHC_3BB0A8C1_0x00465200 100.0% Reimplemented
gynt Nov 9, 2026
ce1e6c2
reimplement: SHC_3BB0A8C1_0x00465360 100.0% Reimplemented
gynt Nov 9, 2026
fce6d48
reimplement: SHC_3BB0A8C1_0x00465480 100.0% Reimplemented
gynt Nov 9, 2026
6f060eb
reimplement: SHC_3BB0A8C1_0x00465560 100.0% Reimplemented
gynt Nov 9, 2026
cf4724e
reimplement: SHC_3BB0A8C1_0x00465630 100.0% Reimplemented
gynt Nov 9, 2026
f10b586
reimplement: SHC_3BB0A8C1_0x004657B0 100.0% Reimplemented
gynt Nov 9, 2026
0659bc0
reimplement: SHC_3BB0A8C1_0x00465820 100.0% Reimplemented
gynt Nov 9, 2026
2aee7fe
reimplement: SHC_3BB0A8C1_0x004659E0 100.0% Reimplemented
gynt Nov 9, 2026
ec78665
reimplement: SHC_3BB0A8C1_0x00466730 100.0% Reimplemented
gynt Nov 9, 2026
ea4c2e1
reimplement: SHC_3BB0A8C1_0x00466810 100.0% Reimplemented
gynt Nov 9, 2026
8136f61
reimplement: SHC_3BB0A8C1_0x0047CA80 100.0% Reimplemented
gynt Nov 9, 2026
06ef01d
reimplement: SHC_3BB0A8C1_0x0047CC10 100.0% Reimplemented
gynt Nov 9, 2026
c29d8c2
reimplement: SHC_3BB0A8C1_0x0047D070 100.0% Reimplemented
gynt Nov 9, 2026
7c7aaa8
reimplement: SHC_3BB0A8C1_0x0047D100 100.0% Reimplemented
gynt Nov 9, 2026
06ae921
reimplement: SHC_3BB0A8C1_0x0047D410 100.0% Reimplemented
gynt Nov 9, 2026
0a470ce
reimplement: SHC_3BB0A8C1_0x0047FFE0 100.0% Reimplemented
gynt Nov 9, 2026
d9d9537
reimplement: SHC_3BB0A8C1_0x00487200 100.0% Reimplemented
gynt Nov 9, 2026
e902aab
reimplement: SHC_3BB0A8C1_0x00491FD0 100.0% Reimplemented
gynt Nov 9, 2026
15127df
reimplement: SHC_3BB0A8C1_0x004B1990 100.0% Reimplemented
gynt Nov 9, 2026
2ac00b2
reimplement: SHC_3BB0A8C1_0x004B8990 100.0% Reimplemented
gynt Nov 9, 2026
a777ced
reimplement: SHC_3BB0A8C1_0x004B8A50 100.0% Reimplemented
gynt Nov 9, 2026
9f5c170
reimplement: SHC_3BB0A8C1_0x004BAD70 100.0% Reimplemented
gynt Nov 9, 2026
289c1b4
reimplement: SHC_3BB0A8C1_0x004BAE30 100.0% Reimplemented
gynt Nov 9, 2026
1371f4e
reimplement: SHC_3BB0A8C1_0x004BAE80 100.0% Reimplemented
gynt Nov 9, 2026
0af8ca8
reimplement: SHC_3BB0A8C1_0x004BB740 100.0% Reimplemented
gynt Nov 9, 2026
8a2c76b
reimplement: SHC_3BB0A8C1_0x004D9230 100.0% Reimplemented
gynt Nov 9, 2026
c0a1517
fix: main's names and types since gynt's base, in 4 of the batch's files
kotijekriv Nov 9, 2026
fbc7046
style: the review asks over the batch: decimals, compound assignment,…
kotijekriv Nov 9, 2026
1398d90
style: no imported plate comments
kotijekriv Nov 9, 2026
5df90c6
style: names for the decompiler's locals, // comments, colours by nam…
kotijekriv Nov 9, 2026
806bf5e
style: the new loops step with ++i up to countof
kotijekriv Nov 9, 2026
b3917f1
headers: GameCommandType values 33 and 37 as GCT_UNKNOWN_33 and GCT_U…
kotijekriv Nov 9, 2026
191ff07
headers: SoundEffectID values 140 and 142 as SEID_UNKNOWN_0x8C and SE…
kotijekriv Nov 9, 2026
d21f2af
headers: TextArrayIndexType value 13 as TAIT_UNKNOWN_13
kotijekriv Nov 9, 2026
e77e69a
style: the review's names, enum names, casts, early returns and inclu…
kotijekriv Nov 9, 2026
b2b5781
style: the second review's names, TAIT names, row counts, comments an…
kotijekriv Nov 9, 2026
87254f5
status: 0x004393C0 says which tail call target differs
kotijekriv Nov 9, 2026
4743fd3
MenuItems backlog: the last comments, one include, one empty default
kotijekriv Nov 9, 2026
d3b8b6b
status: 0x004393C0's remark in main's wording
kotijekriv Nov 9, 2026
989a567
Merge main (d5d965db8) into reimpl/UI-gynt-backlog-MenuItems-1
kotijekriv Nov 9, 2026
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,42 @@
#include "../BuildMenu.func.hpp"

#include "OpenSHC/Map/Units/UnitsState.func.hpp"
#include "OpenSHC/Map/Units/UnitTypeInt.hpp"

#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp"
#include "OpenSHC/Globals/DAT_UnitsState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {
using OpenSHC::Map::Units::UnitTypeInt;

// FUNCTION: STRONGHOLDCRUSADER 0x004393C0
void BuildMenu::MenuItemActionHandler_BuildMenu_CurrentlySelectedTroops(int slotID, ...)
{
DAT_UnitsState::instance.unitControlsRelated = 1;
// 20 selection slots: slotID 0-19 keeps only a slot's unit type selected, 20-39 drops it
if (slotID < 20) {
UnitTypeInt const unitType
= DAT_RenderingDefinedData::instance
.SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID]];
MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueClickNavigateMenuOrEscape,
DAT_UnitsState::ptr)(unitType);
MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionForUnitType,
DAT_UnitsState::ptr)(unitType);
MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::recountUnitsInSelection, DAT_UnitsState::ptr)();
return;
}
UnitTypeInt const unitType
= DAT_RenderingDefinedData::instance
.SelectionSlotUnitTypes[DAT_UnitsState::instance.selectionSlots[slotID - 20]];
MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::queueUnitTypeCommand, DAT_UnitsState::ptr)(
unitType);
MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::filterUnitSelectionExcludeUnitType,
DAT_UnitsState::ptr)(unitType);
MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::recountUnitsInSelection, DAT_UnitsState::ptr)();
}

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

#include "OpenSHC/UI/Enums/BuildMenuTabType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_MinimapViewState.hpp"
#include "OpenSHC/Globals/DAT_TileMapState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00434300
void BuildMenu::MenuItemRenderFunction_BuildMenu_MiniMapInteraction(int unused, ...)
{
if (DAT_ButtonCurrentlyInteracting::instance
&& DAT_GameCore::instance.currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU
&& (DAT_GameCore::instance.activeMenuTab.buildMenuTab == OpenSHC::UI::Enums::BMTT_SOLDIERS
|| DAT_TileMapState::instance.shiftRelated0or3 == 1)) {
DAT_MinimapViewState::instance.minimapClickEnabled = TRUE;
return;
}
DAT_MinimapViewState::instance.minimapClickEnabled = FALSE;
}

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

#include "OpenSHC/Game.func.hpp"
#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp"
#include "OpenSHC/UI/Helpers.func.hpp"
#include "OpenSHC/Commands/GameCommandType.hpp"
#include "OpenSHC/Game/GameMode2.hpp"
#include "OpenSHC/Map/Buildings/BuildingType.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

using OpenSHC::Map::Buildings::BuildingType;

// FUNCTION: STRONGHOLDCRUSADER 0x00465820
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_ChangeRations(int rations, ...)
{
if (DAT_GameCore::instance.gameMode_2 == OpenSHC::Game::GM_CRUSADER_TUTORIAL) {
if (!MACRO_CALL(OpenSHC::Game_Func::Tutorial_IsActionAllowed)(3, rations)) {
MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialHintActiveWithTimestamp)();
return;
}
MACRO_CALL(OpenSHC::UI::Helpers_Func::SetTutorialBuildingActionState)(12, (BuildingType)rations);
}
DAT_GameSynchronyState::instance.DAT_GameCommandParam0 = rations;
MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(
OpenSHC::Commands::GCT_CHANGE_RATIONS);
DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]
.rationsSetting3 = rations;
DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]
.timeTaxesOrRationsChange = timeGetTime();
}

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

#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp"
#include "OpenSHC/Commands/GameCommandType.hpp"

#include "OpenSHC/Globals/DAT_BuildingsState.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00465360
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_DrawbridgeOpenClose(
int openOrClose, ...)
{
DAT_GameSynchronyState::instance.DAT_GameCommandParam0
= DAT_BuildingsState::instance.menuSelectedBuildingID;
DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = openOrClose;
DAT_GameSynchronyState::instance.DAT_GameCommandParam2
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid;
MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(
OpenSHC::Commands::GCT_UNKNOWN_37);
DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]
.gateOpenOrCloseClick = openOrClose;
}

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

#include "OpenSHC/Audio/SFX/SFXState.func.hpp"
#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp"
#include "OpenSHC/Audio/SFX/SoundEffectID.hpp"
#include "OpenSHC/Commands/GameCommandType.hpp"

#include "OpenSHC/Globals/DAT_BuildingsState.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_SFXState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00465480
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_GatehouseOpenClose(int openOrClose, ...)
{
DAT_GameSynchronyState::instance.DAT_GameCommandParam0
= DAT_BuildingsState::instance.menuSelectedBuildingID;
DAT_GameSynchronyState::instance.DAT_GameCommandParam1 = openOrClose;
DAT_GameSynchronyState::instance.DAT_GameCommandParam2
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].uid;
MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::queueCommand, DAT_GameSynchronyState::ptr)(
OpenSHC::Commands::GCT_OPEN_OR_CLOSE_GATE);
DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]
.openOrCloseGateClick = openOrClose;
if (openOrClose == 10) {
MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)(
OpenSHC::Audio::SFX::SEID_UNKNOWN_0x8C);
}
if (openOrClose == 11) {
MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)(
OpenSHC::Audio::SFX::SEID_UNKNOWN_0x8E);
}
}

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

#include "OpenSHC/Globals/DAT_BuildingsState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00466810
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderDelay(
int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue)
{
int const buildingID = DAT_BuildingsState::instance.menuSelectedBuildingID;
switch (scrollbarEvent) {
case 1:
*minValue = 0;
*maxValue = 24000;
*currentValue = DAT_BuildingsState::instance.buildings[buildingID].outpostRelatedUnk3;
return;
case 2:
case 3:
DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk3 = (short)*currentValue;
return;
case 4:
*currentValue
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk3;
return;
case 5: {
// through a pointer, as the original does (direct field writes: quick_diff 0.8723 -> 0.4719)
short const delay
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk3;
short* const delayField
= &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk3;
if (delay > 0) {
*delayField = delay - 1;
}
*currentValue = *delayField;
return;
}
case 6: {
short const delay
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk3;
short* const delayField
= &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk3;
if (delay < 24000) {
*delayField = delay + 1;
}
*currentValue = *delayField;
}
}
}

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

#include "OpenSHC/Globals/DAT_BuildingsState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x00466730
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_OutpostSliderSize(
int unused, int scrollbarEvent, int* minValue, int* maxValue, int* currentValue)
{
int const buildingID = DAT_BuildingsState::instance.menuSelectedBuildingID;
switch (scrollbarEvent) {
case 1:
*minValue = 0;
*maxValue = 5;
*currentValue = DAT_BuildingsState::instance.buildings[buildingID].outpostRelatedUnk2;
return;
case 2:
case 3:
DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk2 = (short)*currentValue;
return;
case 4:
*currentValue
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk2;
return;
case 5: {
// through a pointer, as the original does (direct field writes: quick_diff 0.8723 -> 0.4719)
short const size
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk2;
short* const sizeField
= &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk2;
if (size > 0) {
*sizeField = size - 1;
}
*currentValue = *sizeField;
return;
}
case 6: {
short const size
= DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk2;
short* const sizeField
= &DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID]
.outpostRelatedUnk2;
if (size < 5) {
*sizeField = size + 1;
}
*currentValue = *sizeField;
}
}
}

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

#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/Game/GameStateStructures.func.hpp"
#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameState.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

// FUNCTION: STRONGHOLDCRUSADER 0x004659E0
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_SelectBuySellGoods(
int resourceType, ...)
{
if (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::isResourceTypeTradeable, DAT_GameState::ptr)(
(Game::Resources::ResourceType)resourceType)) {
DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]
.marketSelectedResourceType = resourceType;
DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = UI::Enums::BASMTT_MARKETPLACE_TRADE;
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0);
}
}

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

#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/UI/Helpers.func.hpp"
#include "OpenSHC/Game/GameMode2.hpp"
#include "OpenSHC/Map/Buildings/BuildingType.hpp"
#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/INT_00b96120.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuItems {

using Map::Buildings::BuildingType;

// FUNCTION: STRONGHOLDCRUSADER 0x0043E490
void BuildingAndStatusMenu::MenuItemActionHandler_BuildingAndStatusMenu_StatusMenuButtons(int tabType, ...)
{
if (tabType == UI::Enums::BASMTT_STATUS_OVERVIEW
&& DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo == UI::Enums::BASMTT_STATUS_FOOD
&& INT_00b96120::instance == UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP) {
tabType = UI::Enums::BASMTT_GRANARY_OR_MPMENU_TCPIP;
}
DAT_GameCore::instance.buildingandstatusmenuMenuTabToSwitchTo = tabType;
MACRO_CALL_MEMBER(Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
UI::Enums::MVT_BUILDING_AND_STATUS_MENU, 0);
if (DAT_GameCore::instance.gameMode_2 == Game::GM_CRUSADER_TUTORIAL
&& tabType != UI::Enums::BASMTT_STATUS_OVERVIEW) {
MACRO_CALL(UI::Helpers_Func::SetTutorialBuildingActionState)(15, (BuildingType)tabType);
}
}

}
}
}
Loading
Loading