From 5b8ea3575695aca84a75b175617031fd7f44467f Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:42:09 -0500 Subject: [PATCH] Implement Isle::VTable0x50 (#432) * push changes * fix formatting * Fix structure * Fix return --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/act1state.h | 11 +++++++ LEGO1/lego/legoomni/include/isle.h | 1 + .../legoomni/include/legoanimationmanager.h | 1 + LEGO1/lego/legoomni/include/legoentity.h | 2 +- LEGO1/lego/legoomni/include/legogamestate.h | 2 +- .../lego/legoomni/include/legovideomanager.h | 1 + LEGO1/lego/legoomni/src/act1/act1state.cpp | 13 +++++++++ .../legoomni/src/common/legogamestate.cpp | 29 +++++++++++++++++-- LEGO1/lego/legoomni/src/isle/isle.cpp | 22 ++++++++++++-- .../src/video/legoanimationmanager.cpp | 5 ++++ 10 files changed, 81 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index d0daec7d..84537e88 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -24,10 +24,21 @@ class Act1State : public LegoState { inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x18 = p_unk0x18; } inline MxU32 GetUnknown18() { return m_unk0x18; } + inline void SetUnknown21(MxS16 p_unk0x21) { m_unk0x21 = p_unk0x21; } + inline MxS16 GetUnknown21() { return m_unk0x21; } + + void FUN_10034d00(); protected: undefined m_unk0x8[0x10]; // 0x8 MxU32 m_unk0x18; // 0x18 + undefined2 m_unk0x1c; // 0x1c + undefined m_unk0x1e; // 0x1e + undefined m_unk0x1f; // 0x1f + undefined m_unk0x20; // 0x20 + MxBool m_unk0x21; // 0x21 + undefined m_unk0x22; // 0x22 + // TODO }; #endif // ACT1STATE_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 6bf1fd48..d5b7c57b 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -57,6 +57,7 @@ class Isle : public LegoWorld { MxLong HandleType17Notification(MxParam& p_param); MxLong HandleType19Notification(MxParam& p_param); MxLong HandleTransitionEnd(); + void FUN_10032620(); protected: Act1State* m_act1state; // 0xf8 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 5c13947f..a781128e 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -27,6 +27,7 @@ class LegoAnimationManager : public MxCore { return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name); } + void FUN_1005ef10(); void FUN_1005f6d0(MxBool); void FUN_1005f720(undefined4); void FUN_10064670(MxBool); diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 21dd26a8..d892168d 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -3,7 +3,7 @@ #include "decomp.h" #include "extra.h" -#include "mxdsobject.h" +#include "mxdsaction.h" #include "mxentity.h" #include "realtime/vector.h" #include "roi/legoroi.h" diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 5f62b107..00781094 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -72,7 +72,7 @@ class LegoGameState { undefined m_unk0x41a[8]; // 0x41a - might be part of the structure at 0xa6 MxBool m_isDirty; // 0x420 undefined4 m_unk0x424; // 0x424 - undefined4 m_unk0x428; // 0x428 + undefined4 m_prevArea; // 0x428 undefined4 m_unk0x42c; // 0x42c }; diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index 898204da..6921e7d2 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -41,6 +41,7 @@ class LegoVideoManager : public MxVideoManager { inline Lego3DManager* Get3DManager() { return this->m_3dManager; } inline MxDirect3D* GetDirect3D() { return this->m_direct3d; } inline void SetRender3D(MxBool p_render3d) { this->m_render3d = p_render3d; } + inline void SetUnk0x554(MxBool p_unk0x554) { this->m_unk0x554 = p_unk0x554; } private: MxResult CreateDirect3D(); diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp index c013b502..17f09277 100644 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ b/LEGO1/lego/legoomni/src/act1/act1state.cpp @@ -2,6 +2,19 @@ // STUB: LEGO1 0x100334b0 Act1State::Act1State() +{ + // TODO + m_unk0x1e = 0; + m_unk0x18 = 1; + m_unk0x20 = 0; + m_unk0x1f = 0; + m_unk0x21 = TRUE; + m_unk0x22 = 0; + m_unk0x1c = 1; +} + +// STUB: LEGO1 0x10034d00 +void Act1State::FUN_10034d00() { // TODO } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index a081248c..4bf4ab82 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1,9 +1,13 @@ #include "legogamestate.h" #include "infocenterstate.h" +#include "legoanimationmanager.h" #include "legoomni.h" #include "legostate.h" #include "legostream.h" +#include "legoutil.h" +#include "legovideomanager.h" +#include "mxbackgroundaudiomanager.h" #include "mxobjectfactory.h" #include "mxstring.h" #include "mxvariabletable.h" @@ -186,9 +190,30 @@ void LegoGameState::FUN_1003a720(MxU32) } // STUB: LEGO1 0x1003b060 -void LegoGameState::HandleAction(MxU32) +void LegoGameState::HandleAction(MxU32 p_area) { - // TODO + m_prevArea = p_area; + BackgroundAudioManager()->Stop(); + AnimationManager()->FUN_1005ef10(); + VideoManager()->SetUnk0x554(0); + + MxAtomId* script = g_isleScript; + switch (p_area) { + case 1: + break; + case 2: + VideoManager()->SetUnk0x554(1); + script = g_infomainScript; + break; + case 3: + VideoManager()->SetUnk0x554(1); + script = g_infodoorScript; + break; + + // TODO: implement other cases + } + + InvokeAction(ExtraActionType_opendisk, *script, 0, NULL); } // FUNCTION: LEGO1 0x1003bac0 diff --git a/LEGO1/lego/legoomni/src/isle/isle.cpp b/LEGO1/lego/legoomni/src/isle/isle.cpp index d10e18ad..4fba4bb5 100644 --- a/LEGO1/lego/legoomni/src/isle/isle.cpp +++ b/LEGO1/lego/legoomni/src/isle/isle.cpp @@ -152,10 +152,22 @@ MxLong Isle::StopAction(MxParam& p_param) return 0; } -// STUB: LEGO1 0x10030fc0 +// FUNCTION: LEGO1 0x10030fc0 void Isle::VTable0x50() { - // TODO + LegoWorld::VTable0x50(); + + if (m_act1state->GetUnknown21()) { + GameState()->HandleAction(2); + m_act1state->SetUnknown18(0); + m_act1state->SetUnknown21(0); + } + else if (GameState()->GetCurrentAct()) { + FUN_1003ef00(TRUE); + FUN_10032620(); + m_act1state->FUN_10034d00(); + FUN_10015820(0, 7); + } } // STUB: LGEO1 0x10031030 @@ -176,6 +188,12 @@ void Isle::VTable0x68(MxBool p_add) // TODO } +// STUB: LEGO1 0x10032620 +void Isle::FUN_10032620() +{ + // TODO +} + // STUB: LEGO1 0x100327a0 MxLong Isle::HandleTransitionEnd() { diff --git a/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp index 578cf55d..476c6291 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimationmanager.cpp @@ -21,6 +21,11 @@ LegoAnimationManager::~LegoAnimationManager() // TODO } +// STUB: LEGO1 0x1005ef10 +void LegoAnimationManager::FUN_1005ef10() +{ +} + // STUB: LEGO1 0x1005f130 void LegoAnimationManager::Init() {