diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h index 63b884d8..16c92120 100644 --- a/LEGO1/lego/legoomni/include/animstate.h +++ b/LEGO1/lego/legoomni/include/animstate.h @@ -24,7 +24,7 @@ class AnimState : public LegoState { } MxBool SetFlag() override; // vtable+0x18 - MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10065130 // AnimState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index aed800f9..07ebc3dd 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -193,6 +193,7 @@ class LegoOmni : public MxOmni { void StopTimer() override; // vtable+3c LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); + LegoROI* FindROI(const char* p_name); void AddWorld(LegoWorld* p_world); void DeleteWorld(LegoWorld* p_world); void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags); @@ -273,8 +274,9 @@ LegoWorld* CurrentWorld(); LegoUnkSaveDataWriter* UnkSaveDataWriter(); GifManager* GetGifManager(); void FUN_10015820(MxBool p_disable, MxU16 p_flags); -void FUN_10015860(const char*, MxU8); +void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c); LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); +LegoROI* FindROI(const char* p_name); MxDSAction& GetCurrentAction(); void PlayMusic(MxU32 p_index); diff --git a/LEGO1/lego/legoomni/include/towtrackmissionstate.h b/LEGO1/lego/legoomni/include/towtrackmissionstate.h index e96e87be..444806c5 100644 --- a/LEGO1/lego/legoomni/include/towtrackmissionstate.h +++ b/LEGO1/lego/legoomni/include/towtrackmissionstate.h @@ -22,7 +22,7 @@ class TowTrackMissionState : public LegoState { return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); } - MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1C + MxResult VTable0x1c(LegoFile* p_legoFile) override; // vtable+0x1c inline MxU16 GetColor(MxU8 p_id) { diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index ee9d8231..a4abf99c 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -448,7 +448,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) } LegoROI* roi = entity->GetROI(); - if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) { + if (roi && !strcmpi(roi->GetName(), p_name)) { return entity; } } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 3e4e3c40..02f24a6b 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -289,8 +289,8 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) m_currentCutscene = e_noIntro; return 1; case 2: - FUN_10015860(g_object2x4red, 0); - FUN_10015860(g_object2x4grn, 0); + SetROIUnknown0x0c(g_object2x4red, 0); + SetROIUnknown0x0c(g_object2x4grn, 0); BackgroundAudioManager()->RaiseVolume(); return 1; case 4: @@ -319,7 +319,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) } m_infocenterState->SetUnknown0x74(2); - FUN_10015860("infoman", 1); + SetROIUnknown0x0c("infoman", 1); return 1; case 12: if (action->GetObjectId() == m_currentInfomainScript) { @@ -1054,15 +1054,15 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param) } PlayAction(objectId); - FUN_10015860(g_object2x4red, 0); - FUN_10015860(g_object2x4grn, 0); + SetROIUnknown0x0c(g_object2x4red, 0); + SetROIUnknown0x0c(g_object2x4grn, 0); return 1; } case 6: if (m_infocenterState->GetUnknown0x74() == 8) { StopCurrentAction(); - FUN_10015860(g_object2x4red, 0); - FUN_10015860(g_object2x4grn, 0); + SetROIUnknown0x0c(g_object2x4red, 0); + SetROIUnknown0x0c(g_object2x4grn, 0); m_infocenterState->SetUnknown0x74(2); PlayAction(c_infomanSneeze); return 1; diff --git a/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp b/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp index 669b41e9..bab97719 100644 --- a/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp @@ -1,6 +1,6 @@ #include "scorestate.h" -DECOMP_SIZE_ASSERT(ScoreState, 0x0C); +DECOMP_SIZE_ASSERT(ScoreState, 0x0c); // FUNCTION: LEGO1 0x1000de20 MxBool ScoreState::VTable0x14() diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 45801476..1b70583c 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -387,7 +387,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); p_param.SetROI(roi); - if (roi && roi->GetUnk0x0c() == 1) { + if (roi && roi->GetUnknown0x0c() == 1) { for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4()) { roi = (LegoROI*) oroi; } diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index b437dba8..13f58bbe 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -226,10 +226,20 @@ void FUN_10015820(MxBool p_disable, MxU16 p_flags) LegoOmni::GetInstance()->FUN_1005b4f0(p_disable, p_flags); } -// STUB: LEGO1 0x10015860 -void FUN_10015860(const char*, MxU8) +// FUNCTION: LEGO1 0x10015840 +LegoROI* FindROI(const char* p_name) { - // TODO + return LegoOmni::GetInstance()->FindROI(p_name); +} + +// FUNCTION: LEGO1 0x10015860 +void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c) +{ + LegoROI* roi = FindROI(p_name); + + if (roi) { + roi->SetUnknown0x0c(p_unk0x0c); + } } // FUNCTION: LEGO1 0x100158c0 @@ -803,6 +813,28 @@ void LegoOmni::DeleteObject(MxDSAction& p_dsAction) MxOmni::DeleteObject(p_dsAction); } +// FUNCTION: LEGO1 0x1005b270 +LegoROI* LegoOmni::FindROI(const char* p_name) +{ + ViewManager* viewManager = GetVideoManager()->Get3DManager()->GetLego3DView()->GetViewManager(); + CompoundObject& unk0x08 = viewManager->GetUnknown0x08(); + + if (p_name != NULL && *p_name != '\0' && unk0x08.size() > 0) { + for (CompoundObject::iterator it = unk0x08.begin(); it != unk0x08.end(); it++) { + LegoROI* roi = (LegoROI*) *it; + const char* name = roi->GetName(); + + if (name != NULL) { + if (!strcmpi(name, p_name)) { + return roi; + } + } + } + } + + return NULL; +} + // FUNCTION: LEGO1 0x1005b2f0 MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) { diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index 91840b16..5fc87c4a 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -135,7 +135,7 @@ void LegoModelPresenter::ParseExtra() list& roiList = currentWorld->GetUnknownList0xe0(); for (list::iterator it = roiList.begin(); it != roiList.end(); it++) { - if (!strcmpi(((LegoROI*) (*it))->GetUnknown0xe4(), output)) { + if (!strcmpi(((LegoROI*) (*it))->GetName(), output)) { m_roi = *it; roiList.erase(it); diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index cfaa21c0..5eb3ae24 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -40,7 +40,7 @@ class LegoROI : public ViewROI { void FUN_100a46b0(Matrix4& p_transform); void FUN_100a58f0(Matrix4& p_transform); - inline const char* GetUnknown0xe4() { return m_unk0xe4; } + inline const char* GetName() { return m_name; } inline LegoEntity* GetUnknown0x104() { return m_unk0x104; } inline void SetUnknown0x104(LegoEntity* p_unk0x104) { m_unk0x104 = p_unk0x104; } @@ -50,7 +50,7 @@ class LegoROI : public ViewROI { private: undefined4 m_unk0xe0; // 0xe0 - const char* m_unk0xe4; // 0xe4 + const char* m_name; // 0xe4 undefined m_unk0xe8[0x1c]; // 0xe8 LegoEntity* m_unk0x104; // 0x104 int m_time; // 0x108 diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index 7f0a0362..e82bf84f 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -81,15 +81,15 @@ class MxOmni : public MxCore { MxString m_mediaPath; // 0x08 HWND m_windowHandle; // 0x18 - MxObjectFactory* m_objectFactory; // 0x1C + MxObjectFactory* m_objectFactory; // 0x1c MxVariableTable* m_variableTable; // 0x20 MxTickleManager* m_tickleManager; // 0x24 MxNotificationManager* m_notificationManager; // 0x28 - MxVideoManager* m_videoManager; // 0x2C + MxVideoManager* m_videoManager; // 0x2c MxSoundManager* m_soundManager; // 0x30 MxMusicManager* m_musicManager; // 0x34 MxEventManager* m_eventManager; // 0x38 - MxTimer* m_timer; // 0x3C + MxTimer* m_timer; // 0x3c MxStreamer* m_streamer; // 0x40 MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44 MxCriticalSection m_criticalsection; // 0x48 diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 6f367c48..196725ac 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -103,7 +103,9 @@ class ROI { int GetLODCount() const { return m_lods ? m_lods->Size() : 0; } const CompoundObject* GetComp() const { return m_comp; } - inline undefined GetUnk0x0c() { return m_unk0x0c; } + inline undefined GetUnknown0x0c() { return m_unk0x0c; } + + inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } // SYNTHETIC: LEGO1 0x100a5d60 // ROI::`scalar deleting destructor' diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index 625722b5..79362c9d 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -20,6 +20,8 @@ class ViewManager { // SYNTHETIC: LEGO1 0x100a6000 // ViewManager::`scalar deleting destructor' + inline CompoundObject& GetUnknown0x08() { return m_unk0x08; } + inline void AddToUnknown0x08(ViewROI* p_roi) { m_unk0x08.push_back(p_roi); } private: