Skip to content
Draft
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
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;
}

}
}
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
2 changes: 1 addition & 1 deletion src/OpenSHC/Audio/ResetGreatestLordGenieSpeechState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace OpenSHC {
namespace Audio {

// FUNCTION: STRONGHOLDCRUSADER 0x0044A720
void __cdecl ResetGreatestLordGenieSpeechState()
void ResetGreatestLordGenieSpeechState()
{
DAT_CurrentPlayerRanking::instance = -1;
INT_00b98698::instance = -1;
Expand Down
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);
}

}
}
4 changes: 2 additions & 2 deletions src/OpenSHC/Audio/SFX/UpdateUnitLossSpeechFeedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Audio {
namespace SFX {

// FUNCTION: STRONGHOLDCRUSADER 0x0044B840
void __stdcall UpdateUnitLossSpeechFeedback()
void UpdateUnitLossSpeechFeedback()
{
if (DAT_GameCore::instance.currentMenuViewType != UI::Enums::MVT_BUILD_MENU) {
return;
Expand Down Expand Up @@ -180,7 +180,7 @@ namespace Audio {
}

// FUNCTION: STRONGHOLDCRUSADER 0x0044AAB0
int __cdecl UpdateUnitLossSpeechFeedback_RelativeValueForGenie(int larger, int smaller)
int UpdateUnitLossSpeechFeedback_RelativeValueForGenie(int larger, int smaller)
{
if (larger < 1) {
larger = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSHC/Audio/mss/RegisterMilesAILShutdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace OpenSHC {
namespace Audio {
namespace MSS {

void __cdecl AIL_shutdown_proxy() { AIL_shutdown(); }
void AIL_shutdown_proxy() { AIL_shutdown(); }

// FUNCTION: STRONGHOLDCRUSADER 0x0057E160
int __cdecl RegisterMilesAILShutdown()
int RegisterMilesAILShutdown()
{
MACRO_CALL(OS_Func::_atexit)(AIL_shutdown_proxy);
return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../SoundSystem.func.hpp"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My clang-format fixes this relative import to its absolute version. Why doesn't yours do the same @TheRedDaemon and what do you prefer?

@TheRedDaemon TheRedDaemon Aug 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agreed on using the relative import to mark the "main" header file, so this is something that should stay.

No idea on your question, though. I still use the integrated clang version of Visual Studio Code. Did you update your version recently to the newest? Maybe something was added regarding the imports?

#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp"

namespace OpenSHC {
namespace Audio {
Expand Down
4 changes: 2 additions & 2 deletions src/OpenSHC/Audio/mss/SoundSystem/setSection1079_28_4_.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../SoundSystem.func.hpp"
#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp"

#include "OpenSHC/Globals/DAT_SoundEffectsHelperData1.hpp"

Expand All @@ -9,7 +9,7 @@ namespace Audio {
// FUNCTION: STRONGHOLDCRUSADER 0x0047A570
void SoundSystem::setSection1079_28_4_(int param_1)
{
DAT_SoundEffectsHelperData1::ptr->SEC_Section1079.field7_0x1c = param_1;
DAT_SoundEffectsHelperData1::instance.SEC_Section1079.field7_0x1c = param_1;
}

}
Expand Down
20 changes: 20 additions & 0 deletions src/OpenSHC/Game/GameCore/setTabToSwitchTo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

namespace OpenSHC {
namespace Game {

using OpenSHC::UI::Enums::MenuViewType;
// FUNCTION: STRONGHOLDCRUSADER 0x0046B300
void GameCore::setTabToSwitchTo()
{
if (this->currentMenuViewType == OpenSHC::UI::Enums::MVT_BUILD_MENU) {
this->secondaryActiveMenuTabToSwitchTo = this->buildmenuMenuTabToSwitchTo;
}
if (this->currentMenuViewType == OpenSHC::UI::Enums::MVT_MAP_EDITOR_LANDSCAPING) {
this->secondaryActiveMenuTabToSwitchTo.tabType = this->landscapingmenuMenuTabToSwitchTo;
}
}

}
}
13 changes: 13 additions & 0 deletions src/OpenSHC/Game/GameCore/setViewOnExitUnk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

namespace OpenSHC {
namespace Game {

using OpenSHC::UI::Enums::MenuViewType;

// FUNCTION: STRONGHOLDCRUSADER 0x0046B2F0
void GameCore::setViewOnExitUnk() { this->currentMenuViewType = ((MenuViewType)2); }

}
}
20 changes: 20 additions & 0 deletions src/OpenSHC/Game/GameCore/swapBuildMenuTab.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp"

namespace OpenSHC {
namespace Game {

using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType;

// FUNCTION: STRONGHOLDCRUSADER 0x0046B320
void GameCore::swapBuildMenuTab()
{
if (this->buildmenuMenuTabToSwitchTo.tabType == OpenSHC::UI::Enums::BASMTT_SIEGETENT_SHIELD) {
this->buildmenuMenuTabToSwitchTo.tabType = OpenSHC::UI::Enums::BASMTT_SIEGETENT_BATTERINGRAM;
return;
}
this->buildmenuMenuTabToSwitchTo = this->secondaryActiveMenuTabToSwitchTo;
}

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

namespace OpenSHC {
namespace Game {

// FUNCTION: STRONGHOLDCRUSADER 0x004586D0
void GameStateStructures::activateTraderState()
{
this->mapAndTime.traderRelated2 = 2;
this->mapAndTime.traderRelatedCounter1 = 0;
}

}
}
13 changes: 13 additions & 0 deletions src/OpenSHC/Game/GameStateStructures/getBatchBuyPrice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "OpenSHC/Game/GameStateStructures.func.hpp"

namespace OpenSHC {
namespace Game {

// FUNCTION: STRONGHOLDCRUSADER 0x00458890
int GameStateStructures::getBatchBuyPrice(undefined4 playerID, int resourceType)
{
return this->mapAndTime.buyAndSalesPriceArray[resourceType].buyPrice;
}

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

#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"

namespace OpenSHC {
namespace Game {

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

// FUNCTION: STRONGHOLDCRUSADER 0x004563B0
BOOLEnum GameStateStructures::isFullIDEqualsToMinus1(int param_1)
{
return DAT_GameSynchronyState::instance.currentPlayerFullIDArray[param_1] == -1;
}

}
}
29 changes: 29 additions & 0 deletions src/OpenSHC/Game/GameStateStructures/resetTraderState.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "OpenSHC/Game/GameStateStructures.func.hpp"





namespace OpenSHC {
namespace Game {




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


// FUNCTION: STRONGHOLDCRUSADER 0x004586F0
void GameStateStructures::resetTraderState()

{
this->mapAndTime.traderRelated2 = 0;
this->mapAndTime.traderRelatedCounter1 = 0;
return;
}


}
}
15 changes: 15 additions & 0 deletions src/OpenSHC/Game/UpdateUnitValueLoss.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "OpenSHC/Globals/DAT_CurrentPlayerUnitLosses.hpp"

namespace OpenSHC {
namespace Game {

// FUNCTION: STRONGHOLDCRUSADER 0x0044aa70
void UpdateUnitValueLoss(int value)
{
if (0 < value) {
DAT_CurrentPlayerUnitLosses::instance += value;
}
}

} // namespace Game
} // namespace OpenSHC
16 changes: 16 additions & 0 deletions src/OpenSHC/Global/PrintToDestination.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "OpenSHC/Global.func.hpp"
#include "OpenSHC/OS.func.hpp"

namespace OpenSHC {

// FUNCTION: STRONGHOLDCRUSADER 0x0045D060
void Global::PrintToDestination(wchar_t* destination, wchar_t* format, ...)
{
// fixme: The calls that call PrintToDestination() use 2, 3, or 4 arguments, but the original assembly
// always uses add esp, 0xc suggesting three parameters. Currently this optimizes to a jump directly.
va_list args;
va_start(args, format);
MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, format, args);
}

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

#include "OpenSHC/Globals/DAT_ProtocolDefinedData.hpp"

namespace OpenSHC {

// FUNCTION: STRONGHOLDCRUSADER 0x00487090
byte IO::Base64EncodeCharacterLookup(char param_1)
{
if ('?' < param_1) {
return (byte)(0x3d);
}
return DAT_ProtocolDefinedData::instance.field136_0x4f4[param_1];
}

}
16 changes: 16 additions & 0 deletions src/OpenSHC/IO/Base64EncodeInit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#include "OpenSHC/IO/Base64State.hpp"

namespace OpenSHC {
namespace IO {

// FUNCTION: STRONGHOLDCRUSADER 0x00487080
void Base64EncodeInit(Base64State* state)
{
state->phase = 0;
*(unsigned char*)&state->carryByte = 0;
state->lineCharacterCounter = 0;
}

} // namespace IO
} // namespace OpenSHC
2 changes: 1 addition & 1 deletion src/OpenSHC/IO/DecoderBuffer/ReadBufferAndComputeHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace IO {
namespace DecoderBuffer {

// FUNCTION: STRONGHOLDCRUSADER 0x0046D270
unsigned int __cdecl ReadBufferAndComputeHash(char* buf, unsigned int* size, void* param)
unsigned int ReadBufferAndComputeHash(char* buf, unsigned int* size, void* param)
{
uint bytesToLoad = *size;
BufferHelper* bufferHelper = (BufferHelper*)param;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSHC/IO/DecoderBuffer/WriteBufferAndComputeHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace IO {
namespace DecoderBuffer {

// FUNCTION: STRONGHOLDCRUSADER 0x0046D300
void __cdecl WriteBufferAndComputeHash(char* buf, unsigned int* size, void* param)
void WriteBufferAndComputeHash(char* buf, unsigned int* size, void* param)
{
uint bytesToWrite = *size;
BufferHelper* bufferHelper = (BufferHelper*)param;
Expand Down
15 changes: 15 additions & 0 deletions src/OpenSHC/IO/SwapInts.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "OpenSHC/IO.hpp"

namespace OpenSHC {
namespace IO {

// FUNCTION: STRONGHOLDCRUSADER 0x0041a740
void SwapInts(int* param_1, int* param_2)
{
int temp;
temp = *param_1;
*param_1 = *param_2;
*param_2 = temp;
}
}
}
10 changes: 10 additions & 0 deletions src/OpenSHC/Input/MouseState/updateMouseWheelStatus.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "OpenSHC/Input/MouseState.hpp"

namespace OpenSHC {
namespace Input {

// FUNCTION: STRONGHOLDCRUSADER 0x004680b0
void MouseState::updateMouseWheelStatus(int delta) { this->mouseWheelDelta = (unsigned short)delta; }

} // namespace Input
} // namespace OpenSHC
11 changes: 11 additions & 0 deletions src/OpenSHC/Input/getCurrentTutorialStep.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "OpenSHC/Input.func.hpp"

#include "OpenSHC/Globals/DAT_TutorialCurrentStep.hpp"

namespace OpenSHC {
namespace Input {

// FUNCTION: STRONGHOLDCRUSADER 0x004BC620
undefined4 OpenSHC::Input::GetCurrentTutorialStep(void) { return DAT_TutorialCurrentStep::instance; }
}
}
Loading