diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/events.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/events.h | 1 | ||||
-rw-r--r-- | engines/titanic/input_translator.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/input_translator.h | 1 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/main_game_window.h | 1 | ||||
-rw-r--r-- | engines/titanic/messages/mouse_messages.h | 14 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 1 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.cpp | 9 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.h | 1 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 1 |
13 files changed, 57 insertions, 0 deletions
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 7522a34737..c4fdb494a1 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -835,6 +835,7 @@ DEFFN(CMouseDragMsg); DEFFN(CMouseDragStartMsg); DEFFN(CMouseDragMoveMsg); DEFFN(CMouseDragEndMsg); +DEFFN(CMouseWheelMsg); DEFFN(CMoveToStartPosMsg); DEFFN(CMovieEndMsg); DEFFN(CMovieFrameMsg); @@ -1426,6 +1427,7 @@ void CSaveableObject::initClassList() { ADDFN(CMouseDragStartMsg, CMouseDragMsg); ADDFN(CMouseDragMoveMsg, CMouseDragMsg); ADDFN(CMouseDragEndMsg, CMouseDragMsg); + ADDFN(CMouseWheelMsg, CMouseMsg); ADDFN(CMoveToStartPosMsg, CMessage); ADDFN(CMovieEndMsg, CMessage); ADDFN(CMovieFrameMsg, CMessage); diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 9a246eb83e..6ca1b61ec0 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -70,6 +70,11 @@ void Events::pollEvents() { _mousePos = event.mouse; eventTarget()->rightButtonUp(_mousePos); break; + case Common::EVENT_WHEELUP: + case Common::EVENT_WHEELDOWN: + _mousePos = event.mouse; + eventTarget()->mouseWheel(_mousePos, event.type == Common::EVENT_WHEELUP); + break; case Common::EVENT_KEYDOWN: eventTarget()->keyDown(event.kbd); break; diff --git a/engines/titanic/events.h b/engines/titanic/events.h index 497c867217..03b271544a 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -65,6 +65,7 @@ public: virtual void middleButtonDoubleClick(const Point &mousePos) {} virtual void rightButtonDown(const Point &mousePos) {} virtual void rightButtonUp(const Point &mousePos) {} + virtual void mouseWheel(const Point &mousePos, bool wheelUp) {} virtual void keyDown(Common::KeyState keyState) {} virtual void keyUp(Common::KeyState keyState) {} }; diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index ce272d152c..a909b8070e 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -90,6 +90,11 @@ void CInputTranslator::rightButtonUp(int special, const Point &pt) { _inputHandler->handleMessage(msg); } +void CInputTranslator::mouseWheel(bool wheelUp, const Point &pt) { + CMouseWheelMsg msg(pt, wheelUp); + _inputHandler->handleMessage(msg); +} + void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) { CMouseDoubleClickMsg msg(pt, MB_RIGHT); _inputHandler->handleMessage(msg); diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h index d92157bccc..66dcaa1cbe 100644 --- a/engines/titanic/input_translator.h +++ b/engines/titanic/input_translator.h @@ -50,6 +50,7 @@ public: void middleButtonDoubleClick(int special, const Point &pt); void rightButtonDown(int special, const Point &pt); void rightButtonUp(int special, const Point &pt); + void mouseWheel(bool wheelUp, const Point &pt); void rightButtonDoubleClick(int special, const Point &pt); void keyDown(const Common::KeyState &keyState); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 8785921640..4ee7154e76 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -341,6 +341,14 @@ void CMainGameWindow::rightButtonUp(const Point &mousePos) { HANDLE_MESSAGE(rightButtonUp) } +void CMainGameWindow::mouseWheel(const Point &mousePos, bool wheelUp) { + if (!isMouseControlEnabled()) + return; + + _gameManager->_inputTranslator.mouseWheel(wheelUp, mousePos); + mouseChanged(); +} + void CMainGameWindow::rightButtonDoubleClick(const Point &mousePos) { if (!isMouseControlEnabled()) return; diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 5065b9fa58..c70aa478b5 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -103,6 +103,7 @@ public: virtual void middleButtonUp(const Point &mousePos); virtual void rightButtonDown(const Point &mousePos); virtual void rightButtonUp(const Point &mousePos); + virtual void mouseWheel(const Point &mousePos, bool wheelUp); virtual void keyDown(Common::KeyState keyState); virtual void keyUp(Common::KeyState keyState); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index a10f3b42a8..05f9685c04 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -101,6 +101,20 @@ public: static void generate(); }; +class CMouseWheelMsg : public CMouseMsg { +public: + bool _wheelUp; +public: + CLASSDEF; + CMouseWheelMsg() : CMouseMsg(), _wheelUp(false) {} + CMouseWheelMsg(const Point &pt, bool wheelUp) : + CMouseMsg(pt, 0), _wheelUp(wheelUp) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + class CMouseDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index d9f00c2974..689ff0162f 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -37,6 +37,7 @@ BEGIN_MESSAGE_MAP(CPetControl, CGameObject) ON_MESSAGE(MouseDragEndMsg) ON_MESSAGE(MouseButtonUpMsg) ON_MESSAGE(MouseDoubleClickMsg) + ON_MESSAGE(MouseWheelMsg) ON_MESSAGE(KeyCharMsg) ON_MESSAGE(VirtualKeyCharMsg) ON_MESSAGE(TimerMsg) @@ -317,6 +318,13 @@ bool CPetControl::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return _sections[_currentArea]->MouseDoubleClickMsg(msg); } +bool CPetControl::MouseWheelMsg(CMouseWheelMsg *msg) { + if (!containsPt(msg->_mousePos) || isInputLocked()) + return false; + + return _sections[_currentArea]->MouseWheelMsg(msg); +} + bool CPetControl::KeyCharMsg(CKeyCharMsg *msg) { if (isInputLocked()) return false; diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index d42dff598c..e95643b967 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -116,6 +116,7 @@ protected: bool MouseDragEndMsg(CMouseDragEndMsg *msg); bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + bool MouseWheelMsg(CMouseWheelMsg *msg); bool KeyCharMsg(CKeyCharMsg *msg); bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); bool TimerMsg(CTimerMsg *msg); diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 58dcd57384..10b3637547 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -203,6 +203,15 @@ bool CPetConversations::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { || _scrollUp.MouseDoubleClickMsg(msg->_mousePos); } +bool CPetConversations::MouseWheelMsg(CMouseWheelMsg *msg) { + if (msg->_wheelUp) + scrollUp(); + else + scrollDown(); + + return true; +} + bool CPetConversations::KeyCharMsg(CKeyCharMsg *msg) { Common::KeyState keyState; keyState.ascii = msg->_key; diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index efb7db4277..1837e5df2a 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -164,6 +164,7 @@ public: virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + virtual bool MouseWheelMsg(CMouseWheelMsg *msg); virtual bool KeyCharMsg(CKeyCharMsg *msg); virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 9e9afe6c21..c68aa90411 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -106,6 +106,7 @@ public: virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; } virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; } + virtual bool MouseWheelMsg(CMouseWheelMsg *msg) { return false; } virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; } virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } |