Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
4895ea0
reimplement: SHC_3BB0A8C1_0x0044D3D0 99.50% Asm reads surface via thi…
kotijekriv Nov 3, 2026
7df0a7a
build: drop takeScreenshot.cpp from the /GL file list
kotijekriv Nov 3, 2026
cd8f676
reimplement: SHC_3BB0A8C1_0x00479540 85.40% Game STL calls; reg rotation
kotijekriv Nov 3, 2026
f8dd114
reimplement: SHC_3BB0A8C1_0x00408FC0 84.10% Reg alloc only
kotijekriv Nov 3, 2026
9cd2756
headers: basic_ofstream_write (0x004791B0) is __cdecl and takes a char
kotijekriv Nov 3, 2026
207e76f
reimplement: SHC_3BB0A8C1_0x00479540 87.10% Game STL ctor/dtor; reg r…
kotijekriv Nov 3, 2026
7e40948
reimplement: SHC_3BB0A8C1_0x004729B0 79.10% Callee-saved register swa…
kotijekriv Nov 3, 2026
685b039
reimplement: SHC_3BB0A8C1_0x004708F0 80.40% Volatile register rotatio…
kotijekriv Nov 3, 2026
303f94b
reimplement: SHC_3BB0A8C1_0x004706E0 71.50% Scheduling and scratch re…
kotijekriv Nov 3, 2026
7dec703
reimplement: SHC_3BB0A8C1_0x00470040 56.70% Zero not kept in ebp; par…
kotijekriv Nov 3, 2026
bde666f
reimplement: SHC_3BB0A8C1_0x004630D0 93.50% Alpha branch's pixel inde…
kotijekriv Nov 3, 2026
8e65f98
reimplement: SHC_3BB0A8C1_0x00463310 72.10% Block placement and jump …
kotijekriv Nov 3, 2026
9f375ff
reimplement: SHC_3BB0A8C1_0x00433780 95.40% Two locals in swapped sta…
kotijekriv Nov 3, 2026
e4a0f0e
reimplement: SHC_3BB0A8C1_0x00493690 85.70% Constant 1 kept in edi
kotijekriv Nov 3, 2026
ce6bd1e
reimplement: SHC_3BB0A8C1_0x004BC790 67.20% Shared blocks and offsets…
kotijekriv Nov 3, 2026
211e32e
reimplement: SHC_3BB0A8C1_0x004B7C90 74.50% Register allocation differs
kotijekriv Nov 3, 2026
b05f87f
reimplement: SHC_3BB0A8C1_0x004DAFB0 67.80% Loop registers and RECT s…
kotijekriv Nov 3, 2026
eddd914
reimplement: SHC_3BB0A8C1_0x004BA910 97.20% One push scheduled later
kotijekriv Nov 3, 2026
d924f3e
reimplement: SHC_3BB0A8C1_0x004D5810 58.70% Frame 8 bytes larger, reg…
kotijekriv Nov 3, 2026
505bef4
reimplement: SHC_3BB0A8C1_0x004D76A0 58.20% Register assignment differs
kotijekriv Nov 3, 2026
41a16b6
reimplement: SHC_3BB0A8C1_0x00453600 89.40% Globals via statics in asm
kotijekriv Nov 3, 2026
bb8e7cf
reimplement: SHC_3BB0A8C1_0x00453B00 92.60% Globals via statics in asm
kotijekriv Nov 3, 2026
a471649
reimplement: SHC_3BB0A8C1_0x00454080 79.70% Prologue registers rotated
kotijekriv Nov 3, 2026
7934c01
reimplement: SHC_3BB0A8C1_0x00452900 98.10% Globals via statics in asm
kotijekriv Nov 3, 2026
35818ac
fix: GMFirstPictureIndex in RenderGoldValue
kotijekriv Nov 3, 2026
f9e33bf
style: names, comments and if/else in UI/Rendering
kotijekriv Nov 3, 2026
33779d7
reimplement: SHC_3BB0A8C1_0x004916C0 90.30% Store scheduling differs
kotijekriv Nov 3, 2026
0ce6fae
reimplement: SHC_3BB0A8C1_0x00493900 93.90% Store scheduling differs
kotijekriv Nov 3, 2026
300f237
reimplement: SHC_3BB0A8C1_0x004B51A0 87.10% Two registers swapped
kotijekriv Nov 3, 2026
34f3fa4
reimplement: SHC_3BB0A8C1_0x004B5280 87.50% Globals via statics in asm
kotijekriv Nov 3, 2026
950e83e
reimplement: SHC_3BB0A8C1_0x004B2820 82.70% Zero kept in esi
kotijekriv Nov 3, 2026
3ccb2cf
reimplement: SHC_3BB0A8C1_0x004B5F70 48.20% Frame one slot smaller
kotijekriv Nov 3, 2026
553dc4f
reimplement: SHC_3BB0A8C1_0x004B5330 21.40% Pixel store and registers…
kotijekriv Nov 3, 2026
6b84fca
style: comments in UI-Core
kotijekriv Nov 3, 2026
288841e
reimplement: SHC_3BB0A8C1_0x0043FAC0 85.30% Loop registers differ
kotijekriv Nov 3, 2026
a268134
reimplement: SHC_3BB0A8C1_0x0043F6A0 82.40% Register naming differs
kotijekriv Nov 3, 2026
a6118a2
reimplement: SHC_3BB0A8C1_0x00447FA0 40.20% Register allocation differs
kotijekriv Nov 3, 2026
3bf73e8
reimplement: SHC_3BB0A8C1_0x0043C1E0 87.60% Register allocation differs
kotijekriv Nov 3, 2026
87c2eb2
style: comments and string literal
kotijekriv Nov 3, 2026
435cc46
fix: GMFirstPictureIndex in isMouseOnButtonImageUnk
kotijekriv Nov 3, 2026
3e056ef
reimplement: SHC_3BB0A8C1_0x00486F20 98.90% One lea scheduled earlier
kotijekriv Nov 3, 2026
1c3c6b1
reimplement: SHC_3BB0A8C1_0x00480440 95.70% ebp is saved at entry; th…
kotijekriv Nov 3, 2026
b83d22f
build: compile determineGameTicksToPerform with /GL
kotijekriv Nov 3, 2026
cb71946
reimplement: SHC_3BB0A8C1_0x00487A30 81.20% Game speed not kept in a …
kotijekriv Nov 3, 2026
48a2c84
status: four lines re-measured in this branch on its own
kotijekriv Nov 3, 2026
dda39f8
build: list determineGameTicksToPerform.cpp next to the other GameSyn…
kotijekriv Nov 3, 2026
3e04e53
Merge sourcehold main
kotijekriv Nov 3, 2026
ef53d2e
style: renderBltAndFlip takes its format string from string-literals.…
kotijekriv Nov 3, 2026
4942821
style: declare at first use, scoped case locals, braces (draft functi…
kotijekriv Nov 3, 2026
9d53d54
style: review fixes (decimal numbers, compound assignments, includes)
kotijekriv Nov 3, 2026
f84d134
style: drop unused using declarations, compound assignments (draft fu…
kotijekriv Nov 3, 2026
d3e6fa8
style: initializeFinalResultsForActivePlayers disables the strcpy dep…
kotijekriv Nov 3, 2026
97cbcfd
Merge main: the upstream header sync (a521bf7bd)
kotijekriv Nov 4, 2026
116dd55
style: DAT_ButtonW is an int now, so the cast goes (RenderScenarioBut…
kotijekriv Nov 4, 2026
b882d22
reimplement: SHC_3BB0A8C1_0x00479540 86.40% calls into the C++ librar…
kotijekriv Nov 4, 2026
536abcc
style: for loops step with ++i / --i (gynt's review of #311)
kotijekriv Nov 4, 2026
74dbb76
header: drop this PR's basic_ofstream_write change, nothing here call…
kotijekriv Nov 4, 2026
d372ee0
header: seven globals the code compares as signed are int
kotijekriv Nov 4, 2026
fb337c1
style: drop the (int) casts on the globals that are int now
kotijekriv Nov 4, 2026
1ac5670
style: drop BOOLEnum.hpp and BGR24.hpp where the type is never named
kotijekriv Nov 4, 2026
bd6a713
style: clang-format after the include clean-up
kotijekriv Nov 4, 2026
f6c6936
Merge main: the second upstream header sync (bc45882f8)
kotijekriv Nov 4, 2026
e4c935e
fix: follow bc45882f8's field names in openBuildingStatusMenuForBuild…
kotijekriv Nov 4, 2026
a14fcb1
Merge main: the third upstream header sync (12854bcf4)
kotijekriv Nov 4, 2026
881c457
Name the text colours with main's ColorsEnum
kotijekriv Nov 4, 2026
73c8fd7
Merge main (#311 and #312) into reimpl/batch1-development
kotijekriv Nov 4, 2026
bff2b90
reimplement: SHC_3BB0A8C1_0x00454080 86.3% the C++ part before the as…
kotijekriv Nov 4, 2026
955b59e
Take the nine functions that reached 100% out of this draft
kotijekriv Nov 4, 2026
78ca687
Merge main (0353cce84) into reimpl/batch1-development
kotijekriv Nov 4, 2026
3481512
Follow 7c6bb9e26's field renames
kotijekriv Nov 4, 2026
70bed82
Merge main (8a3f6e8ea) into reimpl/batch1-development
kotijekriv Nov 4, 2026
ccdcd09
Merge main (630608005) into reimpl/batch1-development
kotijekriv Nov 5, 2026
e09ec78
headers: ColorsEnum gets the colours our menus and displays use
kotijekriv Nov 5, 2026
73c5cfc
Colours by their ColorsEnum names
kotijekriv Nov 5, 2026
d61a9d4
Merge main 948dce845 for countof()
kotijekriv Nov 5, 2026
764858f
Loop bounds by countof(), as main's 948dce845
kotijekriv Nov 5, 2026
52ff377
Merge origin/main (72b27322e) into reimpl/batch1-development
kotijekriv Nov 5, 2026
296da0b
Use main's names from the ghidra sync
kotijekriv Nov 5, 2026
3448886
Move four functions to the ready PR
kotijekriv Nov 6, 2026
6a2b835
RenderStatusMenu_Population: 82.4% -> 93.8%
kotijekriv Nov 6, 2026
9f483a2
Merge main (eef6f667a, gynt's header sync) into reimpl/batch1-develop…
kotijekriv Nov 7, 2026
c03aad6
RenderMissionObjectivesUnk: use main's INT_00eb0b24
kotijekriv Nov 7, 2026
b847a24
Merge main (e32319b21, gynt's Ghidra sync) into reimpl/batch1-develop…
kotijekriv Nov 7, 2026
65f0307
RenderMissionObjectivesUnk: the objectives are ScenarioEventCondition…
kotijekriv Nov 7, 2026
42f06db
Merge main (39ed8174d) into reimpl/batch1-development
kotijekriv Nov 10, 2026
742c910
fix(minimap): index screenPointToTileNumber from its new base
kotijekriv Nov 10, 2026
4d3c4e7
style: self-operations in renderBltAndFlip (style guide rule 29)
kotijekriv Nov 11, 2026
0287fe5
reimplement: SHC_3BB0A8C1_0x004BC790 100.0% Reimplemented
kotijekriv Nov 13, 2026
21b73bc
drafts: move 0x004BC790 RenderAnimatedTutorialFloatOverlay to the uni…
kotijekriv Nov 14, 2026
ee318b7
Merge origin/main (e086ba7c3) into reimpl/batch1-development
kotijekriv Nov 17, 2026
64d6ed0
style: checker fixes in four drafts
kotijekriv Nov 17, 2026
e9ccae5
fix: RenderGreatestLordScreen builds against main's headers
kotijekriv Nov 17, 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
2 changes: 1 addition & 1 deletion cmake/compiler-flags-gl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ src/OpenSHC/IO/LowLevelMemory/putFileNameAndAppendFileExtension.cpp
src/OpenSHC/IO/DecoderState/encodeData.cpp
src/OpenSHC/IO/DecoderState/decodeData.cpp
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
Expand Down Expand Up @@ -69,6 +68,7 @@ src/OpenSHC/Map/Buildings/BuildingsState/canUnitReachBuildingPerimeter.cpp
src/OpenSHC/Synchrony/GameSynchronyState/receiveAllTransmittedCommands.cpp
src/OpenSHC/Synchrony/GameSynchronyState/processSyncPacket.cpp
src/OpenSHC/Synchrony/GameSynchronyState/translateMultiplayerIDsIntoPlayerIDs.cpp
src/OpenSHC/Synchrony/GameSynchronyState/determineGameTicksToPerform.cpp
src/OpenSHC/Map/Buildings/UpdateStables.cpp
src/OpenSHC/Map/Buildings/UpdateArmorersWorkshop.cpp
src/OpenSHC/Map/Buildings/UpdateFletchersWorkshop.cpp
Expand Down
132 changes: 132 additions & 0 deletions src/OpenSHC/Rendering/Bink/AIMessageQueue/playAiLordMessage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#include "../AIMessageQueue.func.hpp"

#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp"
#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/Rendering.func.hpp"
#include "OpenSHC/Text/FontSizeClass.func.hpp"
#include "OpenSHC/Text/TextManager.func.hpp"
#include "OpenSHC/UI/DisplayElements.func.hpp"
#include "OpenSHC/UI/MenuModalComposition.func.hpp"
#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp"
#include "OpenSHC/DE/SHCDE/eGM.hpp"
#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp"
#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp"
#include "OpenSHC/UI/Enums/DisplayElementID.hpp"
#include "OpenSHC/UI/Enums/MenuModalType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_BinkControlState.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp"
#include "OpenSHC/Globals/DAT_MenuModalComposition2.hpp"
#include "OpenSHC/Globals/DAT_SoundSystemState.hpp"
#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"

namespace OpenSHC {
namespace Rendering {
namespace Bink {

// FUNCTION: STRONGHOLDCRUSADER 0x004B7C90
void AIMessageQueue::playAiLordMessage(int x, int y)
{
DWORD const now = timeGetTime();
int yOffset = 0;
if (!MACRO_CALL_MEMBER(Game::GameCore_Func::getAreWeInAInGameMenu, DAT_GameCore::ptr)()) {
return;
}
if (DAT_GameCore::instance.currentMenuViewType == UI::Enums::MVT_BUILDING_AND_STATUS_MENU) {
if (DAT_GameCore::instance.activeMenuTab.tabType == UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) {
yOffset = -40;
} else if (DAT_GameCore::instance.activeMenuTab.tabType == UI::Enums::BASMTT_MERCENARYPOST) {
yOffset = -40;
} else {
yOffset = -20;
}
}
if (MACRO_CALL(UI::DisplayElements_Func::GetIfDisplayElementStateNotZero)(
UI::Enums::DEID_KEEP_AND_GRANERY_PLACEMENT_INFO)) {
yOffset -= 40;
}
int textHeight;
int textWidth;
if (!this->currentMessageUnknownValue_0x4) {
textHeight = MACRO_CALL_MEMBER(Text::FontSizeClass_Func::renderMultilineWideTextUnk,
&DAT_TextManagerObject::instance.fontSizeClassArray[18])(
(WCHAR*)this->currentMessageText_0x8, 0, 0, 580, 0, 0, 1);
textWidth = MACRO_CALL_MEMBER(Text::FontSizeClass_Func::renderMultilineWideTextUnk,
&DAT_TextManagerObject::instance.fontSizeClassArray[18])(
(WCHAR*)this->currentMessageText_0x8, 0, 0, 580, 0, 0, 2);
MACRO_CALL_MEMBER(Text::TextManager_Func::renderMultilineWideTextUnk, DAT_TextManagerObject::ptr)(
(WCHAR*)this->currentMessageText_0x8, x - textWidth, yOffset - textHeight + y, 580,
OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18, 0);
} else {
textHeight = MACRO_CALL_MEMBER(Text::FontSizeClass_Func::renderMultilineTextUnk,
&DAT_TextManagerObject::instance.fontSizeClassArray[18])(
this->currentMessageText_0x8, 0, 0, 580, 0, 0, 1);
textWidth = MACRO_CALL_MEMBER(Text::FontSizeClass_Func::renderMultilineTextUnk,
&DAT_TextManagerObject::instance.fontSizeClassArray[18])(
this->currentMessageText_0x8, 0, 0, 580, 0, 0, 2);
MACRO_CALL_MEMBER(Text::TextManager_Func::renderMultilineText6Unk, DAT_TextManagerObject::ptr)(
this->currentMessageText_0x8, x - textWidth, yOffset - textHeight + y, 580,
OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18, 0);
}
if ((int)this->currentMessageUnknownValue2_0xd4 > 0) {
int const nameHeight = MACRO_CALL_MEMBER(Text::FontSizeClass_Func::renderMultilineTextUnk,
&DAT_TextManagerObject::instance.fontSizeClassArray[18])(
DAT_GameSynchronyState::instance.DAT_PlayerNames[this->currentMessageUnknownValue2_0xd4], 0, 0, 580,
0, 0, 1);
int const nameWidth = MACRO_CALL_MEMBER(Text::FontSizeClass_Func::renderMultilineTextUnk,
&DAT_TextManagerObject::instance.fontSizeClassArray[18])(
DAT_GameSynchronyState::instance.DAT_PlayerNames[this->currentMessageUnknownValue2_0xd4], 0, 0, 580,
0, 0, 2);
MACRO_CALL_MEMBER(Text::TextManager_Func::renderMultilineText6Unk, DAT_TextManagerObject::ptr)(
DAT_GameSynchronyState::instance.DAT_PlayerNames[this->currentMessageUnknownValue2_0xd4],
x - nameWidth, yOffset - nameHeight + y, 580, OpenSHC::Rendering::Colors::COL_CCFAFF, 0, 18, 0);
int aiCharacter = 0;
if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[this->currentMessageUnknownValue2_0xd4]
== -1) {
aiCharacter
= DAT_GameSynchronyState::instance.currentAIArray[this->currentMessageUnknownValue2_0xd4];
}
int const faceX = x - nameWidth - 80;
int const faceY = y - nameHeight - 48;
MACRO_CALL_MEMBER(UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)(
DE::SHCDE::GM_INTERFACE_ICONS2, this->currentMessageUnknownValue2_0xd4 + 546, faceX, faceY);
if (!aiCharacter) {
MACRO_CALL_MEMBER(UI::Rendering::TextureRenderCore_Func::renderGM,
DAT_TextureRenderCoreObject::ptr)(DE::SHCDE::GM_INTERFACE_ICONS2, 539, faceX, faceY);
} else {
MACRO_CALL_MEMBER(
UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)(
DE::SHCDE::GM_INTERFACE_ICONS2, aiCharacter + 522, faceX, faceY);
}
}
if (!MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)(
Audio::MSS::enums::SND_STR_SPEECH_1)) {
this->mbr_0x92c = 1;
}
if ((int)(now - this->videoStartTimeUnk_0xd8) <= 10000 && textWidth != 0) {
return;
}
if (this->currentMessageVfxFile_0xc[0] != '\0') {
if (DAT_BinkControlState::instance.binkObjPtrArray[1] != NULL) {
return;
}
} else if (this->currentMessageSfxFile_0x70[0] != '\0' && DAT_SoundSystemState::instance.waveOutOpenUnk_0x8
&& DAT_SoundSystemState::instance.soundActiveUnk_0x0 && !this->mbr_0x92c) {
return;
}
if (DAT_GameCore::instance.gamePausedLogical) {
return;
}
this->mbr_0x928 = 0;
DAT_GameCore::instance.countdown = 2;
MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition2::ptr)(
UI::Enums::MMT_NONE, FALSE);
}

}
}
}
134 changes: 134 additions & 0 deletions src/OpenSHC/Rendering/Bink/BinkControlClass/copyBinkToVideoBuffer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#include "../BinkControlClass.func.hpp"

#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp"
#include "OpenSHC/Rendering.func.hpp"
#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/Audio/MSS/enums/SHC_SoundStream.hpp"
#include "OpenSHC/Rendering/Bink/UnsortedBinkFlag.hpp"
#include "OpenSHC/UI/Menu.hpp"

#include "OpenSHC/Globals/COL_BLACK.hpp"
#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp"
#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"
#include "OpenSHC/Globals/DAT_SoundSystemState.hpp"
#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp"

namespace OpenSHC {
namespace Rendering {
namespace Bink {

using OpenSHC::Audio::MSS::enums::SHC_SoundStream;

// The original inlined this per-video body into the loop: its early returns are the jumps to the loop
// increment. Plain `inline` is not expanded by MSVC here, so it has to be __forceinline (same code as a goto,
// no goto needed).
static __forceinline void copyBinkToVideoBuffer_copyFrame(
BinkControlClass* self, int binkObjIndex, dword videoTarget)
{
if (self->soundStreamIndex[binkObjIndex] != OpenSHC::Audio::MSS::enums::SND_STR_MUSIC) {
if (!MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::isSampleOrStreamPlaying,
DAT_SoundSystemState::ptr)((SHC_SoundStream)self->soundStreamIndex[binkObjIndex])
|| timeGetTime() - self->startTime[binkObjIndex] > 20000) {
self->soundStreamIndex[binkObjIndex] = OpenSHC::Audio::MSS::enums::SND_STR_MUSIC;
}
}

if (self->unknownParam07[binkObjIndex] == videoTarget) {
self->unknown01_zero[binkObjIndex] = 0;
self->unknown02_zero[binkObjIndex] = 0;
}

if (self->binkObjPtrArray[binkObjIndex] == NULL || self->unknownParam07[binkObjIndex] != videoTarget) {
return;
}

if (BinkWait(self->binkObjPtrArray[binkObjIndex]) == 0) {
BinkDoFrame(self->binkObjPtrArray[binkObjIndex]);

if ((self->binkObjPtrArray[binkObjIndex]->FrameNum == self->binkObjPtrArray[binkObjIndex]->Frames)
&& (self->unknownParam03[binkObjIndex] == 0)) {
if (self->soundStreamIndex[binkObjIndex] == OpenSHC::Audio::MSS::enums::SND_STR_MUSIC) {
if (videoTarget != 2) {
self->unknown01_zero[binkObjIndex] = 1;
MACRO_CALL_MEMBER(OpenSHC::Rendering::Bink::BinkControlClass_Func::stopBinkPlayback, self)(
binkObjIndex);
return;
}
self->unknown02_zero[binkObjIndex] = 1;
} else if (videoTarget == 2) {
self->unknown02_zero[binkObjIndex] = 1;
}
} else {
BinkNextFrame(self->binkObjPtrArray[binkObjIndex]);
}

self->frameReadyToDisplay[binkObjIndex] = TRUE;
}

if (videoTarget == 2) {
int const menuBorderHeight = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight;
int const menuBorderWidth = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth;
OpenSHC::UI::Menu* const menu = DAT_MenuHandlerState::instance.currentMenu;
menu->xPosition = menuBorderWidth;
menu->yPosition = menuBorderHeight;
DAT_MenuHandlerState::instance.y = menuBorderHeight;
DAT_MenuHandlerState::instance.x = menuBorderWidth;
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox,
DAT_PencilRenderCore::ptr)(0, 0, DAT_WindowAndDirectDraw::instance.resolutionX,
DAT_WindowAndDirectDraw::instance.resolutionY, COL_BLACK::instance.shortValue);
}

if (!self->frameReadyToDisplay[binkObjIndex]) {
return;
}

IDirectDrawSurface* surface;
if (self->unknownParam04[binkObjIndex] != 0) {
HRESULT result = DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_mapGame->Lock(
NULL, &DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfMapGame, DDLOCK_WAIT, NULL);
while (result == DDERR_SURFACELOST) {
if (DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_mapGame->Restore()
!= DD_OK) {
return;
}
result = DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_mapGame->Lock(
NULL, &DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfMapGame, DDLOCK_WAIT, NULL);
}
BinkCopyToBuffer(self->binkObjPtrArray[binkObjIndex],
DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfMapGame.lpSurface,
DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfMapGame.lPitch,
self->binkObjPtrArray[binkObjIndex]->Height, self->xPos[binkObjIndex], self->yPos[binkObjIndex],
self->mapGameSurfaceType | OpenSHC::Rendering::Bink::UBF_BINKCOPYALL);
surface = DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_mapGame;
} else {
HRESULT result = DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_screenMenu->Lock(
NULL, &DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfScreenMenu_0x104, DDLOCK_WAIT, NULL);
while (result == DDERR_SURFACELOST) {
if (DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_screenMenu->Restore()
!= DD_OK) {
return;
}
result = DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_screenMenu->Lock(NULL,
&DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfScreenMenu_0x104, DDLOCK_WAIT, NULL);
}
BinkCopyToBuffer(self->binkObjPtrArray[binkObjIndex],
DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfScreenMenu_0x104.lpSurface,
DAT_WindowAndDirectDraw::instance.surfDescBink_offSurfScreenMenu_0x104.lPitch,
self->binkObjPtrArray[binkObjIndex]->Height, self->xPos[binkObjIndex], self->yPos[binkObjIndex],
self->screenMenuSurfaceType_0x5c | OpenSHC::Rendering::Bink::UBF_BINKCOPYALL);
surface = DAT_WindowAndDirectDraw::instance.directDrawOffscreenSurfacePointer_screenMenu;
}
surface->Unlock(NULL);
}

// FUNCTION: STRONGHOLDCRUSADER 0x00408FC0
void BinkControlClass::copyBinkToVideoBuffer(dword videoTarget)
{
for (int binkObjIndex = 0; binkObjIndex < 2; ++binkObjIndex) {
copyBinkToVideoBuffer_copyFrame(this, binkObjIndex, videoTarget);
}
}

}
}
}
Loading
Loading