Repository navigation
Reimplement 23 UI, Credits, Rendering, Text and Audio functions #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
6and8
wants to merge
9
commits into
sourcehold:main
Choose a base branch
from
6and8:pr-ui-100
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,591
−28
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5b643f8
headers: INT_00ec083c is a float
loamifi-jake c044790
Reimplement 23 UI, Credits, Rendering, Text and Audio functions at 100%
loamifi-jake 26b5042
Merge remote-tracking branch 'origin/main' into pr-ui-100
loamifi-jake e09c4c4
headers: CreditsRelatedStructure2.binkFileName is an inline char[32]
loamifi-jake a53abeb
headers: declare UCPointerStruct::loadMenuElement (0x4F4D70)
loamifi-jake f99d949
Review: relative main includes, countof for the credits bound, enums …
loamifi-jake ea9fb67
loadCRTex: _ucrt_open takes char*, use the string macro for cr.tex
loamifi-jake 097b69d
OS: _ucrt_open takes char const* like _open
loamifi-jake 3a373f9
loadCRTex: cr.tex from string-literals
loamifi-jake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #include "../SFX.func.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Audio { | ||
| namespace SFX { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0044C400 | ||
| int ComputeCurrentPlayerRanking() | ||
| { | ||
| return MACRO_CALL(SFX_Func::ComputePlayerRanking)(DAT_GameSynchronyState::instance.currentPlayerSlotID); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #include "../SFX.func.hpp" | ||
|
|
||
| #include "OpenSHC/Game/GameStateStructures.func.hpp" | ||
| #include "OpenSHC/Game/Resources/ResourceType.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_GameState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Audio { | ||
| namespace SFX { | ||
|
|
||
| using namespace OpenSHC::Game::Resources; | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x0044A830 | ||
| int ComputePlayerPoints1(int playerID) | ||
| { | ||
| int const goldPoints = DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_GOLD] / 10; | ||
| int const troopPoints = DAT_GameState::instance.playerDataArray[playerID].totalTroopValue; | ||
| int const foodPoints | ||
| = (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)(RT_BREAD) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_BREAD] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_CHEESE) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_CHEESE] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_MEAT) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_MEAT] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_APPLE) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_APPLE]) | ||
| / 10; | ||
| int const weaponPoints | ||
| = (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)(RT_BOW) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_BOW] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_CROSSBOW) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_CROSSBOW] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_SPEAR) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_SPEAR] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_PIKE) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_PIKE] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_MACE) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_MACE] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_SWORD) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_SWORD] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_LEATHERARMOR) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_LEATHERARMOR] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_IRONARMOR) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_IRONARMOR]) | ||
| / 10; | ||
| int const materialPoints | ||
| = (MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)(RT_WOOD) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_WOOD] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_HOPS) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_HOPS] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_STONE) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_STONE] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_IRON) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_IRON] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_PARTIALPITCH) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_PARTIALPITCH] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_ALE) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_ALE] | ||
| + MACRO_CALL_MEMBER(Game::GameStateStructures_Func::getSalePriceOfGood, DAT_GameState::ptr)( | ||
| RT_FLOUR) | ||
| * DAT_GameState::instance.playerDataArray[playerID].currentResources[RT_FLOUR]) | ||
| / 10; | ||
| return DAT_GameState::instance.playerDataArray[playerID].currentPopulation * 10 + materialPoints | ||
| + weaponPoints + foodPoints + troopPoints + goldPoints; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/OpenSHC/Rendering/Bink/AIMessageQueue/playNextStoredBinkVideo.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #include "../AIMessageQueue.func.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Rendering { | ||
| namespace Bink { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x004C62A0 | ||
| void AIMessageQueue::playNextStoredBinkVideo() | ||
| { | ||
| if (this->messagePlaying_0x0) { | ||
| MACRO_CALL_MEMBER(AIMessageQueue_Func::playNextStoredAIMessage, this)(); | ||
| } | ||
| this->storedMessages_0x924 = 0; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| #include "../Rendering.func.hpp" | ||
|
|
||
| #include "OpenSHC/UI/Rendering.func.hpp" | ||
| #include "OpenSHC/Rendering/ColorMode.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/COL_BLACK.hpp" | ||
| #include "OpenSHC/Globals/COL_BLUE.hpp" | ||
| #include "OpenSHC/Globals/COL_BRIGHT_YELLOW.hpp" | ||
| #include "OpenSHC/Globals/COL_DARK_CYAN_GREY.hpp" | ||
| #include "OpenSHC/Globals/COL_DARK_GRAYISH_GREEN.hpp" | ||
| #include "OpenSHC/Globals/COL_DARK_GREEN.hpp" | ||
| #include "OpenSHC/Globals/COL_DARK_LIME.hpp" | ||
| #include "OpenSHC/Globals/COL_DARK_RED.hpp" | ||
| #include "OpenSHC/Globals/COL_GREYISH_YELLOW.hpp" | ||
| #include "OpenSHC/Globals/COL_LIGHT_GREY.hpp" | ||
| #include "OpenSHC/Globals/COL_LIME.hpp" | ||
| #include "OpenSHC/Globals/COL_MAGENTA.hpp" | ||
| #include "OpenSHC/Globals/COL_MODERATE_GREEN.hpp" | ||
| #include "OpenSHC/Globals/COL_RED.hpp" | ||
| #include "OpenSHC/Globals/COL_VERY_DARK_GREY.hpp" | ||
| #include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" | ||
| #include "OpenSHC/Globals/COL_VIVID_BLUE.hpp" | ||
| #include "OpenSHC/Globals/COL_WHITE.hpp" | ||
| #include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Rendering { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x00467890 | ||
| void InitializeColors() | ||
| { | ||
| COL_BLUE::instance.shortValue = 31; | ||
| COL_BLACK::instance.shortValue = 0; | ||
| if (DAT_WindowAndDirectDraw::instance.colorBitMode == RGB_555) { | ||
| COL_RED::instance.shortValue = (short)64512; | ||
| COL_LIME::instance.shortValue = 992; | ||
| COL_DARK_GREEN::instance.shortValue = 480; | ||
| COL_WHITE::instance.shortValue = 32767; | ||
| COL_BRIGHT_YELLOW::instance.shortValue = 29447; | ||
| COL_MODERATE_GREEN::instance.shortValue = 13063; | ||
| COL_DARK_CYAN_GREY::instance.shortValue = 13807; | ||
| COL_VERY_DARK_GREY::instance.shortValue = 7399; | ||
| COL_MAGENTA::instance.shortValue = 31775; | ||
| COL_VIVID_BLUE::instance.shortValue = 4703; | ||
| COL_VERY_SOFT_YELLOW::instance.shortValue = 30647; | ||
| } else { | ||
| COL_RED::instance.shortValue = (short)63488; | ||
| COL_LIME::instance.shortValue = 1984; | ||
| COL_DARK_GREEN::instance.shortValue = 960; | ||
| COL_WHITE::instance.shortValue = (short)65535; | ||
| COL_BRIGHT_YELLOW::instance.shortValue = (short)50695; | ||
| COL_MODERATE_GREEN::instance.shortValue = 17927; | ||
| COL_DARK_CYAN_GREY::instance.shortValue = 31695; | ||
| COL_VERY_DARK_GREY::instance.shortValue = 14791; | ||
| COL_MAGENTA::instance.shortValue = (short)63519; | ||
| COL_VIVID_BLUE::instance.shortValue = 9407; | ||
| COL_VERY_SOFT_YELLOW::instance.shortValue = (short)61303; | ||
| } | ||
| COL_LIGHT_GREY::instance.shortValue | ||
| = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(192, 192, 192); | ||
| COL_GREYISH_YELLOW::instance.shortValue | ||
| = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(215, 210, 164); | ||
| COL_DARK_LIME::instance.shortValue | ||
| = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(41, 117, 32); | ||
| COL_DARK_GRAYISH_GREEN::instance.shortValue | ||
| = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(104, 116, 88); | ||
| COL_DARK_RED::instance.shortValue | ||
| = (short)MACRO_CALL(UI::Rendering_Func::TransformToCurrentModeColor)(140, 0, 0); | ||
| } | ||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| #include "../TextManager.func.hpp" | ||
|
|
||
| #include "OpenSHC/IO/LowLevelMemory.func.hpp" | ||
| #include "OpenSHC/OS.func.hpp" | ||
| #include "OpenSHC/Util/WideCharMultiByteState.func.hpp" | ||
| #include "OpenSHC/DE/SHCDE/eTextSections.hpp" | ||
| #include "OpenSHC/Rendering/Enums/RenderTarget.hpp" | ||
| #include "OpenSHC/Text/GameLanguage.hpp" | ||
| #include "OpenSHC/WindowsHelper/Enums/CodePage.hpp" | ||
| #include "OpenSHC/string-literals.hpp" | ||
|
|
||
| #include "OpenSHC/Globals/DAT_LowLevelMemory.hpp" | ||
| #include "OpenSHC/Globals/DAT_WideCharMultiByteState.hpp" | ||
|
|
||
| namespace OpenSHC { | ||
| namespace Text { | ||
|
|
||
| // FUNCTION: STRONGHOLDCRUSADER 0x00473870 | ||
| void TextManager::loadCRTex() | ||
| { | ||
| this->codePage = WindowsHelper::Enums::CP_WINDOWS_1252; | ||
| this->field_0x14 = 1; | ||
| this->helpTextLinkActive = FALSE; | ||
| this->textSurfaceTarget = Rendering::Enums::RT_SCREEN_MENU; | ||
| this->field_0x1348 = 0; | ||
| int file = MACRO_CALL(OS_Func::_ucrt_open)(s_cr_tex_005a6334, _O_BINARY, 0); | ||
| if (file == -1) { | ||
| return; | ||
| } | ||
| MACRO_CALL(OS_Func::_ucrt_read)(file, this->textOffsets, sizeof(this->textOffsets)); | ||
| LPWSTR wideText = (LPWSTR)MACRO_CALL(OS_Func::_malloc)(702000); | ||
| MACRO_CALL(OS_Func::_ucrt_read)(file, wideText, 702000); | ||
| MACRO_CALL_MEMBER(Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, | ||
| DAT_WideCharMultiByteState::ptr)(this->textStart, wideText, 351000); | ||
| this->alternativeCodePageUsedUnk = FALSE; | ||
| this->gameLanguage = GL_ENGLISH; | ||
| if (MACRO_CALL(OS_Func::__stricmp)(s_polish_005a632c, | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)(DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->codePage = WindowsHelper::Enums::CP_WINDOWS_1250; | ||
| this->alternativeCodePageUsedUnk = TRUE; | ||
| MACRO_CALL_MEMBER(Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, | ||
| DAT_WideCharMultiByteState::ptr)(this->textStart, wideText, 351000); | ||
| this->gameLanguage = GL_POLISH; | ||
| } else if (MACRO_CALL(OS_Func::__stricmp)(s_english_005a6324, | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( | ||
| DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->gameLanguage = GL_ENGLISH; | ||
| } else if (MACRO_CALL(OS_Func::__stricmp)(s_american_005a6318, | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( | ||
| DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->gameLanguage = GL_AMERICAN; | ||
| } else if (MACRO_CALL(OS_Func::__stricmp)(s_german_005a6310, | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( | ||
| DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->gameLanguage = GL_GERMAN; | ||
| } else if (MACRO_CALL(OS_Func::__stricmp)(s_french_005a6308, | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( | ||
| DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->gameLanguage = GL_FRENCH; | ||
| } else if (MACRO_CALL(OS_Func::__stricmp)(s_italian_005a6300, | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( | ||
| DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->gameLanguage = GL_ITALIAN; | ||
| } else if (MACRO_CALL(OS_Func::__stricmp)("SPANISH", | ||
| MACRO_CALL_MEMBER(TextManager_Func::getTextStringInGroupAtOffset, this)( | ||
| DE::SHCDE::TEXT_LANGUAGE, 0)) | ||
| == 0) { | ||
| this->gameLanguage = GL_SPANISH; | ||
| } | ||
| MACRO_CALL(OS_Func::_ucrt_close)(file); | ||
| this->field_0x1348 = 1; | ||
| this->field_0x24 = 0; | ||
| this->field_0x28 = 0; | ||
| MACRO_CALL_MEMBER(IO::LowLevelMemory_Func::fillMemory_ByteValue, DAT_LowLevelMemory::ptr)( | ||
| sizeof(this->field_0x1334), 0, this->field_0x1334); | ||
| MACRO_CALL_MEMBER(TextManager_Func::resetTextClipRange, this)(); | ||
| this->field_0x34 = 0; | ||
| } | ||
|
|
||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.