Implement/match Isle::HandleEndAction and Isle::HandleElevatorEndAction (#691)

* WIP

* Match
This commit is contained in:
Christian Semmler
2024-03-18 15:00:58 -04:00
committed by GitHub
parent d96679ea9e
commit 52d74647be
11 changed files with 149 additions and 46 deletions

View File

@@ -17,7 +17,7 @@ extern MxAtomId* g_isleScript;
// STUB: LEGO1 0x100334b0
Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0)
{
m_unk0x01e = 0;
m_unk0x01e = FALSE;
m_unk0x018 = 1;
m_unk0x010 = 0;
m_planeActive = FALSE;

View File

@@ -1,7 +1,9 @@
#include "jukeboxentity.h"
#include "isle.h"
#include "isle_actions.h"
#include "islepathactor.h"
#include "jukebox_actions.h"
#include "jukeboxstate.h"
#include "legogamestate.h"
#include "legoomni.h"
@@ -54,28 +56,28 @@ void JukeBoxEntity::StartAction()
switch (state->GetState()) {
case 0:
InvokeAction(Extra::e_start, *g_isleScript, 0x319, NULL);
GameState()->SetUnknown0x41c(0x37);
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic1);
break;
case 1:
InvokeAction(Extra::e_start, *g_isleScript, 0x31e, NULL);
GameState()->SetUnknown0x41c(0x38);
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic2);
break;
case 2:
InvokeAction(Extra::e_start, *g_isleScript, 0x31b, NULL);
GameState()->SetUnknown0x41c(0x39);
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic3);
break;
case 3:
InvokeAction(Extra::e_start, *g_isleScript, 0x31a, NULL);
GameState()->SetUnknown0x41c(0x3a);
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic4);
break;
case 4:
InvokeAction(Extra::e_start, *g_isleScript, 0x31f, NULL);
GameState()->SetUnknown0x41c(0x3b);
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic5);
break;
case 5:
InvokeAction(Extra::e_start, *g_isleScript, 0x31c, NULL);
GameState()->SetUnknown0x41c(0x3c);
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL);
GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic6);
break;
}
@@ -91,35 +93,35 @@ void JukeBoxEntity::StartAction()
}
// FUNCTION: LEGO1 0x100860f0
void JukeBoxEntity::StopAction(MxU32 p_state)
void JukeBoxEntity::StopAction(JukeboxScript::Script p_script)
{
JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
if (state && state->IsActive()) {
switch (p_state) {
case 0x37:
switch (p_script) {
case JukeboxScript::c_JBMusic1:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x319, NULL);
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL);
break;
case 0x38:
case JukeboxScript::c_JBMusic2:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31e, NULL);
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL);
break;
case 0x39:
case JukeboxScript::c_JBMusic3:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31b, NULL);
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL);
break;
case 0x3a:
case JukeboxScript::c_JBMusic4:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31a, NULL);
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL);
break;
case 0x3b:
case JukeboxScript::c_JBMusic5:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31f, NULL);
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL);
break;
case 0x3c:
case JukeboxScript::c_JBMusic6:
state->SetActive(FALSE);
InvokeAction(Extra::e_stop, *g_isleScript, 0x31c, NULL);
InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL);
break;
}

View File

@@ -232,7 +232,7 @@ void MxBackgroundAudioManager::StopAction(MxParam& p_param)
m_action2.SetObjectId(-1);
}
Lego()->HandleActionEnd(p_param);
Lego()->HandleEndAction(p_param);
}
// FUNCTION: LEGO1 0x1007f2f0

View File

@@ -8,6 +8,7 @@
#include "isle.h"
#include "islepathactor.h"
#include "jetski.h"
#include "jukebox_actions.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h"
#include "legocharactermanager.h"
@@ -93,7 +94,7 @@ LegoGameState::LegoGameState()
m_actorId = 0;
m_savePath = NULL;
m_stateArray = NULL;
m_unk0x41c = -1;
m_unk0x41c = JukeboxScript::c_noneJukebox;
m_currentArea = e_undefined;
m_previousArea = e_undefined;
m_unk0x42c = e_undefined;

View File

@@ -21,6 +21,7 @@
#include "legovideomanager.h"
#include "misc.h"
#include "motocycle.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxstillpresenter.h"
@@ -123,7 +124,7 @@ MxLong Isle::Notify(MxParam& p_param)
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:
result = StopAction(p_param);
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationButtonUp:
case c_notificationButtonDown:
@@ -167,10 +168,90 @@ MxLong Isle::Notify(MxParam& p_param)
return result;
}
// STUB: LEGO1 0x10030d90
MxLong Isle::StopAction(MxParam& p_param)
// FUNCTION: LEGO1 0x10030d90
MxLong Isle::HandleEndAction(MxEndActionNotificationParam& p_param)
{
return 0;
MxLong result;
switch (m_act1state->m_unk0x018) {
case 2:
HandleElevatorEndAction();
result = 1;
break;
case 3:
result = m_pizza->Notify(p_param);
break;
case 8:
result = m_towtrack->Notify(p_param);
break;
case 10:
result = m_ambulance->Notify(p_param);
break;
default:
result = m_radio.Notify(p_param);
if (result == 0) {
MxDSAction* action = p_param.GetAction();
// TODO: Should be signed, but worsens match
MxU32 script;
if (action->GetAtomId() == *g_jukeboxScript) {
script = action->GetObjectId();
if (script >= JukeboxScript::c_JBMusic1 && script <= JukeboxScript::c_JBMusic6) {
m_jukebox->StopAction((JukeboxScript::Script) script);
result = 1;
}
}
else if (m_act1state->m_planeActive) {
script = action->GetObjectId();
if (script >= IsleScript::c_nic002pr_RunAnim && script <= IsleScript::c_nic004pr_RunAnim) {
m_act1state->m_planeActive = FALSE;
}
}
else {
script = action->GetObjectId();
if (script == IsleScript::c_Avo917In_PlayWav ||
(script >= IsleScript::c_Avo900Ps_PlayWav && script <= IsleScript::c_Avo907Ps_PlayWav)) {
BackgroundAudioManager()->RaiseVolume();
}
}
}
}
return result;
}
// FUNCTION: LEGO1 0x10030ef0
void Isle::HandleElevatorEndAction()
{
switch (m_act1state->m_elevFloor) {
case Act1State::c_floor1:
m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
m_act1state->m_unk0x018 = 0;
break;
case Act1State::c_floor2:
if (m_act1state->m_unk0x01e) {
m_act1state->m_unk0x01e = FALSE;
m_act1state->m_unk0x018 = 0;
InputManager()->EnableInputProcessing();
}
else {
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Floor2, NULL);
InputManager()->EnableInputProcessing();
m_act1state->m_unk0x01e = TRUE;
}
break;
case Act1State::c_floor3:
m_destLocation = LegoGameState::e_elevopen;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
m_act1state->m_unk0x018 = 0;
break;
}
}
// FUNCTION: LEGO1 0x10030fc0
@@ -228,7 +309,7 @@ MxLong Isle::HandleClick(LegoControlManagerEvent& p_param)
break;
case Act1State::c_floor2:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Floor2, NULL);
m_act1state->m_unk0x01e = 1;
m_act1state->m_unk0x01e = TRUE;
break;
case Act1State::c_floor3:
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Elev3_2_Ride, NULL);