Implement/match Ambulance::HandleButtonDown (#1028)

This commit is contained in:
Christian Semmler 2024-06-13 11:34:44 -04:00 committed by GitHub
parent 33c64bb002
commit cf7246ac6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 3 deletions

View File

@ -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*);

View File

@ -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;
}

View File

@ -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