2023-06-29 04:10:08 -04:00
|
|
|
#include "jukebox.h"
|
|
|
|
|
2024-06-03 12:53:25 -04:00
|
|
|
#include "isle.h"
|
2024-03-17 13:01:47 -04:00
|
|
|
#include "jukebox_actions.h"
|
|
|
|
#include "jukeboxw_actions.h"
|
2024-02-26 10:12:14 -05:00
|
|
|
#include "legocontrolmanager.h"
|
|
|
|
#include "legogamestate.h"
|
|
|
|
#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"
|
|
|
|
#include "mxmisc.h"
|
2023-12-24 09:16:07 -05:00
|
|
|
#include "mxnotificationmanager.h"
|
2024-02-26 10:12:14 -05:00
|
|
|
#include "mxstillpresenter.h"
|
|
|
|
#include "mxticklemanager.h"
|
|
|
|
#include "mxtransitionmanager.h"
|
|
|
|
#include "mxvideopresenter.h"
|
2023-12-24 09:16:07 -05:00
|
|
|
|
|
|
|
DECOMP_SIZE_ASSERT(JukeBox, 0x104)
|
2024-06-03 12:53:25 -04:00
|
|
|
DECOMP_SIZE_ASSERT(JukeBoxState, 0x10)
|
2023-12-24 09:16:07 -05:00
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x1005d660
|
2023-06-29 04:10:08 -04:00
|
|
|
JukeBox::JukeBox()
|
|
|
|
{
|
2023-12-24 09:16:07 -05:00
|
|
|
m_unk0x100 = 0;
|
2024-02-26 10:12:14 -05:00
|
|
|
m_state = NULL;
|
2023-12-24 09:16:07 -05:00
|
|
|
NotificationManager()->Register(this);
|
2023-10-25 14:51:59 -04:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
2024-02-07 06:13:20 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005d6e0
|
2024-01-20 18:04:46 -05:00
|
|
|
MxBool JukeBox::VTable0x5c()
|
|
|
|
{
|
2024-02-07 06:13:20 -05:00
|
|
|
return TRUE;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-26 10:12:14 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005d830
|
|
|
|
JukeBox::~JukeBox()
|
|
|
|
{
|
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
|
|
|
|
ControlManager()->Unregister(this);
|
|
|
|
TickleManager()->UnregisterClient(this);
|
|
|
|
NotificationManager()->Unregister(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x1005d8d0
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult JukeBox::Create(MxDSAction& p_dsAction)
|
|
|
|
{
|
2024-02-26 10:12:14 -05:00
|
|
|
MxResult ret = LegoWorld::Create(p_dsAction);
|
|
|
|
if (ret == SUCCESS) {
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
ControlManager()->Register(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
InputManager()->SetCamera(NULL);
|
|
|
|
|
|
|
|
m_state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
|
|
|
|
if (!m_state) {
|
|
|
|
m_state = (JukeBoxState*) GameState()->CreateState("JukeBoxState");
|
2024-06-03 07:00:38 -04:00
|
|
|
m_state->m_music = JukeBoxState::e_pasquell;
|
2024-02-26 10:12:14 -05:00
|
|
|
}
|
|
|
|
|
2024-11-01 12:21:15 -04:00
|
|
|
GameState()->m_currentArea = LegoGameState::e_jukeboxw;
|
2024-02-26 10:12:14 -05:00
|
|
|
GameState()->StopArea(LegoGameState::e_previousArea);
|
|
|
|
TickleManager()->RegisterClient(this, 2000);
|
|
|
|
return ret;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-26 10:12:14 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005d980
|
2024-01-20 18:04:46 -05:00
|
|
|
MxLong JukeBox::Notify(MxParam& p_param)
|
|
|
|
{
|
2024-02-26 10:12:14 -05:00
|
|
|
MxLong result = 0;
|
|
|
|
LegoWorld::Notify(p_param);
|
|
|
|
|
|
|
|
if (m_worldStarted) {
|
|
|
|
switch (((MxNotificationParam&) p_param).GetNotification()) {
|
2024-05-30 09:54:24 -04:00
|
|
|
case c_notificationControl:
|
2024-06-16 10:47:53 -04:00
|
|
|
result = HandleControl((LegoControlManagerNotificationParam&) p_param);
|
2024-02-26 10:12:14 -05:00
|
|
|
break;
|
|
|
|
case c_notificationTransitioned:
|
2024-03-13 13:17:20 -04:00
|
|
|
GameState()->SwitchArea(m_destLocation);
|
2024-02-26 10:12:14 -05:00
|
|
|
result = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-26 10:12:14 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005d9f0
|
2024-06-03 07:00:38 -04:00
|
|
|
// FUNCTION: BETA10 0x10037e39
|
2024-01-27 15:18:35 -05:00
|
|
|
void JukeBox::ReadyWorld()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-02-26 10:12:14 -05:00
|
|
|
MxStillPresenter* presenter = NULL;
|
|
|
|
|
2024-06-03 07:00:38 -04:00
|
|
|
switch (m_state->m_music) {
|
|
|
|
case JukeBoxState::e_pasquell:
|
|
|
|
break;
|
|
|
|
case JukeBoxState::e_right:
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_decal:
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_wallis:
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_nelson:
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_torpedos:
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (presenter) {
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_unk0x100 = 1;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-26 10:12:14 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005da70
|
2024-06-03 07:00:38 -04:00
|
|
|
// FUNCTION: BETA10 0x10037f6d
|
2024-06-16 10:47:53 -04:00
|
|
|
MxBool JukeBox::HandleControl(LegoControlManagerNotificationParam& p_param)
|
2024-02-26 10:12:14 -05:00
|
|
|
{
|
|
|
|
MxStillPresenter* presenter;
|
|
|
|
|
2024-06-03 07:00:38 -04:00
|
|
|
if (p_param.m_unk0x28 == 1) {
|
|
|
|
switch (p_param.m_clickedObjectId) {
|
2024-03-10 12:08:21 -04:00
|
|
|
case JukeboxwScript::c_Dback_Ctl:
|
2024-06-03 07:00:38 -04:00
|
|
|
switch (m_state->m_music) {
|
|
|
|
case JukeBoxState::e_pasquell:
|
|
|
|
m_state->m_music = JukeBoxState::e_torpedos;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_right:
|
|
|
|
m_state->m_music = JukeBoxState::e_pasquell;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_decal:
|
|
|
|
m_state->m_music = JukeBoxState::e_right;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_wallis:
|
|
|
|
m_state->m_music = JukeBoxState::e_decal;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_nelson:
|
|
|
|
m_state->m_music = JukeBoxState::e_wallis;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_torpedos:
|
|
|
|
m_state->m_music = JukeBoxState::e_nelson;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2024-03-10 12:08:21 -04:00
|
|
|
case JukeboxwScript::c_Dfwd_Ctl:
|
2024-06-03 07:00:38 -04:00
|
|
|
switch (m_state->m_music) {
|
|
|
|
case JukeBoxState::e_pasquell:
|
|
|
|
m_state->m_music = JukeBoxState::e_right;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_right:
|
|
|
|
m_state->m_music = JukeBoxState::e_decal;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_decal:
|
|
|
|
m_state->m_music = JukeBoxState::e_wallis;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_wallis:
|
|
|
|
m_state->m_music = JukeBoxState::e_nelson;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_nelson:
|
|
|
|
m_state->m_music = JukeBoxState::e_torpedos;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
|
|
|
|
presenter->Enable(TRUE);
|
|
|
|
break;
|
2024-06-03 07:00:38 -04:00
|
|
|
case JukeBoxState::e_torpedos:
|
|
|
|
m_state->m_music = JukeBoxState::e_pasquell;
|
2024-02-26 10:12:14 -05:00
|
|
|
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
|
|
|
|
presenter->Enable(FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2024-03-10 12:08:21 -04:00
|
|
|
case JukeboxwScript::c_Note_Ctl:
|
2024-06-03 07:00:38 -04:00
|
|
|
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
|
|
|
|
act1State->m_unk0x018 = 11;
|
|
|
|
m_destLocation = LegoGameState::Area::e_jukeboxExterior;
|
2024-03-11 04:57:58 -04:00
|
|
|
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, 0, FALSE);
|
2024-02-26 10:12:14 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x1005dde0
|
2024-02-02 12:18:46 -05:00
|
|
|
void JukeBox::Enable(MxBool p_enable)
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-02-26 10:12:14 -05:00
|
|
|
LegoWorld::Enable(p_enable);
|
|
|
|
|
|
|
|
if (p_enable) {
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
InputManager()->SetCamera(NULL);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-26 10:12:14 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005de30
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult JukeBox::Tickle()
|
|
|
|
{
|
2024-02-26 10:12:14 -05:00
|
|
|
if (m_worldStarted == FALSE) {
|
|
|
|
LegoWorld::Tickle();
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_unk0x100 == 1) {
|
|
|
|
m_unk0x100 = 0;
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
}
|
|
|
|
|
2024-01-20 18:04:46 -05:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-02-26 10:12:14 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005de70
|
2024-05-24 20:41:57 -04:00
|
|
|
MxBool JukeBox::Escape()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_infomain;
|
2024-02-26 10:12:14 -05:00
|
|
|
return TRUE;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|