Implement/match LegoLocomotionAnimPresenter (#925)

This commit is contained in:
Christian Semmler 2024-05-15 15:29:00 -04:00 committed by GitHub
parent 9a05edd0a7
commit 3c89cbe4e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 116 additions and 17 deletions

View file

@ -2,6 +2,7 @@
#define LEGOLOCOMOTIONANIMPRESENTER_H
#include "legoloopinganimpresenter.h"
#include "legoroimaplist.h"
// VTABLE: LEGO1 0x100d9170
// SIZE 0xd8
@ -50,12 +51,12 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter {
void Init();
void Destroy(MxBool p_fromDestructor);
undefined4 m_unk0xc0; // 0xc0
undefined4* m_unk0xc4; // 0xc4
MxCore* m_unk0xc8; // 0xc8
MxS32 m_unk0xcc; // 0xcc
MxS32 m_unk0xd0; // 0xd0
undefined2 m_unk0xd4; // 0xd4
undefined4 m_unk0xc0; // 0xc0
undefined4* m_unk0xc4; // 0xc4
LegoROIMapList* m_roiMapList; // 0xc8
MxS32 m_unk0xcc; // 0xcc
MxS32 m_unk0xd0; // 0xd0
undefined2 m_unk0xd4; // 0xd4
};
#endif // LEGOLOCOMOTIONANIMPRESENTER_H

View file

@ -0,0 +1,55 @@
#ifndef LEGOROIMAPLIST_H
#define LEGOROIMAPLIST_H
#include "mxlist.h"
#include "mxtypes.h"
class LegoROI;
// VTABLE: LEGO1 0x100d9218
// class MxCollection<LegoROI **>
// VTABLE: LEGO1 0x100d9230
// class MxList<LegoROI **>
// VTABLE: LEGO1 0x100d9248
// class MxPtrList<LegoROI *>
// VTABLE: LEGO1 0x100d9260
// SIZE 0x18
class LegoROIMapList : public MxPtrList<LegoROI*> {
public:
LegoROIMapList() : MxPtrList<LegoROI*>(TRUE) {}
// SYNTHETIC: LEGO1 0x1006d360
// LegoROIMapList::`scalar deleting destructor'
};
// TEMPLATE: LEGO1 0x1006d250
// MxCollection<LegoROI * *>::Compare
// TEMPLATE: LEGO1 0x1006d260
// MxCollection<LegoROI * *>::~MxCollection<LegoROI * *>
// TEMPLATE: LEGO1 0x1006d2b0
// MxCollection<LegoROI * *>::Destroy
// TEMPLATE: LEGO1 0x1006d2c0
// MxList<LegoROI * *>::~MxList<LegoROI * *>
// TEMPLATE: LEGO1 0x1006d3d0
// MxPtrList<LegoROI *>::~MxPtrList<LegoROI *>
// TEMPLATE: LEGO1 0x1006d350
// MxPtrList<LegoROI *>::Destroy
// SYNTHETIC: LEGO1 0x1006d420
// MxCollection<LegoROI * *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1006d490
// MxList<LegoROI * *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1006d540
// MxPtrList<LegoROI *>::`scalar deleting destructor'
#endif // LEGOROIMAPLIST_H

View file

@ -1,8 +1,14 @@
#include "legolocomotionanimpresenter.h"
#include "anim/legoanim.h"
#include "legoanimactor.h"
#include "legomain.h"
#include "legoworld.h"
#include "misc.h"
#include "mxautolock.h"
#include "mxdssubscriber.h"
#include "mxmisc.h"
#include "mxvariabletable.h"
DECOMP_SIZE_ASSERT(LegoLocomotionAnimPresenter, 0xd8)
@ -22,10 +28,10 @@ LegoLocomotionAnimPresenter::~LegoLocomotionAnimPresenter()
void LegoLocomotionAnimPresenter::Init()
{
m_unk0xc0 = 0;
m_unk0xc4 = 0;
m_unk0xc4 = NULL;
m_unk0xcc = -1;
m_unk0xd0 = -1;
m_unk0xc8 = 0;
m_roiMapList = NULL;
m_unk0xd4 = 0;
}
@ -38,8 +44,8 @@ void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor)
delete[] m_unk0xc4;
}
if (m_unk0xc8) {
delete m_unk0xc8;
if (m_roiMapList) {
delete m_roiMapList;
}
m_roiMap = NULL;
@ -48,7 +54,7 @@ void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor)
m_criticalSection.Leave();
if (!p_fromDestructor) {
LegoAnimPresenter::Destroy();
LegoLoopingAnimPresenter::Destroy();
}
}
@ -59,10 +65,17 @@ MxResult LegoLocomotionAnimPresenter::CreateAnim(MxStreamChunk* p_chunk)
return result == SUCCESS ? SUCCESS : result;
}
// STUB: LEGO1 0x1006d160
// FUNCTION: LEGO1 0x1006d160
// FUNCTION: BETA10 0x100528c7
MxResult LegoLocomotionAnimPresenter::AddToManager()
{
return MxVideoPresenter::AddToManager();
m_roiMapList = new LegoROIMapList();
if (m_roiMapList == NULL) {
return FAILURE;
}
return LegoAnimPresenter::AddToManager();
}
// FUNCTION: LEGO1 0x1006d5b0
@ -92,10 +105,18 @@ void LegoLocomotionAnimPresenter::ReadyTickle()
}
}
// STUB: LEGO1 0x1006d610
// FUNCTION: LEGO1 0x1006d610
// FUNCTION: BETA10 0x10052a34
void LegoLocomotionAnimPresenter::StartingTickle()
{
// TODO
if (m_subscriber->PeekData()) {
MxStreamChunk* chunk = m_subscriber->PopData();
m_subscriber->FreeDataChunk(chunk);
}
if (m_roiMapList->GetCount() != 0) {
ProgressTickleState(e_streaming);
}
}
// FUNCTION: LEGO1 0x1006d660
@ -114,8 +135,30 @@ void LegoLocomotionAnimPresenter::EndAction()
}
}
// STUB: LEGO1 0x1006d680
// FUNCTION: LEGO1 0x1006d680
// FUNCTION: BETA10 0x10052b3d
void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value)
{
// TODO
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;
}
}