Implement LegoAnimPresenter::FUN_100692b0 (#594)

* Implement LegoAnimPresenter::FUN_100692b0

* Match
This commit is contained in:
Christian Semmler 2024-02-25 12:04:30 -05:00 committed by GitHub
parent 377eebb610
commit 96c98cec3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 190 additions and 4 deletions

View file

@ -2,6 +2,7 @@
#define LEGOANIMPRESENTER_H
#include "anim/legoanim.h"
#include "legoroilist.h"
#include "mxgeometry/mxgeometry3d.h"
#include "mxvideopresenter.h"
@ -47,12 +48,15 @@ class LegoAnimPresenter : public MxVideoPresenter {
protected:
void Init();
void Destroy(MxBool p_fromDestructor);
LegoChar* FUN_10069150(const LegoChar*);
void FUN_100692b0();
LegoChar* FUN_100697c0(const LegoChar*, LegoChar*);
LegoAnim* m_anim; // 0x64
undefined4 m_unk0x68; // 0x68
undefined4 m_unk0x6c; // 0x6c
undefined4 m_unk0x70; // 0x70
undefined4 m_unk0x74; // 0x74
LegoROIList* m_unk0x74; // 0x74
undefined4 m_unk0x78; // 0x78
undefined4 m_unk0x7c; // 0x7c
LegoWorld* m_currentWorld; // 0x80

View file

@ -0,0 +1,54 @@
#ifndef LEGOROILIST_H
#define LEGOROILIST_H
#include "mxlist.h"
#include "mxtypes.h"
#include "roi/legoroi.h"
// VTABLE: LEGO1 0x100d8c30
// class MxCollection<LegoROI *>
// VTABLE: LEGO1 0x100d8c48
// class MxList<LegoROI *>
// VTABLE: LEGO1 0x100d8c60
// class MxPtrList<LegoROI>
// VTABLE: LEGO1 0x100d8c78
// SIZE 0x18
class LegoROIList : public MxPtrList<LegoROI> {
public:
LegoROIList(MxBool p_ownership = FALSE) : MxPtrList<LegoROI>(p_ownership) {}
// FUNCTION: LEGO1 0x1005f360
MxS8 Compare(LegoROI* p_a, LegoROI* p_b) override { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } // vtable+0x14
// SYNTHETIC: LEGO1 0x1005f480
// LegoROIList::`scalar deleting destructor'
};
// TEMPLATE: LEGO1 0x1005f380
// MxCollection<LegoROI *>::Compare
// TEMPLATE: LEGO1 0x1005f390
// MxCollection<LegoROI *>::~MxCollection<LegoROI *>
// TEMPLATE: LEGO1 0x1005f3e0
// MxCollection<LegoROI *>::Destroy
// TEMPLATE: LEGO1 0x1005f3f0
// MxList<LegoROI *>::~MxList<LegoROI *>
// TEMPLATE: LEGO1 0x1005f4f0
// MxPtrList<LegoROI>::~MxPtrList<LegoROI>
// SYNTHETIC: LEGO1 0x1005f540
// MxCollection<LegoROI *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1005f5b0
// MxList<LegoROI *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1005f660
// MxPtrList<LegoROI>::`scalar deleting destructor'
#endif // LEGOROILIST_H

View file

@ -64,6 +64,8 @@ class LegoUnkSaveDataWriter {
void FUN_100832a0();
void FUN_10083db0(LegoROI* p_roi);
void FUN_10083f10(LegoROI* p_roi);
LegoROI* FUN_10085210(LegoChar*, LegoChar*, undefined);
LegoROI* FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3);
private:
static char* g_customizeAnimFile;

View file

@ -127,3 +127,15 @@ void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value)
g_customizeAnimFile = NULL;
}
}
// STUB: LEGO1 0x10085210
LegoROI* LegoUnkSaveDataWriter::FUN_10085210(LegoChar*, LegoChar*, undefined)
{
return NULL;
}
// FUNCTION: LEGO1 0x10085a80
LegoROI* LegoUnkSaveDataWriter::FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3)
{
return FUN_10085210(p_und1, p_und2, p_und3);
}

View file

@ -1,6 +1,7 @@
#include "legoanimpresenter.h"
#include "legoomni.h"
#include "legounksavedatawriter.h"
#include "legoworld.h"
#include "mxcompositepresenter.h"
#include "mxdsanim.h"
@ -27,7 +28,7 @@ void LegoAnimPresenter::Init()
m_anim = NULL;
m_unk0x68 = 0;
m_unk0x6c = 0;
m_unk0x74 = 0;
m_unk0x74 = NULL;
m_unk0x70 = 0;
m_unk0x78 = 0;
m_unk0x7c = 0;
@ -104,6 +105,95 @@ MxResult LegoAnimPresenter::CreateAnim(MxStreamChunk* p_chunk)
return result;
}
// STUB: LEGO1 0x10069150
LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar*)
{
return NULL;
}
// FUNCTION: LEGO1 0x100692b0
void LegoAnimPresenter::FUN_100692b0()
{
m_unk0x74 = new LegoROIList();
if (m_unk0x74) {
LegoU32 numActors = m_anim->GetNumActors();
for (LegoU32 i = 0; i < numActors; i++) {
LegoChar* str = FUN_100697c0(m_anim->GetActorName(i), NULL);
undefined4 unk0x04 = m_anim->GetActorUnknown0x04(i);
LegoROI* roi = NULL;
if (unk0x04 == 2) {
LegoChar* src;
if (str[0] == '*') {
src = str + 1;
}
else {
src = str;
}
roi = UnkSaveDataWriter()->FUN_10083500(src, TRUE);
if (roi != NULL && str[0] == '*') {
roi->SetUnknown0x0c(0);
}
}
else if (unk0x04 == 4) {
LegoChar* src = new LegoChar[strlen(str)];
strcpy(src, str + 1);
strlwr(src);
LegoChar* und = FUN_10069150(str);
roi = UnkSaveDataWriter()->FUN_10085a80(und, src, 1);
if (roi != NULL) {
roi->SetUnknown0x0c(0);
}
delete[] src;
delete[] und;
}
else if (unk0x04 == 3) {
LegoChar* src = new LegoChar[strlen(str)];
strcpy(src, str + 1);
for (LegoChar* i = &src[strlen(src) - 1]; i > src; i--) {
if ((*i < '0' || *i > '9') && *i != '_') {
break;
}
*i = '\0';
}
strlwr(src);
LegoChar* und = FUN_10069150(str);
roi = UnkSaveDataWriter()->FUN_10085210(und, src, 1);
if (roi != NULL) {
roi->SetUnknown0x0c(0);
}
delete[] src;
delete[] und;
}
if (roi != NULL) {
m_unk0x74->Append(roi);
}
delete[] str;
}
}
}
// STUB: LEGO1 0x100697c0
LegoChar* LegoAnimPresenter::FUN_100697c0(const LegoChar*, LegoChar*)
{
return NULL;
}
// STUB: LEGO1 0x1006ad30
void LegoAnimPresenter::PutFrame()
{
@ -165,10 +255,10 @@ void LegoAnimPresenter::StreamingTickle()
}
}
// STUB: LEGO1 0x1006b8c0
// FUNCTION: LEGO1 0x1006b8c0
void LegoAnimPresenter::DoneTickle()
{
// TODO
MxVideoPresenter::DoneTickle();
}
// FUNCTION: LEGO1 0x1006b8d0

View file

@ -504,6 +504,26 @@ LegoResult LegoAnim::Write(LegoStorage* p_storage)
return SUCCESS;
}
// FUNCTION: LEGO1 0x100a0f20
const LegoChar* LegoAnim::GetActorName(LegoU32 p_index)
{
if (p_index < m_numActors) {
return m_actors[p_index].m_name;
}
return NULL;
}
// FUNCTION: LEGO1 0x100a0f40
undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index)
{
if (p_index < m_numActors) {
return m_actors[p_index].m_unk0x04;
}
return NULL;
}
// FUNCTION: LEGO1 0x100a0f60
LegoMorphKey::LegoMorphKey()
{

View file

@ -139,9 +139,13 @@ class LegoAnim : public LegoTree {
LegoAnim();
~LegoAnim() override;
LegoTime GetDuration() { return m_duration; }
LegoU32 GetNumActors() { return m_numActors; }
LegoResult Write(LegoStorage* p_storage) override; // vtable+0x08
virtual LegoResult Read(LegoStorage* p_storage, LegoS32 p_parseScene); // vtable+0x10
const LegoChar* GetActorName(LegoU32 p_index);
undefined4 GetActorUnknown0x04(LegoU32 p_index);
// SYNTHETIC: LEGO1 0x100a0ba0
// LegoAnim::`scalar deleting destructor'