diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index ed424efd..1f02d28f 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -40,6 +40,8 @@ class ElevatorBottom : public LegoWorld { private: undefined4 m_unk0xf8; // 0xf8 + + MxLong HandleNotification17(MxParam& p_param); }; #endif // ELEVATORBOTTOM_H diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 4d8ed408..7de6ec45 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -170,10 +170,10 @@ class Infocenter : public LegoWorld { InfocenterUnkDataEntry m_entries[7]; // 0x120 MxS16 m_unk0x1c8; // 0x1c8 undefined4 m_unk0x1cc; // 0x1cc - MxU16 m_unk0x1d0; // 0x1d0 - MxU16 m_unk0x1d2; // 0x1d2 + MxS16 m_infoManDialogueTimer; // 0x1d0 + MxS16 m_bookAnimationTimer; // 0x1d2 MxU16 m_unk0x1d4; // 0x1d4 - MxU16 m_unk0x1d6; // 0x1d6 + MxS16 m_unk0x1d6; // 0x1d6 }; #endif // INFOCENTER_H diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index effb22cf..1890f0b1 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -36,6 +36,9 @@ class InfocenterDoor : public LegoWorld { // SYNTHETIC: LEGO1 0x100378d0 // InfocenterDoor::`scalar deleting destructor' + +private: + MxS32 m_unk0xf8; // 0xf8 }; #endif // INFOCENTERDOOR_H diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index df003f06..385ee92b 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -28,7 +28,7 @@ class LegoControlManager : public MxCore { void FUN_10028df0(MxPresenterList* p_presenterList); void Register(MxCore* p_listener); void Unregister(MxCore* p_listener); - void FUN_100293c0(undefined4, const MxAtomId&, undefined2); + void FUN_100293c0(undefined4, const char*, undefined2); // SYNTHETIC: LEGO1 0x10028d40 // LegoControlManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 64c19cd5..481bd9c5 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -31,7 +31,7 @@ void LegoControlManager::Unregister(MxCore* p_listener) } // STUB: LEGO1 0x100293c0 -void LegoControlManager::FUN_100293c0(undefined4, const MxAtomId&, undefined2) +void LegoControlManager::FUN_100293c0(undefined4, const char*, undefined2) { } diff --git a/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp index ad199882..c3d6a7a2 100644 --- a/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/elevatorbottom.cpp @@ -1,7 +1,5 @@ #include "elevatorbottom.h" -DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc) - #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" @@ -9,6 +7,8 @@ DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc) #include "mxnotificationmanager.h" #include "mxomni.h" +DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc) + // FUNCTION: LEGO1 0x10017e90 ElevatorBottom::ElevatorBottom() { @@ -43,11 +43,24 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction) return result; } -// STUB: LEGO1 0x10018150 +// FUNCTION: LEGO1 0x10018150 MxLong ElevatorBottom::Notify(MxParam& p_param) { - // TODO - return LegoWorld::Notify(p_param); + MxLong ret = 0; + LegoWorld::Notify(p_param); + + if (m_worldStarted) { + switch (((MxNotificationParam&) p_param).GetType()) { + case c_notificationType17: + ret = HandleNotification17(p_param); + break; + case c_notificationTransitioned: + GameState()->HandleAction(m_unk0xf8); + break; + } + } + + return ret; } // FUNCTION: LEGO1 0x100181b0 @@ -58,6 +71,12 @@ void ElevatorBottom::VTable0x50() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } +// STUB: LEGO1 0x100181d0 +MxLong ElevatorBottom::HandleNotification17(MxParam& p_param) +{ + return 0; +} + // FUNCTION: LEGO1 0x100182c0 void ElevatorBottom::VTable0x68(MxBool p_add) { diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 68090a69..5ffa3676 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -35,14 +35,14 @@ Infocenter::Infocenter() m_currentInfomainScript = c_noInfomain; m_currentCutscene = e_noIntro; - memset(&m_entries, 0, sizeof(InfocenterUnkDataEntry) * 7); + memset(&m_entries, 0, sizeof(m_entries)); m_unk0x1c8 = -1; SetAppCursor(1); NotificationManager()->Register(this); - m_unk0x1d0 = 0; - m_unk0x1d2 = 0; + m_infoManDialogueTimer = 0; + m_bookAnimationTimer = 0; m_unk0x1d4 = 0; m_unk0x1d6 = 0; } @@ -130,7 +130,7 @@ MxLong Infocenter::Notify(MxParam& p_param) break; case c_notificationTransitioned: StopBookAnimation(); - m_unk0x1d2 = 0; + m_bookAnimationTimer = 0; if (m_infocenterState->GetUnknown0x74() == 0xc) { StartCredits(); @@ -198,7 +198,7 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param) return result; if (action->GetObjectId() == c_returnBackGuidanceDialogue2) { - ControlManager()->FUN_100293c0(0x10, action->GetAtomId(), 0); + ControlManager()->FUN_100293c0(0x10, action->GetAtomId().GetInternal(), 0); m_unk0x1d6 = 0; } @@ -232,7 +232,7 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param) m_currentCutscene = e_noIntro; if (m_infocenterState->GetInfocenterBufferElement(0) == 0) { - m_unk0x1d2 = 1; + m_bookAnimationTimer = 1; return 1; } break; @@ -278,7 +278,7 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param) if (m_infocenterState->GetInfocenterBufferElement(0) == 0 && m_currentInfomainScript != 40 && m_currentInfomainScript != 41 && m_currentInfomainScript != 42 && m_currentInfomainScript != 43 && m_currentInfomainScript != 44) { - m_unk0x1d0 = 1; + m_infoManDialogueTimer = 1; PlayMusic(11); } @@ -299,8 +299,8 @@ MxLong Infocenter::HandleEndAction(MxParam& p_param) // STUB: LEGO1 0x1006f4e0 void Infocenter::VTable0x50() { - m_unk0x1d0 = 0; - m_unk0x1d2 = 0; + m_infoManDialogueTimer = 0; + m_bookAnimationTimer = 0; m_unk0x1d4 = 0; m_unk0x1d6 = 0; @@ -319,7 +319,7 @@ void Infocenter::VTable0x50() case 4: m_infocenterState->SetUnknown0x74(2); if (m_infocenterState->GetInfocenterBufferElement(0) == 0) { - m_unk0x1d2 = 1; + m_bookAnimationTimer = 1; } PlayAction(c_letsGetStartedDialogue); @@ -337,7 +337,7 @@ void Infocenter::VTable0x50() return; case 0xf: if (m_infocenterState->GetInfocenterBufferElement(0) == 0) { - m_unk0x1d2 = 1; + m_bookAnimationTimer = 1; } PlayAction(c_clickOnInfomanDialogue); @@ -383,7 +383,7 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key) m_infocenterState->SetUnknown0x74(1); if (m_infocenterState->GetInfocenterBufferElement(0) == 0) { - m_unk0x1d2 = 1; + m_bookAnimationTimer = 1; return 1; } break; @@ -452,11 +452,43 @@ void Infocenter::VTable0x68(MxBool p_add) } } -// STUB: LEGO1 0x10070af0 +// FUNCTION: LEGO1 0x10070af0 MxResult Infocenter::Tickle() { - // TODO - return LegoWorld::Tickle(); + if (m_worldStarted == FALSE) { + LegoWorld::Tickle(); + return SUCCESS; + } + + if (m_infoManDialogueTimer != 0 && (m_infoManDialogueTimer += 100) > 25000) { + PlayAction(c_clickOnInfomanDialogue); + m_infoManDialogueTimer = 0; + } + + if (m_bookAnimationTimer != 0 && (m_bookAnimationTimer += 100) > 3000) { + PlayBookAnimation(); + m_bookAnimationTimer = 1; + } + + if (m_unk0x1d6 != 0) { + m_unk0x1d6 += 100; + + if (m_unk0x1d6 > 3400 && m_unk0x1d6 < 3650) { + ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 1); + } + else if (m_unk0x1d6 > 3650 && m_unk0x1d6 < 3900) { + ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 0); + } + else if (m_unk0x1d6 > 3900 && m_unk0x1d6 < 4150) { + ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 1); + } + else if (m_unk0x1d6 > 4400) { + ControlManager()->FUN_100293c0(0x10, m_atom.GetInternal(), 0); + m_unk0x1d6 = 0; + } + } + + return SUCCESS; } // FUNCTION: LEGO1 0x10070c20 diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp index 4c50a321..7ba892b4 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp @@ -1,24 +1,47 @@ #include "infocenterdoor.h" +#include "legocontrolmanager.h" +#include "legogamestate.h" #include "legoinputmanager.h" #include "legoomni.h" +#include "mxnotificationmanager.h" -// STUB: LEGO1 0x10037730 +DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc) + +// FUNCTION: LEGO1 0x10037730 InfocenterDoor::InfocenterDoor() { - // TODO + m_unk0xf8 = 0; + + NotificationManager()->Register(this); } -// STUB: LEGO1 0x100378f0 +// FUNCTION: LEGO1 0x100378f0 InfocenterDoor::~InfocenterDoor() { - // TODO + if (InputManager()->GetWorld() == this) { + InputManager()->ClearWorld(); + } + + ControlManager()->Unregister(this); + NotificationManager()->Unregister(this); } -// STUB: LEGO1 0x10037980 +// FUNCTION: LEGO1 0x10037980 MxResult InfocenterDoor::Create(MxDSAction& p_dsAction) { - return SUCCESS; + MxResult result = LegoWorld::Create(p_dsAction); + if (result == SUCCESS) { + InputManager()->SetWorld(this); + ControlManager()->Register(this); + } + + SetIsWorldActive(FALSE); + + GameState()->SetUnknown424(3); + GameState()->FUN_1003a720(0); + + return result; } // STUB: LEGO1 0x100379e0 @@ -52,8 +75,10 @@ void InfocenterDoor::VTable0x68(MxBool p_add) } } -// STUB: LEGO1 0x10037cd0 +// FUNCTION: LEGO1 0x10037cd0 MxBool InfocenterDoor::VTable0x64() { + DeleteObjects(&m_atom, 500, 510); + m_unk0xf8 = 2; return TRUE; } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp index 96e47c55..76ffd3ea 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp @@ -2,15 +2,22 @@ DECOMP_SIZE_ASSERT(InfocenterState, 0x94); -// STUB: LEGO1 0x10071600 +// FUNCTION: LEGO1 0x10071600 InfocenterState::InfocenterState() { // TODO memset(m_buffer, 0, sizeof(m_buffer)); } -// STUB: LEGO1 0x10071920 +// FUNCTION: LEGO1 0x10071920 InfocenterState::~InfocenterState() { - // TODO + MxS16 i = 0; + do { + if (GetInfocenterBufferElement(i) != NULL) { + delete GetInfocenterBufferElement(i)->GetAction(); + delete GetInfocenterBufferElement(i); + } + i++; + } while (i < GetInfocenterBufferSize()); }