2023-06-29 04:10:08 -04:00
|
|
|
#include "infocenterdoor.h"
|
|
|
|
|
2024-01-31 09:47:15 -05:00
|
|
|
#include "infocenterstate.h"
|
2024-01-20 12:41:22 -05:00
|
|
|
#include "jukebox.h"
|
2024-01-20 09:24:54 -05:00
|
|
|
#include "legocontrolmanager.h"
|
|
|
|
#include "legogamestate.h"
|
2024-01-18 20:24:15 -05:00
|
|
|
#include "legoinputmanager.h"
|
|
|
|
#include "legoomni.h"
|
2024-01-31 09:47:15 -05:00
|
|
|
#include "mxactionnotificationparam.h"
|
|
|
|
#include "mxbackgroundaudiomanager.h"
|
2024-01-20 09:24:54 -05:00
|
|
|
#include "mxnotificationmanager.h"
|
2024-01-31 09:47:15 -05:00
|
|
|
#include "mxtransitionmanager.h"
|
2024-01-18 20:24:15 -05:00
|
|
|
|
2024-01-20 09:24:54 -05:00
|
|
|
DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc)
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10037730
|
2023-06-29 04:10:08 -04:00
|
|
|
InfocenterDoor::InfocenterDoor()
|
|
|
|
{
|
2024-01-20 09:24:54 -05:00
|
|
|
m_unk0xf8 = 0;
|
|
|
|
|
|
|
|
NotificationManager()->Register(this);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-01-20 09:24:54 -05:00
|
|
|
// FUNCTION: LEGO1 0x100378f0
|
2023-06-29 04:10:08 -04:00
|
|
|
InfocenterDoor::~InfocenterDoor()
|
|
|
|
{
|
2024-01-20 09:24:54 -05:00
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
|
|
|
|
ControlManager()->Unregister(this);
|
|
|
|
NotificationManager()->Unregister(this);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-01-20 09:24:54 -05:00
|
|
|
// FUNCTION: LEGO1 0x10037980
|
2024-01-18 20:24:15 -05:00
|
|
|
MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
|
|
|
|
{
|
2024-01-20 09:24:54 -05:00
|
|
|
MxResult result = LegoWorld::Create(p_dsAction);
|
|
|
|
if (result == SUCCESS) {
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
ControlManager()->Register(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetIsWorldActive(FALSE);
|
|
|
|
|
2024-01-31 07:34:36 -05:00
|
|
|
GameState()->SetCurrentArea(3);
|
|
|
|
GameState()->StopArea();
|
2024-01-20 09:24:54 -05:00
|
|
|
|
|
|
|
return result;
|
2024-01-18 20:24:15 -05:00
|
|
|
}
|
|
|
|
|
2024-01-31 09:47:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x100379e0
|
2023-12-13 05:48:14 -05:00
|
|
|
MxLong InfocenterDoor::Notify(MxParam& p_param)
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2024-01-31 09:47:15 -05:00
|
|
|
MxLong result = 0;
|
|
|
|
LegoWorld::Notify(p_param);
|
|
|
|
|
|
|
|
if (m_worldStarted) {
|
|
|
|
switch (((MxNotificationParam&) p_param).GetType()) {
|
|
|
|
case c_notificationEndAction:
|
|
|
|
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atom) {
|
|
|
|
BackgroundAudioManager()->RaiseVolume();
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case c_notificationClick:
|
|
|
|
result = HandleClick((LegoControlManagerEvent&) p_param);
|
|
|
|
break;
|
|
|
|
case c_notificationTransitioned:
|
|
|
|
GameState()->SwitchArea(m_unk0xf8);
|
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2024-01-18 20:24:15 -05:00
|
|
|
}
|
2023-06-29 04:10:08 -04:00
|
|
|
|
2024-01-18 20:24:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x10037a70
|
2024-01-27 15:18:35 -05:00
|
|
|
void InfocenterDoor::ReadyWorld()
|
2024-01-18 20:24:15 -05:00
|
|
|
{
|
2024-01-27 15:18:35 -05:00
|
|
|
LegoWorld::ReadyWorld();
|
2024-01-20 12:41:22 -05:00
|
|
|
PlayMusic(JukeBox::e_informationCenter);
|
2024-01-18 20:24:15 -05:00
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
}
|
|
|
|
|
2024-01-31 09:47:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x10037a90
|
|
|
|
MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
|
|
|
|
{
|
|
|
|
MxLong result = 0;
|
|
|
|
|
|
|
|
if (p_param.GetUnknown0x28() == 1) {
|
|
|
|
DeleteObjects(&m_atom, 500, 510);
|
|
|
|
|
|
|
|
switch (p_param.GetClickedObjectId()) {
|
|
|
|
case 1:
|
|
|
|
m_unk0xf8 = 13;
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
|
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_unk0xf8 = 5;
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
|
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
m_unk0xf8 = 2;
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
|
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (GameState()->GetUnknownC()) {
|
|
|
|
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
|
|
|
|
if (state->GetInfocenterBufferElement(0) != NULL) {
|
|
|
|
m_unk0xf8 = 4;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MxDSAction action;
|
|
|
|
action.SetObjectId(503);
|
|
|
|
action.SetAtomId(*g_infodoorScript);
|
|
|
|
BackgroundAudioManager()->LowerVolume();
|
|
|
|
Start(&action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MxDSAction action;
|
|
|
|
action.SetObjectId(500);
|
|
|
|
action.SetAtomId(*g_infodoorScript);
|
|
|
|
BackgroundAudioManager()->LowerVolume();
|
|
|
|
Start(&action);
|
|
|
|
}
|
|
|
|
|
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
|
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2024-01-18 20:24:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x10037c80
|
|
|
|
void InfocenterDoor::VTable0x68(MxBool p_add)
|
|
|
|
{
|
|
|
|
LegoWorld::VTable0x68(p_add);
|
|
|
|
|
|
|
|
if (p_add) {
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
SetIsWorldActive(FALSE);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-20 09:24:54 -05:00
|
|
|
// FUNCTION: LEGO1 0x10037cd0
|
2024-01-18 20:24:15 -05:00
|
|
|
MxBool InfocenterDoor::VTable0x64()
|
|
|
|
{
|
2024-01-20 09:24:54 -05:00
|
|
|
DeleteObjects(&m_atom, 500, 510);
|
|
|
|
m_unk0xf8 = 2;
|
2024-01-18 20:24:15 -05:00
|
|
|
return TRUE;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|