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();
|
|
|
|
|
|
|
|
FUN_100c5d40(&m_mxSmack);
|
|
|
|
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-06 07:10:45 -05:00
|
|
|
// STUB: 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-11-25 14:08:10 -05:00
|
|
|
// TODO
|
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-10-27 13:00:20 -04:00
|
|
|
m_bitmap->SetSize(m_mxSmack.m_smack.m_width, m_mxSmack.m_smack.m_height, NULL, FALSE);
|
|
|
|
}
|
|
|
|
|
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-10-30 12:46:38 -04:00
|
|
|
MxU32 MxSmkPresenter::VTable0x88()
|
|
|
|
{
|
|
|
|
MxU32 result = m_unk0x71c;
|
|
|
|
if ((m_mxSmack.m_smack.m_smkType & 1) != 0) {
|
|
|
|
result = m_unk0x71c / m_mxSmack.m_smack.m_frames;
|
|
|
|
if (1 < m_unk0x71c && (m_unk0x71c % m_mxSmack.m_smack.m_frames) == 1) {
|
|
|
|
m_unk0x71c = 1;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (m_mxSmack.m_smack.m_frames == result) {
|
|
|
|
m_unk0x71c = 0;
|
|
|
|
result = 0;
|
|
|
|
memset(m_mxSmack.m_smack.m_palette, 0, sizeof(m_mxSmack.m_smack.m_palette));
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c5d40
|
2023-11-21 03:44:45 -05:00
|
|
|
void MxSmkPresenter::FUN_100c5d40(MxSmack* p_mxSmack)
|
|
|
|
{
|
|
|
|
if (p_mxSmack->m_unk0x6a0)
|
|
|
|
delete p_mxSmack->m_unk0x6a0;
|
|
|
|
if (p_mxSmack->m_unk0x6a4)
|
|
|
|
delete p_mxSmack->m_unk0x6a4;
|
|
|
|
if (p_mxSmack->m_unk0x6a8)
|
|
|
|
delete p_mxSmack->m_unk0x6a8;
|
|
|
|
if (p_mxSmack->m_unk0x6ac)
|
|
|
|
delete p_mxSmack->m_unk0x6ac;
|
|
|
|
if (p_mxSmack->m_unk0x6b4)
|
|
|
|
delete p_mxSmack->m_unk0x6b4;
|
|
|
|
}
|