From c5318dca1350cb9a11bef5002de49dc4418536d7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 25 Feb 2024 12:55:57 -0500 Subject: [PATCH] Implement/match LegoAnimPresenter::FUN_100695c0 (#595) --- .../lego/legoomni/include/legoanimpresenter.h | 4 +- .../legoomni/include/legounksavedatawriter.h | 2 +- .../src/common/legounksavedatawriter.cpp | 2 +- .../legoomni/src/video/legoanimpresenter.cpp | 46 ++++++++++++++++++- LEGO1/library_msvc.h | 3 ++ 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 86206fee..9d1a6416 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -50,12 +50,14 @@ class LegoAnimPresenter : public MxVideoPresenter { void Destroy(MxBool p_fromDestructor); LegoChar* FUN_10069150(const LegoChar*); void FUN_100692b0(); + void FUN_100695c0(); LegoChar* FUN_100697c0(const LegoChar*, LegoChar*); + LegoBool FUN_100698b0(CompoundObject&, const LegoChar*); LegoAnim* m_anim; // 0x64 undefined4 m_unk0x68; // 0x68 undefined4 m_unk0x6c; // 0x6c - undefined4 m_unk0x70; // 0x70 + LegoROIList* m_unk0x70; // 0x70 LegoROIList* m_unk0x74; // 0x74 undefined4 m_unk0x78; // 0x78 undefined4 m_unk0x7c; // 0x7c diff --git a/LEGO1/lego/legoomni/include/legounksavedatawriter.h b/LEGO1/lego/legoomni/include/legounksavedatawriter.h index 7c49bfa1..7dd38998 100644 --- a/LEGO1/lego/legoomni/include/legounksavedatawriter.h +++ b/LEGO1/lego/legoomni/include/legounksavedatawriter.h @@ -64,7 +64,7 @@ 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_10085210(const LegoChar*, LegoChar*, undefined); LegoROI* FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3); private: diff --git a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp index a1055e63..2fdc658c 100644 --- a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp +++ b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp @@ -129,7 +129,7 @@ void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value) } // STUB: LEGO1 0x10085210 -LegoROI* LegoUnkSaveDataWriter::FUN_10085210(LegoChar*, LegoChar*, undefined) +LegoROI* LegoUnkSaveDataWriter::FUN_10085210(const LegoChar*, LegoChar*, undefined) { return NULL; } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 2eae93ca..0c04bb25 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -2,6 +2,7 @@ #include "legoomni.h" #include "legounksavedatawriter.h" +#include "legovideomanager.h" #include "legoworld.h" #include "mxcompositepresenter.h" #include "mxdsanim.h" @@ -29,7 +30,7 @@ void LegoAnimPresenter::Init() m_unk0x68 = 0; m_unk0x6c = 0; m_unk0x74 = NULL; - m_unk0x70 = 0; + m_unk0x70 = NULL; m_unk0x78 = 0; m_unk0x7c = 0; m_unk0xa8.Clear(); @@ -108,6 +109,7 @@ MxResult LegoAnimPresenter::CreateAnim(MxStreamChunk* p_chunk) // STUB: LEGO1 0x10069150 LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar*) { + // TODO return NULL; } @@ -188,12 +190,54 @@ void LegoAnimPresenter::FUN_100692b0() } } +// FUNCTION: LEGO1 0x100695c0 +void LegoAnimPresenter::FUN_100695c0() +{ + m_unk0x70 = new LegoROIList(); + + if (m_unk0x70) { + CompoundObject& unk0x08 = VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->GetUnknown0x08(); + LegoU32 numActors = m_anim->GetNumActors(); + + for (LegoU32 i = 0; i < numActors; i++) { + if (FUN_100698b0(unk0x08, m_anim->GetActorName(i)) == FALSE) { + undefined4 unk0x04 = m_anim->GetActorUnknown0x04(i); + + if (unk0x04 == 5 || unk0x04 == 6) { + LegoChar dest[256]; + const LegoChar* str = m_anim->GetActorName(i); + + LegoU32 len = strlen(str); + strcpy(dest, str); + + for (LegoChar* i = &dest[len - 1]; isdigit(*i) || *i == '_'; i--) { + *i = '\0'; + } + + strlwr(dest); + + UnkSaveDataWriter()->FUN_10085210(str, dest, 0); + FUN_100698b0(unk0x08, str); + } + } + } + } +} + // STUB: LEGO1 0x100697c0 LegoChar* LegoAnimPresenter::FUN_100697c0(const LegoChar*, LegoChar*) { + // TODO return NULL; } +// STUB: LEGO1 0x100698b0 +LegoBool LegoAnimPresenter::FUN_100698b0(CompoundObject&, const LegoChar*) +{ + // TODO + return FALSE; +} + // STUB: LEGO1 0x1006ad30 void LegoAnimPresenter::PutFrame() { diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 259ed919..f08a4876 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -81,6 +81,9 @@ // LIBRARY: LEGO1 0x1008c5c0 // _fseek +// LIBRARY: LEGO1 0x1008c6a0 +// _isdigit + // LIBRARY: LEGO1 0x1008ca60 // _abort