From 040c97d92a18af27315cf482afc62baa8df325a3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 3 Nov 2024 09:59:21 -0700 Subject: [PATCH] Implement/match Act1State::PlayCptClickDialogue (#1131) --- LEGO1/lego/legoomni/include/isle.h | 64 ++++++++++++------------- LEGO1/lego/legoomni/src/worlds/isle.cpp | 36 ++++++++------ 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 3d50b835..51d1f943 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -85,8 +85,8 @@ class Act1State : public LegoState { MxBool SetFlag() override; // vtable+0x18 MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c - void FUN_10034660(); - void FUN_100346a0(); + void PlayCptClickDialogue(); + void StopCptClickDialogue(); void FUN_10034b60(); void FUN_10034d00(); @@ -103,36 +103,36 @@ class Act1State : public LegoState { // TODO: Most likely getters/setters are not used according to BETA. - Playlist m_unk0x008; // 0x008 - MxS32 m_unk0x014; // 0x014 - MxU32 m_unk0x018; // 0x018 - MxS16 m_elevFloor; // 0x01c - MxBool m_unk0x01e; // 0x01e - MxBool m_unk0x01f; // 0x01f - MxBool m_planeActive; // 0x020 - undefined m_unk0x021; // 0x021 - MxBool m_unk0x022; // 0x022 - undefined m_unk0x023; // 0x023 - NamedPlane m_unk0x024; // 0x024 - NamedPlane m_unk0x070; // 0x070 - NamedPlane m_unk0x0bc; // 0x0bc - NamedPlane m_unk0x108; // 0x108 - LegoNamedTexture* m_unk0x154; // 0x154 - LegoNamedTexture* m_unk0x158; // 0x158 - LegoNamedTexture* m_unk0x15c; // 0x15c - Helicopter* m_helicopter; // 0x160 - NamedPlane m_unk0x164; // 0x164 - LegoNamedTexture* m_unk0x1b0; // 0x1b0 - LegoNamedTexture* m_unk0x1b4; // 0x1b4 - Jetski* m_jetski; // 0x1b8 - NamedPlane m_unk0x1bc; // 0x1bc - LegoNamedTexture* m_unk0x208; // 0x208 - DuneBuggy* m_dunebuggy; // 0x20c - NamedPlane m_unk0x210; // 0x210 - LegoNamedTexture* m_unk0x25c; // 0x25c - LegoNamedTexture* m_unk0x260; // 0x260 - LegoNamedTexture* m_unk0x264; // 0x264 - RaceCar* m_racecar; // 0x268 + Playlist m_cptClickDialogue; // 0x008 + IsleScript::Script m_currentCptClickDialogue; // 0x014 + MxU32 m_unk0x018; // 0x018 + MxS16 m_elevFloor; // 0x01c + MxBool m_unk0x01e; // 0x01e + MxBool m_unk0x01f; // 0x01f + MxBool m_planeActive; // 0x020 + undefined m_unk0x021; // 0x021 + MxBool m_unk0x022; // 0x022 + undefined m_unk0x023; // 0x023 + NamedPlane m_unk0x024; // 0x024 + NamedPlane m_unk0x070; // 0x070 + NamedPlane m_unk0x0bc; // 0x0bc + NamedPlane m_unk0x108; // 0x108 + LegoNamedTexture* m_unk0x154; // 0x154 + LegoNamedTexture* m_unk0x158; // 0x158 + LegoNamedTexture* m_unk0x15c; // 0x15c + Helicopter* m_helicopter; // 0x160 + NamedPlane m_unk0x164; // 0x164 + LegoNamedTexture* m_unk0x1b0; // 0x1b0 + LegoNamedTexture* m_unk0x1b4; // 0x1b4 + Jetski* m_jetski; // 0x1b8 + NamedPlane m_unk0x1bc; // 0x1bc + LegoNamedTexture* m_unk0x208; // 0x208 + DuneBuggy* m_dunebuggy; // 0x20c + NamedPlane m_unk0x210; // 0x210 + LegoNamedTexture* m_unk0x25c; // 0x25c + LegoNamedTexture* m_unk0x260; // 0x260 + LegoNamedTexture* m_unk0x264; // 0x264 + RaceCar* m_racecar; // 0x268 }; // FUNCTION: LEGO1 0x10033a70 diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 4a37afdd..e34fad19 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -46,7 +46,7 @@ DECOMP_SIZE_ASSERT(Isle, 0x140) MxU32 g_isleFlags = 0x7f; // GLOBAL: LEGO1 0x100f37f0 -IsleScript::Script g_unk0x100f37f0[] = +IsleScript::Script g_cptClickDialogue[] = {IsleScript::c_Avo905Ps_PlayWav, IsleScript::c_Avo906Ps_PlayWav, IsleScript::c_Avo907Ps_PlayWav}; // FUNCTION: LEGO1 0x10030820 @@ -362,14 +362,14 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_Observe_LeftArrow_Ctl: - m_act1state->FUN_100346a0(); + m_act1state->StopCptClickDialogue(); m_radio.Stop(); case IsleScript::c_SeaView_RightArrow_Ctl: m_destLocation = LegoGameState::e_elevopen; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_Observe_RightArrow_Ctl: - m_act1state->FUN_100346a0(); + m_act1state->StopCptClickDialogue(); m_radio.Stop(); case IsleScript::c_SeaView_LeftArrow_Ctl: m_destLocation = LegoGameState::e_elevdown; @@ -420,7 +420,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) break; case IsleScript::c_Observe_Draw1_Ctl: case IsleScript::c_Observe_Draw2_Ctl: - m_act1state->FUN_10034660(); + m_act1state->PlayCptClickDialogue(); break; case IsleScript::c_ElevDown_Elevator_Ctl: m_destLocation = LegoGameState::e_elevride2; @@ -1287,10 +1287,10 @@ Act1State::Act1State() m_elevFloor = Act1State::c_floor1; m_unk0x018 = 1; m_unk0x01e = FALSE; - m_unk0x008 = Playlist((MxU32*) g_unk0x100f37f0, sizeOfArray(g_unk0x100f37f0), Playlist::e_loop); + m_cptClickDialogue = Playlist((MxU32*) g_cptClickDialogue, sizeOfArray(g_cptClickDialogue), Playlist::e_loop); m_unk0x01f = FALSE; m_planeActive = FALSE; - m_unk0x014 = -1; + m_currentCptClickDialogue = IsleScript::c_noneIsle; m_unk0x022 = FALSE; m_unk0x154 = NULL; m_unk0x158 = NULL; @@ -1386,7 +1386,7 @@ MxResult Act1State::Serialize(LegoFile* p_file) } } - Write(p_file, m_unk0x008.m_nextIndex); + Write(p_file, m_cptClickDialogue.m_nextIndex); Write(p_file, m_unk0x022); } else if (p_file->IsReadMode()) { @@ -1440,7 +1440,7 @@ MxResult Act1State::Serialize(LegoFile* p_file) } } - Read(p_file, &m_unk0x008.m_nextIndex); + Read(p_file, &m_cptClickDialogue.m_nextIndex); Read(p_file, &m_unk0x022); } @@ -1448,18 +1448,24 @@ MxResult Act1State::Serialize(LegoFile* p_file) return SUCCESS; } -// STUB: LEGO1 0x10034660 -void Act1State::FUN_10034660() +// FUNCTION: LEGO1 0x10034660 +void Act1State::PlayCptClickDialogue() { - // TODO + StopCptClickDialogue(); + m_currentCptClickDialogue = (IsleScript::Script) m_cptClickDialogue.Next(); + BackgroundAudioManager()->LowerVolume(); + + if (m_currentCptClickDialogue != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_start, *g_isleScript, m_currentCptClickDialogue, NULL); + } } // FUNCTION: LEGO1 0x100346a0 -void Act1State::FUN_100346a0() +void Act1State::StopCptClickDialogue() { - if (m_unk0x014 != -1) { - InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x014, NULL); - m_unk0x014 = -1; + if (m_currentCptClickDialogue != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_currentCptClickDialogue, NULL); + m_currentCptClickDialogue = IsleScript::c_noneIsle; } }