isle-portable/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp

126 lines
3.1 KiB
C++
Raw Normal View History

#include "jukeboxentity.h"
#include "isle.h"
#include "islepathactor.h"
#include "jukeboxstate.h"
#include "legogamestate.h"
#include "legoutil.h"
#include "mxbackgroundaudiomanager.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
// FUNCTION: LEGO1 0x10085bc0
JukeBoxEntity::JukeBoxEntity()
{
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x10085dd0
JukeBoxEntity::~JukeBoxEntity()
{
NotificationManager()->Unregister(this);
}
Enforce vtable match (#464) * vtable enforce * Vtable progress * IslePathActor subclasses * LegoState subclasses * LegoWorld subclasses * Presenter progress * Remaining presenters * All but two that need new files * Merge into vtable branch (#3) * Implement MxDisplaySurface::VTable0x44 (#467) * Update mxdisplaysurface.cpp * add arguments to header * Fix glitched bitmaps * WIP fixes * Match * Fix * Changes * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implmement PoliceState::VTable0x1c (#468) * Implmement PoliceState::VTable0x1c * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implement Lego3DView::Render (#470) * Implement Lego3DView::Render * use MxDouble * Revert "use MxDouble" This reverts commit a006b60e2066b79ded3e15e143a302d8fd707deb. * Begin work on Police class (#469) * Begin work on Police class * Use JukeBox::e_policeStation value * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implement MxDisplaySurface::CreateCursorSurface (#471) * Update mxdisplaysurface.cpp * Fixes * Update legovideomanager.cpp * Match to 100% --------- Co-authored-by: Christian Semmler <mail@csemmler.com> --------- Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com> Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com> * Police fix * Finish * motocycle lower case * Update historybook.h * Update hospitalstate.h * Update jetski.h * Update legoinputmanager.h * Update legolocomotionanimpresenter.h * Update pizza.h * Update act3shark.h * Update ambulancemissionstate.h * Update bumpbouy.h * Update doors.h --------- Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com> Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>
2024-01-20 18:04:46 -05:00
// FUNCTION: LEGO1 0x10085e40
Enforce vtable match (#464) * vtable enforce * Vtable progress * IslePathActor subclasses * LegoState subclasses * LegoWorld subclasses * Presenter progress * Remaining presenters * All but two that need new files * Merge into vtable branch (#3) * Implement MxDisplaySurface::VTable0x44 (#467) * Update mxdisplaysurface.cpp * add arguments to header * Fix glitched bitmaps * WIP fixes * Match * Fix * Changes * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implmement PoliceState::VTable0x1c (#468) * Implmement PoliceState::VTable0x1c * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implement Lego3DView::Render (#470) * Implement Lego3DView::Render * use MxDouble * Revert "use MxDouble" This reverts commit a006b60e2066b79ded3e15e143a302d8fd707deb. * Begin work on Police class (#469) * Begin work on Police class * Use JukeBox::e_policeStation value * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implement MxDisplaySurface::CreateCursorSurface (#471) * Update mxdisplaysurface.cpp * Fixes * Update legovideomanager.cpp * Match to 100% --------- Co-authored-by: Christian Semmler <mail@csemmler.com> --------- Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com> Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com> * Police fix * Finish * motocycle lower case * Update historybook.h * Update hospitalstate.h * Update jetski.h * Update legoinputmanager.h * Update legolocomotionanimpresenter.h * Update pizza.h * Update act3shark.h * Update ambulancemissionstate.h * Update bumpbouy.h * Update doors.h --------- Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com> Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>
2024-01-20 18:04:46 -05:00
MxLong JukeBoxEntity::Notify(MxParam& p_param)
{
if (((MxNotificationParam&) p_param).GetType() == c_notificationType11) {
if (!FUN_1003ef60()) {
return 1;
}
if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
CurrentVehicle()->VTable0xe4();
}
((Isle*) FindWorld(*g_isleScript, 0))->SetUnknown13c(0x35);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
return 1;
}
Enforce vtable match (#464) * vtable enforce * Vtable progress * IslePathActor subclasses * LegoState subclasses * LegoWorld subclasses * Presenter progress * Remaining presenters * All but two that need new files * Merge into vtable branch (#3) * Implement MxDisplaySurface::VTable0x44 (#467) * Update mxdisplaysurface.cpp * add arguments to header * Fix glitched bitmaps * WIP fixes * Match * Fix * Changes * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implmement PoliceState::VTable0x1c (#468) * Implmement PoliceState::VTable0x1c * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implement Lego3DView::Render (#470) * Implement Lego3DView::Render * use MxDouble * Revert "use MxDouble" This reverts commit a006b60e2066b79ded3e15e143a302d8fd707deb. * Begin work on Police class (#469) * Begin work on Police class * Use JukeBox::e_policeStation value * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com> * Implement MxDisplaySurface::CreateCursorSurface (#471) * Update mxdisplaysurface.cpp * Fixes * Update legovideomanager.cpp * Match to 100% --------- Co-authored-by: Christian Semmler <mail@csemmler.com> --------- Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com> Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com> * Police fix * Finish * motocycle lower case * Update historybook.h * Update hospitalstate.h * Update jetski.h * Update legoinputmanager.h * Update legolocomotionanimpresenter.h * Update pizza.h * Update act3shark.h * Update ambulancemissionstate.h * Update bumpbouy.h * Update doors.h --------- Co-authored-by: Misha <106913236+MishaProductions@users.noreply.github.com> Co-authored-by: Christian Semmler <mail@csemmler.com> Co-authored-by: Joshua Peisach <itzswirlz2020@outlook.com>
2024-01-20 18:04:46 -05:00
return 0;
}
// FUNCTION: LEGO1 0x10085ed0
void JukeBoxEntity::StartAction()
{
MxDSAction action;
BackgroundAudioManager()->Stop();
JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
state->SetActive(TRUE);
switch (state->GetState()) {
case 0:
InvokeAction(Extra::e_start, *g_isleScript, 0x319, NULL);
GameState()->SetUnknown0x41c(0x37);
break;
case 1:
InvokeAction(Extra::e_start, *g_isleScript, 0x31e, NULL);
GameState()->SetUnknown0x41c(0x38);
break;
case 2:
InvokeAction(Extra::e_start, *g_isleScript, 0x31b, NULL);
GameState()->SetUnknown0x41c(0x39);
break;
case 3:
InvokeAction(Extra::e_start, *g_isleScript, 0x31a, NULL);
GameState()->SetUnknown0x41c(0x3a);
break;
case 4:
InvokeAction(Extra::e_start, *g_isleScript, 0x31f, NULL);
GameState()->SetUnknown0x41c(0x3b);
break;
case 5:
InvokeAction(Extra::e_start, *g_isleScript, 0x31c, NULL);
GameState()->SetUnknown0x41c(0x3c);
break;
}
action.SetAtomId(*g_jukeboxScript);
action.SetObjectId(GameState()->GetUnknown0x41c());
m_audioEnabled = BackgroundAudioManager()->GetEnabled();
if (!m_audioEnabled) {
BackgroundAudioManager()->Enable(TRUE);
}
BackgroundAudioManager()->PlayMusic(action, 5, 4);
}
// FUNCTION: LEGO1 0x100860f0
void JukeBoxEntity::StopAction(MxU32 p_state)
{
JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
if (state && state->IsActive()) {
switch (p_state) {
case 0x37:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x319, NULL);
break;
case 0x38:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31e, NULL);
break;
case 0x39:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31b, NULL);
break;
case 0x3a:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31a, NULL);
break;
case 0x3b:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31f, NULL);
break;
case 0x3c:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31c, NULL);
break;
}
BackgroundAudioManager()->Enable(IsBackgroundAudioEnabled());
}
}