aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-06 23:28:42 -0400
committerPaul Gilbert2016-04-06 23:28:42 -0400
commit51dc36a9a52f95815b4b1109b080d070247bf247 (patch)
treed53d8c288a593fd897536f943debbd2d7b46275e
parent51df4d98d3a066e092f34cf7968c436a3e430df2 (diff)
downloadscummvm-rg350-51dc36a9a52f95815b4b1109b080d070247bf247.tar.gz
scummvm-rg350-51dc36a9a52f95815b4b1109b080d070247bf247.tar.bz2
scummvm-rg350-51dc36a9a52f95815b4b1109b080d070247bf247.zip
TITANIC: Furhter in-progress message handling conversion
-rw-r--r--engines/titanic/core/tree_item.h2
-rw-r--r--engines/titanic/core/view_item.cpp28
-rw-r--r--engines/titanic/core/view_item.h8
-rw-r--r--engines/titanic/game/arboretum_gate.cpp24
-rw-r--r--engines/titanic/game/arboretum_gate.h24
-rw-r--r--engines/titanic/game/bar_bell.h3
-rw-r--r--engines/titanic/game/bomb.h3
-rw-r--r--engines/titanic/game/cdrom.h6
-rw-r--r--engines/titanic/game/cdrom_tray.h5
-rw-r--r--engines/titanic/game/chicken_cooler.h3
-rw-r--r--engines/titanic/game/dead_area.h4
-rw-r--r--engines/titanic/game/doorbot_elevator_handler.h3
-rw-r--r--engines/titanic/game/end_sequence_control.h3
-rw-r--r--engines/titanic/game/fan_noises.h3
-rw-r--r--engines/titanic/game/get_lift_eye2.h3
-rw-r--r--engines/titanic/game/light.h3
-rw-r--r--engines/titanic/game/light_switch.h3
-rw-r--r--engines/titanic/game/parrot/player_meets_parrot.h3
-rw-r--r--engines/titanic/game/pet/pet_monitor.h3
-rw-r--r--engines/titanic/game/pet/pet_position.h3
-rw-r--r--engines/titanic/game/pet/pet_transport.h3
-rw-r--r--engines/titanic/game/sgt/sgt_state_room.h3
-rw-r--r--engines/titanic/game/ship_setting.h3
-rw-r--r--engines/titanic/game/start_action.h4
-rw-r--r--engines/titanic/game/transport/lift.h3
-rw-r--r--engines/titanic/game/transport/pellerator.h3
-rw-r--r--engines/titanic/game/up_lighter.h3
-rw-r--r--engines/titanic/game/volume_control.h2
-rw-r--r--engines/titanic/gfx/st_button.cpp12
-rw-r--r--engines/titanic/gfx/st_button.h12
-rw-r--r--engines/titanic/messages/messages.cpp28
-rw-r--r--engines/titanic/messages/messages.h106
-rw-r--r--engines/titanic/messages/mouse_messages.h62
-rw-r--r--engines/titanic/messages/pet_messages.h10
-rw-r--r--engines/titanic/moves/enter_bridge.h3
-rw-r--r--engines/titanic/npcs/barbot.h3
-rw-r--r--engines/titanic/npcs/liftbot.h3
-rw-r--r--engines/titanic/pet_control/pet_control.cpp60
-rw-r--r--engines/titanic/pet_control/pet_control.h30
-rw-r--r--engines/titanic/pet_control/pet_element.cpp4
-rw-r--r--engines/titanic/pet_control/pet_element.h2
-rw-r--r--engines/titanic/pet_control/pet_frame.cpp4
-rw-r--r--engines/titanic/pet_control/pet_frame.h4
-rw-r--r--engines/titanic/pet_control/pet_section.h16
-rw-r--r--engines/titanic/sound/auto_music_player.h3
-rw-r--r--engines/titanic/sound/music_player.h3
-rw-r--r--engines/titanic/sound/node_auto_sound_player.h3
-rw-r--r--engines/titanic/sound/room_auto_sound_player.h3
-rw-r--r--engines/titanic/sound/room_trigger_auto_music_player.h2
49 files changed, 230 insertions, 304 deletions
diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h
index f5b1407fcd..d34f963584 100644
--- a/engines/titanic/core/tree_item.h
+++ b/engines/titanic/core/tree_item.h
@@ -29,6 +29,7 @@ namespace Titanic {
class CGameManager;
class CDontSaveFileItem;
+class CMessage;
class CNamedItem;
class CPetControl;
class CProjectItem;
@@ -36,6 +37,7 @@ class CScreenManager;
class CRoomItem;
class CTreeItem: public CMessageTarget {
+ friend class CMessage;
DECLARE_MESSAGE_MAP
private:
CTreeItem *_parent;
diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index 26e0d86d27..8120b3c671 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -168,9 +168,9 @@ void CViewItem::enterView(CViewItem *newView) {
}
}
-bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) {
- if (msg._buttons & MB_LEFT) {
- if (!handleMouseMsg(&msg, true)) {
+bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (msg->_buttons & MB_LEFT) {
+ if (!handleMouseMsg(msg, true)) {
CGameManager *gm = getGameManager();
if (gm->test54()) {
findNode()->findRoom();
@@ -178,7 +178,7 @@ bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) {
CLinkItem *linkItem = dynamic_cast<CLinkItem *>(
findChildInstanceOf(CLinkItem::_type));
while (linkItem) {
- if (linkItem->_bounds.contains(msg._mousePos)) {
+ if (linkItem->_bounds.contains(msg->_mousePos)) {
gm->_gameState.triggerLink(linkItem);
return true;
}
@@ -193,24 +193,24 @@ bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) {
return true;
}
-bool CViewItem::MouseButtonUpMsg(CMouseButtonUpMsg &msg) {
- if (msg._buttons & MB_LEFT)
- handleMouseMsg(&msg, false);
+bool CViewItem::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ if (msg->_buttons & MB_LEFT)
+ handleMouseMsg(msg, false);
return true;
}
-bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg &msg) {
- if (msg._buttons & MB_LEFT)
- handleMouseMsg(&msg, false);
+bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
+ if (msg->_buttons & MB_LEFT)
+ handleMouseMsg(msg, false);
return true;
}
-bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) {
+bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) {
CScreenManager *screenManager = CScreenManager::_screenManagerPtr;
- if (handleMouseMsg(&msg, true)) {
+ if (handleMouseMsg(msg, true)) {
screenManager->_mouseCursor->setCursor(CURSOR_ARROW);
} else {
// Iterate through each link item, and if any is highlighted,
@@ -218,7 +218,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) {
CTreeItem *treeItem = getFirstChild();
while (treeItem) {
CLinkItem *linkItem = dynamic_cast<CLinkItem *>(treeItem);
- if (linkItem && linkItem->_bounds.contains(msg._mousePos)) {
+ if (linkItem && linkItem->_bounds.contains(msg->_mousePos)) {
screenManager->_mouseCursor->setCursor(linkItem->_cursorId);
return true;
}
@@ -226,7 +226,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) {
treeItem = treeItem->getNextSibling();
}
- if (!handleMouseMsg(&msg, false))
+ if (!handleMouseMsg(msg, false))
screenManager->_mouseCursor->setCursor(CURSOR_ARROW);
}
diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h
index f439929f5e..95edc7a49a 100644
--- a/engines/titanic/core/view_item.h
+++ b/engines/titanic/core/view_item.h
@@ -52,10 +52,10 @@ protected:
int _field50;
int _field54;
protected:
- virtual bool MouseButtonDownMsg(CMouseButtonDownMsg &msg);
- virtual bool MouseButtonUpMsg(CMouseButtonUpMsg &msg);
- virtual bool MouseMoveMsg(CMouseMoveMsg &msg);
- virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg &msg);
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ virtual bool MouseMoveMsg(CMouseMoveMsg *msg);
+ virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
public:
int _viewNumber;
public:
diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp
index 6770430cdc..f3e3301136 100644
--- a/engines/titanic/game/arboretum_gate.cpp
+++ b/engines/titanic/game/arboretum_gate.cpp
@@ -24,6 +24,16 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CArboretumGate, CBackground)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(LeaveViewMsg)
+ ON_MESSAGE(TurnOff)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
int CArboretumGate::_v1;
int CArboretumGate::_v2;
int CArboretumGate::_v3;
@@ -133,17 +143,17 @@ void CArboretumGate::load(SimpleFile *file) {
CBackground::load(file);
}
-bool CArboretumGate::handleMessage(CActMsg &msg) { return false; }
-bool CArboretumGate::handleMessage(CLeaveViewMsg &msg) { return false; }
-bool CArboretumGate::handleMessage(CTurnOff &msg) { return false; }
-bool CArboretumGate::handleMessage(CMouseButtonDownMsg &msg) { return false; }
+bool CArboretumGate::ActMsg(CActMsg *msg) { return false; }
+bool CArboretumGate::LeaveViewMsg(CLeaveViewMsg *msg) { return false; }
+bool CArboretumGate::TurnOff(CTurnOff *msg) { return false; }
+bool CArboretumGate::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; }
-bool CArboretumGate::handleMessage(CEnterViewMsg &msg) {
+bool CArboretumGate::EnterViewMsg(CEnterViewMsg *msg) {
warning("CArboretumGate::handleEvent");
return false;
}
-bool CArboretumGate::handleMessage(CTurnOn &msg) { return false; }
-bool CArboretumGate::handleMessage(CMovieEndMsg &msg) { return false; }
+bool CArboretumGate::TurnOn(CTurnOn *msg) { return false; }
+bool CArboretumGate::MovieEndMsg(CMovieEndMsg *msg) { return false; }
} // End of namespace Titanic
diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h
index a176e93ed9..9b0674fe75 100644
--- a/engines/titanic/game/arboretum_gate.h
+++ b/engines/titanic/game/arboretum_gate.h
@@ -29,14 +29,8 @@
namespace Titanic {
-class CArboretumGate : public CBackground,
- public CActMsgTarget,
- public CLeaveViewMsgTarget,
- public CTurnOffTarget,
- public CMouseButtonDownMsgTarget,
- public CEnterViewMsgTarget,
- public CTurnOnTarget,
- public CMovieEndMsgTarget {
+class CArboretumGate : public CBackground {
+ DECLARE_MESSAGE_MAP
private:
static int _v1;
static int _v2;
@@ -73,13 +67,13 @@ private:
int _field150;
CString _string2;
protected:
- virtual bool handleMessage(CActMsg &msg);
- virtual bool handleMessage(CLeaveViewMsg &msg);
- virtual bool handleMessage(CTurnOff &msg);
- virtual bool handleMessage(CMouseButtonDownMsg &msg);
- virtual bool handleMessage(CEnterViewMsg &msg);
- virtual bool handleMessage(CTurnOn &msg);
- virtual bool handleMessage(CMovieEndMsg &msg);
+ virtual bool ActMsg(CActMsg *msg);
+ virtual bool LeaveViewMsg(CLeaveViewMsg *msg);
+ virtual bool TurnOff(CTurnOff *msg);
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ virtual bool EnterViewMsg(CEnterViewMsg *msg);
+ virtual bool TurnOn(CTurnOn *msg);
+ virtual bool MovieEndMsg(CMovieEndMsg *msg);
public:
CLASSDEF
CArboretumGate();
diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h
index 865e446cc5..2d8a36b61a 100644
--- a/engines/titanic/game/bar_bell.h
+++ b/engines/titanic/game/bar_bell.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CBarBell : public CGameObject,
- public CEnterRoomMsgTarget {
+class CBarBell : public CGameObject {
public:
int _fieldBC;
int _fieldC0;
diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h
index 9f33189d56..bd3852ef17 100644
--- a/engines/titanic/game/bomb.h
+++ b/engines/titanic/game/bomb.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CBomb : public CBackground,
- public CEnterRoomMsgTarget {
+class CBomb : public CBackground {
private:
int _fieldE0;
int _fieldE4;
diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h
index 61bada0b74..fa1c80335a 100644
--- a/engines/titanic/game/cdrom.h
+++ b/engines/titanic/game/cdrom.h
@@ -29,11 +29,7 @@
namespace Titanic {
-class CCDROM : public CGameObject,
- public CMouseDragStartMsgTarget,
- public CMouseDragEndMsgTarget,
- public CMouseDragMoveMsgTarget,
- public CActMsgTarget {
+class CCDROM : public CGameObject {
private:
Point _tempPos;
protected:
diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h
index b1893c548e..0833847530 100644
--- a/engines/titanic/game/cdrom_tray.h
+++ b/engines/titanic/game/cdrom_tray.h
@@ -28,10 +28,7 @@
namespace Titanic {
-class CCDROMTray : public CGameObject,
- public CActMsgTarget,
- public CMovieEndMsgTarget,
- public CStatusChangeMsgTarget {
+class CCDROMTray : public CGameObject {
public:
int _state;
CString _string1;
diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h
index 6f57cddb9c..f15bba4983 100644
--- a/engines/titanic/game/chicken_cooler.h
+++ b/engines/titanic/game/chicken_cooler.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CChickenCooler : public CGameObject,
- public CEnterRoomMsgTarget {
+class CChickenCooler : public CGameObject {
private:
int _fieldBC;
int _fieldC0;
diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h
index c696c841c2..6390475d4e 100644
--- a/engines/titanic/game/dead_area.h
+++ b/engines/titanic/game/dead_area.h
@@ -31,9 +31,7 @@ namespace Titanic {
/**
* Implements a non-responsive screen area
*/
-class CDeadArea : public CGameObject,
- public CMouseButtonDownMsgTarget,
- public CMouseButtonUpMsgTarget {
+class CDeadArea : public CGameObject {
protected:
virtual bool handleMessage(CMouseButtonDownMsg &msg) { return true; }
virtual bool handleMessage(CMouseButtonUpMsg &msg) { return true; }
diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h
index bd33747239..351fb1f13b 100644
--- a/engines/titanic/game/doorbot_elevator_handler.h
+++ b/engines/titanic/game/doorbot_elevator_handler.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CDoorbotElevatorHandler : public CGameObject,
- public CEnterNodeMsgTarget {
+class CDoorbotElevatorHandler : public CGameObject {
private:
static int _v1;
int _value;
diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h
index 87eaf17c0e..61165e3ba5 100644
--- a/engines/titanic/game/end_sequence_control.h
+++ b/engines/titanic/game/end_sequence_control.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CEndSequenceControl : public CGameObject,
- public CEnterRoomMsgTarget {
+class CEndSequenceControl : public CGameObject {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h
index 495ac39f8e..778891e6e1 100644
--- a/engines/titanic/game/fan_noises.h
+++ b/engines/titanic/game/fan_noises.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CFanNoises : public CGameObject,
- public CEnterRoomMsgTarget {
+class CFanNoises : public CGameObject {
private:
int _fieldBC;
int _fieldC0;
diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h
index 7ca0b4d32e..f7195878e0 100644
--- a/engines/titanic/game/get_lift_eye2.h
+++ b/engines/titanic/game/get_lift_eye2.h
@@ -27,8 +27,7 @@
#include "titanic/messages/messages.h"
namespace Titanic {
-class CGetLiftEye2 : public CGameObject,
- public CEnterRoomMsgTarget {
+class CGetLiftEye2 : public CGameObject {
private:
static CString *_v1;
protected:
diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h
index a2e562c573..e419a3bcd6 100644
--- a/engines/titanic/game/light.h
+++ b/engines/titanic/game/light.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CLight : public CBackground,
- public CEnterRoomMsgTarget {
+class CLight : public CBackground {
private:
int _fieldE0;
int _fieldE4;
diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h
index 3e44590390..f2132c9bdf 100644
--- a/engines/titanic/game/light_switch.h
+++ b/engines/titanic/game/light_switch.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CLightSwitch : public CBackground,
- public CEnterRoomMsgTarget {
+class CLightSwitch : public CBackground {
public:
static int _v1;
private:
diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h
index 9e47a0a932..bc96cb84f7 100644
--- a/engines/titanic/game/parrot/player_meets_parrot.h
+++ b/engines/titanic/game/parrot/player_meets_parrot.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CPlayerMeetsParrot : public CGameObject,
- public CEnterRoomMsgTarget {
+class CPlayerMeetsParrot : public CGameObject {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h
index 5cf14f38cb..56116d8313 100644
--- a/engines/titanic/game/pet/pet_monitor.h
+++ b/engines/titanic/game/pet/pet_monitor.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CPETMonitor : public CGameObject,
- public CEnterRoomMsgTarget {
+class CPETMonitor : public CGameObject {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h
index 820df41c50..589f2b60b1 100644
--- a/engines/titanic/game/pet/pet_position.h
+++ b/engines/titanic/game/pet/pet_position.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CPETPosition : public CGameObject,
- public CEnterRoomMsgTarget {
+class CPETPosition : public CGameObject {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h
index 8dd3f3aac5..2c94bb6fe7 100644
--- a/engines/titanic/game/pet/pet_transport.h
+++ b/engines/titanic/game/pet/pet_transport.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CPETTransport : public CGameObject,
- public CEnterRoomMsgTarget {
+class CPETTransport : public CGameObject {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h
index 6e53ad39da..7ae961145f 100644
--- a/engines/titanic/game/sgt/sgt_state_room.h
+++ b/engines/titanic/game/sgt/sgt_state_room.h
@@ -45,8 +45,7 @@ struct CSGTStateRoomStatics {
int _v14;
};
-class CSGTStateRoom : public CBackground,
- public CEnterRoomMsgTarget {
+class CSGTStateRoom : public CBackground {
private:
static CSGTStateRoomStatics *_statics;
private:
diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h
index 878feba8ba..5b5ea68719 100644
--- a/engines/titanic/game/ship_setting.h
+++ b/engines/titanic/game/ship_setting.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CShipSetting : public CBackground,
- public CEnterRoomMsgTarget {
+class CShipSetting : public CBackground {
private:
CString _string3;
Point _pos1;
diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h
index 2b19e77fe2..ebdc4abf25 100644
--- a/engines/titanic/game/start_action.h
+++ b/engines/titanic/game/start_action.h
@@ -28,9 +28,7 @@
namespace Titanic {
-class CStartAction : public CBackground,
- public CMouseButtonDownMsgTarget,
- public CMouseButtonUpMsgTarget {
+class CStartAction : public CBackground {
protected:
CString _msgTarget;
CString _msgAction;
diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h
index c2a18df4dd..dc324e10c0 100644
--- a/engines/titanic/game/transport/lift.h
+++ b/engines/titanic/game/transport/lift.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CLift : public CTransport,
- public CEnterRoomMsgTarget {
+class CLift : public CTransport {
private:
static int _v1;
static int _v2;
diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h
index b97d17ff88..82809a0717 100644
--- a/engines/titanic/game/transport/pellerator.h
+++ b/engines/titanic/game/transport/pellerator.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CPellerator : public CTransport,
- public CEnterRoomMsgTarget {
+class CPellerator : public CTransport {
private:
static int _v1;
static int _v2;
diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h
index 589e279d6b..27b1d7b8fd 100644
--- a/engines/titanic/game/up_lighter.h
+++ b/engines/titanic/game/up_lighter.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CUpLighter : public CDropTarget,
- public CEnterRoomMsgTarget {
+class CUpLighter : public CDropTarget {
private:
int _field118;
int _field11C;
diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h
index 5586c9cb45..ae10d975e2 100644
--- a/engines/titanic/game/volume_control.h
+++ b/engines/titanic/game/volume_control.h
@@ -28,7 +28,7 @@
namespace Titanic {
-class CVolumeControl : public CGameObject, CEnterNodeMsgTarget {
+class CVolumeControl : public CGameObject {
private:
int _fieldBC;
CString _string1;
diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp
index 387800430f..154122ed60 100644
--- a/engines/titanic/gfx/st_button.cpp
+++ b/engines/titanic/gfx/st_button.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSTButton, CBackground)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(MouseButtonUpMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
CSTButton::CSTButton() : CBackground() {
_statusInc = 0;
_statusTarget = "NULL";
@@ -60,14 +66,14 @@ void CSTButton::load(SimpleFile *file) {
CBackground::load(file);
}
-bool CSTButton::handleMessage(CMouseButtonDownMsg &msg) {
+bool CSTButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
changeStatus(0);
// TODO: Obj6c stuff
return true;
}
-bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) {
+bool CSTButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
int oldStatus = _currentStatus;
int newStatus = _currentStatus + _statusInc;
@@ -82,7 +88,7 @@ bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) {
return true;
}
-bool CSTButton::handleMessage(CEnterViewMsg &msg) {
+bool CSTButton::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(_buttonFrame);
return true;
}
diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h
index d613ad0eea..fd2b0fa401 100644
--- a/engines/titanic/gfx/st_button.h
+++ b/engines/titanic/gfx/st_button.h
@@ -29,10 +29,8 @@
namespace Titanic {
-class CSTButton : public CBackground,
- public CMouseButtonDownMsgTarget,
- public CMouseButtonUpMsgTarget,
- public CEnterViewMsgTarget {
+class CSTButton : public CBackground {
+ DECLARE_MESSAGE_MAP
private:
int _statusInc;
CString _statusTarget;
@@ -42,9 +40,9 @@ private:
CString _string5;
int _buttonFrame;
protected:
- virtual bool handleMessage(CMouseButtonDownMsg &msg);
- virtual bool handleMessage(CMouseButtonUpMsg &msg);
- virtual bool handleMessage(CEnterViewMsg &msg);
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ virtual bool EnterViewMsg(CEnterViewMsg *msg);
public:
CLASSDEF
CSTButton();
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp
index 1c3d406b1b..9f46fef6ca 100644
--- a/engines/titanic/messages/messages.cpp
+++ b/engines/titanic/messages/messages.cpp
@@ -23,6 +23,7 @@
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
#include "titanic/core/game_object.h"
+#include "titanic/core/message_target.h"
#include "titanic/core/tree_item.h"
#include "titanic/titanic.h"
@@ -79,6 +80,33 @@ bool CMessage::execute(const CString &target, const ClassDef *classDef, int flag
return false;
}
+const MSGMAP_ENTRY *CMessage::findMapEntry(const CTreeItem *treeItem, const ClassDef *classDef) {
+ // Iterate through the class and any parent classes
+ for (const MSGMAP *msgMap = treeItem->getMessageMap(); msgMap->pFnGetBaseMap;
+ msgMap = msgMap->pFnGetBaseMap()) {
+ // Iterate through the map entries for this class
+ for (const MSGMAP_ENTRY *entry = msgMap->lpEntries;
+ entry->_class != nullptr; ++entry) {
+ // Check if the class or any of it's ancesotrs is handled by this entry
+ for (const ClassDef *entryDef = entry->_class; entryDef; entryDef = entryDef->_parent) {
+ if (entryDef == classDef)
+ return entry;
+ }
+ }
+ }
+
+ return nullptr;
+}
+
+bool CMessage::perform(CTreeItem *treeItem) {
+ const MSGMAP_ENTRY *entry = findMapEntry(treeItem, getType());
+ return entry && (*treeItem.*(entry->_fn))(this);
+}
+
+bool CMessage::supports(const CTreeItem *treeItem, ClassDef *classDef) {
+ return findMapEntry(treeItem, classDef) != nullptr;
+}
+
bool CMessage::isMouseMsg() const {
return dynamic_cast<const CMouseMsg *>(this) != nullptr;
}
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index f4c16f5017..e566b5d661 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -35,67 +35,49 @@ enum MessageFlag {
MSGFLAG_CLASS_DEF = 4
};
-#define MSGTARGET(NAME) class NAME; class NAME##Target { public: \
- virtual bool handleMessage(NAME &msg) = 0; }
-
-#define MESSAGE0(NAME) MSGTARGET(NAME); \
+#define MESSAGE0(NAME) \
class NAME: public CMessage { \
public: NAME() : CMessage() {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
- return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
- virtual bool perform(CTreeItem *treeItem) { \
- NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
- return dest != nullptr && dest->handleMessage(*this); \
- } }
-#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \
+ return supports(item, _type); } \
+}
+#define MESSAGE1(NAME, F1, N1, V1) \
class NAME: public CMessage { \
public: F1 _##N1; \
NAME() : CMessage(), _##N1(V1) {} \
NAME(F1 N1) : CMessage(), _##N1(N1) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
- return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
- virtual bool perform(CTreeItem *treeItem) { \
- NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
- return dest != nullptr && dest->handleMessage(*this); \
- } }
-#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \
+ return supports(item, _type); } \
+}
+#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) \
class NAME: public CMessage { \
public: F1 _##N1; F2 _##N2; \
NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \
NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
- return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
- virtual bool perform(CTreeItem *treeItem) { \
- NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
- return dest != nullptr && dest->handleMessage(*this); \
- } }
-#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \
+ return supports(item, _type); } \
+}
+#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) \
class NAME: public CMessage { \
public: F1 _##N1; F2 _##N2; F3 _##N3; \
NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \
NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
- return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
- virtual bool perform(CTreeItem *treeItem) { \
- NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
- return dest != nullptr && dest->handleMessage(*this); \
- } }
-#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \
+ return supports(item, _type); } \
+}
+#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) \
class NAME: public CMessage { \
public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \
NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \
NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
- return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
- virtual bool perform(CTreeItem *treeItem) { \
- NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
- return dest != nullptr && dest->handleMessage(*this); \
- } }
+ return supports(item, _type); } \
+}
class CGameObject;
class CRoomItem;
@@ -103,6 +85,11 @@ class CNodeItem;
class CViewItem;
class CMessage : public CSaveableObject {
+private:
+ /**
+ * Find a map entry that supports the given class
+ */
+ static const MSGMAP_ENTRY *findMapEntry(const CTreeItem *treeItem, const ClassDef *classDef);
public:
CLASSDEF
CMessage();
@@ -121,7 +108,15 @@ public:
bool execute(const CString &target, const ClassDef *classDef = nullptr,
int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED);
- virtual bool perform(CTreeItem *treeItem) { return false; }
+ /**
+ * Makes the passed item execute the message
+ */
+ virtual bool perform(CTreeItem *treeItem);
+
+ /**
+ * Returns true if the passed item supports the specified message class
+ */
+ static bool supports(const CTreeItem *treeItem, ClassDef *classDef);
/**
* Save the data for the class to file
@@ -149,7 +144,6 @@ public:
virtual bool isLeaveViewMsg() const;
};
-MSGTARGET(CEditControlMsg);
class CEditControlMsg : public CMessage {
public:
int _field4;
@@ -164,16 +158,10 @@ public:
_field1C(0), _field20(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CEditControlMsgTarget *>(item) != nullptr;
- }
-
- virtual bool perform(CTreeItem *treeItem) {
- CEditControlMsgTarget *dest = dynamic_cast<CEditControlMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return CMessage::supports(item, _type);
}
};
-MSGTARGET(CLightsMsg);
class CLightsMsg : public CMessage {
public:
int _field4;
@@ -186,15 +174,10 @@ public:
_fieldC(0), _field10(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CLightsMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CLightsMsgTarget *dest = dynamic_cast<CLightsMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CIsHookedOnMsg);
class CIsHookedOnMsg : public CMessage {
public:
int _field4;
@@ -209,15 +192,10 @@ public:
_field18(0), _field1C(0), _field20(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CIsHookedOnMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CIsHookedOnMsgTarget *dest = dynamic_cast<CIsHookedOnMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CSubAcceptCCarryMsg);
class CSubAcceptCCarryMsg : public CMessage {
public:
CString _string1;
@@ -227,15 +205,10 @@ public:
CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CSubAcceptCCarryMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CSubAcceptCCarryMsgTarget *dest = dynamic_cast<CSubAcceptCCarryMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CTransportMsg);
class CTransportMsg : public CMessage {
public:
CString _string;
@@ -245,17 +218,12 @@ public:
CTransportMsg() : _value1(0), _value2(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CTransportMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CTransportMsgTarget *dest = dynamic_cast<CTransportMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
MESSAGE1(CTimeMsg, int, value, 0);
-MSGTARGET(CTimerMsg);
class CTimerMsg : public CTimeMsg {
public:
int _field8;
@@ -266,11 +234,7 @@ public:
CTimerMsg() : CTimeMsg(), _field8(0), _fieldC(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CTimerMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CTimerMsgTarget *dest = dynamic_cast<CTimerMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h
index 1bc77b6a87..811fdf0ad0 100644
--- a/engines/titanic/messages/mouse_messages.h
+++ b/engines/titanic/messages/mouse_messages.h
@@ -30,7 +30,6 @@ namespace Titanic {
enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 };
-MSGTARGET(CMouseMsg);
class CMouseMsg : public CMessage {
public:
int _buttons;
@@ -38,11 +37,7 @@ public:
public:
CLASSDEF
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseMsg *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseMsgTarget *dest = dynamic_cast<CMouseMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
CMouseMsg() : _buttons(0) {}
@@ -50,7 +45,6 @@ public:
_mousePos(pt), _buttons(buttons) {}
};
-MSGTARGET(CMouseMoveMsg);
class CMouseMoveMsg : public CMouseMsg {
public:
CLASSDEF
@@ -58,15 +52,10 @@ public:
CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseMoveMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseMoveMsgTarget *dest = dynamic_cast<CMouseMoveMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseButtonMsg);
class CMouseButtonMsg : public CMouseMsg {
public:
int _field10;
@@ -76,11 +65,10 @@ public:
CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseButtonMsgTarget *>(item) != nullptr;
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseButtonDownMsg);
class CMouseButtonDownMsg : public CMouseButtonMsg {
public:
CLASSDEF
@@ -88,15 +76,10 @@ public:
CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseButtonDownMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseButtonDownMsgTarget *dest = dynamic_cast<CMouseButtonDownMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseButtonUpMsg);
class CMouseButtonUpMsg : public CMouseButtonMsg {
public:
CLASSDEF
@@ -104,15 +87,10 @@ public:
CMouseButtonUpMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseButtonUpMsg *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseButtonUpMsgTarget *dest = dynamic_cast<CMouseButtonUpMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseDoubleClickMsg);
class CMouseDoubleClickMsg : public CMouseButtonMsg {
public:
CLASSDEF
@@ -120,15 +98,10 @@ public:
CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseDoubleClickMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseDoubleClickMsgTarget *dest = dynamic_cast<CMouseDoubleClickMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseDragMsg);
class CMouseDragMsg : public CMouseMsg {
public:
CLASSDEF
@@ -136,11 +109,10 @@ public:
CMouseDragMsg(const Point &pt) : CMouseMsg(pt, 0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseDragMsg *>(item) != nullptr;
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseDragMoveMsg);
class CMouseDragMoveMsg : public CMouseDragMsg {
public:
CLASSDEF
@@ -148,15 +120,10 @@ public:
CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseDragMoveMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseDragMoveMsgTarget *dest = dynamic_cast<CMouseDragMoveMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseDragStartMsg);
class CMouseDragStartMsg : public CMouseDragMsg {
public:
CTreeItem *_dragItem;
@@ -168,15 +135,10 @@ public:
_dragItem(nullptr), _field14(0) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseDragStartMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseDragStartMsgTarget *dest = dynamic_cast<CMouseDragStartMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
-MSGTARGET(CMouseDragEndMsg);
class CMouseDragEndMsg : public CMouseDragMsg {
public:
CTreeItem *_dropTarget;
@@ -187,11 +149,7 @@ public:
CMouseDragMsg(pt), _dropTarget(dragItem) {}
static bool isSupportedBy(const CTreeItem *item) {
- return dynamic_cast<const CMouseDragEndMsgTarget *>(item) != nullptr;
- }
- virtual bool perform(CTreeItem *treeItem) {
- CMouseDragEndMsgTarget *dest = dynamic_cast<CMouseDragEndMsgTarget *>(treeItem);
- return dest != nullptr && dest->handleMessage(*this);
+ return supports(item, _type);
}
};
diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h
index 7e39056742..f7d9c301a6 100644
--- a/engines/titanic/messages/pet_messages.h
+++ b/engines/titanic/messages/pet_messages.h
@@ -42,18 +42,16 @@ MESSAGE1(CPETStarFieldLockMsg, int, value, 0);
MESSAGE0(CPETStereoFieldOnOffMsg);
MESSAGE2(CPETTargetMsg, CString, name, "", int, numValue, -1);
-#define PET_MESSAGE(NAME) MSGTARGET(NAME); \
+#define PET_MESSAGE(NAME) \
class NAME: public CPETTargetMsg { \
public: \
NAME() : CPETTargetMsg() {} \
NAME(const CString &name, int num) : CPETTargetMsg(name, num) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
- return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
- virtual bool perform(CTreeItem *treeItem) { \
- NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
- return dest != nullptr && dest->handleMessage(*this); \
- } }
+ return supports(item, _type); \
+ } \
+}
PET_MESSAGE(CPETDownMsg);
PET_MESSAGE(CPETUpMsg);
diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h
index 743960d30e..0920443e1d 100644
--- a/engines/titanic/moves/enter_bridge.h
+++ b/engines/titanic/moves/enter_bridge.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CEnterBridge : public CGameObject,
- public CEnterRoomMsgTarget {
+class CEnterBridge : public CGameObject {
private:
int _value;
protected:
diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h
index 0cad69a758..158db10f7a 100644
--- a/engines/titanic/npcs/barbot.h
+++ b/engines/titanic/npcs/barbot.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CBarbot : public CTrueTalkNPC,
- public CEnterRoomMsgTarget {
+class CBarbot : public CTrueTalkNPC {
private:
static int _v0;
private:
diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h
index 03867cc6f3..a984ea8ffb 100644
--- a/engines/titanic/npcs/liftbot.h
+++ b/engines/titanic/npcs/liftbot.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CLiftBot : public CTrueTalkNPC,
- public CEnterRoomMsgTarget {
+class CLiftBot : public CTrueTalkNPC {
private:
static int _v1;
static int _v2;
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index fbb9efc0f1..5bc3edc7a6 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -27,6 +27,18 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CPetControl, CGameObject)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+ ON_MESSAGE(MouseDragMoveMsg)
+ ON_MESSAGE(MouseDragEndMsg)
+ ON_MESSAGE(MouseButtonUpMsg)
+ ON_MESSAGE(MouseDoubleClickMsg)
+ ON_MESSAGE(KeyCharMsg)
+ ON_MESSAGE(VirtualKeyCharMsg)
+ ON_MESSAGE(TimerMsg)
+END_MESSAGE_MAP()
+
CPetControl::CPetControl() : CGameObject(),
_currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0),
_treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr),
@@ -233,74 +245,74 @@ bool CPetControl::getC0() const {
return _fieldC0 > 0;
}
-bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) {
- if (!containsPt(msg._mousePos) || getC0())
+bool CPetControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (!containsPt(msg->_mousePos) || getC0())
return false;
bool result = false;
if (isUnlocked())
- result = _frame.handleMessage(msg);
+ result = _frame.MouseButtonDownMsg(msg);
if (!result) {
- result = _sections[_currentArea]->handleMessage(msg);
+ result = _sections[_currentArea]->MouseButtonDownMsg(msg);
}
makeDirty();
return result;
}
-bool CPetControl::handleMessage(CMouseDragStartMsg &msg) {
- if (!containsPt(msg._mousePos) || getC0())
+bool CPetControl::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ if (!containsPt(msg->_mousePos) || getC0())
return false;
- return _sections[_currentArea]->handleMessage(msg);
+ return _sections[_currentArea]->MouseDragStartMsg(msg);
}
-bool CPetControl::handleMessage(CMouseDragMoveMsg &msg) {
- return _sections[_currentArea]->handleMessage(msg);
+bool CPetControl::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
+ return _sections[_currentArea]->MouseDragMoveMsg(msg);
}
-bool CPetControl::handleMessage(CMouseDragEndMsg &msg) {
- return _sections[_currentArea]->handleMessage(msg);
+bool CPetControl::MouseDragEndMsg(CMouseDragEndMsg *msg) {
+ return _sections[_currentArea]->MouseDragEndMsg(msg);
}
-bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) {
- if (!containsPt(msg._mousePos) || getC0())
+bool CPetControl::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ if (!containsPt(msg->_mousePos) || getC0())
return false;
bool result = false;
if (isUnlocked())
- result = _frame.handleMessage(msg);
+ result = _frame.MouseButtonUpMsg(msg);
if (!result)
- result = _sections[_currentArea]->handleMessage(msg);
+ result = _sections[_currentArea]->MouseButtonUpMsg(msg);
makeDirty();
return result;
}
-bool CPetControl::handleMessage(CMouseDoubleClickMsg &msg) {
- if (!containsPt(msg._mousePos) || getC0())
+bool CPetControl::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
+ if (!containsPt(msg->_mousePos) || getC0())
return false;
- return _sections[_currentArea]->handleMessage(msg);
+ return _sections[_currentArea]->MouseDoubleClickMsg(msg);
}
-bool CPetControl::handleMessage(CKeyCharMsg &msg) {
+bool CPetControl::KeyCharMsg(CKeyCharMsg *msg) {
if (getC0())
return false;
- return _sections[_currentArea]->handleMessage(msg);
+ return _sections[_currentArea]->KeyCharMsg(msg);
}
-bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) {
+bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
if (getC0())
return false;
- bool result = _sections[_currentArea]->handleMessage(msg);
+ bool result = _sections[_currentArea]->VirtualKeyCharMsg(msg);
if (!result) {
- switch (msg._keyState.keycode) {
+ switch (msg->_keyState.keycode) {
case Common::KEYCODE_F1:
result = true;
setArea(PET_INVENTORY);
@@ -329,7 +341,7 @@ bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) {
return result;
}
-bool CPetControl::handleMessage(CTimerMsg &msg) {
+bool CPetControl::TimerMsg(CTimerMsg *msg) {
warning("TODO: CPetControl::CTimerMsg");
return true;
}
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 6f5b7948e3..172cec9bf7 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -39,16 +39,8 @@
namespace Titanic {
-class CPetControl : public CGameObject,
- public CMouseButtonDownMsgTarget,
- public CMouseDragStartMsgTarget,
- public CMouseDragMoveMsgTarget,
- public CMouseDragEndMsgTarget,
- public CMouseButtonUpMsgTarget,
- public CMouseDoubleClickMsgTarget,
- public CKeyCharMsgTarget,
- public CVirtualKeyCharMsgTarget,
- public CTimerMsgTarget {
+class CPetControl : public CGameObject {
+ DECLARE_MESSAGE_MAP
private:
int _fieldC0;
int _locked;
@@ -102,15 +94,15 @@ private:
bool getC0() const;
protected:
- bool handleMessage(CMouseButtonDownMsg &msg);
- bool handleMessage(CMouseDragStartMsg &msg);
- bool handleMessage(CMouseDragMoveMsg &msg);
- bool handleMessage(CMouseDragEndMsg &msg);
- bool handleMessage(CMouseButtonUpMsg &msg);
- bool handleMessage(CMouseDoubleClickMsg &msg);
- bool handleMessage(CKeyCharMsg &msg);
- bool handleMessage(CVirtualKeyCharMsg &msg);
- bool handleMessage(CTimerMsg &msg);
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool MouseDragStartMsg(CMouseDragStartMsg *msg);
+ bool MouseDragMoveMsg(CMouseDragMoveMsg *msg);
+ bool MouseDragEndMsg(CMouseDragEndMsg *msg);
+ bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
+ bool KeyCharMsg(CKeyCharMsg *msg);
+ bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg);
+ bool TimerMsg(CTimerMsg *msg);
public:
PetArea _currentArea;
public:
diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp
index 423c79af8b..68c258c0fb 100644
--- a/engines/titanic/pet_control/pet_element.cpp
+++ b/engines/titanic/pet_control/pet_element.cpp
@@ -40,8 +40,8 @@ bool CPetElement::proc6(const Common::Point &pt) {
return result;
}
-bool CPetElement::handleMessage(CMouseButtonDownMsg &msg) {
- bool result = _bounds.contains(msg._mousePos);
+bool CPetElement::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ bool result = _bounds.contains(msg->_mousePos);
if (result)
setMode(MODE_UNSELECTED);
return result;
diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h
index 2d56b57c66..a53715ddb9 100644
--- a/engines/titanic/pet_control/pet_element.h
+++ b/engines/titanic/pet_control/pet_element.h
@@ -70,7 +70,7 @@ public:
virtual void getBounds(Rect *rect);
virtual bool proc6(const Common::Point &pt);
- virtual bool handleMessage(CMouseButtonDownMsg &msg);
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
/**
* Returns whether the passed point falls inside the item
diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp
index 6e3ff4f62c..1859b0d39f 100644
--- a/engines/titanic/pet_control/pet_frame.cpp
+++ b/engines/titanic/pet_control/pet_frame.cpp
@@ -63,9 +63,9 @@ bool CPetFrame::setup() {
return true;
}
-bool CPetFrame::handleMessage(CMouseButtonDownMsg &msg) {
+bool CPetFrame::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
for (int idx = 0; idx < 5; ++idx) {
- if (_modeButtons[idx].handleMessage(msg)) {
+ if (_modeButtons[idx].MouseButtonDownMsg(msg)) {
_petControl->setArea(PET_AREAS[idx]);
resetArea();
_modeButtons[idx].setMode(MODE_SELECTED);
diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h
index f26a2bf48e..ec8bd1e1d8 100644
--- a/engines/titanic/pet_control/pet_frame.h
+++ b/engines/titanic/pet_control/pet_frame.h
@@ -62,8 +62,8 @@ public:
/**
* Handles mouse down messages
*/
- virtual bool handleMessage(CMouseButtonDownMsg &msg);
- virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; }
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; }
/**
* Returns true if the object is in a valid state
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 169f0c0e20..e20c03c3d5 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -80,14 +80,14 @@ public:
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
*/
- virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; }
- virtual bool handleMessage(CMouseDragStartMsg &msg) { return false; }
- virtual bool handleMessage(CMouseDragMoveMsg &msg) { return false; }
- virtual bool handleMessage(CMouseDragEndMsg &msg) { return false; }
- virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; }
- virtual bool handleMessage(CMouseDoubleClickMsg &msg) { return false; }
- virtual bool handleMessage(CKeyCharMsg &msg) { return false; }
- virtual bool handleMessage(CVirtualKeyCharMsg &msg) { return false; }
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; }
+ virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg) { return false; }
+ virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg) { return false; }
+ virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; }
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; }
+ virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; }
+ virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; }
+ virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; }
virtual int proc14() { return 0; }
virtual int proc15() { return 0; }
diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h
index da8a386cb1..0848439d49 100644
--- a/engines/titanic/sound/auto_music_player.h
+++ b/engines/titanic/sound/auto_music_player.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CAutoMusicPlayer : public CAutoMusicPlayerBase,
- public CEnterRoomMsgTarget {
+class CAutoMusicPlayer : public CAutoMusicPlayerBase {
private:
CString _string2;
protected:
diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h
index 4cc510c42f..614fa375cd 100644
--- a/engines/titanic/sound/music_player.h
+++ b/engines/titanic/sound/music_player.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CMusicPlayer : public CGameObject,
- public CEnterRoomMsgTarget {
+class CMusicPlayer : public CGameObject {
protected:
int _fieldBC;
CString _string1;
diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h
index fee4d3dae3..451b94688d 100644
--- a/engines/titanic/sound/node_auto_sound_player.h
+++ b/engines/titanic/sound/node_auto_sound_player.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CNodeAutoSoundPlayer : public CAutoSoundPlayer,
- public CEnterNodeMsgTarget {
+class CNodeAutoSoundPlayer : public CAutoSoundPlayer {
private:
int _fieldEC;
protected:
diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h
index c72aff1763..70d3dfee88 100644
--- a/engines/titanic/sound/room_auto_sound_player.h
+++ b/engines/titanic/sound/room_auto_sound_player.h
@@ -28,8 +28,7 @@
namespace Titanic {
-class CRoomAutoSoundPlayer : public CAutoSoundPlayer,
- public CEnterRoomMsgTarget {
+class CRoomAutoSoundPlayer : public CAutoSoundPlayer {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h
index 4ce4bae7fa..c3e4d0f6a4 100644
--- a/engines/titanic/sound/room_trigger_auto_music_player.h
+++ b/engines/titanic/sound/room_trigger_auto_music_player.h
@@ -28,7 +28,7 @@
namespace Titanic {
-class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget {
+class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer {
protected:
virtual bool handleMessage(CEnterRoomMsg &msg);
public: