Implement/match MxStillPresenter::Clone (#502)

* Implement/match MxStillPresenter::Clone

* Fix
This commit is contained in:
Christian Semmler
2024-01-29 11:29:12 -05:00
committed by GitHub
parent 445084f4b0
commit 96234ddc23
11 changed files with 93 additions and 44 deletions

View File

@@ -679,6 +679,13 @@ done:
return surface;
}
// STUB: LEGO1 0x100bbfb0
LPDIRECTDRAWSURFACE MxDisplaySurface::FUN_100bbfb0(LPDIRECTDRAWSURFACE p_und)
{
// TODO
return NULL;
}
// FUNCTION: LEGO1 0x100bc070
LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface()
{

View File

@@ -12,9 +12,9 @@ DECOMP_SIZE_ASSERT(MxFlcPresenter, 0x68);
// FUNCTION: LEGO1 0x100b3310
MxFlcPresenter::MxFlcPresenter()
{
this->m_flcHeader = NULL;
this->m_flags &= ~c_bit2;
this->m_flags &= ~c_bit3;
m_flcHeader = NULL;
SetBit1(FALSE);
SetBit2(FALSE);
}
// FUNCTION: LEGO1 0x100b3420

View File

@@ -20,8 +20,8 @@ MxLoopingFlcPresenter::~MxLoopingFlcPresenter()
void MxLoopingFlcPresenter::Init()
{
this->m_elapsedDuration = 0;
this->m_flags &= ~c_bit2;
this->m_flags &= ~c_bit3;
SetBit1(FALSE);
SetBit2(FALSE);
}
// FUNCTION: LEGO1 0x100b4430

View File

@@ -20,9 +20,9 @@ MxLoopingSmkPresenter::~MxLoopingSmkPresenter()
// FUNCTION: LEGO1 0x100b49b0
void MxLoopingSmkPresenter::Init()
{
this->m_elapsedDuration = 0;
this->m_flags &= ~c_bit2;
this->m_flags &= ~c_bit3;
m_elapsedDuration = 0;
SetBit1(FALSE);
SetBit2(FALSE);
}
// FUNCTION: LEGO1 0x100b49d0

View File

@@ -23,8 +23,8 @@ void MxSmkPresenter::Init()
{
m_currentFrame = 0;
memset(&m_mxSmack, 0, sizeof(m_mxSmack));
m_flags &= ~c_bit2;
m_flags &= ~c_bit3;
SetBit1(FALSE);
SetBit2(FALSE);
}
// FUNCTION: LEGO1 0x100b3900

View File

@@ -75,12 +75,12 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
MxRect32 rect(x, y, width + x, height + y);
MVideoManager()->InvalidateRect(rect);
if (m_flags & c_bit2) {
if (GetBit1()) {
undefined4 und = 0;
m_unk0x58 = MxOmni::GetInstance()->GetVideoManager()->GetDisplaySurface()->VTable0x44(
m_bitmap,
&und,
(m_flags & c_bit4) / 8,
GetBit3(),
m_action->GetFlags() & MxDSAction::c_bit4
);
@@ -91,9 +91,9 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
m_bitmap = NULL;
if (m_unk0x58 && und)
m_flags |= c_bit3;
SetBit2(TRUE);
else
m_flags &= ~c_bit3;
SetBit2(FALSE);
}
}
@@ -186,7 +186,7 @@ void MxStillPresenter::ParseExtra()
MxPresenter::ParseExtra();
if (m_action->GetFlags() & MxDSAction::c_bit5)
m_flags |= c_bit4;
SetBit3(TRUE);
MxU32 len = m_action->GetExtraLength();
@@ -207,15 +207,52 @@ void MxStillPresenter::ParseExtra()
}
if (KeyValueStringParse(output, g_strBmpIsmap, buf)) {
m_flags |= c_bit5;
m_flags &= ~c_bit2;
m_flags &= ~c_bit3;
SetBit4(TRUE);
SetBit1(FALSE);
SetBit2(FALSE);
}
}
// STUB: LEGO1 0x100ba2c0
// FUNCTION: LEGO1 0x100ba2c0
MxStillPresenter* MxStillPresenter::Clone()
{
// TODO
return NULL;
MxResult result = FAILURE;
MxStillPresenter* presenter = new MxStillPresenter;
if (presenter) {
if (presenter->AddToManager() == SUCCESS) {
MxDSAction* action = presenter->GetAction()->Clone();
if (action && presenter->StartAction(NULL, action) == SUCCESS) {
presenter->SetBit0(GetBit0());
presenter->SetBit1(GetBit1());
presenter->SetBit2(GetBit2());
presenter->SetBit3(GetBit3());
presenter->SetBit4(GetBit4());
if (m_bitmap) {
presenter->m_bitmap = new MxBitmap;
if (!presenter->m_bitmap || presenter->m_bitmap->ImportBitmap(m_bitmap) != SUCCESS)
goto done;
}
if (m_unk0x58)
presenter->m_unk0x58 = MxDisplaySurface::FUN_100bbfb0(m_unk0x58);
if (m_alpha)
presenter->m_alpha = new MxVideoPresenter::AlphaMask(*m_alpha);
result = SUCCESS;
}
}
}
done:
if (result != SUCCESS) {
delete presenter;
presenter = NULL;
}
return presenter;
}

View File

@@ -117,16 +117,16 @@ void MxVideoPresenter::Init()
m_unk0x5c = 1;
m_unk0x58 = NULL;
m_unk0x60 = -1;
m_flags &= ~c_bit1;
SetBit0(FALSE);
if (MVideoManager() != NULL) {
MVideoManager();
m_flags |= c_bit2;
m_flags &= ~c_bit3;
SetBit1(TRUE);
SetBit2(FALSE);
}
m_flags &= ~c_bit4;
m_flags &= ~c_bit5;
SetBit3(FALSE);
SetBit4(FALSE);
}
// FUNCTION: LEGO1 0x100b27b0
@@ -138,8 +138,8 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor)
if (m_unk0x58) {
m_unk0x58->Release();
m_unk0x58 = NULL;
m_flags &= ~c_bit2;
m_flags &= ~c_bit3;
SetBit1(FALSE);
SetBit2(FALSE);
}
if (MVideoManager() && (m_alpha || m_bitmap)) {
@@ -230,8 +230,7 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
pixel = m_bitmap->GetBmiStride() * height + m_bitmap->GetBitmapData();
}
// DECOMP: m_flags is 1 byte, so no enum here
if (m_flags & 0x10)
if (GetBit4())
return (MxBool) *pixel;
if ((GetAction()->GetFlags() & MxDSAction::c_bit4) && *pixel == 0)
@@ -429,13 +428,13 @@ void MxVideoPresenter::StreamingTickle()
LoadFrame(m_currentChunk);
m_subscriber->DestroyChunk(m_currentChunk);
m_currentChunk = NULL;
m_flags |= c_bit1;
SetBit0(TRUE);
if (m_currentTickleState != e_streaming)
break;
}
if (m_flags & c_bit1)
if (GetBit0())
m_unk0x5c = 5;
}
}
@@ -467,13 +466,13 @@ void MxVideoPresenter::RepeatingTickle()
LoadFrame(m_currentChunk);
m_currentChunk = NULL;
m_flags |= c_bit1;
SetBit0(TRUE);
if (m_currentTickleState != e_repeating)
break;
}
if (m_flags & c_bit1)
if (GetBit0())
m_unk0x5c = 5;
}
}