Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
87e53dd
reimplement: SHC_3BB0A8C1_0x00408EB0 100%
Aug 22, 2026
1324489
reimplement: SHC_3BB0A8C1_0x004092B0 100%
Aug 22, 2026
aa776b3
reimplement: SHC_3BB0A8C1_0x0043FCA0 100%
Aug 22, 2026
c466f52
reimplement: SHC_3BB0A8C1_0x004ABD10 100%
Aug 22, 2026
ff5831a
reimplement: SHC_3BB0A8C1_0x00533090 100%
Aug 22, 2026
7ba5b5f
reimplement: SHC_3BB0A8C1_0x004BC620 100%
Aug 22, 2026
8426b8d
reimplement: SHC_3BB0A8C1_0x00469860 100%
Aug 22, 2026
6d74397
reimplement: SHC_3BB0A8C1_0x00480570 100%
Aug 22, 2026
0cdbdd1
reimplement: SHC_3BB0A8C1_0x00496E20 100%
Aug 23, 2026
0bdd650
reimplement: SHC_3BB0A8C1_0x00424310 100%
Aug 23, 2026
a305f62
reimplement: SHC_3BB0A8C1_0x0043F2B0 100%
Aug 23, 2026
58ba078
reimplement: SHC_3BB0A8C1_0x004038A0 100%
Aug 23, 2026
7de12b3
reimplement: SHC_3BB0A8C1_0x0040BFD0 100%
Aug 23, 2026
6249544
reimplement: SHC_3BB0A8C1_0x00434260 100%
Aug 23, 2026
0a8300f
many 100%
Aug 23, 2026
d38c888
remove __cdecl
Aug 23, 2026
c4f2941
batch 2
Aug 23, 2026
40f2583
repair vararg
Aug 23, 2026
8713d65
revert va_list
Aug 23, 2026
c9b2dc1
batch 2: percentage not yet checked, but compiling
Aug 24, 2026
547c07b
reimplement: SHC_3BB0A8C1_0x00401000 100%
Aug 25, 2026
567b8ca
reimplement: SHC_3BB0A8C1_0x00401B60 100%
Aug 25, 2026
d993b2c
reimplement: SHC_3BB0A8C1_0x0040F3F0 100%
Aug 25, 2026
a1bac7c
reimplement: SHC_3BB0A8C1_0x0041A060 100%
Aug 26, 2026
e44a43c
100%
Aug 26, 2026
85899cc
reimplement: SHC_3BB0A8C1_0x0041A0D0 100%
Aug 26, 2026
43e59b4
reimplement: SHC_3BB0A8C1_0x0041A2B0 100%
Aug 26, 2026
707b0c8
reimplement: SHC_3BB0A8C1_0x0041A390 100%
Aug 26, 2026
0a46334
reimplement: SHC_3BB0A8C1_0x0041A3C0 100%
Aug 26, 2026
61e5ba1
progress
Aug 26, 2026
c890b13
reimplement: SHC_3BB0A8C1_0x0041A3C0 72% stuck
Aug 26, 2026
e483b6e
reimplement: SHC_3BB0A8C1_0x0042AC60 100%
Aug 26, 2026
73257c1
reimplement: 100%
Aug 26, 2026
84ea79f
reimplement: SHC_3BB0A8C1_0x00439390 100%
Aug 27, 2026
504042e
reimplement: SHC_3BB0A8C1_0x00424770 100%
Aug 27, 2026
57692b7
reimplement: SHC_3BB0A8C1_0x004549C0 100% different register allocation
Aug 27, 2026
baeb438
progress
Aug 27, 2026
8af4061
reimplement: SHC_3BB0A8C1_0x0045D060 100%
Aug 27, 2026
23602ca
progress
Aug 27, 2026
4a4f2f8
reimplement: SHC_3BB0A8C1_0x0045D690 60%
Aug 27, 2026
2119f31
reimplement: SHC_3BB0A8C1_0x0045D9E0 100%
Aug 27, 2026
ae78890
reimplement: SHC_3BB0A8C1_0x00462150 27%
Aug 27, 2026
c0fab9a
reimplement: SHC_3BB0A8C1_0x00468C50 100%
Aug 27, 2026
6fb6f12
progress
Aug 27, 2026
1f29180
progress
Aug 31, 2026
771d380
flush with main
Sep 1, 2026
b98b7ed
reimplement: SHC_3BB0A8C1_0x00462150 100%
Sep 2, 2026
ad9aeeb
reimplement: 100%
Sep 2, 2026
ff8e075
remove WideCharMultiByteState
Sep 2, 2026
954ae59
reimplement: 100%
Sep 3, 2026
c413ed7
reimplement: 100%
Sep 3, 2026
62e5a28
reimplement: 100%
Sep 3, 2026
0fcfaf9
reimplement: 100%
Sep 4, 2026
c665c25
reimplement: 100%
Sep 4, 2026
f754441
reimplement: 100%
Sep 4, 2026
b1518ac
reimplement: 100%
Sep 4, 2026
e16f027
reimplement: 100%
Sep 4, 2026
acc871c
checkout cpp files already on main
Sep 6, 2026
344f831
reimplement: 100%
Sep 6, 2026
807b011
reimplement: 100%
Sep 7, 2026
db2fcfc
progress
Sep 7, 2026
435646c
progress
Sep 10, 2026
41bed22
refactor
Sep 10, 2026
342227b
format
Sep 10, 2026
57d6108
refactor
Sep 10, 2026
dfd50f2
test
Sep 10, 2026
7c7d97d
restore proper versions
Sep 10, 2026
f4823e6
restore proper versions
Sep 10, 2026
6210497
move functions
Sep 10, 2026
3c5ea81
fix line endings
Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions cmake/compiler-flags-gl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ src/OpenSHC/IO/ResourceManager/swapMapDataWithNextMap.cpp
src/OpenSHC/UI/Rendering/WindowAndDirectDraw/takeScreenshot.cpp
src/OpenSHC/IO/ResourceManager/readFirstPartOfCurrentResourceIntoMemory.cpp
src/OpenSHC/IO/ResourceManager/readNextPartOfCurrentResourceIntoMemory.cpp
src/OpenSHC/Map/TileMapState/updateMoatCountdownTimers.cpp
src/OpenSHC/Map/TileMapState/recountTotalOwnedMoats.cpp
39 changes: 39 additions & 0 deletions src/OpenSHC/AI/AICState/aiFarmChoice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/AI/AIType.hpp"
#include "OpenSHC/AI/AITypeInt.hpp"
#include "OpenSHC/Game/Player/PlayerID.hpp"

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

namespace OpenSHC {
namespace AI {

using OpenSHC::AI::AIType;
using OpenSHC::AI::AITypeInt;
using OpenSHC::Game::Player::PlayerID;

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004CB180
int AICState::aiFarmChoice(PlayerID playerID)

{
AITypeInt AVar1;

AVar1 = DAT_GameState::instance.playerDataArray[playerID].aiType;
if (AVar1 == OpenSHC::AI::AIT_NULL) {
return 0;
}
/*
ugly because EAX is always 1 or higher
*/

return *(int*)((int)DAT_EntityState::instance.seagullArray
+ (AVar1 * 0xa9 + DAT_GameState::instance.playerDataArray[playerID].aiFarmIndex) * 4 + 0x24a0);
}

}
}
3 changes: 2 additions & 1 deletion src/OpenSHC/AI/AICState/getAIBuildInterval.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "../AICState.hpp""
#include "../AICState.hpp"

#include "OpenSHC/AI/AITypeA.hpp"

#include "OpenSHC/Globals/DAT_GameState.hpp"
Expand Down
36 changes: 36 additions & 0 deletions src/OpenSHC/AI/AICState/getResourceRebuildDelay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/AI/AIType.hpp"
#include "OpenSHC/AI/AITypeInt.hpp"

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

namespace OpenSHC {
namespace AI {

using OpenSHC::AI::AIType;
using OpenSHC::AI::AITypeInt;

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004CB150
int AICState::getResourceRebuildDelay(int param_1)

{
AITypeInt AVar1;

AVar1 = DAT_GameState::instance.playerDataArray[param_1].aiType;
if (AVar1 == OpenSHC::AI::AIT_NULL) {
return 0;
}
/*
access resourceBuildDelay
*/

return *(int*)((int)DAT_EntityState::instance.seagullArray + AVar1 * 0x2a4 + 0x24ec);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Commands/MappersEnum.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_AIVState.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::Commands::MappersEnum;
using OpenSHC::WindowsHelper::Enums::BOOLEnum;

/*
WARNING: Enum "MappersEnum": Some values do not have unique names
*/

/*
WARNING: Enum "MappersEnumShort": Some values do not have unique names
*/

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004ECAB0
BOOLEnum AICState::mapperIsWoodCuttersHutWhileNoWoodAvailable(undefined4 playerID, MappersEnum param_2)

{
if ((param_2 == OpenSHC::Commands::M_MAPPER_WOODSMAN)
&& (DAT_AIVState::instance.mapExtraInfo.totalWoodAvailable < 1)) {
return TRUE;
}
return FALSE;
}

}
}
31 changes: 31 additions & 0 deletions src/OpenSHC/AI/AICState/playJokeBikFromAIToHuman.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Map/Units/UnitsState.func.hpp"
#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp"

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

namespace OpenSHC {
namespace AI {

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004D0F90
void AICState::playJokeBikFromAIToHuman(int playerID, int aiType)

{
int iVar1;

iVar1 = MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::getAliveLordForPlayer, DAT_UnitsState::ptr)(
playerID);
if (iVar1 != 0) {
MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::AIMessageQueue_Func::playBikVideoFromPlayer,
DAT_VideoBikQueue::ptr)(playerID, aiType, 0x14);
}
return;
}

}
}
30 changes: 30 additions & 0 deletions src/OpenSHC/AI/AICState/setTriggerForAITauntResponse.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::WindowsHelper::Enums::BOOLEnum;

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004D1090
void AICState::setTriggerForAITauntResponse()

{
BOOLEnum BVar1;

BVar1 = MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::getAreWeInAInGameMenu, DAT_GameCore::ptr)();
if (BVar1 != FALSE) {
this->aiTauntResponseTimeWindow = timeGetTime();
}
return;
}

}
}
34 changes: 34 additions & 0 deletions src/OpenSHC/AI/AICState/shouldNotBeBuildingArmoury.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Commands/MappersEnum.hpp"
#include "OpenSHC/Game/Player/PlayerID.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_GameState.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::Commands::MappersEnum;
using OpenSHC::Game::Player::PlayerID;
using OpenSHC::WindowsHelper::Enums::BOOLEnum;

/*
WARNING: Enum "MappersEnum": Some values do not have unique names
*/

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004ECA60
BOOLEnum AICState::shouldNotBeBuildingArmoury(PlayerID playerID, MappersEnum param_2)

{
if (param_2 != OpenSHC::Commands::M_MAPPER_ARMOURY) {
return FALSE;
}
return (uint)(DAT_GameState::instance.playerDataArray[playerID].isArmouryAlmostFilledUp == 0);
}

}
}
32 changes: 32 additions & 0 deletions src/OpenSHC/AI/AICState/shouldNotBeBuildingGranary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Commands/MappersEnum.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_GameState.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::Commands::MappersEnum;
using OpenSHC::WindowsHelper::Enums::BOOLEnum;

/*
WARNING: Enum "MappersEnum": Some values do not have unique names
*/

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004ECA30
BOOLEnum AICState::shouldNotBeBuildingGranary(int playerID, MappersEnum param_2)

{
if (param_2 != OpenSHC::Commands::M_MAPPER_GRANARY) {
return FALSE;
}
return (uint)(DAT_GameState::instance.playerDataArray[playerID].granaryIsAlmostFilledUp == FALSE);
}

}
}
24 changes: 24 additions & 0 deletions src/OpenSHC/AI/AICState/shouldNotBuildKillingPits.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Commands/MappersEnum.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "OpenSHC/Globals/DAT_AIVState.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::Commands::MappersEnum;
using OpenSHC::WindowsHelper::Enums::BOOLEnum;

// FUNCTION: STRONGHOLDCRUSADER 0x004ECA90
BOOLEnum AICState::shouldNotBuildKillingPits(int playerID, MappersEnum commandBuildingType)
{
BOOLEnum _totalAbove99 = FALSE;
if (commandBuildingType == OpenSHC::Commands::M_MAPPER_KILLING_PIT) {
_totalAbove99 = 100 <= DAT_AIVState::instance.mapExtraInfo.playerTotalKillingPits[playerID];
}
return _totalAbove99;
}

}
}
37 changes: 37 additions & 0 deletions src/OpenSHC/AI/AICState/unitIDIsRangedOrArmored.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/Game/Skirmish/SkirmishDefinedData.hpp"

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

namespace OpenSHC {
namespace AI {

using OpenSHC::Game::Skirmish::SkirmishDefinedData;

/*
WARNING: Enum "MappersEnum": Some values do not have unique names
*/

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004CC8D0
undefined4 AICState::unitIDIsRangedOrArmored(int unitID)

{
SkirmishDefinedData* pSVar1;

pSVar1 = DAT_SkirmishDefinedData::ptr;
do {
if (pSVar1->RangedAndArmoredUnits[0] == (int)(short)DAT_UnitsState::instance.units[unitID].unitType) {
return (undefined4)(1);
}
pSVar1 = (SkirmishDefinedData*)(pSVar1->RangedAndArmoredUnits + 1);
} while ((int)pSVar1 < 0xb3eb50);
return (undefined4)(0);
}

}
}
35 changes: 35 additions & 0 deletions src/OpenSHC/AI/AICState/wipeAICMemory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "OpenSHC/AI/AICState.func.hpp"
#include "OpenSHC/IO/LowLevelMemory.func.hpp"
#include "OpenSHC/AI/AICState.hpp"

#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::AI::AICState;

/*
decompilerscript: committed: 2025-01-30 21:57:43.216000
*/

// FUNCTION: STRONGHOLDCRUSADER 0x004C6D30
void AICState::wipeAICMemory()

{
AICState* destination;
int iVar1;

destination = this;
iVar1 = 20;
do {
MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(
676, '\0', (void*)((int)(destination)));
destination = (AICState*)(destination->aics + 1);
iVar1 = iVar1 + -1;
} while (iVar1 != 0);
return;
}

}
}
17 changes: 17 additions & 0 deletions src/OpenSHC/AI/AIVState/clearTheHeatmaps.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "OpenSHC/AI/AIVState.func.hpp"
#include "OpenSHC/IO/LowLevelMemory.func.hpp"

#include "OpenSHC/Globals/DAT_LowLevelMemory.hpp"

namespace OpenSHC {
namespace AI {

// FUNCTION: STRONGHOLDCRUSADER 0x004EDC90
void AIVState::clearTheHeatmaps()
{
MACRO_CALL_MEMBER(OpenSHC::IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)(
307200, '\0', (void*)((int)(this->heatMaps)));
}

} // namespace AI
} // namespace OpenSHC
16 changes: 16 additions & 0 deletions src/OpenSHC/Audio/SFX/ComputeCurrentPlayerRanking.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "OpenSHC/Audio/SFX.func.hpp"

#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"

namespace OpenSHC {
namespace Audio {

// FUNCTION: STRONGHOLDCRUSADER 0x0044C400
int SFX::ComputeCurrentPlayerRanking()
{
return MACRO_CALL(OpenSHC::Audio::SFX_Func::ComputePlayerRanking)(
DAT_GameSynchronyState::instance.currentPlayerSlotID);
}

}
}
Loading