Rename c_notificationDrag* enum (#1191)

* Improve functions with drag notifications

* Rename drag notifications

* A couple more addrs
This commit is contained in:
MS 2024-12-04 18:19:48 -05:00 committed by GitHub
parent c51a09af0b
commit 6ca54824e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 36 deletions

View file

@ -54,9 +54,17 @@ class LegoEventNotificationParam : public MxNotificationParam {
MxS32 GetY() const { return m_y; }
void SetROI(LegoROI* p_roi) { m_roi = p_roi; }
// FUNCTION: BETA10 0x1007d620
void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; }
// FUNCTION: BETA10 0x1007d6b0
void SetKey(MxU8 p_key) { m_key = p_key; }
// FUNCTION: BETA10 0x1007d650
void SetX(MxS32 p_x) { m_x = p_x; }
// FUNCTION: BETA10 0x1007d680
void SetY(MxS32 p_y) { m_y = p_y; }
protected:

View file

@ -43,26 +43,6 @@ MxLong LegoCameraController::Notify(MxParam& p_param)
{
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(
@ -77,6 +57,26 @@ MxLong LegoCameraController::Notify(MxParam& p_param)
));
}
} break;
case c_notificationDragStart: {
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_notificationDrag: {
OnMouseMove(
((LegoEventNotificationParam&) p_param).GetModifier(),
MxPoint32(((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY())
);
} break;
}
return SUCCESS;

View file

@ -379,7 +379,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
if (p_param.GetKey() == VK_SHIFT) {
if (m_unk0x195) {
m_unk0x80 = FALSE;
p_param.SetNotification(c_notificationDrag);
p_param.SetNotification(c_notificationDragEnd);
if (m_camera) {
m_camera->Notify(p_param);
@ -489,16 +489,24 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
}
// FUNCTION: LEGO1 0x1005cdf0
// FUNCTION: BETA10 0x10089cc1
MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
{
MxBool result = FALSE;
switch (p_param.GetNotification()) {
case c_notificationButtonDown:
m_x = p_param.GetX();
m_y = p_param.GetY();
m_unk0x80 = FALSE;
m_unk0x81 = TRUE;
StartAutoDragTimer();
break;
case c_notificationButtonUp:
StopAutoDragTimer();
if (m_unk0x80) {
p_param.SetNotification(c_notificationDrag);
p_param.SetNotification(c_notificationDragEnd);
result = TRUE;
}
else if (m_unk0x81) {
@ -511,13 +519,6 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
m_unk0x80 = FALSE;
m_unk0x81 = FALSE;
break;
case c_notificationButtonDown:
m_x = p_param.GetX();
m_y = p_param.GetY();
m_unk0x80 = FALSE;
m_unk0x81 = TRUE;
StartAutoDragTimer();
break;
case c_notificationMouseMove:
if (m_unk0x195) {
p_param.SetModifier(LegoEventNotificationParam::c_lButtonState);
@ -532,18 +533,19 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
MxS32 diffX = p_param.GetX() - m_x;
MxS32 diffY = p_param.GetY() - m_y;
MxS32 t = diffX * diffX + diffY * diffY;
if (m_unk0x195 || (diffX * diffX) + (diffY * diffY) > m_unk0x74) {
if (m_unk0x195 || t > m_unk0x74) {
StopAutoDragTimer();
m_unk0x80 = TRUE;
p_param.SetNotification(c_notificationDragEnd);
p_param.SetNotification(c_notificationDragStart);
result = TRUE;
p_param.SetX(m_x);
p_param.SetY(m_y);
}
}
else {
p_param.SetNotification(c_notificationDragStart);
p_param.SetNotification(c_notificationDrag);
result = TRUE;
}
}
@ -557,7 +559,7 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
p_param.SetX(m_x);
p_param.SetY(m_y);
p_param.SetModifier(LegoEventNotificationParam::c_lButtonState);
p_param.SetNotification(c_notificationDragEnd);
p_param.SetNotification(c_notificationDragStart);
result = TRUE;
}
else {
@ -571,12 +573,14 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
}
// FUNCTION: LEGO1 0x1005cfb0
// FUNCTION: BETA10 0x10089fc5
void LegoInputManager::StartAutoDragTimer()
{
m_autoDragTimerID = ::SetTimer(LegoOmni::GetInstance()->GetWindowHandle(), 1, m_autoDragTime, NULL);
}
// FUNCTION: LEGO1 0x1005cfd0
// FUNCTION: BETA10 0x1008a005
void LegoInputManager::StopAutoDragTimer()
{
if (m_autoDragTimerID) {

View file

@ -20,9 +20,9 @@ enum NotificationId {
c_notificationButtonDown = 9, // 100d6aa0
c_notificationMouseMove = 10, // 100d6aa0
c_notificationClick = 11, // 100d6aa0
c_notificationDragEnd = 12,
c_notificationDragStart = 13,
c_notificationDrag = 14,
c_notificationDragStart = 12,
c_notificationDrag = 13,
c_notificationDragEnd = 14,
c_notificationTimer = 15, // 100d6aa0
c_notificationControl = 17,
c_notificationEndAnim = 18, // 100d7e80
@ -55,7 +55,10 @@ class MxNotificationParam : public MxParam {
// FUNCTION: BETA10 0x1003c960
MxCore* GetSender() const { return m_sender; }
// FUNCTION: BETA10 0x1007d5c0
void SetNotification(NotificationId p_type) { m_type = p_type; }
// FUNCTION: BETA10 0x1007d5f0
void SetSender(MxCore* p_sender) { m_sender = p_sender; }
protected: