diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index f501d1a1..adb09677 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -38,6 +38,7 @@ extern MxAtomId* g_isleScript; LegoEntity* PickEntity(MxLong, MxLong); LegoROI* PickROI(MxLong, MxLong); +LegoROI* PickParentROI(MxLong p_a, MxLong p_b); MxS16 CountTotalTreeNodes(LegoTreeNode* p_node); void FUN_1003e050(LegoAnimPresenter* p_presenter); Extra::ActionType MatchActionString(const char*); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 5459c882..ce878893 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -236,10 +236,26 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param) return 1; } -// STUB: LEGO1 0x100367c0 +// FUNCTION: LEGO1 0x100367c0 +// FUNCTION: BETA10 0x100230bf MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) { - // TODO + if (m_unk0x170 == 1) { + LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); + + if (roi != NULL && !strcmpi(roi->GetName(), "ps-gate")) { + m_unk0x170 = 3; + return 1; + } + + roi = PickParentROI(p_param.GetX(), p_param.GetY()); + + if (roi != NULL && !strcmpi(roi->GetName(), "gd")) { + m_unk0x170 = 3; + return 1; + } + } + return 0; } diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 7efa5a96..3b6b1267 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -34,7 +34,24 @@ // FUNCTION: LEGO1 0x1003dd70 LegoROI* PickROI(MxLong p_a, MxLong p_b) { - return (LegoROI*) VideoManager()->Get3DManager()->GetLego3DView()->Pick(p_a, p_b); + LegoVideoManager* videoManager = VideoManager(); + Lego3DView* view = videoManager->Get3DManager()->GetLego3DView(); + return (LegoROI*) view->Pick(p_a, p_b); +} + +// FUNCTION: LEGO1 0x1003dd90 +// FUNCTION: BETA10 0x100d3449 +LegoROI* PickParentROI(MxLong p_a, MxLong p_b) +{ + LegoVideoManager* videoManager = VideoManager(); + Lego3DView* view = videoManager->Get3DManager()->GetLego3DView(); + LegoROI* roi = (LegoROI*) view->Pick(p_a, p_b); + + while (roi != NULL && roi->GetParentROI() != NULL) { + roi = (LegoROI*) roi->GetParentROI(); + } + + return roi; } // STUB: LEGO1 0x1003ddc0