From ba5bc46c0c1a91e29e8b26bd8fd05d061690815a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 18 Mar 2024 10:38:02 -0400 Subject: [PATCH] Implement/match FUN_10032620 (#687) --- LEGO1/lego/legoomni/include/isle.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 9 ++-- LEGO1/lego/legoomni/include/legogamestate.h | 12 ++++-- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 14 +++--- .../legoomni/src/actors/islepathactor.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 43 ++++++++++++++----- .../legoomni/src/worlds/registrationbook.cpp | 2 +- LEGO1/mxgeometry/mxmatrix.h | 4 ++ 9 files changed, 62 insertions(+), 30 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index ba219794..13cc593c 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -79,7 +79,7 @@ class Isle : public LegoWorld { virtual void VTable0x6c(IslePathActor* p_actor); // vtable+6c MxLong StopAction(MxParam& p_param); - MxLong HandleType17Notification(MxParam& p_param); + MxLong HandleClick(MxParam& p_param); MxLong HandleType19Notification(MxParam& p_param); MxLong HandleTransitionEnd(); void FUN_10032620(); diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index fb81efef..c8286903 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -2,6 +2,7 @@ #define ISLEPATHACTOR_H #include "legocontrolmanager.h" +#include "legogamestate.h" #include "legopathactor.h" #include "legoworld.h" #include "mxtype18notificationparam.h" @@ -50,10 +51,10 @@ class IslePathActor : public LegoPathActor { // FUNCTION: LEGO1 0x10002e00 virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc - virtual void VTable0xe0(); // vtable+0xe0 - virtual void VTable0xe4(); // vtable+0xe4 - virtual void VTable0xe8(MxU32, MxBool, MxU8); // vtable+0xe8 - virtual void VTable0xec(); // vtable+0xec + virtual void VTable0xe0(); // vtable+0xe0 + virtual void VTable0xe4(); // vtable+0xe4 + virtual void VTable0xe8(LegoGameState::Area, MxBool, MxU8); // vtable+0xe8 + virtual void VTable0xec(MxMatrix, MxU32, MxBool); // vtable+0xec // SYNTHETIC: LEGO1 0x10002ff0 // IslePathActor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index f61467df..0e15334f 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -68,14 +68,20 @@ class LegoGameState { e_dunecarbuild, e_jetskibuild, e_racecarbuild, + e_unk40, + e_unk41, + e_unk42, - e_act2main = 46, + e_unk45 = 45, + e_act2main, e_act3script, + e_unk48, + e_unk49, e_jukeboxw = 53, e_unk54, - - e_histbook = 56, + e_unk55, + e_histbook, e_bike, e_dunecar, e_motocycle, diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 969f32c8..147d9468 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -62,7 +62,7 @@ void Helicopter::GetState() void Helicopter::VTable0xe4() { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { - VTable0xe8(0x28, TRUE, 7); + VTable0xe8(LegoGameState::e_unk40, TRUE, 7); } IslePathActor::VTable0xe4(); @@ -71,7 +71,7 @@ void Helicopter::VTable0xe4() GameState()->SetCurrentArea(LegoGameState::e_copter); if (CurrentActor()) { if (CurrentActor()->IsA("IslePathActor")) { - ((IslePathActor*) CurrentActor())->VTable0xe8(0x37, TRUE, 7); + ((IslePathActor*) CurrentActor())->VTable0xe8(LegoGameState::e_unk55, TRUE, 7); } } } @@ -114,7 +114,7 @@ MxU32 Helicopter::VTable0xcc() case LegoGameState::e_act1: m_script = *g_isleScript; AnimationManager()->FUN_10064670(FALSE); - VTable0xe8(0x29, TRUE, 7); + VTable0xe8(LegoGameState::e_unk41, TRUE, 7); ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_copter); FUN_10015820(TRUE, 0); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE); @@ -253,10 +253,10 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) case 1: { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4); - VTable0xe8(0x2a, TRUE, 7); + VTable0xe8(LegoGameState::e_unk42, TRUE, 7); } else { - VTable0xe8(0x31, TRUE, 7); + VTable0xe8(LegoGameState::e_unk49, TRUE, 7); } m_state->SetUnknown8(2); @@ -290,10 +290,10 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); - VTable0xe8(0x29, TRUE, 7); + VTable0xe8(LegoGameState::e_unk41, TRUE, 7); } else { - VTable0xe8(0x30, TRUE, 7); + VTable0xe8(LegoGameState::e_unk48, TRUE, 7); } m_state->SetUnknown8(0); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 55ef5b71..6bcb2956 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -45,13 +45,13 @@ void IslePathActor::VTable0xe4() } // STUB: LEGO1 0x1001b2a0 -void IslePathActor::VTable0xe8(MxU32, MxBool, MxU8) +void IslePathActor::VTable0xe8(LegoGameState::Area, MxBool, MxU8) { // TODO } // STUB: LEGO1 0x1001b5b0 -void IslePathActor::VTable0xec() +void IslePathActor::VTable0xec(MxMatrix, MxU32, MxBool) { // TODO } diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 4646718a..861951e6 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -102,7 +102,7 @@ MxResult Hospital::Create(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x10074990 MxLong Hospital::Notify(MxParam& p_param) { - MxResult result = SUCCESS; + MxLong result = 0; LegoWorld::Notify(p_param); if (m_worldStarted) { diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 41c8c15e..93ababb8 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -51,7 +51,7 @@ Isle::Isle() m_skateboard = NULL; m_racecar = NULL; m_jetski = NULL; - m_act1state = 0; + m_act1state = NULL; m_destLocation = LegoGameState::e_undefined; NotificationManager()->Register(this); @@ -137,7 +137,7 @@ MxLong Isle::Notify(MxParam& p_param) } break; case c_notificationClick: - result = HandleType17Notification(p_param); + result = HandleClick(p_param); break; case c_notificationType18: switch (m_act1state->GetUnknown18()) { @@ -183,7 +183,7 @@ void Isle::ReadyWorld() m_act1state->SetUnknown18(0); m_act1state->SetUnknown21(0); } - else if (GameState()->GetLoadedAct()) { + else if (GameState()->GetLoadedAct() != LegoGameState::e_act1) { FUN_1003ef00(TRUE); FUN_10032620(); m_act1state->FUN_10034d00(); @@ -192,7 +192,7 @@ void Isle::ReadyWorld() } // STUB: LGEO1 0x10031030 -MxLong Isle::HandleType17Notification(MxParam& p_param) +MxLong Isle::HandleClick(MxParam& p_param) { return 0; } @@ -252,7 +252,7 @@ void Isle::Enable(MxBool p_enable) if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) { IslePathActor* actor = CurrentActor(); - actor->VTable0xe8(0x2d, FALSE, 7); + actor->VTable0xe8(LegoGameState::e_unk45, FALSE, 7); actor->SetUnknownDC(0); } else { @@ -428,7 +428,7 @@ void Isle::Enable(MxBool p_enable) } break; case 5: { - CurrentActor()->VTable0xe8(0xf, FALSE, 7); + CurrentActor()->VTable0xe8(LegoGameState::e_jetrace2, FALSE, 7); JetskiRaceState* raceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState"); if (raceState->GetUnknown0x28() == 2) { @@ -456,8 +456,7 @@ void Isle::Enable(MxBool p_enable) } case 6: { GameState()->m_currentArea = LegoGameState::e_carraceExterior; - CurrentActor()->VTable0xe8(0x15, FALSE, 7); - + CurrentActor()->VTable0xe8(LegoGameState::e_unk21, FALSE, 7); CarRaceState* raceState = (CarRaceState*) GameState()->GetState("CarRaceState"); if (raceState->GetUnknown0x28() == 2) { @@ -502,7 +501,7 @@ void Isle::Enable(MxBool p_enable) break; case 11: m_act1state->m_unk0x018 = 0; - CurrentActor()->VTable0xe8(0x36, TRUE, 7); + CurrentActor()->VTable0xe8(LegoGameState::e_unk54, TRUE, 7); GameState()->m_currentArea = LegoGameState::e_unk66; FUN_1003ef00(TRUE); m_jukebox->StartAction(); @@ -540,10 +539,32 @@ void Isle::Enable(MxBool p_enable) } } -// STUB: LEGO1 0x10032620 +// FUNCTION: LEGO1 0x10032620 void Isle::FUN_10032620() { - // TODO + VideoManager()->Get3DManager()->SetFrustrum(90.0, 0.1, 250.0); + + switch (GameState()->m_currentArea) { + case LegoGameState::e_unk66: { + MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); + MxU32 unk0x88 = CurrentActor()->GetUnknown88(); + CurrentActor()->VTable0xec(mat, unk0x88, TRUE); + break; + } + case LegoGameState::e_unk4: + case LegoGameState::e_jetraceExterior: + case LegoGameState::e_unk17: + case LegoGameState::e_carraceExterior: + case LegoGameState::e_unk20: + case LegoGameState::e_pizzeriaExterior: + case LegoGameState::e_garageExterior: + case LegoGameState::e_hospitalExterior: + case LegoGameState::e_unk31: + case LegoGameState::e_policeExterior: + CurrentActor()->VTable0xe8(GameState()->m_currentArea, TRUE, 7); + GameState()->m_currentArea = LegoGameState::e_unk66; + break; + } } // FUNCTION: LEGO1 0x100327a0 diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 31d720da..a31df965 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -124,7 +124,7 @@ MxLong RegistrationBook::HandleClick(LegoControlManagerEvent& p_param) if (unk0x28 == 28) { DeleteObjects(&m_atom, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); - if (GameState()->GetCurrentAct() == 0) { + if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { m_infocenterState->SetUnknown0x74(15); } else { diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index 13c07c54..c32635b9 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -8,8 +8,12 @@ class MxMatrix : public Matrix4 { public: inline MxMatrix() : Matrix4(m_elements) {} + + // FUNCTION: LEGO1 0x10032770 inline MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } + inline MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } + float* operator[](size_t idx) { return m_data[idx]; } const float* operator[](size_t idx) const { return m_data[idx]; }