From c9a2a7203b0d2c185bc4fdd856b947022f112195 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 29 Nov 2024 13:24:14 -0700 Subject: [PATCH] Implement/match LegoAct2::HandleTransitionEnd (#1176) --- LEGO1/lego/legoomni/include/legoact2.h | 29 ++++++++++---------- LEGO1/lego/legoomni/src/actors/buildings.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 14 ++++++---- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 1b809287..c73e0c55 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -2,6 +2,7 @@ #define LEGOACT2_H #include "act2brick.h" +#include "legogamestate.h" #include "legostate.h" #include "legoworld.h" @@ -66,7 +67,7 @@ class LegoAct2 : public LegoWorld { void Enable(MxBool p_enable) override; // vtable+0x68 void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } - void SetUnknown0x1150(undefined4 p_unk0x1150) { m_unk0x1150 = p_unk0x1150; } + void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } undefined4 FUN_10052560( MxS32 p_param1, @@ -98,19 +99,19 @@ class LegoAct2 : public LegoWorld { // variable name verified by BETA10 0x10014633 char* m_siFile; // 0x10d4 - LegoROI* m_unk0x10d8; // 0x10d8 - MxMatrix m_unk0x10dc; // 0x10dc - undefined4 m_unk0x1124; // 0x1124 - LegoROI* m_ambulance; // 0x1128 - undefined4 m_unk0x112c; // 0x112c - undefined4 m_unk0x1130; // 0x1130 - undefined4 m_unk0x1134; // 0x1134 - Act2Actor* m_unk0x1138; // 0x1138 - undefined m_unk0x113c; // 0x113c - undefined4 m_unk0x1140; // 0x1140 - undefined4 m_unk0x1144; // 0x1144 - undefined m_unk0x1148[0x08]; // 0x1148 - undefined4 m_unk0x1150; // 0x1150 + LegoROI* m_unk0x10d8; // 0x10d8 + MxMatrix m_unk0x10dc; // 0x10dc + undefined4 m_unk0x1124; // 0x1124 + LegoROI* m_ambulance; // 0x1128 + undefined4 m_unk0x112c; // 0x112c + undefined4 m_unk0x1130; // 0x1130 + undefined4 m_unk0x1134; // 0x1134 + Act2Actor* m_unk0x1138; // 0x1138 + undefined m_unk0x113c; // 0x113c + undefined4 m_unk0x1140; // 0x1140 + undefined4 m_unk0x1144; // 0x1144 + undefined m_unk0x1148[0x08]; // 0x1148 + LegoGameState::Area m_destLocation; // 0x1150 }; #endif // LEGOACT2_H diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 79e7ef23..64188031 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -58,7 +58,7 @@ MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param) } case LegoGameState::Act::e_act2: { LegoAct2* act2 = (LegoAct2*) FindWorld(*g_act2mainScript, Act2mainScript::c__Act2Main); - act2->SetUnknown0x1150(2); + act2->SetDestLocation(LegoGameState::e_infomain); LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State"); if (act2state) { diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 39a4a9a9..7612bc34 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -58,7 +58,7 @@ LegoAct2::LegoAct2() m_unk0x1138 = NULL; m_unk0x1140 = 0; m_unk0x1144 = 0; - m_unk0x1150 = 0; + m_destLocation = LegoGameState::e_undefined; m_unk0x10c8 = 0; m_siFile = ""; m_unk0x113c = 5; @@ -328,11 +328,15 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) return 0; } -// STUB: LEGO1 0x10050a50 +// FUNCTION: LEGO1 0x10050a50 MxLong LegoAct2::HandleTransitionEnd() { - // TODO - return 0; + if (m_destLocation != LegoGameState::e_undefined) { + GameState()->SwitchArea(m_destLocation); + m_destLocation = LegoGameState::e_undefined; + } + + return 1; } // STUB: LEGO1 0x10050a80 @@ -393,7 +397,7 @@ MxBool LegoAct2::Escape() m_gameState->m_unk0x0c = 0; } - m_unk0x1150 = 2; + m_destLocation = LegoGameState::e_infomain; return TRUE; }