From 313bd9ffd072760164f4aa3e32ec44b6f446a596 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Sun, 24 Mar 2024 17:26:55 -0400 Subject: [PATCH] PoliceEntity::VTable0x50 (#720) * PoliceEntity::VTable0x50 * fix * don't hardcode Isle world object id * style --------- Co-authored-by: Ramen2X Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/policeentity.h | 3 +- .../lego/legoomni/src/police/policeentity.cpp | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/policeentity.h b/LEGO1/lego/legoomni/include/policeentity.h index 726d47b8..42792204 100644 --- a/LEGO1/lego/legoomni/include/policeentity.h +++ b/LEGO1/lego/legoomni/include/policeentity.h @@ -20,8 +20,7 @@ class PoliceEntity : public BuildingEntity { return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); } - // STUB: LEGO1 0x10015310 - MxLong VTable0x50(MxParam& p_param) override { return 0; } + MxLong VTable0x50(MxParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f900 // PoliceEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp index a9bc65cb..227799d4 100644 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ b/LEGO1/lego/legoomni/src/police/policeentity.cpp @@ -1,3 +1,39 @@ #include "policeentity.h" +#include "act1state.h" +#include "isle.h" +#include "isle_actions.h" +#include "islepathactor.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(PoliceEntity, 0x68) + +// FUNCTION: LEGO1 0x10015310 +MxLong PoliceEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + if (state->GetUnknown18() != 10) { + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + CurrentActor()->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_police); + + AnimationManager()->FUN_10061010(NULL); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +}