From 1cf60ccda65efeecb9abe895c2961a23849759ca Mon Sep 17 00:00:00 2001 From: Ramen2X Date: Wed, 27 Mar 2024 12:12:20 -0400 Subject: [PATCH] implement/match HospitalEntity::VTable0x50() (#738) --- LEGO1/lego/legoomni/include/hospitalentity.h | 3 +- .../legoomni/src/hospital/hospitalentity.cpp | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/hospitalentity.h b/LEGO1/lego/legoomni/include/hospitalentity.h index 2910916e..3dbe7d54 100644 --- a/LEGO1/lego/legoomni/include/hospitalentity.h +++ b/LEGO1/lego/legoomni/include/hospitalentity.h @@ -20,8 +20,7 @@ class HospitalEntity : public BuildingEntity { return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); } - // STUB: LEGO1 0x10015270 - MxLong VTable0x50(MxParam& p_param) override { return 0; } + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f820 // HospitalEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp index 35e6eb90..9e55303e 100644 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp @@ -1,3 +1,39 @@ #include "hospitalentity.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(HospitalEntity, 0x68) + +// FUNCTION: LEGO1 0x10015270 +MxLong HospitalEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + + if (act1State->GetUnknown18() != 10) { + act1State->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + CurrentActor()->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_hospital); + + AnimationManager()->FUN_10061010(NULL); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +}