2023-06-29 04:10:08 -04:00
|
|
|
#include "legophonemepresenter.h"
|
|
|
|
|
2024-04-16 10:07:13 -04:00
|
|
|
#include "legocharactermanager.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "misc/legocontainer.h"
|
|
|
|
#include "mxcompositepresenter.h"
|
|
|
|
|
2024-03-22 21:30:58 -04:00
|
|
|
DECOMP_SIZE_ASSERT(LegoPhonemePresenter, 0x88)
|
2023-08-28 05:38:46 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1004e180
|
2023-06-29 04:10:08 -04:00
|
|
|
LegoPhonemePresenter::LegoPhonemePresenter()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
Init();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1004e340
|
2023-11-21 03:44:45 -05:00
|
|
|
LegoPhonemePresenter::~LegoPhonemePresenter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1004e3b0
|
2023-06-29 04:10:08 -04:00
|
|
|
void LegoPhonemePresenter::Init()
|
|
|
|
{
|
2024-04-17 07:26:11 -04:00
|
|
|
m_rectCount = 0;
|
2024-04-16 10:07:13 -04:00
|
|
|
m_textureInfo = NULL;
|
|
|
|
m_unk0x70 = FALSE;
|
|
|
|
m_unk0x84 = FALSE;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-04-16 10:07:13 -04:00
|
|
|
// FUNCTION: LEGO1 0x1004e3d0
|
2024-04-17 07:26:11 -04:00
|
|
|
// FUNCTION: BETA10 0x100c3646
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoPhonemePresenter::StartingTickle()
|
|
|
|
{
|
2024-04-16 10:07:13 -04:00
|
|
|
MxFlcPresenter::StartingTickle();
|
|
|
|
|
|
|
|
if (m_textureInfo == NULL) {
|
|
|
|
MxU16 extraLength;
|
|
|
|
char* extraData;
|
|
|
|
|
|
|
|
m_action->GetExtra(extraLength, extraData);
|
|
|
|
|
|
|
|
if (extraData != NULL) {
|
|
|
|
m_roiName = extraData;
|
|
|
|
m_roiName.ToUpperCase();
|
|
|
|
|
|
|
|
LegoROI *entityROI, *head;
|
|
|
|
|
|
|
|
if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoAnimMMPresenter")) {
|
|
|
|
entityROI = FindROI(m_roiName.GetData());
|
|
|
|
m_unk0x84 = TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
entityROI = CharacterManager()->GetROI(m_roiName.GetData(), TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
head = entityROI->FindChildROI("head", entityROI);
|
|
|
|
head->GetTexture(m_textureInfo);
|
2024-02-06 17:53:35 -05:00
|
|
|
|
2024-04-16 10:07:13 -04:00
|
|
|
LegoPhonemeList* phonemeList = VideoManager()->GetPhonemeList();
|
|
|
|
LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1);
|
|
|
|
|
|
|
|
LegoPhonemeListCursor cursor(phonemeList);
|
|
|
|
|
|
|
|
if (!cursor.Find(phoneme)) {
|
2024-04-17 11:03:17 -04:00
|
|
|
LegoTextureInfo* textureInfo = TextureContainer()->GetCached(m_textureInfo);
|
2024-04-16 10:07:13 -04:00
|
|
|
|
|
|
|
CharacterManager()->FUN_100849a0(entityROI, textureInfo);
|
|
|
|
|
|
|
|
phoneme->VTable0x0c(m_textureInfo);
|
|
|
|
phoneme->VTable0x14(textureInfo);
|
|
|
|
phonemeList->Append(phoneme);
|
|
|
|
m_textureInfo = textureInfo;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LegoPhoneme* newPhoneme = phoneme;
|
|
|
|
cursor.Current(phoneme);
|
|
|
|
delete newPhoneme;
|
|
|
|
|
|
|
|
phoneme->VTable0x04(phoneme->VTable0x00() + 1);
|
|
|
|
cursor.SetValue(phoneme);
|
|
|
|
|
|
|
|
m_unk0x70 = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-04-17 07:26:11 -04:00
|
|
|
// FUNCTION: LEGO1 0x1004e800
|
|
|
|
// FUNCTION: BETA10 0x100c3ac9
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoPhonemePresenter::LoadFrame(MxStreamChunk* p_chunk)
|
|
|
|
{
|
2024-04-17 07:26:11 -04:00
|
|
|
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
|
|
|
|
);
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-04-17 07:26:11 -04:00
|
|
|
// FUNCTION: LEGO1 0x1004e840
|
|
|
|
// FUNCTION: BETA10 0x100c3b5d
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoPhonemePresenter::PutFrame()
|
|
|
|
{
|
2024-04-17 07:26:11 -04:00
|
|
|
if (m_textureInfo != NULL && m_rectCount != 0) {
|
|
|
|
m_textureInfo->FUN_10066010(m_frameBitmap->GetImage());
|
|
|
|
m_rectCount = 0;
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-04-17 11:03:17 -04:00
|
|
|
// FUNCTION: LEGO1 0x1004e870
|
|
|
|
// FUNCTION: BETA10 0x100c3c24
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoPhonemePresenter::EndAction()
|
|
|
|
{
|
2024-02-06 17:53:35 -05:00
|
|
|
if (m_action != NULL) {
|
|
|
|
MxFlcPresenter::EndAction();
|
2024-04-17 11:03:17 -04:00
|
|
|
|
|
|
|
LegoPhonemeList* phonemeList = VideoManager()->GetPhonemeList();
|
|
|
|
LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1);
|
|
|
|
|
|
|
|
LegoPhonemeListCursor cursor(phonemeList);
|
|
|
|
|
|
|
|
if (cursor.Find(phoneme)) {
|
|
|
|
LegoPhoneme* newPhoneme = phoneme;
|
|
|
|
cursor.Current(phoneme);
|
|
|
|
delete newPhoneme;
|
|
|
|
|
|
|
|
if (phoneme->VTable0x00() == 1) {
|
|
|
|
LegoROI* roi;
|
|
|
|
|
|
|
|
if (m_unk0x84) {
|
|
|
|
roi = FindROI(m_roiName.GetData());
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
roi = CharacterManager()->GetROI(m_roiName.GetData(), TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (roi != NULL) {
|
|
|
|
CharacterManager()->FUN_100849a0(roi, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!m_unk0x84) {
|
|
|
|
CharacterManager()->FUN_10083c30(m_roiName.GetData());
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureContainer()->EraseCached(phoneme->VTable0x10());
|
|
|
|
TextureContainer()->EraseCached(phoneme->VTable0x08());
|
|
|
|
cursor.Destroy();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
phoneme->VTable0x04(phoneme->VTable0x00() - 1);
|
|
|
|
cursor.SetValue(phoneme);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!m_unk0x84) {
|
|
|
|
CharacterManager()->FUN_10083c30(m_roiName.GetData());
|
|
|
|
}
|
|
|
|
}
|
2024-02-06 17:53:35 -05:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|