Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f69d2a6
reimplement: SHC_3BB0A8C1_0x00431B60 100.0% Reimplemented
kotijekriv Nov 8, 2026
1262303
drawHeaderTextBanner's callers name their text group
kotijekriv Nov 8, 2026
bf6cc6e
header: drawHeaderTextBanner's textGroupIndex is an eTextSections
kotijekriv Nov 8, 2026
db68fc5
drawHeaderTextBanner takes the eTextSections its header declares
kotijekriv Nov 8, 2026
2aec12b
reimplement: SHC_3BB0A8C1_0x004F4EF0 100.0% Reimplemented
kotijekriv Nov 9, 2026
5d8a903
reimplement: SHC_3BB0A8C1_0x004D5780 100.0% Reimplemented
kotijekriv Nov 9, 2026
b445ba1
reimplement: SHC_3BB0A8C1_0x005119C0 100.0% Reimplemented
kotijekriv Nov 9, 2026
88ff943
reimplement: SHC_3BB0A8C1_0x00501110 100.0% Reimplemented
kotijekriv Nov 9, 2026
5575c21
reimplement: SHC_3BB0A8C1_0x004F4C80 100.0% Reimplemented
kotijekriv Nov 9, 2026
979f30a
reimplement: SHC_3BB0A8C1_0x004F6A80 100.0% Reimplemented
kotijekriv Nov 9, 2026
b0b8cfc
reimplement: SHC_3BB0A8C1_0x004AA480 100.0% Reimplemented
kotijekriv Nov 9, 2026
031add6
reimplement: SHC_3BB0A8C1_0x00491680 100.0% Reimplemented
kotijekriv Nov 9, 2026
6596c6f
reimplement: SHC_3BB0A8C1_0x004B6320 100.0% Reimplemented
kotijekriv Nov 9, 2026
a7ebd39
reimplement: SHC_3BB0A8C1_0x004B61F0 100.0% Reimplemented
kotijekriv Nov 9, 2026
5383a12
reimplement: SHC_3BB0A8C1_0x004B7300 100.0% Reimplemented
kotijekriv Nov 9, 2026
a5781f4
reimplement: SHC_3BB0A8C1_0x00464300 100.0% Reimplemented
kotijekriv Nov 9, 2026
c138819
reimplement: SHC_3BB0A8C1_0x00464370 100.0% Reimplemented
kotijekriv Nov 9, 2026
6905948
header: BuildMenuTabType gets BMTT_UNKNOWN_62
kotijekriv Nov 9, 2026
23c7f46
header: SoundEffectID gets SEID_UNKNOWN_0x67
kotijekriv Nov 9, 2026
85b9d29
UI: banner texts, BMTT_UNKNOWN_62 and SEID_UNKNOWN_0x67 in use, unuse…
kotijekriv Nov 9, 2026
2b4a875
MenuView_BuildMenu_DoInitial: the fixme only where the list is reset …
kotijekriv Nov 9, 2026
3bae121
Merge main (d5d965db8) into reimpl/UI-A-round37-100
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
4 changes: 4 additions & 0 deletions cmake/compiler-flags-gl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_RenderCurrentBut
src/OpenSHC/UI/DisplayElements/RenderTimeUntilDefeatDisplayElement.cpp
src/OpenSHC/UI/DisplayElements/GetIfDisplayElementStateNotZero.cpp
src/OpenSHC/UI/DisplayElements/FindDisplayElementWithID.cpp
src/OpenSHC/UI/HoveredState/clearHoveredState.cpp
src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp
src/OpenSHC/UI/Rendering/RenderCurrentButtonOnScreenMenu.cpp
src/OpenSHC/UI/Rendering/RenderCurrentButtonToScreenMenuWithBlendingUnk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "../BottomLeftTextDisplayState.func.hpp"

#include "OpenSHC/Globals/DAT_TextRelatedTime.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x004F4EF0
void BottomLeftTextDisplayState::hasPassedCountdownOrDuration()
{
if (this->currentlyDisplayedTextIsDisplayedUnk != 0) {
if (this->textMessageDurationUnk == 0) {
this->textMessageDurationUnk = -1;
} else if (this->textMessageDurationUnk == -1
|| timeGetTime() - this->textMessageTime > (DWORD)this->textMessageDurationUnk) {
this->currentlyDisplayedTextIsDisplayedUnk = 0;
this->unknownCountdown01 = 1;
}
} else if (this->unknownCountdown01 != 0) {
--this->unknownCountdown01;
}
DWORD const now = timeGetTime();
DWORD const previousTime = DAT_TextRelatedTime::instance;
DAT_TextRelatedTime::instance = now;
if (previousTime != 0) {
this->countdown -= now - previousTime;
}
}

}
}
27 changes: 27 additions & 0 deletions src/OpenSHC/UI/GreatestLord/ComputeSkMasterScore.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "../GreatestLord.func.hpp"

#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x004D5780
int GreatestLord::ComputeSkMasterScore(int playerID)
{
int score = DAT_GameSynchronyState::instance.finalResults.finalBuildingsDestroyedWeighted[playerID] * 100
+ DAT_GameSynchronyState::instance.finalResults.finalGold[playerID] / 10
+ DAT_GameSynchronyState::instance.finalResults.finalTroopsKilledWeighted[playerID];
score += DAT_GameSynchronyState::instance.finalResults.finalKilledLords[playerID] * score / 4;
int months = (DAT_GameSynchronyState::instance.finalResults.tail.tail1.yearEnd
- DAT_GameSynchronyState::instance.finalResults.tail.tail1.yearStart)
* 12
- DAT_GameSynchronyState::instance.finalResults.tail.tail1.monthStart
+ DAT_GameSynchronyState::instance.finalResults.tail.tail1.monthEnd;
if (months < 1) {
months = 1;
}
return score * 200 / (months + 200);
}

}
}
14 changes: 14 additions & 0 deletions src/OpenSHC/UI/HoveredState/Constructor_HoveredState.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "../HoveredState.func.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x005119C0
HoveredState* HoveredState::Constructor_HoveredState()
{
MACRO_CALL_MEMBER(OpenSHC::UI::HoveredState_Func::clearHoveredState, this)();
return this;
}

}
}
35 changes: 35 additions & 0 deletions src/OpenSHC/UI/HoveredState/createHoverStateElement.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "../HoveredState.func.hpp"

#include "OpenSHC/Game/GameMode.hpp"

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

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x00501110
void HoveredState::createHoverStateElement(int x, int y, MappersEnum type, int size, int flag)
{
if (DAT_GameSynchronyState::instance.currentGameMode == Game::GM_SOLITARY) {
return;
}
for (int i = 0; i < countof(this->elements); ++i) {
if (this->elements[i].type == Commands::M_MAPPER_NULL) {
this->elements[i].x = x;
this->elements[i].y = y;
this->elements[i].type = type;
this->elements[i].size = size;
this->elements[i].time
= DAT_GameCore::instance.mapTimeInTicks + DAT_GameSynchronyState::instance.commandDelay + 5;
if (flag >= 80) {
flag = 15;
}
this->elements[i].rotationOrExtraInfo = flag;
return;
}
}
}

}
}
30 changes: 30 additions & 0 deletions src/OpenSHC/UI/MenuHandlerState/setupMenuForRendering.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "../MenuHandlerState.func.hpp"

#include "OpenSHC/UI/Menu.func.hpp"
#include "OpenSHC/UI/Enums/MenuItemHandleState.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x004F6A80
void MenuHandlerState::setupMenuForRendering(MenuViewType menuID)
{
// a pointer over the pairs: indexing the map measures lower (quick_diff 1.0000 -> 0.3636)
for (MenuIDMenuElementAddressPair* pair = this->pointerToMenuIDMenuElementAddressMap;
pair->menuID != OpenSHC::UI::Enums::MVT_MENUVIEWID_MENU_PAIR_ENDMARKER; ++pair) {
if (pair->menuID == menuID) {
Menu* const menu = pair->menuAddress;
this->currentMenu = menu;
MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::handleMenuItems, menu)(
OpenSHC::UI::Enums::MIHS_RESET_MENU_ITEM_STATEUnk);
menu->zero = 0;
// currentMenu is read again for these two, as the original does
this->currentMenu->one = 1;
MACRO_CALL_MEMBER(OpenSHC::UI::Menu_Func::loadMenuElements, this->currentMenu)(0);
return;
}
}
}

}
}
28 changes: 28 additions & 0 deletions src/OpenSHC/UI/MenuHandlerState/startBuildMenuTransition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "../MenuHandlerState.func.hpp"

#include "OpenSHC/Audio/SFX/SFXState.func.hpp"
#include "OpenSHC/Audio/SFX/SoundEffectID.hpp"

#include "OpenSHC/Globals/DAT_SFXState.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x004F4C80
void MenuHandlerState::startBuildMenuTransition(int transitionDuration)
{
this->buildMenuTransitionStartTime_0x30 = timeGetTime();
this->buildMenuTransitionDuration_0x34 = transitionDuration;
this->isBuildMenuTransitioning_0x18 = TRUE;
this->buildMenuTransitionProgress_0x38 = 0;
if (this->buildMenuTransitionDirection_0x2c < 0) {
this->buildMenuTransitionDirection_0x2c = 1;
} else {
this->buildMenuTransitionDirection_0x2c = -1;
}
MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)(
OpenSHC::Audio::SFX::SEID_UNKNOWN_0x67);
}

}
}
40 changes: 40 additions & 0 deletions src/OpenSHC/UI/MenuModalComposition/setSliderParameters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "../MenuModalComposition.func.hpp"

#include "OpenSHC/Globals/Menu_OverlaySlider.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x004AA480
void MenuModalComposition::setSliderParameters(
int minimum, int maximum, int value, undefined* destination, NoArgCallback* callbackFunction)
{
int const range = maximum - minimum;
this->sliderMinimum = minimum;
this->sliderMaximum = maximum;
if (200 < range) {
// ranges wider than 200 are compressed: the lowest fifth of the values takes 4 slider steps each
int const offset = value - minimum;
// stored first and overwritten below, as the original does
this->sliderValue = offset;
if (offset > range / 5) {
this->sliderValue = range * 3 / 5 + offset;
} else {
this->sliderValue = offset * 4;
}
if (value == maximum) {
this->sliderValue = range * 3 / 5 - minimum + maximum;
}
} else {
this->sliderValue = value;
}
this->destination = (int*)destination;
this->destination2 = NULL;
Menu_OverlaySlider::instance.one = 1;
this->textGroup = -1;
this->textIndex = -1;
this->sliderCallbackFunction = callbackFunction;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/CreateOrTriggerInvasion.func.hpp"
#include "../CreateOrTriggerInvasion.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x004AB540
void MenuModalRenderFunction_CreateOrTriggerInvasion(int x, int y, int width, int height)
{
// "Invasion"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(199, 0x2e, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 46, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/DisableTroops.func.hpp"
#include "../DisableTroops.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x004ABCB0
void MenuModalRenderFunction_DisableTroops(int x, int y, int width, int height)
{
// "Troops"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(199, 0xbc, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 188, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/DisableWeapon.func.hpp"
#include "../DisableWeapon.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x004ABCE0
void MenuModalRenderFunction_DisableWeapon(int x, int y, int width, int height)
{
// "Weapons"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(199, 0xbd, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 189, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/EnterTitleOnGameStart.func.hpp"
#include "../EnterTitleOnGameStart.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x00491BF0
void MenuModalRenderFunction_EnterTitleOnGameStart(int x, int y, int width, int height)
{
// "Enter Your Title"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(5, 6, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_MAINOPTIONS, 6, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/GameplayOptions.func.hpp"
#include "../GameplayOptions.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x00491E80
void MenuModalRenderFunction_GameplayOptions(int x, int y, int width, int height)
{
// "Game Play Options"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(0x4a, 0x19, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 25, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/NetworkOptions.func.hpp"
#include "../NetworkOptions.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x00492A60
void MenuModalRenderFunction_NetworkOptions(int x, int y, int width, int height)
{
// "Network Options"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(0x4a, 6, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 6, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/OnlineQuitGame.func.hpp"
#include "../OnlineQuitGame.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x004937B0
void MenuModalRenderFunction_OnlineQuitGame(int x, int y, int width, int height)
{
// "Quit Mission"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(0x4a, 7, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 7, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/OptionsMenu.func.hpp"
#include "../OptionsMenu.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x00491810
void MenuModalRenderFunction_OptionsMenu(int x, int y, int width, int height)
{
// "Game Options"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(0x4a, 1, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_GAME_OPTIONS, 1, x, y, width, height);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "OpenSHC/UI/MenuModals/SkirmishConnectionOptions.func.hpp"
#include "../SkirmishConnectionOptions.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"

#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"

Expand All @@ -11,8 +13,9 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x004ABE50
void MenuModalRenderFunction_SkirmishConnectionOptions(int x, int y, int width, int height)
{
// "Connection options"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(0x4f, 0x5d, x, y, width, height);
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, 93, x, y, width, height);
}

}
Expand Down
Loading
Loading