2023-06-29 04:10:08 -04:00
|
|
|
#include "mxsmkpresenter.h"
|
|
|
|
|
2023-07-02 03:00:28 -04:00
|
|
|
#include "decomp.h"
|
2023-10-30 12:46:38 -04:00
|
|
|
#include "mxvideomanager.h"
|
2023-07-02 03:00:28 -04:00
|
|
|
|
|
|
|
DECOMP_SIZE_ASSERT(MxSmkPresenter, 0x720);
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b3650
|
2023-06-29 04:10:08 -04:00
|
|
|
MxSmkPresenter::MxSmkPresenter()
|
|
|
|
{
|
2023-10-27 13:00:20 -04:00
|
|
|
Init();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b3870
|
2023-10-27 13:00:20 -04:00
|
|
|
MxSmkPresenter::~MxSmkPresenter()
|
|
|
|
{
|
|
|
|
Destroy(TRUE);
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b38d0
|
2023-06-29 04:10:08 -04:00
|
|
|
void MxSmkPresenter::Init()
|
|
|
|
{
|
2023-10-27 13:00:20 -04:00
|
|
|
m_unk0x71c = 0;
|
|
|
|
memset(&m_mxSmack, 0, sizeof(m_mxSmack));
|
|
|
|
m_flags &= 0xfd;
|
|
|
|
m_flags &= 0xfb;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b3900
|
2023-10-27 13:00:20 -04:00
|
|
|
void MxSmkPresenter::Destroy(MxBool p_fromDestructor)
|
|
|
|
{
|
|
|
|
m_criticalSection.Enter();
|
|
|
|
|
2023-12-20 20:07:48 -05:00
|
|
|
MxSmack::Destroy(&m_mxSmack);
|
2023-10-27 13:00:20 -04:00
|
|
|
Init();
|
|
|
|
|
|
|
|
m_criticalSection.Leave();
|
|
|
|
|
|
|
|
if (!p_fromDestructor) {
|
|
|
|
MxVideoPresenter::Destroy(FALSE);
|
|
|
|
}
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2023-10-07 12:48:36 -04:00
|
|
|
|
2023-12-20 20:07:48 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b3940
|
2023-11-25 14:08:10 -05:00
|
|
|
void MxSmkPresenter::LoadHeader(MxStreamChunk* p_chunk)
|
2023-11-21 03:44:45 -05:00
|
|
|
{
|
2023-12-20 20:07:48 -05:00
|
|
|
MxSmack::LoadHeaderAndTrees(p_chunk->GetData(), &m_mxSmack);
|
2023-11-21 03:44:45 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b3960
|
2023-11-25 14:08:10 -05:00
|
|
|
void MxSmkPresenter::CreateBitmap()
|
2023-10-07 12:48:36 -04:00
|
|
|
{
|
2023-11-25 14:08:10 -05:00
|
|
|
if (m_bitmap)
|
2023-10-24 19:38:27 -04:00
|
|
|
delete m_bitmap;
|
2023-10-07 12:48:36 -04:00
|
|
|
|
2023-11-25 14:08:10 -05:00
|
|
|
m_bitmap = new MxBitmap;
|
2023-12-20 20:07:48 -05:00
|
|
|
m_bitmap->SetSize(m_mxSmack.m_smackTag.Width, m_mxSmack.m_smackTag.Height, NULL, FALSE);
|
2023-10-27 13:00:20 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x100b3a00
|
2023-11-25 14:08:10 -05:00
|
|
|
void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
2023-10-30 12:46:38 -04:00
|
|
|
{
|
2023-11-25 14:08:10 -05:00
|
|
|
// TODO
|
2023-10-30 12:46:38 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b4260
|
2023-12-20 20:07:48 -05:00
|
|
|
void MxSmkPresenter::VTable0x88()
|
2023-10-30 12:46:38 -04:00
|
|
|
{
|
2023-12-20 20:07:48 -05:00
|
|
|
if ((m_mxSmack.m_smackTag.SmackerType & 1) != 0) {
|
|
|
|
MxU32 und = (m_unk0x71c % m_mxSmack.m_smackTag.Frames);
|
|
|
|
if (1 < m_unk0x71c && und == 1)
|
2023-10-30 12:46:38 -04:00
|
|
|
m_unk0x71c = 1;
|
|
|
|
}
|
|
|
|
else {
|
2023-12-20 20:07:48 -05:00
|
|
|
if (m_mxSmack.m_smackTag.Frames == m_unk0x71c) {
|
2023-10-30 12:46:38 -04:00
|
|
|
m_unk0x71c = 0;
|
2023-12-20 20:07:48 -05:00
|
|
|
// TODO: struct incorrect, Palette at wrong offset?
|
|
|
|
memset(m_mxSmack.m_smackTag.Palette, 0, sizeof(m_mxSmack.m_smackTag.Palette));
|
2023-10-30 12:46:38 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-21 03:44:45 -05:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b42c0
|
2023-12-07 07:13:31 -05:00
|
|
|
void MxSmkPresenter::RealizePalette()
|
2023-11-21 03:44:45 -05:00
|
|
|
{
|
|
|
|
MxPalette* palette = m_bitmap->CreatePalette();
|
|
|
|
MVideoManager()->RealizePalette(palette);
|
|
|
|
delete palette;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b4300
|
2023-11-21 03:44:45 -05:00
|
|
|
void MxSmkPresenter::Destroy()
|
|
|
|
{
|
|
|
|
Destroy(FALSE);
|
|
|
|
}
|