Implement/match LegoPhonemePresenter::LoadFrame & PutFrame (#812)

* Implement/match LegoPhonemePresenter::LoadFrame & PutFrame

* add beta10 annotations
This commit is contained in:
Christian Semmler 2024-04-17 07:26:11 -04:00 committed by GitHub
parent d639eb4c2b
commit 11410890cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 89 additions and 68 deletions

View file

@ -33,7 +33,7 @@ class LegoPhonemePresenter : public MxFlcPresenter {
private:
void Init();
undefined4 m_unk0x68; // 0x68
MxS32 m_rectCount; // 0x68
LegoTextureInfo* m_textureInfo; // 0x6c
MxBool m_unk0x70; // 0x70
MxString m_roiName; // 0x74

View file

@ -100,17 +100,17 @@ void LegoMeterPresenter::ParseExtra()
void LegoMeterPresenter::StreamingTickle()
{
MxStillPresenter::StreamingTickle();
m_unk0x6c = new MxU8[m_bitmap->GetBmiStride() * m_bitmap->GetBmiHeightAbs()];
m_unk0x6c = new MxU8[m_frameBitmap->GetBmiStride() * m_frameBitmap->GetBmiHeightAbs()];
if (m_unk0x6c == NULL) {
EndAction();
}
memcpy(m_unk0x6c, m_bitmap->GetBitmapData(), m_bitmap->GetBmiStride() * m_bitmap->GetBmiHeightAbs());
memcpy(m_unk0x6c, m_frameBitmap->GetImage(), m_frameBitmap->GetBmiStride() * m_frameBitmap->GetBmiHeightAbs());
m_unk0x88 = 0;
m_unk0x8a = 0;
m_unk0x8c = m_bitmap->GetBmiWidth() - 1;
m_unk0x8e = m_bitmap->GetBmiHeightAbs() - 1;
m_unk0x8c = m_frameBitmap->GetBmiWidth() - 1;
m_unk0x8e = m_frameBitmap->GetBmiHeightAbs() - 1;
}
// FUNCTION: LEGO1 0x10043a30

View file

@ -21,13 +21,14 @@ LegoPhonemePresenter::~LegoPhonemePresenter()
// FUNCTION: LEGO1 0x1004e3b0
void LegoPhonemePresenter::Init()
{
m_unk0x68 = 0;
m_rectCount = 0;
m_textureInfo = NULL;
m_unk0x70 = FALSE;
m_unk0x84 = FALSE;
}
// FUNCTION: LEGO1 0x1004e3d0
// FUNCTION: BETA10 0x100c3646
void LegoPhonemePresenter::StartingTickle()
{
MxFlcPresenter::StartingTickle();
@ -84,16 +85,36 @@ void LegoPhonemePresenter::StartingTickle()
}
}
// STUB: LEGO1 0x1004e800
// FUNCTION: LEGO1 0x1004e800
// FUNCTION: BETA10 0x100c3ac9
void LegoPhonemePresenter::LoadFrame(MxStreamChunk* p_chunk)
{
// TODO
MxU8* data = p_chunk->GetData();
m_rectCount = *(MxS32*) data;
data += sizeof(MxS32);
MxRect32* rects = (MxRect32*) data;
data += m_rectCount * sizeof(MxRect32);
MxBool decodedColorMap;
DecodeFLCFrame(
&m_frameBitmap->GetBitmapInfo()->m_bmiHeader,
m_frameBitmap->GetImage(),
m_flcHeader,
(FLIC_FRAME*) data,
&decodedColorMap
);
}
// STUB: LEGO1 0x1004e840
// FUNCTION: LEGO1 0x1004e840
// FUNCTION: BETA10 0x100c3b5d
void LegoPhonemePresenter::PutFrame()
{
// TODO
if (m_textureInfo != NULL && m_rectCount != 0) {
m_textureInfo->FUN_10066010(m_frameBitmap->GetImage());
m_rectCount = 0;
}
}
// STUB: LEGO1 0x1004e870

View file

@ -92,7 +92,7 @@ class MxBitmap : public MxCore {
inline MxLong GetBmiStride() const { return ((m_bmiHeader->biWidth + 3) & -4); }
inline MxLong GetBmiHeight() const { return m_bmiHeader->biHeight; }
inline MxLong GetBmiHeightAbs() const { return AbsFlipped(m_bmiHeader->biHeight); }
inline MxU8* GetBitmapData() const { return m_data; }
inline MxU8* GetImage() const { return m_data; }
inline MxBITMAPINFO* GetBitmapInfo() const { return m_info; }
inline MxLong GetDataSize() const
{

View file

@ -64,13 +64,13 @@ class MxVideoPresenter : public MxMediaPresenter {
virtual LPDIRECTDRAWSURFACE VTable0x78() { return m_unk0x58; } // vtable+0x78
// FUNCTION: LEGO1 0x1000c7c0
virtual MxBool VTable0x7c() { return m_bitmap != NULL || m_alpha != NULL; } // vtable+0x7c
virtual MxBool VTable0x7c() { return m_frameBitmap != NULL || m_alpha != NULL; } // vtable+0x7c
// FUNCTION: LEGO1 0x1000c7e0
virtual MxS32 GetWidth() { return m_alpha ? m_alpha->m_width : m_bitmap->GetBmiWidth(); } // vtable+0x80
virtual MxS32 GetWidth() { return m_alpha ? m_alpha->m_width : m_frameBitmap->GetBmiWidth(); } // vtable+0x80
// FUNCTION: LEGO1 0x1000c800
virtual MxS32 GetHeight() { return m_alpha ? m_alpha->m_height : m_bitmap->GetBmiHeightAbs(); } // vtable+0x84
virtual MxS32 GetHeight() { return m_alpha ? m_alpha->m_height : m_frameBitmap->GetBmiHeightAbs(); } // vtable+0x84
// VTABLE: LEGO1 0x100dc2bc
// SIZE 0x0c
@ -90,7 +90,7 @@ class MxVideoPresenter : public MxMediaPresenter {
};
inline MxS32 PrepareRects(RECT& p_rectDest, RECT& p_rectSrc);
inline MxBitmap* GetBitmap() { return m_bitmap; }
inline MxBitmap* GetBitmap() { return m_frameBitmap; }
inline AlphaMask* GetAlphaMask() { return m_alpha; }
inline void SetBit0(BOOL p_e) { m_flags.m_bit0 = p_e; }
@ -114,7 +114,7 @@ class MxVideoPresenter : public MxMediaPresenter {
protected:
void Destroy(MxBool p_fromDestructor);
MxBitmap* m_bitmap; // 0x50
MxBitmap* m_frameBitmap; // 0x50
AlphaMask* m_alpha; // 0x54
LPDIRECTDRAWSURFACE m_unk0x58; // 0x58
MxS16 m_unk0x5c; // 0x5c

View file

@ -123,7 +123,7 @@ MxResult MxBitmap::ImportBitmap(MxBitmap* p_bitmap)
this->m_data = new MxU8[p_bitmap->GetDataSize()];
if (this->m_data) {
memcpy(this->m_info, p_bitmap->GetBitmapInfo(), MxBITMAPINFO::Size());
memcpy(this->m_data, p_bitmap->GetBitmapData(), p_bitmap->GetDataSize());
memcpy(this->m_data, p_bitmap->GetImage(), p_bitmap->GetDataSize());
this->m_bmiHeader = &this->m_info->m_bmiHeader;
this->m_paletteData = this->m_info->m_bmiColors;

View file

@ -35,12 +35,12 @@ void MxFlcPresenter::LoadHeader(MxStreamChunk* p_chunk)
// FUNCTION: LEGO1 0x100b34d0
void MxFlcPresenter::CreateBitmap()
{
if (m_bitmap) {
delete m_bitmap;
if (m_frameBitmap) {
delete m_frameBitmap;
}
m_bitmap = new MxBitmap;
m_bitmap->SetSize(m_flcHeader->width, m_flcHeader->height, NULL, FALSE);
m_frameBitmap = new MxBitmap;
m_frameBitmap->SetSize(m_flcHeader->width, m_flcHeader->height, NULL, FALSE);
}
// FUNCTION: LEGO1 0x100b3570
@ -56,8 +56,8 @@ void MxFlcPresenter::LoadFrame(MxStreamChunk* p_chunk)
MxBool decodedColorMap;
DecodeFLCFrame(
&m_bitmap->GetBitmapInfo()->m_bmiHeader,
m_bitmap->GetBitmapData(),
&m_frameBitmap->GetBitmapInfo()->m_bmiHeader,
m_frameBitmap->GetImage(),
m_flcHeader,
(FLIC_FRAME*) data,
&decodedColorMap
@ -77,7 +77,7 @@ void MxFlcPresenter::LoadFrame(MxStreamChunk* p_chunk)
// FUNCTION: LEGO1 0x100b3620
void MxFlcPresenter::RealizePalette()
{
MxPalette* palette = m_bitmap->CreatePalette();
MxPalette* palette = m_frameBitmap->CreatePalette();
MVideoManager()->RealizePalette(palette);
delete palette;
}

View file

@ -52,19 +52,19 @@ void MxSmkPresenter::LoadHeader(MxStreamChunk* p_chunk)
// FUNCTION: LEGO1 0x100b3960
void MxSmkPresenter::CreateBitmap()
{
if (m_bitmap) {
delete m_bitmap;
if (m_frameBitmap) {
delete m_frameBitmap;
}
m_bitmap = new MxBitmap;
m_bitmap->SetSize(m_mxSmack.m_smackTag.Width, m_mxSmack.m_smackTag.Height, NULL, FALSE);
m_frameBitmap = new MxBitmap;
m_frameBitmap->SetSize(m_mxSmack.m_smackTag.Width, m_mxSmack.m_smackTag.Height, NULL, FALSE);
}
// FUNCTION: LEGO1 0x100b3a00
void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk)
{
MxBITMAPINFO* bitmapInfo = m_bitmap->GetBitmapInfo();
MxU8* bitmapData = m_bitmap->GetBitmapData();
MxBITMAPINFO* bitmapInfo = m_frameBitmap->GetBitmapInfo();
MxU8* bitmapData = m_frameBitmap->GetImage();
MxU8* chunkData = p_chunk->GetData();
MxBool paletteChanged = m_mxSmack.m_frameTypes[m_currentFrame] & 1;
@ -110,7 +110,7 @@ void MxSmkPresenter::VTable0x88()
// FUNCTION: LEGO1 0x100b42c0
void MxSmkPresenter::RealizePalette()
{
MxPalette* palette = m_bitmap->CreatePalette();
MxPalette* palette = m_frameBitmap->CreatePalette();
MVideoManager()->RealizePalette(palette);
delete palette;
}

View file

@ -47,12 +47,12 @@ void MxStillPresenter::LoadHeader(MxStreamChunk* p_chunk)
// FUNCTION: LEGO1 0x100b9d10
void MxStillPresenter::CreateBitmap()
{
if (m_bitmap) {
delete m_bitmap;
if (m_frameBitmap) {
delete m_frameBitmap;
}
m_bitmap = new MxBitmap;
m_bitmap->ImportBitmapInfo(m_bitmapInfo);
m_frameBitmap = new MxBitmap;
m_frameBitmap->ImportBitmapInfo(m_bitmapInfo);
delete m_bitmapInfo;
m_bitmapInfo = NULL;
@ -69,7 +69,7 @@ void MxStillPresenter::NextFrame()
// FUNCTION: LEGO1 0x100b9dd0
void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
{
memcpy(m_bitmap->GetBitmapData(), p_chunk->GetData(), p_chunk->GetLength());
memcpy(m_frameBitmap->GetImage(), p_chunk->GetData(), p_chunk->GetLength());
// MxRect32 rect(m_location, MxSize32(GetWidth(), GetHeight()));
MxS32 height = GetHeight() - 1;
@ -83,17 +83,17 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
if (GetBit1()) {
undefined4 und = 0;
m_unk0x58 = MxOmni::GetInstance()->GetVideoManager()->GetDisplaySurface()->VTable0x44(
m_bitmap,
m_frameBitmap,
&und,
GetBit3(),
m_action->GetFlags() & MxDSAction::c_bit4
);
delete m_alpha;
m_alpha = new AlphaMask(*m_bitmap);
m_alpha = new AlphaMask(*m_frameBitmap);
delete m_bitmap;
m_bitmap = NULL;
delete m_frameBitmap;
m_frameBitmap = NULL;
if (m_unk0x58 && und) {
SetBit2(TRUE);
@ -107,7 +107,7 @@ void MxStillPresenter::LoadFrame(MxStreamChunk* p_chunk)
// FUNCTION: LEGO1 0x100b9f30
void MxStillPresenter::RealizePalette()
{
MxPalette* palette = m_bitmap->CreatePalette();
MxPalette* palette = m_frameBitmap->CreatePalette();
MVideoManager()->RealizePalette(palette);
delete palette;
}
@ -177,7 +177,7 @@ void MxStillPresenter::Enable(MxBool p_enable)
{
MxPresenter::Enable(p_enable);
if (MVideoManager() && (m_alpha || m_bitmap)) {
if (MVideoManager() && (m_alpha || m_frameBitmap)) {
// MxRect32 rect(m_location, MxSize32(GetWidth(), GetHeight()));
MxS32 height = GetHeight();
MxS32 width = GetWidth();
@ -240,10 +240,10 @@ MxStillPresenter* MxStillPresenter::Clone()
presenter->SetBit3(GetBit3());
presenter->SetBit4(GetBit4());
if (m_bitmap) {
presenter->m_bitmap = new MxBitmap;
if (m_frameBitmap) {
presenter->m_frameBitmap = new MxBitmap;
if (!presenter->m_bitmap || presenter->m_bitmap->ImportBitmap(m_bitmap) != SUCCESS) {
if (!presenter->m_frameBitmap || presenter->m_frameBitmap->ImportBitmap(m_frameBitmap) != SUCCESS) {
goto done;
}
}

View file

@ -40,11 +40,11 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
else {
rowsBeforeTop = p_bitmap.GetBmiHeightAbs() - 1;
}
bitmapSrcPtr = p_bitmap.GetBitmapData() + (p_bitmap.GetBmiStride() * rowsBeforeTop);
bitmapSrcPtr = p_bitmap.GetImage() + (p_bitmap.GetBmiStride() * rowsBeforeTop);
break;
}
case BI_RGB_TOPDOWN:
bitmapSrcPtr = p_bitmap.GetBitmapData();
bitmapSrcPtr = p_bitmap.GetImage();
break;
default: {
if (p_bitmap.GetBmiHeight() < 0) {
@ -53,7 +53,7 @@ MxVideoPresenter::AlphaMask::AlphaMask(const MxBitmap& p_bitmap)
else {
rowsBeforeTop = p_bitmap.GetBmiHeightAbs() - 1;
}
bitmapSrcPtr = p_bitmap.GetBitmapData() + (p_bitmap.GetBmiStride() * rowsBeforeTop);
bitmapSrcPtr = p_bitmap.GetImage() + (p_bitmap.GetBmiStride() * rowsBeforeTop);
}
}
@ -120,7 +120,7 @@ MxS32 MxVideoPresenter::AlphaMask::IsHit(MxU32 p_x, MxU32 p_y)
// FUNCTION: LEGO1 0x100b2760
void MxVideoPresenter::Init()
{
m_bitmap = NULL;
m_frameBitmap = NULL;
m_alpha = NULL;
m_unk0x5c = 1;
m_unk0x58 = NULL;
@ -151,7 +151,7 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor)
SetBit2(FALSE);
}
if (MVideoManager() && (m_alpha || m_bitmap)) {
if (MVideoManager() && (m_alpha || m_frameBitmap)) {
// MxRect32 rect(m_location, MxSize32(GetWidth(), GetHeight()));
MxS32 height = GetHeight();
MxS32 width = GetWidth();
@ -163,7 +163,7 @@ void MxVideoPresenter::Destroy(MxBool p_fromDestructor)
MVideoManager()->UpdateView(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
}
delete m_bitmap;
delete m_frameBitmap;
delete m_alpha;
Init();
@ -193,21 +193,21 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
{
MxDSAction* action = GetAction();
if ((action == NULL) || (((action->GetFlags() & MxDSAction::c_bit11) == 0) && !IsEnabled()) ||
(!m_bitmap && !m_alpha)) {
(!m_frameBitmap && !m_alpha)) {
return FALSE;
}
if (!m_bitmap) {
if (!m_frameBitmap) {
return m_alpha->IsHit(p_x - m_location.GetX(), p_y - m_location.GetY());
}
MxLong heightAbs = m_bitmap->GetBmiHeightAbs();
MxLong heightAbs = m_frameBitmap->GetBmiHeightAbs();
MxLong minX = m_location.GetX();
MxLong minY = m_location.GetY();
MxLong maxY = minY + heightAbs;
MxLong maxX = minX + m_bitmap->GetBmiWidth();
MxLong maxX = minX + m_frameBitmap->GetBmiWidth();
if (p_x < minX || p_x >= maxX || p_y < minY || p_y >= maxY) {
return FALSE;
@ -215,8 +215,8 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
MxU8* pixel;
MxLong biCompression = m_bitmap->GetBmiHeader()->biCompression;
MxLong height = m_bitmap->GetBmiHeight();
MxLong biCompression = m_frameBitmap->GetBmiHeader()->biCompression;
MxLong height = m_frameBitmap->GetBmiHeight();
MxLong seekRow;
// DECOMP: Same basic layout as AlphaMask constructor
@ -232,15 +232,15 @@ MxBool MxVideoPresenter::IsHit(MxS32 p_x, MxS32 p_y)
height = height > 0 ? height : -height;
seekRow = height - p_y - 1 + m_location.GetY();
}
pixel = m_bitmap->GetBmiStride() * seekRow + m_bitmap->GetBitmapData() - m_location.GetX() + p_x;
pixel = m_frameBitmap->GetBmiStride() * seekRow + m_frameBitmap->GetImage() - m_location.GetX() + p_x;
}
else if (biCompression == BI_RGB_TOPDOWN) {
pixel = m_bitmap->GetBitmapData();
pixel = m_frameBitmap->GetImage();
}
else {
height = height > 0 ? height : -height;
height--;
pixel = m_bitmap->GetBmiStride() * height + m_bitmap->GetBitmapData();
pixel = m_frameBitmap->GetBmiStride() * height + m_frameBitmap->GetImage();
}
if (GetBit4()) {
@ -323,13 +323,13 @@ void MxVideoPresenter::PutFrame()
}
else {
displaySurface->VTable0x30(
m_bitmap,
m_frameBitmap,
0,
0,
rect.GetLeft(),
rect.GetTop(),
m_bitmap->GetBmiWidth(),
m_bitmap->GetBmiHeightAbs(),
m_frameBitmap->GetBmiWidth(),
m_frameBitmap->GetBmiHeightAbs(),
TRUE
);
}
@ -362,7 +362,7 @@ void MxVideoPresenter::PutFrame()
}
else {
displaySurface->VTable0x30(
m_bitmap,
m_frameBitmap,
regionRect->GetLeft() - GetX(),
regionRect->GetTop() - GetY(),
regionRect->GetLeft(),
@ -380,7 +380,7 @@ void MxVideoPresenter::PutFrame()
}
else {
displaySurface->VTable0x28(
m_bitmap,
m_frameBitmap,
regionRect->GetLeft() - GetX(),
regionRect->GetTop() - GetY(),
regionRect->GetLeft(),
@ -546,9 +546,9 @@ void MxVideoPresenter::EndAction()
MxMediaPresenter::EndAction();
AUTOLOCK(m_criticalSection);
if (m_bitmap) {
MxLong height = m_bitmap->GetBmiHeightAbs();
MxLong width = m_bitmap->GetBmiWidth();
if (m_frameBitmap) {
MxLong height = m_frameBitmap->GetBmiHeightAbs();
MxLong width = m_frameBitmap->GetBmiWidth();
MxS32 x = m_location.GetX();
MxS32 y = m_location.GetY();