diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index ed40b398..31ee5a37 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -31,7 +31,7 @@ class LegoAnimationManager : public MxCore { void FUN_1005ef10(); void FUN_1005f0b0(); void FUN_1005f6d0(MxBool); - void FUN_1005f720(undefined4); + void FUN_1005f720(MxS32 p_scriptIndex); void FUN_10061010(undefined4); void FUN_10064670(MxBool); diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index 07ebc3dd..4229e003 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -98,6 +98,9 @@ class LegoOmni : public MxOmni { return *this; } + inline MxS32 GetIndex() { return m_index; } + inline const char* GetKey() { return m_key; } + private: MxS32 m_index; // 0x00 char m_key[20]; // 0x04 @@ -200,7 +203,7 @@ class LegoOmni : public MxOmni { void CreateBackgroundAudio(); void RemoveWorld(const MxAtomId&, MxLong); MxResult RegisterScripts(); - undefined4 FUN_1005b490(char* p_worldName); + MxS32 GetScriptIndex(const char* p_key); static MxS32 GetCurrPathInfo(LegoPathBoundary**, MxS32&); static void CreateInstance(); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 1f67a72d..2670d13c 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -20,7 +20,7 @@ class LegoPlantManager : public MxCore { return "LegoPlantManager"; } - void FUN_10026360(undefined4 p_world); + void FUN_10026360(MxS32 p_scriptIndex); void FUN_100263a0(undefined4 p_und); void FUN_10027120(); diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index f58ecbbe..5b31fd7c 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -65,11 +65,12 @@ class LegoWorld : public LegoEntity { virtual void Enable(MxBool p_enable); // vtable+0x68 inline LegoCameraController* GetCamera() { return m_cameraController; } - inline void SetUnknown0xec(undefined4 p_unk0xec) { m_unk0xec = p_unk0xec; } - inline undefined4 GetUnknown0xec() { return m_unk0xec; } + inline MxS32 GetScriptIndex() { return m_scriptIndex; } inline MxCoreSet& GetUnknown0xd0() { return m_set0xd0; } inline list& GetUnknownList0xe0() { return m_list0xe0; } + inline void SetScriptIndex(MxS32 p_scriptIndex) { m_scriptIndex = p_scriptIndex; } + MxBool PresentersPending(); void Remove(MxCore* p_object); void FUN_1001fc80(IslePathActor* p_actor); @@ -91,7 +92,7 @@ class LegoWorld : public LegoEntity { MxPresenterList m_controlPresenters; // 0xb8 MxCoreSet m_set0xd0; // 0xd0 list m_list0xe0; // 0xe0 - undefined4 m_unk0xec; // 0xec + MxS32 m_scriptIndex; // 0xec LegoHideAnimPresenter* m_hideAnimPresenter; // 0xf0 MxS16 m_startupTicks; // 0xf4 MxBool m_worldStarted; // 0xf6 diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index e8c5e097..b111186a 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -21,7 +21,7 @@ void LegoPlantManager::Init() } // STUB: LEGO1 0x10026360 -void LegoPlantManager::FUN_10026360(undefined4 p_world) +void LegoPlantManager::FUN_10026360(MxS32 p_scriptIndex) { // TODO } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index a4abf99c..3a705813 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -84,7 +84,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) if (p_dsAction.GetFlags() & MxDSAction::c_enabled) { if (CurrentWorld()) { - CurrentWorld()->Enable(0); + CurrentWorld()->Enable(FALSE); } SetCurrentWorld(this); @@ -92,7 +92,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) } SetIsWorldActive(TRUE); - m_unk0xec = -1; + m_scriptIndex = -1; return SUCCESS; } @@ -169,8 +169,8 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } } - if (m_unk0xec != -1 && m_set0xd0.empty()) { - PlantManager()->FUN_100263a0(m_unk0xec); + if (m_scriptIndex != -1 && m_set0xd0.empty()) { + PlantManager()->FUN_100263a0(m_scriptIndex); BuildingManager()->FUN_1002fb30(); } @@ -574,9 +574,9 @@ void LegoWorld::Enable(MxBool p_enable) Lego()->SetNavController(m_cameraController->GetNavController()); } - if (m_unk0xec != -1) { - PlantManager()->FUN_10026360(m_unk0xec); - AnimationManager()->FUN_1005f720(m_unk0xec); + if (m_scriptIndex != -1) { + PlantManager()->FUN_10026360(m_scriptIndex); + AnimationManager()->FUN_1005f720(m_scriptIndex); BuildingManager()->FUN_1002fa00(); AnimationManager()->FUN_1005f0b0(); } @@ -597,8 +597,8 @@ void LegoWorld::Enable(MxBool p_enable) AnimationManager()->FUN_1005ee80(FALSE); m_set0xd0.insert(this); - if (m_unk0xec != -1) { - PlantManager()->FUN_100263a0(m_unk0xec); + if (m_scriptIndex != -1) { + PlantManager()->FUN_100263a0(m_scriptIndex); BuildingManager()->FUN_1002fb30(); } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 174f5a9c..21721f17 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -39,9 +39,9 @@ LegoWorldPresenter::~LegoWorldPresenter() { MxBool result = FALSE; if (m_entity) { - undefined4 world = ((LegoWorld*) m_entity)->GetUnknown0xec(); - PlantManager()->FUN_10026360(world); - AnimationManager()->FUN_1005f720(world); + MxS32 scriptIndex = ((LegoWorld*) m_entity)->GetScriptIndex(); + PlantManager()->FUN_10026360(scriptIndex); + AnimationManager()->FUN_1005f720(scriptIndex); BuildingManager()->FUN_1002fa00(); result = ((LegoWorld*) m_entity)->VTable0x5c(); } @@ -189,9 +189,9 @@ void LegoWorldPresenter::ParseExtra() data[len] = 0; if (KeyValueStringParse(output, g_strWORLD, data)) { - char* worldName = strtok(output, g_parseExtraTokens); - LoadWorld(worldName, (LegoWorld*) m_entity); - ((LegoWorld*) m_entity)->SetUnknown0xec(Lego()->FUN_1005b490(worldName)); + char* worldKey = strtok(output, g_parseExtraTokens); + LoadWorld(worldKey, (LegoWorld*) m_entity); + ((LegoWorld*) m_entity)->SetScriptIndex(Lego()->GetScriptIndex(worldKey)); } } } diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index 13f58bbe..f67e028f 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -883,9 +883,15 @@ MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) return ::CurrentWorld()->GetCurrPathInfo(p_path, p_value); } -// STUB: LEGO1 0x1005b490 -undefined4 LegoOmni::FUN_1005b490(char* p_worldName) +// FUNCTION: LEGO1 0x1005b490 +MxS32 LegoOmni::GetScriptIndex(const char* p_key) { + for (MxS32 i = 0; i < 19; i++) { + if ((MxS32) &m_scripts[i] != -4 && !strcmpi(m_scripts[i].GetKey(), p_key)) { + return m_scripts[i].GetIndex(); + } + } + return -1; } diff --git a/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp index 30c6d16f..bdf3eb98 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp @@ -54,7 +54,7 @@ void LegoAnimationManager::FUN_1005f6d0(MxBool) } // STUB: LEGO1 0x1005f720 -void LegoAnimationManager::FUN_1005f720(undefined4) +void LegoAnimationManager::FUN_1005f720(MxS32 p_scriptIndex) { // TODO }