From 2600b1b4216c8b6a0a60c21c82ae749d6dd83e2f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 16 Apr 2024 10:07:13 -0400 Subject: [PATCH] Implement/match LegoPhonemePresenter::StartingTickle (#809) * Implement/match LegoPhonemePresenter::StartingTickle * Name vars * Fix name --- CMakeLists.txt | 2 +- .../legoomni/include/legocharactermanager.h | 1 + LEGO1/lego/legoomni/include/legophoneme.h | 41 ++++++++++ LEGO1/lego/legoomni/include/legophonemelist.h | 75 +++++++++++++++++++ .../legoomni/include/legophonemepresenter.h | 15 ++-- .../legoomni/include/legounknown100d7c88.h | 21 ------ .../legoomni/include/legounknown100d9d00.h | 48 ------------ .../lego/legoomni/include/legovideomanager.h | 72 +++++++++--------- .../src/common/legocharactermanager.cpp | 7 ++ .../lego/legoomni/src/common/legophoneme.cpp | 62 +++++++++++++++ .../src/unknown/legounknown100d7c88.cpp | 14 ---- .../legoomni/src/video/legoanimpresenter.cpp | 10 +-- .../src/video/legophonemepresenter.cpp | 66 ++++++++++++++-- .../legoomni/src/video/legovideomanager.cpp | 4 +- LEGO1/lego/sources/roi/legoroi.cpp | 15 +++- LEGO1/lego/sources/roi/legoroi.h | 3 +- LEGO1/omni/include/mxstring.h | 1 + 17 files changed, 314 insertions(+), 143 deletions(-) create mode 100644 LEGO1/lego/legoomni/include/legophoneme.h create mode 100644 LEGO1/lego/legoomni/include/legophonemelist.h delete mode 100644 LEGO1/lego/legoomni/include/legounknown100d7c88.h delete mode 100644 LEGO1/lego/legoomni/include/legounknown100d9d00.h create mode 100644 LEGO1/lego/legoomni/src/common/legophoneme.cpp delete mode 100644 LEGO1/lego/legoomni/src/unknown/legounknown100d7c88.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 1882ba76..96ad9343 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,6 +328,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/common/legofullscreenmovie.cpp LEGO1/lego/legoomni/src/common/legogamestate.cpp LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp + LEGO1/lego/legoomni/src/common/legophoneme.cpp LEGO1/lego/legoomni/src/common/legoplantmanager.cpp LEGO1/lego/legoomni/src/common/legostate.cpp LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -388,7 +389,6 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/race/raceskel.cpp LEGO1/lego/legoomni/src/race/racestate.cpp LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp - LEGO1/lego/legoomni/src/unknown/legounknown100d7c88.cpp LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index ece8b915..ca445081 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -61,6 +61,7 @@ class LegoCharacterManager { MxU32 GetRefCount(LegoROI* p_roi); void FUN_10083db0(LegoROI* p_roi); void FUN_10083f10(LegoROI* p_roi); + MxU32 FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo); LegoExtraActor* GetActor(const char* p_key); LegoCharacterData* GetData(const char* p_key); LegoCharacterData* GetData(LegoROI* p_roi); diff --git a/LEGO1/lego/legoomni/include/legophoneme.h b/LEGO1/lego/legoomni/include/legophoneme.h new file mode 100644 index 00000000..76485840 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legophoneme.h @@ -0,0 +1,41 @@ +#ifndef LEGOPHONEME_H +#define LEGOPHONEME_H + +#include "decomp.h" +#include "mxstring.h" + +class LegoTextureInfo; + +// VTABLE: LEGO1 0x100d7c88 +// SIZE 0x20 +class LegoPhoneme { +public: + LegoPhoneme(const char* p_name, undefined4 p_unk0x14) + { + m_name = p_name; + m_name.ToUpperCase(); + Init(); + m_unk0x14 = p_unk0x14; + } + ~LegoPhoneme(); + + virtual undefined4 VTable0x00(); // vtable+0x00 + virtual void VTable0x04(undefined4 p_unk0x14); // vtable+0x04 + virtual LegoTextureInfo* VTable0x08(); // vtable+0x08 + virtual void VTable0x0c(LegoTextureInfo* p_unk0x18); // vtable+0x0c + virtual LegoTextureInfo* VTable0x10(); // vtable+0x10 + virtual void VTable0x14(LegoTextureInfo* p_unk0x1c); // vtable+0x14 + virtual void VTable0x18(); // vtable+0x18 + virtual void Init(); // vtable+0x1c + virtual void VTable0x20(undefined4); // vtable+0x20 + + inline MxString& GetName() { return m_name; } + +private: + MxString m_name; // 0x04 + undefined4 m_unk0x14; // 0x14 + LegoTextureInfo* m_unk0x18; // 0x18 + LegoTextureInfo* m_unk0x1c; // 0x1c +}; + +#endif // LEGOPHONEME_H diff --git a/LEGO1/lego/legoomni/include/legophonemelist.h b/LEGO1/lego/legoomni/include/legophonemelist.h new file mode 100644 index 00000000..10ade657 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legophonemelist.h @@ -0,0 +1,75 @@ +#ifndef LEGOPHONEMELIST_H +#define LEGOPHONEMELIST_H + +#include "decomp.h" +#include "legophoneme.h" +#include "mxlist.h" + +// VTABLE: LEGO1 0x100d9cd0 +// class MxCollection + +// VTABLE: LEGO1 0x100d9ce8 +// class MxList + +// VTABLE: LEGO1 0x100d9d00 +// SIZE 0x18 +class LegoPhonemeList : public MxList { +public: + LegoPhonemeList() { SetDestroy(Destroy); } + + // FUNCTION: LEGO1 0x1007b210 + MxS8 Compare(LegoPhoneme* p_a, LegoPhoneme* p_b) override + { + MxString a(p_a->GetName()); + MxString b(p_b->GetName()); + return a.Equal(b) ? 0 : p_a < p_b ? -1 : 1; + } // vtable+0x14 + + // FUNCTION: LEGO1 0x1007b2e0 + static void Destroy(LegoPhoneme* p_element) { delete p_element; } +}; + +// VTABLE: LEGO1 0x100d80c8 +// class MxListCursor + +// VTABLE: LEGO1 0x100d80e0 +// SIZE 0x10 +class LegoPhonemeListCursor : public MxListCursor { +public: + LegoPhonemeListCursor(LegoPhonemeList* p_list) : MxListCursor(p_list) {} +}; + +// TEMPLATE: LEGO1 0x1004e680 +// LegoPhonemeListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1004e6f0 +// MxListCursor::~MxListCursor + +// TEMPLATE: LEGO1 0x1004e740 +// MxListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1004e7b0 +// LegoPhonemeListCursor::~LegoPhonemeListCursor + +// TEMPLATE: LEGO1 0x1007b300 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x1007b310 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x1007b360 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x1007b370 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x1007b400 +// LegoPhonemeList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1007b470 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1007b4e0 +// MxList::`scalar deleting destructor' + +#endif // LEGOPHONEMELIST_H diff --git a/LEGO1/lego/legoomni/include/legophonemepresenter.h b/LEGO1/lego/legoomni/include/legophonemepresenter.h index 59263f7f..f6bb2c8d 100644 --- a/LEGO1/lego/legoomni/include/legophonemepresenter.h +++ b/LEGO1/lego/legoomni/include/legophonemepresenter.h @@ -6,6 +6,8 @@ #include "mxstring.h" #include "mxtypes.h" +class LegoTextureInfo; + // VTABLE: LEGO1 0x100d8040 // SIZE 0x88 class LegoPhonemePresenter : public MxFlcPresenter { @@ -31,11 +33,14 @@ class LegoPhonemePresenter : public MxFlcPresenter { private: void Init(); - undefined4 m_unk0x68; // 0x68 - undefined4 m_unk0x6c; // 0x6c - undefined m_unk0x70; // 0x70 - MxString m_unk0x74; // 0x74 - undefined m_unk0x84; // 0x84 + undefined4 m_unk0x68; // 0x68 + LegoTextureInfo* m_textureInfo; // 0x6c + MxBool m_unk0x70; // 0x70 + MxString m_roiName; // 0x74 + MxBool m_unk0x84; // 0x84 }; +// TEMPLATE: LEGO1 0x1004eb20 +// MxListEntry::MxListEntry + #endif // LEGOPHONEMEPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legounknown100d7c88.h b/LEGO1/lego/legoomni/include/legounknown100d7c88.h deleted file mode 100644 index 36f20e85..00000000 --- a/LEGO1/lego/legoomni/include/legounknown100d7c88.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef LEGOUNKNOWN100D7C88_H -#define LEGOUNKNOWN100D7C88_H - -#include "decomp.h" -#include "mxstring.h" - -// VTABLE: LEGO1 0x100d7c88 -// SIZE 0x18 -class LegoUnknown100d7c88 { -public: - ~LegoUnknown100d7c88(); - - virtual undefined4 VTable0x00(); // vtable+0x00 - // More virtual functions - -private: - MxString m_unk0x04; // 0x04 - undefined4 m_unk0x14; // 0x14 -}; - -#endif // LEGOUNKNOWN100D7C88_H diff --git a/LEGO1/lego/legoomni/include/legounknown100d9d00.h b/LEGO1/lego/legoomni/include/legounknown100d9d00.h deleted file mode 100644 index 0c567b17..00000000 --- a/LEGO1/lego/legoomni/include/legounknown100d9d00.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef LEGOUNKNOWN100D9D00_H -#define LEGOUNKNOWN100D9D00_H - -#include "decomp.h" -#include "legounknown100d7c88.h" -#include "mxlist.h" - -// VTABLE: LEGO1 0x100d9cd0 -// class MxCollection - -// VTABLE: LEGO1 0x100d9ce8 -// class MxList - -// VTABLE: LEGO1 0x100d9d00 -// SIZE 0x18 -class LegoUnknown100d9d00 : public MxList { -public: - LegoUnknown100d9d00() { SetDestroy(Destroy); } - - // STUB: LEGO1 0x1007b210 - MxS8 Compare(LegoUnknown100d7c88* p_a, LegoUnknown100d7c88* p_b) override { return -1; } // vtable+0x14 - - // FUNCTION: LEGO1 0x1007b2e0 - static void Destroy(LegoUnknown100d7c88* p_element) { delete p_element; } -}; - -// TEMPLATE: LEGO1 0x1007b300 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x1007b310 -// MxCollection::~MxCollection - -// TEMPLATE: LEGO1 0x1007b360 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x1007b370 -// MxList::~MxList - -// SYNTHETIC: LEGO1 0x1007b400 -// LegoUnknown100d9d00::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1007b470 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1007b4e0 -// MxList::`scalar deleting destructor' - -#endif // LEGOUNKNOWN100D9D00_H diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index 6f9a7a93..a036c4e2 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -3,7 +3,7 @@ #include "3dmanager/lego3dmanager.h" #include "decomp.h" -#include "legounknown100d9d00.h" +#include "legophonemelist.h" #include "mxdirectx/mxdirect3d.h" #include "mxdirectx/mxstopwatch.h" #include "mxvideomanager.h" @@ -34,7 +34,7 @@ class LegoVideoManager : public MxVideoManager { virtual MxPresenter* GetPresenterAt(MxS32 p_x, MxS32 p_y); // vtable+0x38 // FUNCTION: LEGO1 0x1007ab10 - virtual LegoUnknown100d9d00* VTable0x3c() { return m_unk0x100d9d00; } // vtable+0x3c + virtual LegoPhonemeList* GetPhonemeList() { return m_phonemeRefList; } // vtable+0x3c void SetSkyColor(float p_red, float p_green, float p_blue); void OverrideSkyColor(MxBool p_shouldOverride); @@ -57,40 +57,40 @@ class LegoVideoManager : public MxVideoManager { inline void DrawCursor(); - Tgl::Renderer* m_renderer; // 0x64 - Lego3DManager* m_3dManager; // 0x68 - LegoROI* m_viewROI; // 0x6c - undefined4 m_unk0x70; // 0x70 - MxDirect3D* m_direct3d; // 0x74 - undefined4 m_unk0x78[27]; // 0x78 - MxBool m_render3d; // 0xe4 - MxBool m_unk0xe5; // 0xe5 - MxBool m_unk0xe6; // 0xe6 - PALETTEENTRY m_paletteEntries[256]; // 0xe7 - undefined m_padding0x4e7; // 0x4e7 - LegoUnknown100d9d00* m_unk0x100d9d00; // 0x4e8 - MxBool m_isFullscreenMovie; // 0x4ec - MxPalette* m_palette; // 0x4f0 - MxStopWatch* m_stopWatch; // 0x4f4 - double m_elapsedSeconds; // 0x4f8 - MxBool m_fullScreenMovie; // 0x500 - MxBool m_drawCursor; // 0x501 - MxS32 m_cursorXCopy; // 0x504 - MxS32 m_cursorYCopy; // 0x508 - MxS32 m_cursorX; // 0x50c - MxS32 m_cursorY; // 0x510 - LPDIRECTDRAWSURFACE m_cursorSurface; // 0x514 - RECT m_cursorRect; // 0x518 - undefined4 m_unk0x528; // 0x528 - MxBool m_drawFPS; // 0x52c - RECT m_fpsRect; // 0x530 - HFONT m_arialFont; // 0x540 - SIZE m_fpsSize; // 0x544 - MxFloat m_unk0x54c; // 0x54c - MxFloat m_unk0x550; // 0x550 - MxBool m_unk0x554; // 0x554 - MxBool m_paused; // 0x555 - undefined m_pad0x556[0x39]; // 0x556 + Tgl::Renderer* m_renderer; // 0x64 + Lego3DManager* m_3dManager; // 0x68 + LegoROI* m_viewROI; // 0x6c + undefined4 m_unk0x70; // 0x70 + MxDirect3D* m_direct3d; // 0x74 + undefined4 m_unk0x78[27]; // 0x78 + MxBool m_render3d; // 0xe4 + MxBool m_unk0xe5; // 0xe5 + MxBool m_unk0xe6; // 0xe6 + PALETTEENTRY m_paletteEntries[256]; // 0xe7 + undefined m_padding0x4e7; // 0x4e7 + LegoPhonemeList* m_phonemeRefList; // 0x4e8 + MxBool m_isFullscreenMovie; // 0x4ec + MxPalette* m_palette; // 0x4f0 + MxStopWatch* m_stopWatch; // 0x4f4 + double m_elapsedSeconds; // 0x4f8 + MxBool m_fullScreenMovie; // 0x500 + MxBool m_drawCursor; // 0x501 + MxS32 m_cursorXCopy; // 0x504 + MxS32 m_cursorYCopy; // 0x508 + MxS32 m_cursorX; // 0x50c + MxS32 m_cursorY; // 0x510 + LPDIRECTDRAWSURFACE m_cursorSurface; // 0x514 + RECT m_cursorRect; // 0x518 + undefined4 m_unk0x528; // 0x528 + MxBool m_drawFPS; // 0x52c + RECT m_fpsRect; // 0x530 + HFONT m_arialFont; // 0x540 + SIZE m_fpsSize; // 0x544 + MxFloat m_unk0x54c; // 0x54c + MxFloat m_unk0x550; // 0x550 + MxBool m_unk0x554; // 0x554 + MxBool m_paused; // 0x555 + undefined m_pad0x556[0x39]; // 0x556 }; // SYNTHETIC: LEGO1 0x1007ab20 diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 3ef3a814..53b43697 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -469,6 +469,13 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) return roi; } +// STUB: LEGO1 0x100849a0 +MxU32 LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x10084c00 MxBool LegoCharacterManager::Exists(const char* p_key) { diff --git a/LEGO1/lego/legoomni/src/common/legophoneme.cpp b/LEGO1/lego/legoomni/src/common/legophoneme.cpp new file mode 100644 index 00000000..55da20c9 --- /dev/null +++ b/LEGO1/lego/legoomni/src/common/legophoneme.cpp @@ -0,0 +1,62 @@ +#include "legophoneme.h" + +DECOMP_SIZE_ASSERT(LegoPhoneme, 0x20) + +// FUNCTION: LEGO1 0x10044e50 +LegoPhoneme::~LegoPhoneme() +{ +} + +// FUNCTION: LEGO1 0x10044eb0 +undefined4 LegoPhoneme::VTable0x00() +{ + return m_unk0x14; +} + +// FUNCTION: LEGO1 0x10044ec0 +void LegoPhoneme::VTable0x04(undefined4 p_unk0x14) +{ + m_unk0x14 = p_unk0x14; +} + +// FUNCTION: LEGO1 0x10044ed0 +LegoTextureInfo* LegoPhoneme::VTable0x08() +{ + return m_unk0x18; +} + +// FUNCTION: LEGO1 0x10044ee0 +void LegoPhoneme::VTable0x0c(LegoTextureInfo* p_unk0x18) +{ + m_unk0x18 = p_unk0x18; +} + +// FUNCTION: LEGO1 0x10044ef0 +LegoTextureInfo* LegoPhoneme::VTable0x10() +{ + return m_unk0x1c; +} + +// FUNCTION: LEGO1 0x10044f00 +void LegoPhoneme::VTable0x14(LegoTextureInfo* p_unk0x1c) +{ + m_unk0x1c = p_unk0x1c; +} + +// FUNCTION: LEGO1 0x10044f10 +void LegoPhoneme::VTable0x18() +{ +} + +// FUNCTION: LEGO1 0x10044f20 +void LegoPhoneme::Init() +{ + m_unk0x14 = 0; + m_unk0x18 = NULL; + m_unk0x1c = NULL; +} + +// FUNCTION: LEGO1 0x10044f30 +void LegoPhoneme::VTable0x20(undefined4) +{ +} diff --git a/LEGO1/lego/legoomni/src/unknown/legounknown100d7c88.cpp b/LEGO1/lego/legoomni/src/unknown/legounknown100d7c88.cpp deleted file mode 100644 index 27349fbf..00000000 --- a/LEGO1/lego/legoomni/src/unknown/legounknown100d7c88.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "legounknown100d7c88.h" - -DECOMP_SIZE_ASSERT(LegoUnknown100d7c88, 0x18) - -// FUNCTION: LEGO1 0x10044e50 -LegoUnknown100d7c88::~LegoUnknown100d7c88() -{ -} - -// FUNCTION: LEGO1 0x10044eb0 -MxU32 LegoUnknown100d7c88::VTable0x00() -{ - return m_unk0x14; -} diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 937bd7bc..40a2939c 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -394,10 +394,10 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* } } else { - LegoROI* roi2 = p_roi->FUN_100a8ce0(name, p_roi); + LegoROI* child = p_roi->FindChildROI(name, p_roi); - if (roi2 != NULL) { - FUN_1006a4f0(p_map, data, und, roi2); + if (child != NULL) { + FUN_1006a4f0(p_map, data, und, child); } else { if (FUN_100699e0(name) != NULL) { @@ -473,9 +473,9 @@ MxBool LegoAnimPresenter::FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi) } } else { - LegoROI* roi2 = p_roi->FUN_100a8ce0(name, p_roi); + LegoROI* child = p_roi->FindChildROI(name, p_roi); - if (roi2 == NULL) { + if (child == NULL) { if (FUN_100699e0(name) != NULL) { if (FUN_1006abb0(p_node, NULL)) { result = TRUE; diff --git a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp index 78a5c625..d1b7b68d 100644 --- a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp @@ -1,5 +1,10 @@ #include "legophonemepresenter.h" +#include "legocharactermanager.h" +#include "misc.h" +#include "misc/legocontainer.h" +#include "mxcompositepresenter.h" + DECOMP_SIZE_ASSERT(LegoPhonemePresenter, 0x88) // FUNCTION: LEGO1 0x1004e180 @@ -17,17 +22,66 @@ LegoPhonemePresenter::~LegoPhonemePresenter() void LegoPhonemePresenter::Init() { m_unk0x68 = 0; - m_unk0x6c = 0; - m_unk0x70 = 0; - m_unk0x84 = 0; + m_textureInfo = NULL; + m_unk0x70 = FALSE; + m_unk0x84 = FALSE; } -// STUB: LEGO1 0x1004e3d0 +// FUNCTION: LEGO1 0x1004e3d0 void LegoPhonemePresenter::StartingTickle() { - // TODO + MxFlcPresenter::StartingTickle(); - EndAction(); + 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); + + LegoPhonemeList* phonemeList = VideoManager()->GetPhonemeList(); + LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1); + + LegoPhonemeListCursor cursor(phonemeList); + + if (!cursor.Find(phoneme)) { + LegoTextureInfo* textureInfo = TextureContainer()->AddToList(m_textureInfo); + + 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; + } + } + } } // STUB: LEGO1 0x1004e800 diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index 5f2a022c..e24de146 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -25,7 +25,7 @@ LegoVideoManager::LegoVideoManager() m_unk0xe6 = FALSE; memset(m_unk0x78, 0, sizeof(m_unk0x78)); m_unk0x78[0] = 0x6c; - m_unk0x100d9d00 = NULL; + m_phonemeRefList = NULL; m_isFullscreenMovie = FALSE; m_palette = NULL; m_stopWatch = NULL; @@ -194,7 +194,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM m_3dManager->Add(*m_viewROI); m_3dManager->SetPointOfView(*m_viewROI); - m_unk0x100d9d00 = new LegoUnknown100d9d00; + m_phonemeRefList = new LegoPhonemeList; SetRender3D(FALSE); m_stopWatch = new MxStopWatch; m_stopWatch->Start(); diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index e5f5e490..9262dc6e 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -341,7 +341,7 @@ LegoResult LegoROI::FUN_100a8cb0(LegoAnimNodeData* p_data, LegoTime p_time, Matr } // FUNCTION: LEGO1 0x100a8ce0 -LegoROI* LegoROI::FUN_100a8ce0(const LegoChar* p_name, LegoROI* p_roi) +LegoROI* LegoROI::FindChildROI(const LegoChar* p_name, LegoROI* p_roi) { CompoundObject::iterator it; const LegoChar* name = p_roi->GetName(); @@ -362,7 +362,7 @@ LegoROI* LegoROI::FUN_100a8ce0(const LegoChar* p_name, LegoROI* p_roi) } for (it = comp->begin(); it != comp->end(); it++) { - LegoROI* roi = FUN_100a8ce0(p_name, (LegoROI*) *it); + LegoROI* roi = FindChildROI(p_name, (LegoROI*) *it); if (roi != NULL) { return roi; @@ -379,10 +379,10 @@ LegoResult LegoROI::FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, MxMatrix mat; LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); const LegoChar* name = data->GetName(); - LegoROI* roi = FUN_100a8ce0(name, p_roi); + LegoROI* roi = FindChildROI(name, p_roi); if (roi == NULL) { - roi = FUN_100a8ce0(name, this); + roi = FindChildROI(name, this); } if (roi != NULL) { @@ -498,6 +498,13 @@ LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo) return result; } +// STUB: LEGO1 0x100a92a0 +LegoResult LegoROI::GetTexture(LegoTextureInfo*&) +{ + // TODO + return FAILURE; +} + // FUNCTION: LEGO1 0x100a9a50 TimeROI::TimeROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, LegoTime p_time) : LegoROI(p_renderer, p_lodList) { diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index 68309a91..52206424 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -30,12 +30,13 @@ class LegoROI : public ViewROI { LegoTextureContainer* p_textureContainer, LegoStorage* p_storage ); - LegoROI* FUN_100a8ce0(const LegoChar* p_name, LegoROI* p_roi); + LegoROI* FindChildROI(const LegoChar* p_name, LegoROI* p_roi); LegoResult FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, LegoTime p_time, LegoROI* p_roi); static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_rois); LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time); LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo); + LegoResult GetTexture(LegoTextureInfo*&); void SetName(const LegoChar* p_name); float IntrinsicImportance() const override; // vtable+0x04 diff --git a/LEGO1/omni/include/mxstring.h b/LEGO1/omni/include/mxstring.h index 7cb486df..231d2e2c 100644 --- a/LEGO1/omni/include/mxstring.h +++ b/LEGO1/omni/include/mxstring.h @@ -20,6 +20,7 @@ class MxString : public MxCore { MxString& operator+=(const char* p_str); inline MxS8 Compare(const MxString& p_str) const { return strcmp(m_data, p_str.m_data); } + inline MxBool Equal(const MxString& p_str) const { return strcmp(m_data, p_str.m_data) == 0; } inline const char* GetData() const { return m_data; } inline char* GetDataPtr() const { return m_data; } inline const MxU16 GetLength() const { return m_length; }