Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
72de9e2
header: FLOAT_00eb9b24 is an int
kotijekriv Nov 4, 2026
67f73b2
header: PrepareHistoryBook returns nothing
kotijekriv Nov 4, 2026
b6b6a24
header: FindCampaignMapHotspotAtMouse returns an int
kotijekriv Nov 4, 2026
8c24044
header: INT_00b960b8 is an int[4]
kotijekriv Nov 4, 2026
13970fb
header: DAT_SiegeInformationArray is an int[7][3]
kotijekriv Nov 4, 2026
f56d3ba
reimplement: SHC_3BB0A8C1_0x0042C1E0 89.6% order of the three product…
kotijekriv Nov 4, 2026
bf73922
reimplement: SHC_3BB0A8C1_0x004E1810 50.1% block order: the original …
kotijekriv Nov 4, 2026
5b0d73f
reimplement: SHC_3BB0A8C1_0x004DB300 71.1% register scheduling of the…
kotijekriv Nov 4, 2026
3bf6d85
reimplement: SHC_3BB0A8C1_0x0043E5A0 75.0% the original keeps the fea…
kotijekriv Nov 4, 2026
e1d89a9
reimplement: SHC_3BB0A8C1_0x0042C190 83.7% the original zeroes its re…
kotijekriv Nov 4, 2026
970c17c
reimplement: SHC_3BB0A8C1_0x0046CF90 88.7% the float constants live a…
kotijekriv Nov 4, 2026
91ca381
reimplement: SHC_3BB0A8C1_0x0057B9C0 91.3% the original's joke-flag a…
kotijekriv Nov 4, 2026
5536c3a
reimplement: SHC_3BB0A8C1_0x004DAF50 96.9% only the loop end address …
kotijekriv Nov 4, 2026
0f1b0a9
reimplement: SHC_3BB0A8C1_0x004DB210 98.3% only the loop end address …
kotijekriv Nov 4, 2026
e5aa20a
reimplement: SHC_3BB0A8C1_0x004DC140 97.9% only the loop end address …
kotijekriv Nov 4, 2026
b0f3274
headers: HelpTextToken value 0 as HTT_NONE
kotijekriv Nov 3, 2026
5445484
reimplement: SHC_3BB0A8C1_0x004950B0 76.40% strcpy/strcat and switch;…
kotijekriv Nov 3, 2026
1497696
reimplement: SHC_3BB0A8C1_0x00462340 79.40% strlen/strcpy intrinsics;…
kotijekriv Nov 3, 2026
193b3ea
reimplement: SHC_3BB0A8C1_0x00442C30 62.70% strcpy/strcat; register a…
kotijekriv Nov 3, 2026
9db16b7
reimplement: SHC_3BB0A8C1_0x00462340 80.20% strlen/strcpy intrinsics;…
kotijekriv Nov 4, 2026
a83ab62
reimplement: SHC_3BB0A8C1_0x00442C30 88.10% for loops instead of goto…
kotijekriv Nov 4, 2026
3b212a5
reimplement: SHC_3BB0A8C1_0x00462340 80.40% no gotos; register alloca…
kotijekriv Nov 4, 2026
d1af3e2
headers: GameCommandType value 86 as GCT_UNKNOWN_86
kotijekriv Nov 4, 2026
3915938
headers: SoundEffectID value 135 as SEID_UNKNOWN_0x87
kotijekriv Nov 4, 2026
87fb034
headers: UnitType value -1 as UT_NONE
kotijekriv Nov 4, 2026
1461dd5
headers: BuildingType value 0 as BT_NONE
kotijekriv Nov 4, 2026
c00f64a
reimplement: SHC_3BB0A8C1_0x00444410 71.40% stance per case; engineer…
kotijekriv Nov 4, 2026
81cbba1
reimplement: SHC_3BB0A8C1_0x004950B0 91.80% if-chains in the original…
kotijekriv Nov 4, 2026
8d36341
style: mechanical review fixes in ToolbarButtonPressed and Singleplay…
kotijekriv Nov 4, 2026
c59c746
style: clang-format MenuItemActionHandler_TextEditor_Buttons
kotijekriv Nov 4, 2026
7f28dcf
reimplement: SHC_3BB0A8C1_0x004950B0 92.00% if-chains in the original…
kotijekriv Nov 4, 2026
361c72f
reimplement: SHC_3BB0A8C1_0x004950B0 92.20% if-chains in the original…
kotijekriv Nov 4, 2026
2afeda2
reimplement: SHC_3BB0A8C1_0x00442C30 92.60% behaviour fix (siege copy…
kotijekriv Nov 4, 2026
ab2c48e
reimplement: SHC_3BB0A8C1_0x004950B0 92.00% if-chains in the original…
kotijekriv Nov 4, 2026
f39bfb6
fix: SingleplayerMapChoice follows DAT_SiegeInformationArray's int[7]…
kotijekriv Nov 4, 2026
1dd6d10
style: ProgressBarBox and SingleplayerMapChoice review fixes
kotijekriv Nov 4, 2026
3daee98
style: PlayJokeVideoBasedOnCurrentTimeAndPlayTime drops the unused BO…
kotijekriv Nov 4, 2026
d6350af
Merge main: the second upstream header sync (bc45882f8)
kotijekriv Nov 4, 2026
8bfade6
Merge main: the third upstream header sync (12854bcf4)
kotijekriv Nov 4, 2026
b1f3cc0
Follow main's int[501] map lists
kotijekriv Nov 4, 2026
f93f848
style: the two wait loops in UI::Helpers are for loops (rule 9)
kotijekriv Nov 4, 2026
ba9bf14
Merge main (#311 and #312) into reimpl/batch2-development
kotijekriv Nov 4, 2026
309f63b
Take the five functions that reached 100% out of this draft
kotijekriv Nov 4, 2026
51cef9b
Merge main (0353cce84) into reimpl/batch2-development
kotijekriv Nov 4, 2026
e2a42ec
Follow 7c6bb9e26's field renames
kotijekriv Nov 4, 2026
763c095
Merge main (8a3f6e8ea) into reimpl/batch2-development
kotijekriv Nov 4, 2026
e8cd3ae
reimplement: SHC_3BB0A8C1_0x004DB210 100.0% Reimplemented, only the l…
kotijekriv Nov 4, 2026
61c441e
Revert "header: FindCampaignMapHotspotAtMouse returns an int"
kotijekriv Nov 4, 2026
84ef446
Merge main (630608005) into reimpl/batch2-development
kotijekriv Nov 5, 2026
12d6858
TrimStoredMenuString follows the rename to INT_00eb9b24
kotijekriv Nov 5, 2026
4897ff5
Move PrepareHistoryBook to the ready PR
kotijekriv Nov 5, 2026
ada2e6c
Move TrimStoredMenuString to the ready PR
kotijekriv Nov 5, 2026
4353a78
Move WriteMissionToScoresFile to the ready PR
kotijekriv Nov 5, 2026
ba0fa32
Merge main 948dce845 for countof()
kotijekriv Nov 5, 2026
8fb6841
Loop bounds by countof(), as main's 948dce845
kotijekriv Nov 5, 2026
90eef6a
Merge origin/main (72b27322e) into reimpl/batch2-development
kotijekriv Nov 5, 2026
49a51e7
Use main's names from the ghidra sync
kotijekriv Nov 5, 2026
8fcb04f
drafts: move 0x00442C30 SingleplayerMapChoice_MapTable to the 100% PR
kotijekriv Nov 6, 2026
2254869
Merge main (eef6f667a, gynt's header sync) into reimpl/batch2-develop…
kotijekriv Nov 7, 2026
fb28cf0
drafts: move 0x00444410 to the round 13 PR
kotijekriv Nov 14, 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
26 changes: 26 additions & 0 deletions src/OpenSHC/UI/Helpers/ClearSiegeInformationArray2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "../Helpers.func.hpp"

#include "OpenSHC/Globals/DAT_SiegeInformationArray_2.hpp"
#include "OpenSHC/Globals/INT_ARRAY_00b960b8.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x0042C190
void Helpers::ClearSiegeInformationArray2()
{
INT_ARRAY_00b960b8::instance[0] = 0;
INT_ARRAY_00b960b8::instance[1] = 0;
INT_ARRAY_00b960b8::instance[2] = 0;
INT_ARRAY_00b960b8::instance[3] = 0;
// The original clears only the first 11 of each setup's 21 values.
for (int setup = 0; setup < 4; ++setup) {
int* const values = DAT_SiegeInformationArray_2::instance[setup][0];
for (int value = 0; value < 11; ++value) {
values[value] = 0;
}
}
}

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

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

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x0043E5A0
undefined4 Helpers::SomeFearFactorComputation()
{
// Picks a message number from the player's fear factor level.
int const fearFactor
= DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID]
.fearFactorLevel;
if (fearFactor <= -5) {
return 14;
}
if (fearFactor <= -3) {
return 15;
}
if (fearFactor <= -1) {
return 16;
}
if (fearFactor >= 5) {
return 19;
}
int message = 18;
if (fearFactor < 3) {
message = 17;
}
return message;
}

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

#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp"
#include "OpenSHC/Globals/DAT_SiegeInformationArray.hpp"
#include "OpenSHC/Globals/DAT_SiegeInformationArray_2.hpp"
#include "OpenSHC/Globals/DAT_SiegeRemainingPoints.hpp"
#include "OpenSHC/Globals/INT_ARRAY_00b960b8.hpp"

namespace OpenSHC {
namespace UI {

// FUNCTION: STRONGHOLDCRUSADER 0x0042C1E0
void Helpers::SomeSiegeUnitsComputation(int slot)
{
// The value table starts at ARCHER (7 entries of 3), the slot percentages at field_0x548dc.
int* const unitValues = &DAT_RenderingDefinedData::instance.ARCHER;
int* const slotPercentages = &DAT_RenderingDefinedData::instance.field_0x548dc;
int total = INT_ARRAY_00b960b8::instance[1];
for (int unit = 0; unit < 7; ++unit) {
for (int value = 0; value < 3; ++value) {
total += DAT_SiegeInformationArray_2::instance[1][unit][value] * unitValues[unit * 3 + value];
}
}
int budgets[4];
for (int budget = 0; budget < 4; ++budget) {
budgets[budget] = slotPercentages[budget] * total / 100;
}
INT_ARRAY_00b960b8::instance[0] = DAT_SiegeRemainingPoints::instance;
INT_ARRAY_00b960b8::instance[1] = DAT_SiegeRemainingPoints::instance;
INT_ARRAY_00b960b8::instance[2] = DAT_SiegeRemainingPoints::instance;
INT_ARRAY_00b960b8::instance[3] = DAT_SiegeRemainingPoints::instance;
for (int setup = 0; setup < 4; ++setup) {
// The 7 units by 3 values are copied as one run of 21.
for (int value = 0; value < 21; ++value) {
DAT_SiegeInformationArray_2::instance[setup][value / 3][value % 3]
= DAT_SiegeInformationArray::instance[value / 3][value % 3];
}
}
if (slot != 1) {
int const percentage = slotPercentages[slot];
int cost = 0;
for (int unit = 0; unit < 7; ++unit) {
DAT_SiegeInformationArray_2::instance[1][unit][0]
= DAT_SiegeInformationArray_2::instance[slot][unit][0] * 100 / percentage;
DAT_SiegeInformationArray_2::instance[1][unit][1]
= DAT_SiegeInformationArray_2::instance[slot][unit][1] * 100 / percentage;
DAT_SiegeInformationArray_2::instance[1][unit][2]
= DAT_SiegeInformationArray_2::instance[slot][unit][2] * 100 / percentage;
cost += DAT_SiegeInformationArray_2::instance[1][unit][0] * unitValues[unit * 3]
+ DAT_SiegeInformationArray_2::instance[1][unit][1] * unitValues[unit * 3 + 1]
+ DAT_SiegeInformationArray_2::instance[1][unit][2] * unitValues[unit * 3 + 2];
}
INT_ARRAY_00b960b8::instance[1] = total - cost;
if (INT_ARRAY_00b960b8::instance[1] < 0) {
INT_ARRAY_00b960b8::instance[1] = 0;
}
}
for (int other = 0; other < 4; ++other) {
if (other == slot || other == 1) {
continue;
}
int const percentage = slotPercentages[other];
int cost = 0;
for (int unit = 0; unit < 7; ++unit) {
for (int value = 0; value < 3; ++value) {
DAT_SiegeInformationArray_2::instance[other][unit][value]
= DAT_SiegeInformationArray_2::instance[1][unit][value] * percentage / 100;
cost += DAT_SiegeInformationArray_2::instance[other][unit][value] * unitValues[unit * 3 + value];
}
}
INT_ARRAY_00b960b8::instance[other] = budgets[other] - cost;
if (INT_ARRAY_00b960b8::instance[other] < 0) {
INT_ARRAY_00b960b8::instance[other] = 0;
}
}
}

}
}
Loading
Loading