mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 15:37:55 -05:00
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:
parent
770da22a1d
commit
9256554406
4 changed files with 77 additions and 6 deletions
|
@ -11,6 +11,13 @@
|
|||
// SIZE 0x20
|
||||
class LegoEventNotificationParam : public MxNotificationParam {
|
||||
public:
|
||||
enum {
|
||||
c_lButtonState = 0x01,
|
||||
c_rButtonState = 0x02,
|
||||
c_modKey1 = 0x04,
|
||||
c_modKey2 = 0x08,
|
||||
};
|
||||
|
||||
// FUNCTION: LEGO1 0x10028690
|
||||
MxNotificationParam* Clone() override
|
||||
{
|
||||
|
@ -35,7 +42,11 @@ class LegoEventNotificationParam : public MxNotificationParam {
|
|||
|
||||
inline MxU8 GetModifier() { return m_modifier; }
|
||||
inline MxU8 GetKey() const { return m_key; }
|
||||
|
||||
// FUNCTION: LEGO1 0x10012190
|
||||
inline MxS32 GetX() const { return m_x; }
|
||||
|
||||
// FUNCTION: LEGO1 0x100121a0
|
||||
inline MxS32 GetY() const { return m_y; }
|
||||
|
||||
inline void SetROI(LegoROI* p_roi) { m_roi = p_roi; }
|
||||
|
|
|
@ -31,11 +31,48 @@ 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
|
||||
|
@ -83,6 +120,7 @@ void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3&
|
|||
// STUB: LEGO1 0x100123e0
|
||||
void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012740
|
||||
|
|
|
@ -477,16 +477,35 @@ 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]);
|
||||
|
||||
// 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
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
class MxPoint32 {
|
||||
public:
|
||||
MxPoint32() {}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012170
|
||||
MxPoint32(MxS32 p_x, MxS32 p_y) { CopyFrom(p_x, p_y); }
|
||||
|
||||
MxPoint32(const MxPoint32& p_point)
|
||||
{
|
||||
this->m_x = p_point.m_x;
|
||||
|
|
Loading…
Reference in a new issue