diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index fc16dfcf..5b83a715 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -42,7 +42,7 @@ class LegoControlManager : public MxCore { undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x0c; // 0x0c undefined m_unk0x10; // 0x10 - undefined m_padding0x08[0x4c]; // 0x14 + undefined m_padding0x14[0x4c]; // 0x14 }; #endif // LEGOCONTROLMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index aefbcc37..9eb6c7b5 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -29,7 +29,7 @@ class LegoEventNotificationParam : public MxNotificationParam { MxS32 p_y, MxU8 p_key ) - : MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_roi(0) + : MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_roi(NULL) { } diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 027577df..25b7addf 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -109,7 +109,6 @@ class LegoInputManager : public MxPresenter { void ProcessEvents(); MxBool ProcessOneEvent(LegoEventNotificationParam& p_param); - MxBool FUN_1005cdf0(LegoEventNotificationParam& p_param); // SYNTHETIC: LEGO1 0x1005b8d0 diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index f1ad14c5..ce9963e4 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -31,7 +31,8 @@ class LegoVideoManager : public MxVideoManager { override; // vtable+0x2c virtual MxResult RealizePalette(MxPalette*) override; // vtable+0x30 virtual void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34 - virtual MxPresenter* VTable0x38(MxS32 p_x, MxS32 p_y); // vtable+0x38 + virtual MxPresenter* GetPresenterAt(MxS32 p_x, MxS32 p_y); // vtable+0x38 + // FUNCTION: LEGO1 0x1007ab10 virtual LegoUnknown100d9d00* VTable0x3c() { return m_unk0x100d9d00; } // vtable+0x3c diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 92bd4061..b558f0a5 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -285,12 +285,14 @@ void LegoInputManager::ProcessEvents() MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) { MxBool processRoi; + if (p_param.GetType() == c_notificationKeyPress) { if (!Lego()->IsTimerRunning() || p_param.GetKey() == 0x13) { - if (p_param.GetKey() == 16) { + if (p_param.GetKey() == 0x10) { if (m_unk0x195) { m_unk0x80 = 0; p_param.SetType(c_notificationDrag); + if (m_camera) { m_camera->Notify(p_param); } @@ -301,9 +303,10 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) } LegoNotifyListCursor cursor(m_keyboardNotifyList); - MxCore* obj; - while (cursor.Next(obj)) { - if (obj->Notify(p_param) != 0) { + MxCore* target; + + while (cursor.Next(target)) { + if (target->Notify(p_param) != 0) { return TRUE; } } @@ -312,14 +315,15 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) else { if (!Lego()->IsTimerRunning()) { processRoi = TRUE; + if (m_unk0x335 != 0) { if (p_param.GetType() == c_notificationButtonDown) { LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, ' '); - LegoNotifyListCursor cursor(m_keyboardNotifyList); - MxCore* obj; - while (cursor.Next(obj)) { - if (obj->Notify(p_param) != 0) { + MxCore* target; + + while (cursor.Next(target)) { + if (target->Notify(notification) != 0) { return TRUE; } } @@ -338,50 +342,60 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) } if (p_param.GetType() == c_notificationButtonDown) { - MxPresenter* presenter = VideoManager()->VTable0x38(p_param.GetX(), p_param.GetY()); + MxPresenter* presenter = VideoManager()->GetPresenterAt(p_param.GetX(), p_param.GetY()); + if (presenter) { if (presenter->GetDisplayZ() < 0) { processRoi = FALSE; + if (m_controlManager->FUN_10029210(p_param, presenter)) { return TRUE; } } else { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); + if (roi == NULL && m_controlManager->FUN_10029210(p_param, presenter)) { return TRUE; } } } } - - if (p_param.GetType() == c_notificationButtonUp) { - if (g_unk0x100f31b0 != -1 || !m_controlManager->GetUnknown0x10() || + else if (p_param.GetType() == c_notificationButtonUp) { + if (g_unk0x100f31b0 != -1 || m_controlManager->GetUnknown0x10() || m_controlManager->GetUnknown0x0c() == 1) { - MxBool result2 = m_controlManager->FUN_10029210(p_param, NULL); + MxBool result = m_controlManager->FUN_10029210(p_param, NULL); KillTimer(); + m_unk0x80 = 0; m_unk0x81 = 0; - return result2; + return result; } - else { - if (FUN_1005cdf0(p_param)) { - if (processRoi && p_param.GetType() == c_notificationType11) { - LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); - p_param.SetROI(roi); - if (roi && roi->GetUnk0x0c() == 1) { - // TODO: enumerate through some list in ROI - } - } + } - if (m_camera && m_camera->Notify(p_param) != 0) { + if (FUN_1005cdf0(p_param)) { + if (processRoi && p_param.GetType() == c_notificationType11) { + LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); + p_param.SetROI(roi); + + if (roi && roi->GetUnk0x0c() == 1) { + for (OrientableROI* oroi = roi->GetUnknown0xd4(); oroi; oroi = oroi->GetUnknown0xd4()) + roi = (LegoROI*) oroi; + + LegoEntity* entity = roi->GetUnknown0x104(); + if (entity && entity->Notify(p_param) != 0) { return TRUE; } } } + + if (m_camera && m_camera->Notify(p_param) != 0) { + return TRUE; + } } } } + return FALSE; } diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index ef5b4393..7f1b46e7 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -331,7 +331,7 @@ void LegoVideoManager::DrawFPS() } // FUNCTION: LEGO1 0x1007c080 -MxPresenter* LegoVideoManager::VTable0x38(MxS32 p_x, MxS32 p_y) +MxPresenter* LegoVideoManager::GetPresenterAt(MxS32 p_x, MxS32 p_y) { MxPresenterListCursor cursor(m_presenters); MxPresenter* presenter; diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index 36b8ae50..adbd493d 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -32,6 +32,7 @@ class OrientableROI : public ROI { const float* GetWorldPosition() const { return m_local2world[3]; } const float* GetWorldDirection() const { return m_local2world[2]; } const float* GetWorldUp() const { return m_local2world[1]; } + OrientableROI* GetUnknown0xd4() const { return m_unk0xd4; } protected: MxMatrix m_local2world; // 0x10 @@ -46,7 +47,7 @@ class OrientableROI : public ROI { Mx3DPointFloat m_unk0x94; // 0x94 BoundingSphere m_world_bounding_sphere; // 0xa8 Mx3DPointFloat m_world_velocity; // 0xc0 - undefined4 m_unk0xd4; // 0xd4 + OrientableROI* m_unk0xd4; // 0xd4 undefined4 m_unk0xd8; // 0xd8 };