diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 94728ee2..505ef646 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -2,6 +2,8 @@ #define JUKEBOX_H #include "decomp.h" +#include "jukeboxstate.h" +#include "legogamestate.h" #include "legoworld.h" // VTABLE: LEGO1 0x100d8958 @@ -109,9 +111,9 @@ class JukeBox : public LegoWorld { }; private: - undefined m_unk0xf8[4]; // 0xf8 - undefined4 m_unk0xfc; // 0xfc - undefined2 m_unk0x100; // 0x100 + LegoGameState::Area m_transitionDestination; // 0xf8 + JukeBoxState* m_jukeBoxState; // 0xfc + undefined2 m_unk0x100; // 0x100 }; #endif // JUKEBOX_H diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h index a12c97e5..18a4aa62 100644 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ b/LEGO1/lego/legoomni/include/jukeboxstate.h @@ -25,6 +25,7 @@ class JukeBoxState : public LegoState { inline MxU32 IsActive() { return m_active; } inline void SetActive(MxU32 p_active) { m_active = p_active; } inline MxU32 GetState() { return m_state; } + inline void SetState(MxU32 p_state) { m_state = p_state; } // SYNTHETIC: LEGO1 0x1000f3d0 // JukeBoxState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/isle/jukebox.cpp b/LEGO1/lego/legoomni/src/isle/jukebox.cpp index 73b03ab0..fa12f01c 100644 --- a/LEGO1/lego/legoomni/src/isle/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/isle/jukebox.cpp @@ -1,7 +1,15 @@ #include "jukebox.h" +#include "jukeboxstate.h" +#include "legocontrolmanager.h" +#include "legogamestate.h" +#include "legoinputmanager.h" +#include "legoomni.h" #include "mxnotificationmanager.h" #include "mxomni.h" +#include "mxstillpresenter.h" +#include "mxticklemanager.h" +#include "mxvideopresenter.h" DECOMP_SIZE_ASSERT(JukeBox, 0x104) @@ -9,7 +17,7 @@ DECOMP_SIZE_ASSERT(JukeBox, 0x104) JukeBox::JukeBox() { m_unk0x100 = 0; - m_unk0xfc = 0; + m_jukeBoxState = NULL; NotificationManager()->Register(this); } @@ -19,11 +27,29 @@ MxBool JukeBox::VTable0x5c() return TRUE; } -// STUB: LEGO1 0x1005d8d0 +// FUNCTION: LEGO1 0x1005d8d0 MxResult JukeBox::Create(MxDSAction& p_dsAction) { - // TODO - return SUCCESS; + MxResult ret = LegoWorld::Create(p_dsAction); + if (ret == SUCCESS) { + InputManager()->SetWorld(this); + ControlManager()->Register(this); + } + + InputManager()->SetCamera(NULL); + + LegoGameState* gameState = GameState(); + JukeBoxState* jukeBoxState = (JukeBoxState*) gameState->GetState("JukeBoxState"); + if (!jukeBoxState) { + jukeBoxState = (JukeBoxState*) gameState->CreateState("JukeBoxState"); + jukeBoxState->SetState(0); + } + + m_jukeBoxState = jukeBoxState; + GameState()->SetCurrentArea(LegoGameState::e_jukeboxw); + GameState()->StopArea(LegoGameState::e_previousArea); + TickleManager()->RegisterClient(this, 2000); + return ret; } // STUB: LEGO1 0x1005d980 @@ -33,28 +59,74 @@ MxLong JukeBox::Notify(MxParam& p_param) return 0; } -// STUB: LEGO1 0x1005d9f0 +// FUNCTION: LEGO1 0x1005d9f0 void JukeBox::ReadyWorld() { - // TODO + MxStillPresenter* bg; + char* objectName; + + switch (m_jukeBoxState->GetState()) { + case 1: + objectName = "Right_Bitmap"; + break; + case 2: + objectName = "Decal_Bitmap"; + break; + case 3: + objectName = "Wallis_Bitmap"; + break; + case 4: + objectName = "Nelson_Bitmap"; + break; + case 5: + objectName = "Torpedos_Bitmap"; + break; + default: + goto done; + } + bg = (MxStillPresenter*) Find("MxStillPresenter", objectName); +done: + if (bg) { + bg->Enable(TRUE); + } + m_unk0x100 = 1; } -// STUB: LEGO1 0x1005dde0 +// FUNCTION: LEGO1 0x1005dde0 void JukeBox::Enable(MxBool p_enable) { - // TODO + LegoWorld::Enable(p_enable); + + if (p_enable) { + InputManager()->SetWorld(this); + InputManager()->SetCamera(NULL); + } + else { + if (InputManager()->GetWorld() == this) { + InputManager()->ClearWorld(); + } + } } -// STUB: LEGO1 0x1005de30 +// FUNCTION: LEGO1 0x1005de30 MxResult JukeBox::Tickle() { - // TODO + if (m_worldStarted == FALSE) { + LegoWorld::Tickle(); + return SUCCESS; + } + + if (m_unk0x100 == 1) { + m_unk0x100 = 0; + FUN_10015820(FALSE, 7); + } + return SUCCESS; } -// STUB: LEGO1 0x1005de70 +// FUNCTION: LEGO1 0x1005de70 MxBool JukeBox::VTable0x64() { - // TODO - return FALSE; + m_transitionDestination = LegoGameState::e_infomain; + return TRUE; }