From 9d110f8b6e1c8ef00bcbec9d06f04b0dd93c2db7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 18 Mar 2024 13:20:37 -0400 Subject: [PATCH] Match --- LEGO1/lego/legoomni/include/act1state.h | 2 +- LEGO1/lego/legoomni/src/act1/act1state.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 40 ++++++++++++++++++---- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index c12e49c0..20b8d44b 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -101,7 +101,7 @@ class Act1State : public LegoState { MxS32 m_unk0x014; // 0x014 MxU32 m_unk0x018; // 0x018 MxS16 m_elevFloor; // 0x01c - undefined m_unk0x01e; // 0x01e + MxBool m_unk0x01e; // 0x01e MxBool m_unk0x01f; // 0x01f MxBool m_planeActive; // 0x020 undefined m_unk0x021; // 0x021 diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp index 99ddb8f5..71bd7039 100644 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ b/LEGO1/lego/legoomni/src/act1/act1state.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 0f953320..c3d8a6ad 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -193,23 +193,26 @@ MxLong Isle::HandleEndAction(MxEndActionNotificationParam& p_param) if (result == 0) { MxDSAction* action = p_param.GetAction(); + // TODO: Should be signed, but worsens match + MxU32 script; + if (action->GetAtomId() == *g_jukeboxScript) { - JukeboxScript::Script script = (JukeboxScript::Script) action->GetObjectId(); + script = action->GetObjectId(); if (script >= JukeboxScript::c_JBMusic1 && script <= JukeboxScript::c_JBMusic6) { - m_jukebox->StopAction(script); + m_jukebox->StopAction((JukeboxScript::Script) script); result = 1; } } else if (m_act1state->m_planeActive) { - IsleScript::Script script = (IsleScript::Script) action->GetObjectId(); + script = action->GetObjectId(); if (script >= IsleScript::c_nic002pr_RunAnim && script <= IsleScript::c_nic004pr_RunAnim) { m_act1state->m_planeActive = FALSE; } } else { - IsleScript::Script script = (IsleScript::Script) action->GetObjectId(); + script = action->GetObjectId(); if (script == IsleScript::c_Avo917In_PlayWav || (script >= IsleScript::c_Avo900Ps_PlayWav && script <= IsleScript::c_Avo907Ps_PlayWav)) { @@ -222,10 +225,33 @@ MxLong Isle::HandleEndAction(MxEndActionNotificationParam& p_param) return result; } -// STUB: LEGO1 0x10030ef0 +// FUNCTION: LEGO1 0x10030ef0 void Isle::HandleElevatorEndAction() { - // TODO + 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 @@ -283,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);