2023-06-29 04:10:08 -04:00
|
|
|
#include "legolocomotionanimpresenter.h"
|
|
|
|
|
2024-05-15 15:29:00 -04:00
|
|
|
#include "anim/legoanim.h"
|
|
|
|
#include "legoanimactor.h"
|
2024-05-04 08:06:32 -04:00
|
|
|
#include "legomain.h"
|
2024-01-21 09:58:15 -05:00
|
|
|
#include "legoworld.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "misc.h"
|
2024-05-15 15:29:00 -04:00
|
|
|
#include "mxautolock.h"
|
|
|
|
#include "mxdssubscriber.h"
|
|
|
|
#include "mxmisc.h"
|
|
|
|
#include "mxvariabletable.h"
|
2024-01-21 09:58:15 -05:00
|
|
|
|
|
|
|
DECOMP_SIZE_ASSERT(LegoLocomotionAnimPresenter, 0xd8)
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006cdd0
|
2023-06-29 04:10:08 -04:00
|
|
|
LegoLocomotionAnimPresenter::LegoLocomotionAnimPresenter()
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
Init();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d050
|
|
|
|
LegoLocomotionAnimPresenter::~LegoLocomotionAnimPresenter()
|
|
|
|
{
|
|
|
|
Destroy(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x1006d0b0
|
2023-06-29 04:10:08 -04:00
|
|
|
void LegoLocomotionAnimPresenter::Init()
|
|
|
|
{
|
2024-01-21 09:58:15 -05:00
|
|
|
m_unk0xc0 = 0;
|
2024-05-15 15:29:00 -04:00
|
|
|
m_unk0xc4 = NULL;
|
2024-01-21 09:58:15 -05:00
|
|
|
m_unk0xcc = -1;
|
|
|
|
m_unk0xd0 = -1;
|
2024-05-15 15:29:00 -04:00
|
|
|
m_roiMapList = NULL;
|
2024-01-21 09:58:15 -05:00
|
|
|
m_unk0xd4 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x1006d0e0
|
|
|
|
void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor)
|
|
|
|
{
|
|
|
|
m_criticalSection.Enter();
|
|
|
|
|
|
|
|
if (m_unk0xc4) {
|
|
|
|
delete[] m_unk0xc4;
|
|
|
|
}
|
|
|
|
|
2024-05-15 15:29:00 -04:00
|
|
|
if (m_roiMapList) {
|
|
|
|
delete m_roiMapList;
|
2024-01-21 09:58:15 -05:00
|
|
|
}
|
|
|
|
|
2024-04-20 11:40:23 -04:00
|
|
|
m_roiMap = NULL;
|
2024-01-21 09:58:15 -05:00
|
|
|
Init();
|
|
|
|
|
|
|
|
m_criticalSection.Leave();
|
|
|
|
|
|
|
|
if (!p_fromDestructor) {
|
2024-05-15 15:29:00 -04:00
|
|
|
LegoLoopingAnimPresenter::Destroy();
|
2024-01-21 09:58:15 -05:00
|
|
|
}
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d140
|
2024-02-25 09:14:39 -05:00
|
|
|
MxResult LegoLocomotionAnimPresenter::CreateAnim(MxStreamChunk* p_chunk)
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-02-25 09:14:39 -05:00
|
|
|
MxResult result = LegoAnimPresenter::CreateAnim(p_chunk);
|
2024-01-21 09:58:15 -05:00
|
|
|
return result == SUCCESS ? SUCCESS : result;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-05-15 15:29:00 -04:00
|
|
|
// FUNCTION: LEGO1 0x1006d160
|
|
|
|
// FUNCTION: BETA10 0x100528c7
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult LegoLocomotionAnimPresenter::AddToManager()
|
|
|
|
{
|
2024-05-15 15:29:00 -04:00
|
|
|
m_roiMapList = new LegoROIMapList();
|
|
|
|
|
|
|
|
if (m_roiMapList == NULL) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return LegoAnimPresenter::AddToManager();
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d5b0
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoLocomotionAnimPresenter::Destroy()
|
|
|
|
{
|
2024-01-21 09:58:15 -05:00
|
|
|
Destroy(FALSE);
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d5c0
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoLocomotionAnimPresenter::PutFrame()
|
|
|
|
{
|
2024-01-21 09:58:15 -05:00
|
|
|
// Empty
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d5d0
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoLocomotionAnimPresenter::ReadyTickle()
|
|
|
|
{
|
2024-05-14 10:35:22 -04:00
|
|
|
LegoLoopingAnimPresenter::ReadyTickle();
|
2024-01-21 09:58:15 -05:00
|
|
|
|
|
|
|
if (m_currentWorld != NULL && m_currentTickleState == e_starting) {
|
2024-01-26 16:00:02 -05:00
|
|
|
m_currentWorld->Add(this);
|
2024-01-21 09:58:15 -05:00
|
|
|
if (m_compositePresenter != NULL) {
|
|
|
|
SendToCompositePresenter(Lego());
|
|
|
|
}
|
|
|
|
|
|
|
|
m_unk0xd4++;
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-05-15 15:29:00 -04:00
|
|
|
// FUNCTION: LEGO1 0x1006d610
|
|
|
|
// FUNCTION: BETA10 0x10052a34
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoLocomotionAnimPresenter::StartingTickle()
|
|
|
|
{
|
2024-05-15 15:29:00 -04:00
|
|
|
if (m_subscriber->PeekData()) {
|
|
|
|
MxStreamChunk* chunk = m_subscriber->PopData();
|
|
|
|
m_subscriber->FreeDataChunk(chunk);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_roiMapList->GetCount() != 0) {
|
|
|
|
ProgressTickleState(e_streaming);
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d660
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoLocomotionAnimPresenter::StreamingTickle()
|
|
|
|
{
|
2024-01-21 09:58:15 -05:00
|
|
|
if (m_unk0xd4 == 0) {
|
|
|
|
EndAction();
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-01-21 09:58:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x1006d670
|
2024-01-20 18:04:46 -05:00
|
|
|
void LegoLocomotionAnimPresenter::EndAction()
|
|
|
|
{
|
2024-01-21 09:58:15 -05:00
|
|
|
if (m_action) {
|
|
|
|
MxVideoPresenter::EndAction();
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
2024-04-24 09:51:28 -04:00
|
|
|
|
2024-05-15 15:29:00 -04:00
|
|
|
// FUNCTION: LEGO1 0x1006d680
|
|
|
|
// FUNCTION: BETA10 0x10052b3d
|
2024-04-24 09:51:28 -04:00
|
|
|
void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value)
|
|
|
|
{
|
2024-05-15 15:29:00 -04:00
|
|
|
AUTOLOCK(m_criticalSection);
|
|
|
|
|
|
|
|
MxVariableTable* variableTable = VariableTable();
|
|
|
|
|
|
|
|
const char* key = ((LegoAnimNodeData*) m_anim->GetRoot()->GetData())->GetName();
|
|
|
|
variableTable->SetVariable(key, p_actor->GetROI()->GetName());
|
|
|
|
|
|
|
|
FUN_100695c0();
|
|
|
|
FUN_10069b10();
|
|
|
|
|
|
|
|
if (m_roiMap != NULL) {
|
|
|
|
m_roiMapList->Append(m_roiMap);
|
|
|
|
p_actor->FUN_1001c450(m_anim, p_value, m_roiMap, m_roiMapSize);
|
|
|
|
m_roiMap = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
variableTable->SetVariable(key, "");
|
|
|
|
|
|
|
|
if (m_unk0x70 != NULL) {
|
|
|
|
delete m_unk0x70;
|
|
|
|
m_unk0x70 = NULL;
|
|
|
|
}
|
2024-04-24 09:51:28 -04:00
|
|
|
}
|