Refactor JukeBox, add enum for music ()

* Refactor JukeBox, add enum for music

* add BETA annotation

* Fix BETA annotation

* Fix BETA annotation

* Fix
This commit is contained in:
Christian Semmler 2024-06-03 07:00:38 -04:00 committed by GitHub
parent 828b35e9d2
commit 73bb37596e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 102 additions and 105 deletions

View file

@ -79,6 +79,8 @@ public:
void FUN_10034b60();
void FUN_10034d00();
// TODO: Most likely getters/setters are not used according to BETA.
inline MxU32 GetUnknown18() { return m_unk0x018; }
inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; }
inline MxU8 GetUnknown21() { return m_unk0x021; }
@ -90,10 +92,6 @@ public:
// SYNTHETIC: LEGO1 0x10033960
// Act1State::`scalar deleting destructor'
friend class Isle;
friend class SkateBoard;
protected:
MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008
MxS16 m_unk0x00c; // 0x00c
undefined2 m_unk0x00e; // 0x00e

View file

@ -7,6 +7,15 @@
// SIZE 0x10
class JukeBoxState : public LegoState {
public:
enum Music {
e_pasquell = 0,
e_right,
e_decal,
e_wallis,
e_nelson,
e_torpedos
};
// FUNCTION: LEGO1 0x1000f310
inline const char* ClassName() const override // vtable+0x0c
{
@ -22,16 +31,10 @@ public:
MxBool IsSerializable() override; // vtable+0x14
inline MxU32 IsActive() { return m_active; }
inline void SetActive(MxU32 p_active) { m_active = p_active; }
inline MxU32 GetState() { return m_state; }
inline void SetState(MxU32 p_state) { m_state = p_state; }
// SYNTHETIC: LEGO1 0x1000f3d0
// JukeBoxState::`scalar deleting destructor'
// protected:
MxU32 m_state; // 0x08
Music m_music; // 0x08
MxU32 m_active; // 0x0c
};

View file

@ -18,6 +18,8 @@ public:
m_clickedAtom = NULL;
}
// TODO: Most likely getters/setters are not used according to BETA.
inline MxS32 GetClickedObjectId() const { return m_clickedObjectId; }
inline const char* GetClickedAtom() const { return m_clickedAtom; }
inline MxS16 GetUnknown0x28() const { return m_unk0x28; }
@ -26,7 +28,6 @@ public:
inline void SetClickedAtom(const char* p_clickedAtom) { m_clickedAtom = p_clickedAtom; }
inline void SetUnknown0x28(MxS16 p_unk0x28) { m_unk0x28 = p_unk0x28; }
private:
MxS32 m_clickedObjectId; // 0x20
const char* m_clickedAtom; // 0x24
MxS16 m_unk0x28; // 0x28

View file

@ -90,7 +90,7 @@ public:
e_unk51,
e_unk52,
e_jukeboxw,
e_unk54,
e_jukeboxExterior,
e_unk55,
e_histbook,
e_bike,
@ -174,7 +174,6 @@ public:
inline Act GetLoadedAct() { return m_loadedAct; }
inline Area GetCurrentArea() { return m_currentArea; }
inline Area GetPreviousArea() { return m_previousArea; }
inline JukeboxScript::Script GetUnknown0x41c() { return m_unk0x41c; }
inline Area GetUnknown0x42c() { return m_unk0x42c; }
inline History* GetHistory() { return &m_history; }
@ -182,7 +181,6 @@ public:
inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; }
inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; }
inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; }
inline void SetUnknown0x41c(JukeboxScript::Script p_unk0x41c) { m_unk0x41c = p_unk0x41c; }
inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; }
inline Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; }
inline MxS16 GetPlayerCount() { return m_playerCount; }
@ -210,24 +208,18 @@ private:
LegoFullScreenMovie* m_fullScreenMovie; // 0x20
MxU16 m_unk0x24; // 0x24
// Member visibility needs to be refactored, since most members are accessed directly.
// TODO: Most likely getters/setters are not used according to BETA for the following members:
public:
MxS16 m_playerCount; // 0x26
Username m_players[9]; // 0x28
private:
History m_history; // 0xa6
undefined2 m_unk0x41a; // 0x41a
JukeboxScript::Script m_unk0x41c; // 0x41c
MxBool m_isDirty; // 0x420
public:
Area m_currentArea; // 0x424
Area m_previousArea; // 0x428
private:
Area m_unk0x42c; // 0x42c
MxS16 m_playerCount; // 0x26
Username m_players[9]; // 0x28
History m_history; // 0xa6
undefined2 m_unk0x41a; // 0x41a
JukeboxScript::Script m_jukeboxMusic; // 0x41c
MxBool m_isDirty; // 0x420
Area m_currentArea; // 0x424
Area m_previousArea; // 0x428
Area m_unk0x42c; // 0x42c
};
MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen);

View file

@ -44,7 +44,7 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO
void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool);
void FUN_1003eda0();
MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id);
void FUN_1003ef00(MxBool p_enable);
void EnableAnimations(MxBool p_enable);
void SetAppCursor(Cursor p_cursor);
MxBool FUN_1003ef60();
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId);

View file

@ -430,7 +430,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_noneJukebox
);
g_spawnLocations[27] = SpawnLocation(
LegoGameState::e_unk54,
LegoGameState::e_jukeboxExterior,
g_isleScript,
0,
"int36",

View file

@ -55,37 +55,37 @@ void JukeBoxEntity::StartAction()
MxDSAction action;
BackgroundAudioManager()->Stop();
JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
state->SetActive(TRUE);
state->m_active = TRUE;
switch (state->GetState()) {
case 0:
switch (state->m_music) {
case JukeBoxState::e_pasquell:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic1);
GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic1;
break;
case 1:
case JukeBoxState::e_right:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic2);
GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic2;
break;
case 2:
case JukeBoxState::e_decal:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic3);
GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic3;
break;
case 3:
case JukeBoxState::e_wallis:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic4);
GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic4;
break;
case 4:
case JukeBoxState::e_nelson:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic5);
GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic5;
break;
case 5:
case JukeBoxState::e_torpedos:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic6);
GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic6;
break;
}
action.SetAtomId(*g_jukeboxScript);
action.SetObjectId(GameState()->GetUnknown0x41c());
action.SetObjectId(GameState()->m_jukeboxMusic);
m_audioEnabled = BackgroundAudioManager()->GetEnabled();
if (!m_audioEnabled) {
@ -100,30 +100,30 @@ void JukeBoxEntity::StopAction(JukeboxScript::Script p_script)
{
JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
if (state && state->IsActive()) {
if (state && state->m_active) {
switch (p_script) {
case JukeboxScript::c_JBMusic1:
state->SetActive(FALSE);
state->m_active = FALSE;
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL);
break;
case JukeboxScript::c_JBMusic2:
state->SetActive(FALSE);
state->m_active = FALSE;
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL);
break;
case JukeboxScript::c_JBMusic3:
state->SetActive(FALSE);
state->m_active = FALSE;
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL);
break;
case JukeboxScript::c_JBMusic4:
state->SetActive(FALSE);
state->m_active = FALSE;
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL);
break;
case JukeboxScript::c_JBMusic5:
state->SetActive(FALSE);
state->m_active = FALSE;
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL);
break;
case JukeboxScript::c_JBMusic6:
state->SetActive(FALSE);
state->m_active = FALSE;
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL);
break;
}

View file

@ -124,7 +124,7 @@ LegoGameState::LegoGameState()
m_actorId = 0;
m_savePath = NULL;
m_stateArray = NULL;
m_unk0x41c = JukeboxScript::c_noneJukebox;
m_jukeboxMusic = JukeboxScript::c_noneJukebox;
m_currentArea = e_undefined;
m_previousArea = e_undefined;
m_unk0x42c = e_undefined;
@ -982,7 +982,7 @@ void LegoGameState::SwitchArea(Area p_area)
VideoManager()->SetUnk0x554(TRUE);
InvokeAction(Extra::ActionType::e_opendisk, *g_jukeboxwScript, JukeboxwScript::c__StartUp, NULL);
break;
case e_unk54:
case e_jukeboxExterior:
LoadIsle();
break;
case e_histbook:

View file

@ -437,7 +437,7 @@ MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_wor
}
// FUNCTION: LEGO1 0x1003ef00
void FUN_1003ef00(MxBool p_enable)
void EnableAnimations(MxBool p_enable)
{
if (p_enable) {
AnimationManager()->Resume();

View file

@ -100,7 +100,7 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
GameState()->StopArea(LegoGameState::e_previousArea);
InputManager()->Register(this);
FUN_1003ef00(FALSE);
EnableAnimations(FALSE);
return result;
}

View file

@ -113,7 +113,7 @@ MxResult Isle::Create(MxDSAction& p_dsAction)
}
m_act1state = act1state;
FUN_1003ef00(TRUE);
EnableAnimations(TRUE);
GameState()->SetDirty(TRUE);
}
@ -270,7 +270,7 @@ void Isle::ReadyWorld()
m_act1state->SetUnknown21(0);
}
else if (GameState()->GetLoadedAct() != LegoGameState::e_act1) {
FUN_1003ef00(TRUE);
EnableAnimations(TRUE);
FUN_10032620();
m_act1state->FUN_10034d00();
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
@ -548,7 +548,7 @@ void Isle::Enable(MxBool p_enable)
GameState()->StopArea(LegoGameState::e_previousArea);
GameState()->m_previousArea = GameState()->m_currentArea;
FUN_1003ef00(TRUE);
EnableAnimations(TRUE);
if (m_act1state->m_unk0x018 == 0) {
MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
@ -748,7 +748,7 @@ void Isle::Enable(MxBool p_enable)
}
m_act1state->m_unk0x018 = 0;
FUN_1003ef00(FALSE);
EnableAnimations(FALSE);
AnimationManager()->FUN_10064670(NULL);
break;
}
@ -781,7 +781,7 @@ void Isle::Enable(MxBool p_enable)
}
m_act1state->m_unk0x018 = 0;
FUN_1003ef00(TRUE);
EnableAnimations(TRUE);
break;
}
case 7:
@ -806,12 +806,12 @@ void Isle::Enable(MxBool p_enable)
m_act1state->m_unk0x018 = 0;
((IslePathActor*) CurrentActor())
->SpawnPlayer(
LegoGameState::e_unk54,
LegoGameState::e_jukeboxExterior,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
GameState()->m_currentArea = LegoGameState::e_unk66;
FUN_1003ef00(TRUE);
EnableAnimations(TRUE);
m_jukebox->StartAction();
break;
}

View file

@ -58,7 +58,7 @@ MxResult JukeBox::Create(MxDSAction& p_dsAction)
m_state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
if (!m_state) {
m_state = (JukeBoxState*) GameState()->CreateState("JukeBoxState");
m_state->SetState(0);
m_state->m_music = JukeBoxState::e_pasquell;
}
GameState()->SetCurrentArea(LegoGameState::e_jukeboxw);
@ -89,24 +89,27 @@ MxLong JukeBox::Notify(MxParam& p_param)
}
// FUNCTION: LEGO1 0x1005d9f0
// FUNCTION: BETA10 0x10037e39
void JukeBox::ReadyWorld()
{
MxStillPresenter* presenter = NULL;
switch (m_state->GetState()) {
case 1:
switch (m_state->m_music) {
case JukeBoxState::e_pasquell:
break;
case JukeBoxState::e_right:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
break;
case 2:
case JukeBoxState::e_decal:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
break;
case 3:
case JukeBoxState::e_wallis:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
break;
case 4:
case JukeBoxState::e_nelson:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
break;
case 5:
case JukeBoxState::e_torpedos:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
break;
}
@ -119,47 +122,48 @@ void JukeBox::ReadyWorld()
}
// FUNCTION: LEGO1 0x1005da70
// FUNCTION: BETA10 0x10037f6d
MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param)
{
MxStillPresenter* presenter;
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
if (p_param.m_unk0x28 == 1) {
switch (p_param.m_clickedObjectId) {
case JukeboxwScript::c_Dback_Ctl:
switch (m_state->GetState()) {
case JukeboxScript::c_MusicTheme1:
m_state->SetState(JukeboxScript::c_ResidentalArea_Music);
switch (m_state->m_music) {
case JukeBoxState::e_pasquell:
m_state->m_music = JukeBoxState::e_torpedos;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_MusicTheme3:
m_state->SetState(JukeboxScript::c_MusicTheme1);
case JukeBoxState::e_right:
m_state->m_music = JukeBoxState::e_pasquell;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(FALSE);
break;
case JukeboxScript::c_Act2Cave:
m_state->SetState(JukeboxScript::c_MusicTheme3);
case JukeBoxState::e_decal:
m_state->m_music = JukeBoxState::e_right;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_BrickstrChase:
m_state->SetState(JukeboxScript::c_Act2Cave);
case JukeBoxState::e_wallis:
m_state->m_music = JukeBoxState::e_decal;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_BrickHunt:
m_state->SetState(JukeboxScript::c_BrickstrChase);
case JukeBoxState::e_nelson:
m_state->m_music = JukeBoxState::e_wallis;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_ResidentalArea_Music:
m_state->SetState(JukeboxScript::c_BrickHunt);
case JukeBoxState::e_torpedos:
m_state->m_music = JukeBoxState::e_nelson;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
@ -168,52 +172,51 @@ MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param)
}
break;
case JukeboxwScript::c_Dfwd_Ctl:
switch (m_state->GetState()) {
case JukeboxScript::c_MusicTheme1:
m_state->SetState(JukeboxScript::c_MusicTheme3);
switch (m_state->m_music) {
case JukeBoxState::e_pasquell:
m_state->m_music = JukeBoxState::e_right;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_MusicTheme3:
m_state->SetState(JukeboxScript::c_Act2Cave);
case JukeBoxState::e_right:
m_state->m_music = JukeBoxState::e_decal;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_Act2Cave:
m_state->SetState(JukeboxScript::c_BrickstrChase);
case JukeBoxState::e_decal:
m_state->m_music = JukeBoxState::e_wallis;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_BrickstrChase:
m_state->SetState(JukeboxScript::c_BrickHunt);
case JukeBoxState::e_wallis:
m_state->m_music = JukeBoxState::e_nelson;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_BrickHunt:
m_state->SetState(JukeboxScript::c_ResidentalArea_Music);
case JukeBoxState::e_nelson:
m_state->m_music = JukeBoxState::e_torpedos;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(TRUE);
break;
case JukeboxScript::c_ResidentalArea_Music:
m_state->SetState(JukeboxScript::c_MusicTheme1);
case JukeBoxState::e_torpedos:
m_state->m_music = JukeBoxState::e_pasquell;
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(FALSE);
break;
}
break;
case JukeboxwScript::c_Note_Ctl:
LegoGameState* gameState = GameState();
Act1State* act1State = (Act1State*) gameState->GetState("Act1State");
act1State->SetUnknown18(11);
m_destLocation = LegoGameState::Area::e_unk54;
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
act1State->m_unk0x018 = 11;
m_destLocation = LegoGameState::Area::e_jukeboxExterior;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, 0, FALSE);
break;
}