Implement LegoCameraController::Notify & TimeROI::FUN_100a9b40 (#707)

* Implement LegoCameraController::Notify & TimeROI::FUN_100a9b40

* Fixes/matches

* Style

* Fix

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-03-21 10:39:23 -04:00 committed by GitHub
parent 770da22a1d
commit 9256554406
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 77 additions and 6 deletions

View file

@ -11,6 +11,13 @@
// SIZE 0x20 // SIZE 0x20
class LegoEventNotificationParam : public MxNotificationParam { class LegoEventNotificationParam : public MxNotificationParam {
public: public:
enum {
c_lButtonState = 0x01,
c_rButtonState = 0x02,
c_modKey1 = 0x04,
c_modKey2 = 0x08,
};
// FUNCTION: LEGO1 0x10028690 // FUNCTION: LEGO1 0x10028690
MxNotificationParam* Clone() override MxNotificationParam* Clone() override
{ {
@ -35,7 +42,11 @@ class LegoEventNotificationParam : public MxNotificationParam {
inline MxU8 GetModifier() { return m_modifier; } inline MxU8 GetModifier() { return m_modifier; }
inline MxU8 GetKey() const { return m_key; } inline MxU8 GetKey() const { return m_key; }
// FUNCTION: LEGO1 0x10012190
inline MxS32 GetX() const { return m_x; } inline MxS32 GetX() const { return m_x; }
// FUNCTION: LEGO1 0x100121a0
inline MxS32 GetY() const { return m_y; } inline MxS32 GetY() const { return m_y; }
inline void SetROI(LegoROI* p_roi) { m_roi = p_roi; } inline void SetROI(LegoROI* p_roi) { m_roi = p_roi; }

View file

@ -31,11 +31,48 @@ MxResult LegoCameraController::Create()
return LegoPointOfViewController::Create(VideoManager()->Get3DManager()->GetLego3DView()); return LegoPointOfViewController::Create(VideoManager()->Get3DManager()->GetLego3DView());
} }
// STUB: LEGO1 0x10012020 // FUNCTION: LEGO1 0x10012020
MxLong LegoCameraController::Notify(MxParam& p_param) MxLong LegoCameraController::Notify(MxParam& p_param)
{ {
// TODO switch (((MxNotificationParam&) p_param).GetNotification()) {
return 0; 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 // FUNCTION: LEGO1 0x100121b0
@ -83,6 +120,7 @@ void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3&
// STUB: LEGO1 0x100123e0 // STUB: LEGO1 0x100123e0
void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32) void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32)
{ {
// TODO
} }
// FUNCTION: LEGO1 0x10012740 // FUNCTION: LEGO1 0x10012740

View file

@ -477,16 +477,35 @@ TimeROI::TimeROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, LegoTime p_t
m_time = p_time; m_time = p_time;
} }
// STUB: LEGO1 0x100a9b40 // FUNCTION: LEGO1 0x100a9b40
void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) 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]);
// TODO: Figure out how to get type right for the call
// TODO: Fix constness of vector/matrix functions
#ifdef COMPAT_MODE
Vector3 worldPosition(m_local2world[3]);
((Vector3&) targetPosition).Sub(&worldPosition);
#else
((Vector3&) targetPosition).Sub(&Vector3(m_local2world[3]));
#endif
float division = time * 0.001;
((Vector3&) targetPosition).Div(division);
FUN_100a5a30(targetPosition);
}
} }
// FUNCTION: LEGO1 0x100a9bf0 // FUNCTION: LEGO1 0x100a9bf0
LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha) 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) { if (p_param == NULL) {
return FALSE; return FALSE;
} }

View file

@ -6,7 +6,10 @@
class MxPoint32 { class MxPoint32 {
public: public:
MxPoint32() {} MxPoint32() {}
// FUNCTION: LEGO1 0x10012170
MxPoint32(MxS32 p_x, MxS32 p_y) { CopyFrom(p_x, p_y); } MxPoint32(MxS32 p_x, MxS32 p_y) { CopyFrom(p_x, p_y); }
MxPoint32(const MxPoint32& p_point) MxPoint32(const MxPoint32& p_point)
{ {
this->m_x = p_point.m_x; this->m_x = p_point.m_x;