2023-06-29 04:10:08 -04:00
|
|
|
#include "infocenterdoor.h"
|
|
|
|
|
2024-01-31 09:47:15 -05:00
|
|
|
#include "infocenterstate.h"
|
2024-03-18 11:05:05 -04:00
|
|
|
#include "infodoor_actions.h"
|
2024-01-20 12:41:22 -05:00
|
|
|
#include "jukebox.h"
|
2024-03-17 13:01:47 -04:00
|
|
|
#include "jukebox_actions.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"
|
2024-05-04 08:06:32 -04:00
|
|
|
#include "legomain.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "misc.h"
|
2024-01-31 09:47:15 -05:00
|
|
|
#include "mxactionnotificationparam.h"
|
|
|
|
#include "mxbackgroundaudiomanager.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxmisc.h"
|
2024-01-20 09:24:54 -05:00
|
|
|
#include "mxnotificationmanager.h"
|
2024-01-31 09:47:15 -05:00
|
|
|
#include "mxtransitionmanager.h"
|
2024-05-04 08:06:32 -04:00
|
|
|
#include "scripts.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-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_undefined;
|
2024-01-20 09:24:54 -05:00
|
|
|
|
|
|
|
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-02-10 13:17:07 -05:00
|
|
|
GameState()->SetCurrentArea(LegoGameState::e_infodoor);
|
|
|
|
GameState()->StopArea(LegoGameState::e_previousArea);
|
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:
|
2024-03-13 13:17:20 -04:00
|
|
|
GameState()->SwitchArea(m_destLocation);
|
2024-01-31 09:47:15 -05:00
|
|
|
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-03-10 12:08:21 -04:00
|
|
|
PlayMusic(JukeboxScript::c_InformationCenter_Music);
|
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()) {
|
2024-03-18 11:05:05 -04:00
|
|
|
case InfodoorScript::c_LeftArrow_Ctl:
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_infoscor;
|
2024-03-11 04:57:58 -04:00
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
2024-01-31 09:47:15 -05:00
|
|
|
result = 1;
|
|
|
|
break;
|
2024-03-18 11:05:05 -04:00
|
|
|
case InfodoorScript::c_RightArrow_Ctl:
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_elevbott;
|
2024-03-11 04:57:58 -04:00
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
2024-01-31 09:47:15 -05:00
|
|
|
result = 1;
|
|
|
|
break;
|
2024-03-18 11:05:05 -04:00
|
|
|
case InfodoorScript::c_Info_Ctl:
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_infomain;
|
2024-03-11 04:57:58 -04:00
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
2024-01-31 09:47:15 -05:00
|
|
|
result = 1;
|
|
|
|
break;
|
2024-03-18 11:05:05 -04:00
|
|
|
case InfodoorScript::c_Door_Ctl:
|
2024-02-26 11:19:16 -05:00
|
|
|
if (GameState()->GetActorId()) {
|
2024-01-31 09:47:15 -05:00
|
|
|
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
|
2024-02-11 10:44:55 -05:00
|
|
|
if (state->HasRegistered()) {
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_unk4;
|
2024-01-31 09:47:15 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
MxDSAction action;
|
|
|
|
action.SetObjectId(503);
|
|
|
|
action.SetAtomId(*g_infodoorScript);
|
|
|
|
BackgroundAudioManager()->LowerVolume();
|
|
|
|
Start(&action);
|
2024-02-02 16:32:50 -05:00
|
|
|
goto done;
|
2024-01-31 09:47:15 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MxDSAction action;
|
|
|
|
action.SetObjectId(500);
|
|
|
|
action.SetAtomId(*g_infodoorScript);
|
|
|
|
BackgroundAudioManager()->LowerVolume();
|
|
|
|
Start(&action);
|
2024-02-02 16:32:50 -05:00
|
|
|
goto done;
|
2024-01-31 09:47:15 -05:00
|
|
|
}
|
|
|
|
|
2024-03-11 04:57:58 -04:00
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
|
2024-02-02 16:32:50 -05:00
|
|
|
|
|
|
|
done:
|
2024-01-31 09:47:15 -05:00
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2024-01-18 20:24:15 -05:00
|
|
|
// FUNCTION: LEGO1 0x10037c80
|
2024-02-02 12:18:46 -05:00
|
|
|
void InfocenterDoor::Enable(MxBool p_enable)
|
2024-01-18 20:24:15 -05:00
|
|
|
{
|
2024-02-02 12:18:46 -05:00
|
|
|
LegoWorld::Enable(p_enable);
|
2024-01-18 20:24:15 -05:00
|
|
|
|
2024-02-02 12:18:46 -05:00
|
|
|
if (p_enable) {
|
2024-01-18 20:24:15 -05:00
|
|
|
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);
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_infomain;
|
2024-01-18 20:24:15 -05:00
|
|
|
return TRUE;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|