From 763fcf89808237a7dca56ba7c588a5a4348c3c01 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Sun, 14 Jan 2024 16:58:00 -0500 Subject: [PATCH] ElevatorBottom ctor/dtor (#436) * ElevatorBottom ctor * ElevatorBottom destructor * Use setters --------- Co-authored-by: Christian Semmler --- ISLE/isleapp.cpp | 4 ++-- LEGO1/lego/legoomni/include/elevatorbottom.h | 5 +++++ .../lego/legoomni/include/legoinputmanager.h | 4 +++- .../src/infocenter/elevatorbottom.cpp | 21 +++++++++++++++---- .../src/video/mxtransitionmanager.cpp | 4 ++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index d6f9c293..4aeb633e 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -614,8 +614,8 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine) LegoAnimationManager::configureLegoAnimationManager(m_islandQuality); if (LegoOmni::GetInstance()) { if (LegoOmni::GetInstance()->GetInputManager()) { - LegoOmni::GetInstance()->GetInputManager()->m_useJoystick = m_useJoystick; - LegoOmni::GetInstance()->GetInputManager()->m_joystickIndex = m_joystickIndex; + LegoOmni::GetInstance()->GetInputManager()->SetUseJoystick(m_useJoystick); + LegoOmni::GetInstance()->GetInputManager()->SetJoystickIndex(m_joystickIndex); } } if (m_fullScreen) { diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index 64b3f221..e10b7727 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -1,9 +1,11 @@ #ifndef ELEVATORBOTTOM_H #define ELEVATORBOTTOM_H +#include "decomp.h" #include "legoworld.h" // VTABLE: LEGO1 0x100d5f20 +// SIZE: 0xfc (from inlined ctor at 0x1000a8aa) class ElevatorBottom : public LegoWorld { public: ElevatorBottom(); @@ -23,6 +25,9 @@ class ElevatorBottom : public LegoWorld { { return !strcmp(p_name, ElevatorBottom::ClassName()) || LegoWorld::IsA(p_name); } + +private: + undefined4 m_unk0xf8; // 0xf8 }; #endif // ELEVATORBOTTOM_H diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 59e0a949..455c2f1a 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -53,6 +53,8 @@ class LegoInputManager : public MxPresenter { inline void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; } inline void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; } + inline void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; } + inline void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; } inline LegoControlManager* GetControlManager() { return m_controlManager; } inline LegoWorld* GetWorld() { return m_world; } @@ -61,7 +63,7 @@ class LegoInputManager : public MxPresenter { void ProcessEvents(); MxBool ProcessOneEvent(LegoEventNotificationParam& p_param); - // private: +private: MxCriticalSection m_criticalSection; MxList* m_unk0x5c; // list or hash table LegoCameraController* m_camera; diff --git a/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp index 247defb0..1dbb8a67 100644 --- a/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp @@ -1,15 +1,28 @@ #include "elevatorbottom.h" -// STUB: LEGO1 0x10017e90 +DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc) + +#include "legocontrolmanager.h" +#include "legoinputmanager.h" +#include "legoomni.h" +#include "mxnotificationmanager.h" +#include "mxomni.h" + +// FUNCTION: LEGO1 0x10017e90 ElevatorBottom::ElevatorBottom() { - // TODO + NotificationManager()->Register(this); + this->m_unk0xf8 = 0; } -// STUB: LEGO1 0x10018060 +// FUNCTION: LEGO1 0x10018060 ElevatorBottom::~ElevatorBottom() { - // TODO + if (InputManager()->GetWorld() == this) { + InputManager()->ClearWorld(); + } + ControlManager()->Unregister(this); + NotificationManager()->Unregister(this); } // STUB: LEGO1 0x10018150 diff --git a/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp index 3cb088ca..cfbe925d 100644 --- a/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/video/mxtransitionmanager.cpp @@ -114,8 +114,8 @@ MxResult MxTransitionManager::StartTransition( tickleManager->RegisterClient(this, p_speed); LegoInputManager* inputManager = InputManager(); - inputManager->m_unk0x88 = TRUE; - inputManager->m_unk0x336 = FALSE; + inputManager->SetUnknown88(TRUE); + inputManager->SetUnknown336(FALSE); LegoVideoManager* videoManager = VideoManager(); videoManager->SetRender3D(FALSE);