From 87f633af54f88bf742148d7855313f53dd941124 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Fri, 29 Mar 2024 14:09:53 -0400 Subject: [PATCH] InfoCenterEntity::VTable0x50 implementation (#725) * Start InfoCenterEntity::VTable0x50 implementation * Fully implement InfoCenterEntity::VTable0x50 * Fix function name typo * match * fix style --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/act3.h | 4 +- .../lego/legoomni/include/infocenterentity.h | 3 +- LEGO1/lego/legoomni/include/isle.h | 1 + LEGO1/lego/legoomni/include/legoact2.h | 2 + LEGO1/lego/legoomni/include/legoact2state.h | 3 +- LEGO1/lego/legoomni/include/policeentity.h | 2 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 4 +- .../src/infocenter/infocenterentity.cpp | 57 +++++++++++++++++++ LEGO1/lego/legoomni/src/worlds/isle.cpp | 6 ++ 9 files changed, 74 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index eb4161ff..2883ff9d 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -35,8 +35,8 @@ class Act3 : public LegoWorld { MxBool VTable0x64() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 - inline void SetUnkown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; } - inline void SetUnkown4270(MxU32 p_unk0x4270) { m_unk0x4270 = p_unk0x4270; } + inline void SetUnknown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; } + inline void SetUnknown4270(MxU32 p_unk0x4270) { m_unk0x4270 = p_unk0x4270; } // SYNTHETIC: LEGO1 0x10072630 // Act3::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/infocenterentity.h b/LEGO1/lego/legoomni/include/infocenterentity.h index 0584db7f..82fa3d30 100644 --- a/LEGO1/lego/legoomni/include/infocenterentity.h +++ b/LEGO1/lego/legoomni/include/infocenterentity.h @@ -20,8 +20,7 @@ class InfoCenterEntity : public BuildingEntity { return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); } - // STUB: LEGO1 0x100150c0 - MxLong VTable0x50(MxParam& p_param) override { return 0; } + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f7b0 // InfoCenterEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 0439d0a1..38895964 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -69,6 +69,7 @@ class Isle : public LegoWorld { void FUN_10031590(); void FUN_10032620(); void FUN_100330e0(); + void FUN_10033350(); void FUN_10032d30( IsleScript::Script p_script, JukeboxScript::Script p_music, diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index d90fe268..f0ee58dd 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -19,6 +19,8 @@ class LegoAct2 : public LegoWorld { MxBool VTable0x64() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 + inline void SetUnknown0x1150(undefined4 p_unk0x1150) { m_unk0x1150 = p_unk0x1150; } + // SYNTHETIC: LEGO1 0x1004fe20 // LegoAct2::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoact2state.h b/LEGO1/lego/legoomni/include/legoact2state.h index 8fcb4829..e4898960 100644 --- a/LEGO1/lego/legoomni/include/legoact2state.h +++ b/LEGO1/lego/legoomni/include/legoact2state.h @@ -28,10 +28,11 @@ class LegoAct2State : public LegoState { // LegoAct2State::`scalar deleting destructor' inline undefined4 GetUnknown0x08() { return m_unk0x08; } + inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } private: undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c + undefined m_unk0x0c; // 0x0c }; #endif // LEGOACT2STATE_H diff --git a/LEGO1/lego/legoomni/include/policeentity.h b/LEGO1/lego/legoomni/include/policeentity.h index 42792204..48156150 100644 --- a/LEGO1/lego/legoomni/include/policeentity.h +++ b/LEGO1/lego/legoomni/include/policeentity.h @@ -20,7 +20,7 @@ class PoliceEntity : public BuildingEntity { return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f900 // PoliceEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 2f8de444..ded0b705 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -41,7 +41,7 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction) LegoWorld* world = CurrentWorld(); SetWorld(world); if (world->IsA("Act3")) { - ((Act3*) GetWorld())->SetUnkown420c(this); + ((Act3*) GetWorld())->SetUnknown420c(this); } world = GetWorld(); if (world) { @@ -160,7 +160,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) switch (p_param.GetClickedObjectId()) { case IsleScript::c_HelicopterArms_Ctl: if (*g_act3Script == script) { - ((Act3*) CurrentWorld())->SetUnkown4270(2); + ((Act3*) CurrentWorld())->SetUnknown4270(2); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } else if (m_state->GetUnkown8() != 0) { diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp index 0f5689ac..5157cb25 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp @@ -1,3 +1,60 @@ #include "infocenterentity.h" +#include "act1state.h" +#include "act2main_actions.h" +#include "act3.h" +#include "act3_actions.h" +#include "act3state.h" +#include "isle.h" +#include "isle_actions.h" +#include "islepathactor.h" +#include "legoact2.h" +#include "legoact2state.h" +#include "legoanimationmanager.h" +#include "legogamestate.h" +#include "legoomni.h" +#include "legoutils.h" +#include "legoworld.h" +#include "misc.h" +#include "mxtransitionmanager.h" + DECOMP_SIZE_ASSERT(InfoCenterEntity, 0x68) + +// FUNCTION: LEGO1 0x100150c0 +MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) +{ + switch (GameState()->GetCurrentAct()) { + case LegoGameState::Act::e_act1: { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + CurrentActor()->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->FUN_10033350(); + isle->SetDestLocation(LegoGameState::Area::e_infomain); + + Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); + act1state->SetUnknown18(0); + break; + } + case LegoGameState::Act::e_act2: { + LegoAct2* act2 = (LegoAct2*) FindWorld(*g_act2mainScript, Act2mainScript::c__Act2Main); + act2->SetUnknown0x1150(2); + + LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State"); + if (act2state) { + act2state->SetUnknown0x0c(0); + } + break; + } + case LegoGameState::Act::e_act3: + Act3* act3 = (Act3*) FindWorld(*g_act3Script, Act3Script::c__Act3); + act3->SetUnknown4270(2); + break; + } + + AnimationManager()->FUN_10061010(0); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + + return 1; +} diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index bf5f85a8..2a6f900c 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1115,3 +1115,9 @@ MxBool Isle::VTable0x64() // TODO return FALSE; } + +// STUB: LEGO1 0x10033350 +void Isle::FUN_10033350() +{ + // TODO +}