From 397c2fd48b6eae68146dd46ae216b9c3f9343a5a Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:30:05 -0400 Subject: [PATCH] Implement LegoCameraController::Notify & TimeROI::FUN_100a9b40 --- .../include/legoeventnotificationparam.h | 13 ++++++ .../src/entity/legocameracontroller.cpp | 40 +++++++++++++++++-- LEGO1/lego/sources/roi/legoroi.cpp | 18 +++++++-- LEGO1/omni/include/mxpoint32.h | 3 ++ 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index a9c13632..305de0d6 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -11,6 +11,13 @@ // SIZE 0x20 class LegoEventNotificationParam : public MxNotificationParam { public: + enum { + c_lButtonState = 1, + c_rButtonState = 2, + c_modKey1 = 4, + c_modKey2 = 8, + }; + // FUNCTION: LEGO1 0x10028690 MxNotificationParam* Clone() override { @@ -58,4 +65,10 @@ class LegoEventNotificationParam : public MxNotificationParam { // SYNTHETIC: LEGO1 0x100287e0 // LegoEventNotificationParam::~LegoEventNotificationParam +// SYNTHETIC: LEGO1 0x10012190 +// LegoEventNotificationParam::GetX + +// SYNTHETIC: LEGO1 0x100121a0 +// LegoEventNotificationParam::GetY + #endif // LEGOEVENTNOTIFICATIONPARAM_H diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index a007193e..a75f4f69 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -31,11 +31,43 @@ MxResult LegoCameraController::Create() return LegoPointOfViewController::Create(VideoManager()->Get3DManager()->GetLego3DView()); } -// STUB: LEGO1 0x10012020 +// FUNCTION: LEGO1 0x10012020 MxLong LegoCameraController::Notify(MxParam& p_param) { - // TODO - return 0; + switch (((MxNotificationParam&) p_param).GetNotification()) { + case c_notificationDragEnd: { + if ((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_lButtonState) + OnLButtonDown(MxPoint32( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + )); + else if ((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_rButtonState) + OnRButtonDown(MxPoint32( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + )); + } break; + case c_notificationDragStart: { + OnMouseMove( + ((LegoEventNotificationParam&) p_param).GetModifier(), + MxPoint32(((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY()) + ); + } break; + case c_notificationDrag: { + if (((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_lButtonState) == 0) + OnLButtonUp(MxPoint32( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + )); + else if (((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_rButtonState) == 0) + OnRButtonUp(MxPoint32( + ((LegoEventNotificationParam&) p_param).GetX(), + ((LegoEventNotificationParam&) p_param).GetY() + )); + + } break; + } + return SUCCESS; } // FUNCTION: LEGO1 0x100121b0 @@ -81,7 +113,7 @@ void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3& } // STUB: LEGO1 0x100123e0 -void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32) +void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_un) { } diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 8543a4a0..4a73d9d0 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -477,16 +477,28 @@ TimeROI::TimeROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, LegoTime p_t m_time = p_time; } -// STUB: LEGO1 0x100a9b40 +// FUNCTION: LEGO1 0x100a9b40 void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) { - // TODO + LegoTime time = p_time - m_time; + if (time) { + m_time = p_time; + + Mx3DPointFloat targetPosition(p_matrix[3]); + + Vector3 worldPosition(GetWorldPosition()); + targetPosition.Sub(&worldPosition); + + float division = time * 0.001; + targetPosition.Div(division); + + FUN_100a5a30(targetPosition); + } } // FUNCTION: LEGO1 0x100a9bf0 LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha) { - // TODO if (p_param == NULL) { return FALSE; } diff --git a/LEGO1/omni/include/mxpoint32.h b/LEGO1/omni/include/mxpoint32.h index 37c6dd19..a9321c2c 100644 --- a/LEGO1/omni/include/mxpoint32.h +++ b/LEGO1/omni/include/mxpoint32.h @@ -30,4 +30,7 @@ class MxPoint32 { MxS32 m_y; // 0x04 }; +// SYNTHETIC: LEGO1 0x10012170 +// MxPoint32::MxPoint32 + #endif // MXPOINT32_H