Implement/match PickEntity (#1153)

* Implement/match PickEntity

* Rename function
This commit is contained in:
Christian Semmler 2024-11-15 10:35:53 -07:00 committed by GitHub
parent 62f09570b0
commit 93c640a45f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 12 deletions

View file

@ -40,9 +40,9 @@ class LegoTreeNode;
extern MxAtomId* g_isleScript;
LegoEntity* PickEntity(MxLong, MxLong);
LegoROI* PickROI(MxLong, MxLong);
LegoROI* PickParentROI(MxLong p_a, MxLong p_b);
LegoEntity* PickEntity(MxLong p_x, MxLong p_y);
LegoROI* PickROI(MxLong p_x, MxLong p_y);
LegoROI* PickRootROI(MxLong p_x, MxLong p_y);
void RotateY(LegoROI* p_roi, MxFloat p_angle);
MxBool SpheresIntersect(const BoundingSphere& p_sphere1, const BoundingSphere& p_sphere2);
MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3]);

View file

@ -253,7 +253,7 @@ MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
return 1;
}
roi = PickParentROI(p_param.GetX(), p_param.GetY());
roi = PickRootROI(p_param.GetX(), p_param.GetY());
if (roi != NULL && !strcmpi(roi->GetName(), "gd")) {
m_unk0x170 = 3;

View file

@ -36,20 +36,20 @@
// FUNCTION: LEGO1 0x1003dd70
// FUNCTION: BETA10 0x100d3410
LegoROI* PickROI(MxLong p_a, MxLong p_b)
LegoROI* PickROI(MxLong p_x, MxLong p_y)
{
LegoVideoManager* videoManager = VideoManager();
Lego3DView* view = videoManager->Get3DManager()->GetLego3DView();
return (LegoROI*) view->Pick(p_a, p_b);
return (LegoROI*) view->Pick(p_x, p_y);
}
// FUNCTION: LEGO1 0x1003dd90
// FUNCTION: BETA10 0x100d3449
LegoROI* PickParentROI(MxLong p_a, MxLong p_b)
LegoROI* PickRootROI(MxLong p_x, MxLong p_y)
{
LegoVideoManager* videoManager = VideoManager();
Lego3DView* view = videoManager->Get3DManager()->GetLego3DView();
LegoROI* roi = (LegoROI*) view->Pick(p_a, p_b);
LegoROI* roi = (LegoROI*) view->Pick(p_x, p_y);
while (roi != NULL && roi->GetParentROI() != NULL) {
roi = (LegoROI*) roi->GetParentROI();
@ -58,11 +58,16 @@ LegoROI* PickParentROI(MxLong p_a, MxLong p_b)
return roi;
}
// STUB: LEGO1 0x1003ddc0
LegoEntity* PickEntity(MxLong, MxLong)
// FUNCTION: LEGO1 0x1003ddc0
LegoEntity* PickEntity(MxLong p_x, MxLong p_y)
{
// TODO
return NULL;
LegoROI* roi = PickRootROI(p_x, p_y);
if (roi == NULL) {
return NULL;
}
return roi->GetEntity();
}
// FUNCTION: LEGO1 0x1003dde0