diff options
author | Paul Gilbert | 2016-03-18 21:34:04 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-18 21:34:04 -0400 |
commit | 9565fbaeac8f48ea0090ebbd751a18eacc6d1230 (patch) | |
tree | 171dfb6d26b10897f93062d5871364b83929c4a5 /engines/titanic/messages | |
parent | 61947ef56b77ab4778adafde93388fb526911eb7 (diff) | |
download | scummvm-rg350-9565fbaeac8f48ea0090ebbd751a18eacc6d1230.tar.gz scummvm-rg350-9565fbaeac8f48ea0090ebbd751a18eacc6d1230.tar.bz2 scummvm-rg350-9565fbaeac8f48ea0090ebbd751a18eacc6d1230.zip |
TITANIC: Implement input translator event methods
Diffstat (limited to 'engines/titanic/messages')
-rw-r--r-- | engines/titanic/messages/messages.cpp | 57 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 18 | ||||
-rw-r--r-- | engines/titanic/messages/mouse_messages.h | 14 |
3 files changed, 89 insertions, 0 deletions
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 00debc562c..b44748d899 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -21,6 +21,7 @@ */ #include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/core/game_object.h" #include "titanic/core/tree_item.h" @@ -66,4 +67,60 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) c return result; } +bool CMessage::isMouseMsg() const { + return dynamic_cast<const CMouseMsg *>(this) != nullptr; +} + +bool CMessage::isButtonDownMsg() const { + return dynamic_cast<const CMouseButtonDownMsg *>(this) != nullptr; +} + +bool CMessage::isButtonUpMsg() const { + return dynamic_cast<const CMouseButtonUpMsg *>(this) != nullptr; +} + +bool CMessage::isMouseMoveMsg() const { + return dynamic_cast<const CMouseMoveMsg *>(this) != nullptr; +} + +bool CMessage::isDoubleClickMsg() const { + return dynamic_cast<const CMouseButtonDoubleClickMsg *>(this) != nullptr; +} + +bool CMessage::isEnterRoomMsg() const { + return dynamic_cast<const CEnterRoomMsg *>(this) != nullptr; +} + +bool CMessage::isPreEnterRoomMsg() const { + return dynamic_cast<const CPreEnterRoomMsg *>(this) != nullptr; +} + +bool CMessage::isleaveRoomMsg() const { + return dynamic_cast<const CLeaveRoomMsg *>(this) != nullptr; +} + +bool CMessage::isEnterNodeMsg() const { + return dynamic_cast<const CEnterNodeMsg *>(this) != nullptr; +} + +bool CMessage::isPreEnterNodeMsg() const { + return dynamic_cast<const CPreEnterNodeMsg *>(this) != nullptr; +} + +bool CMessage::isLeaveNodeMsg() const { + return dynamic_cast<const CLeaveNodeMsg *>(this) != nullptr; +} + +bool CMessage::isEnterViewMsg() const { + return dynamic_cast<const CEnterViewMsg *>(this) != nullptr; +} + +bool CMessage::isPreEnterViewMsg() const { + return dynamic_cast<const CPreEnterViewMsg *>(this) != nullptr; +} + +bool CMessage::isLeaveViewMsg() const { + return dynamic_cast<const CLeaveViewMsg *>(this) != nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 958275868d..d22144332b 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -59,6 +59,21 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + virtual bool isMouseMsg() const; + virtual bool isButtonDownMsg() const; + virtual bool isButtonUpMsg() const; + virtual bool isMouseMoveMsg() const; + virtual bool isDoubleClickMsg() const; + virtual bool isEnterRoomMsg() const; + virtual bool isPreEnterRoomMsg() const; + virtual bool isleaveRoomMsg() const; + virtual bool isEnterNodeMsg() const; + virtual bool isPreEnterNodeMsg() const; + virtual bool isLeaveNodeMsg() const; + virtual bool isEnterViewMsg() const; + virtual bool isPreEnterViewMsg() const; + virtual bool isLeaveViewMsg() const; }; MSGTARGET(CEditControlMsg); @@ -244,6 +259,9 @@ MESSAGE1(CDropobjectMsg, int, value, 0); MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); MESSAGE1(CEjectCylinderMsg, int, value, 0); +MESSAGE1(CPreEnterNodeMsg, CNodeItem *, node, nullptr); +MESSAGE1(CPreEnterRoomMsg, CRoomItem *, room, nullptr); +MESSAGE1(CPreEnterViewMsg, CViewItem *, view, nullptr); MESSAGE1(CEnterNodeMsg, CNodeItem *, node, nullptr); MESSAGE1(CEnterRoomMsg, CRoomItem *, room, nullptr); MESSAGE1(CEnterViewMsg, CViewItem *, view, nullptr); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 0386eb6bd9..e36b54dcc0 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -23,10 +23,13 @@ #ifndef TITANIC_MOUSE_MESSAGES_H #define TITANIC_MOUSE_MESSAGES_H +#include "common/rect.h" #include "titanic/messages/messages.h" namespace Titanic { +enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; + class CMouseMsg : public CMessage { public: int _buttons; @@ -34,12 +37,16 @@ public: public: CLASSDEF CMouseMsg() : _buttons(0) {} + CMouseMsg(const Common::Point &pt, int buttons) : + _mousePos(pt), _buttons(buttons) {} }; MSGTARGET(CMouseMoveMsg); class CMouseMoveMsg : public CMouseMsg { public: CLASSDEF + CMouseMoveMsg() : CMouseMsg() {} + CMouseMoveMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -54,12 +61,15 @@ public: public: CLASSDEF CMouseButtonMsg() : CMouseMsg(), _field10(0) {} + CMouseButtonMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} }; MSGTARGET(CMouseButtonDownMsg); class CMouseButtonDownMsg : public CMouseButtonMsg { public: CLASSDEF + CMouseButtonDownMsg() : CMouseButtonMsg() {} + CMouseButtonDownMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -72,6 +82,8 @@ MSGTARGET(CMouseButtonUpMsg); class CMouseButtonUpMsg : public CMouseButtonMsg { public: CLASSDEF + CMouseButtonUpMsg() : CMouseButtonMsg() {} + CMouseButtonUpMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -84,6 +96,8 @@ MSGTARGET(CMouseButtonDoubleClickMsg); class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF + CMouseButtonDoubleClickMsg() : CMouseButtonMsg() {} + CMouseButtonDoubleClickMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} virtual bool handleMessage(const CMouseButtonDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { |