From 66e198d665a8aacd1724848a40e6533f3d5cfebc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 07:49:59 -0400 Subject: TITANIC: Cleanup and fixes for message hierarchy --- engines/titanic/core/view_item.cpp | 14 ++-- engines/titanic/core/view_item.h | 12 ++-- engines/titanic/game/arboretum_gate.cpp | 14 ++-- engines/titanic/game/arboretum_gate.h | 14 ++-- engines/titanic/game/auto_animate.cpp | 2 +- engines/titanic/game/auto_animate.h | 2 +- engines/titanic/game/bar_bell.cpp | 2 +- engines/titanic/game/bar_bell.h | 2 +- engines/titanic/game/bomb.cpp | 2 +- engines/titanic/game/bomb.h | 2 +- engines/titanic/game/chicken_cooler.cpp | 2 +- engines/titanic/game/chicken_cooler.h | 2 +- engines/titanic/game/doorbot_elevator_handler.cpp | 2 +- engines/titanic/game/doorbot_elevator_handler.h | 2 +- engines/titanic/game/end_sequence_control.cpp | 2 +- engines/titanic/game/end_sequence_control.h | 2 +- engines/titanic/game/fan_noises.cpp | 2 +- engines/titanic/game/fan_noises.h | 2 +- engines/titanic/game/get_lift_eye2.cpp | 2 +- engines/titanic/game/get_lift_eye2.h | 2 +- engines/titanic/game/gondolier/gondolier_mixer.cpp | 2 +- engines/titanic/game/gondolier/gondolier_mixer.h | 2 +- engines/titanic/game/light.cpp | 2 +- engines/titanic/game/light.h | 2 +- engines/titanic/game/light_switch.cpp | 2 +- engines/titanic/game/light_switch.h | 2 +- engines/titanic/game/long_stick_dispenser.cpp | 2 +- engines/titanic/game/long_stick_dispenser.h | 2 +- .../titanic/game/parrot/player_meets_parrot.cpp | 2 +- engines/titanic/game/parrot/player_meets_parrot.h | 2 +- engines/titanic/game/pet/pet_monitor.cpp | 2 +- engines/titanic/game/pet/pet_monitor.h | 2 +- engines/titanic/game/pet/pet_position.cpp | 2 +- engines/titanic/game/pet/pet_position.h | 2 +- engines/titanic/game/pet/pet_transport.cpp | 2 +- engines/titanic/game/pet/pet_transport.h | 2 +- engines/titanic/game/phonograph.cpp | 2 +- engines/titanic/game/phonograph.h | 2 +- engines/titanic/game/sgt/sgt_state_room.cpp | 2 +- engines/titanic/game/sgt/sgt_state_room.h | 2 +- engines/titanic/game/ship_setting.cpp | 2 +- engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game/transport/lift.cpp | 2 +- engines/titanic/game/transport/lift.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/transport/pellerator.cpp | 2 +- engines/titanic/game/transport/pellerator.h | 2 +- engines/titanic/game/up_lighter.cpp | 2 +- engines/titanic/game/up_lighter.h | 2 +- engines/titanic/game/volume_control.cpp | 2 +- engines/titanic/game/volume_control.h | 2 +- engines/titanic/input_handler.cpp | 6 +- engines/titanic/input_handler.h | 6 +- engines/titanic/messages/bilge_dispensor_event.cpp | 2 +- engines/titanic/messages/bilge_dispensor_event.h | 2 +- engines/titanic/messages/messages.cpp | 4 +- engines/titanic/messages/messages.h | 81 +++++++++------------- engines/titanic/messages/mouse_messages.h | 44 ++++++------ engines/titanic/moves/enter_bridge.cpp | 2 +- engines/titanic/moves/enter_bridge.h | 2 +- engines/titanic/npcs/barbot.cpp | 2 +- engines/titanic/npcs/barbot.h | 2 +- engines/titanic/npcs/liftbot.cpp | 2 +- engines/titanic/npcs/liftbot.h | 2 +- engines/titanic/sound/auto_music_player.cpp | 2 +- engines/titanic/sound/auto_music_player.h | 2 +- engines/titanic/sound/music_player.cpp | 2 +- engines/titanic/sound/music_player.h | 2 +- engines/titanic/sound/node_auto_sound_player.cpp | 2 +- engines/titanic/sound/node_auto_sound_player.h | 2 +- .../titanic/sound/restricted_auto_music_player.cpp | 2 +- .../titanic/sound/restricted_auto_music_player.h | 2 +- engines/titanic/sound/room_auto_sound_player.cpp | 2 +- engines/titanic/sound/room_auto_sound_player.h | 2 +- .../sound/room_trigger_auto_music_player.cpp | 2 +- .../titanic/sound/room_trigger_auto_music_player.h | 2 +- engines/titanic/sound/titania_speech.cpp | 2 +- engines/titanic/sound/titania_speech.h | 2 +- 78 files changed, 160 insertions(+), 173 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 1b9a1dd1a6..414cf302c0 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -160,7 +160,7 @@ void CViewItem::enterView(CViewItem *newView) { } } -bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { +bool CViewItem::handleMessage(CMouseButtonDownMsg &msg) { if (msg._buttons & MB_LEFT) { if (!handleMouseMsg(&msg, true)) { CGameManager *gm = getGameManager(); @@ -185,21 +185,21 @@ bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { return true; } -bool CViewItem::handleEvent(CMouseButtonUpMsg &msg) { +bool CViewItem::handleMessage(CMouseButtonUpMsg &msg) { if (msg._buttons & MB_LEFT) handleMouseMsg(&msg, false); return true; } -bool CViewItem::handleEvent(CMouseDoubleClickMsg &msg) { +bool CViewItem::handleMessage(CMouseDoubleClickMsg &msg) { if (msg._buttons & MB_LEFT) handleMouseMsg(&msg, false); return true; } -bool CViewItem::handleEvent(CMouseMoveMsg &msg) { +bool CViewItem::handleMessage(CMouseMoveMsg &msg) { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; if (handleMouseMsg(&msg, true)) { @@ -224,8 +224,8 @@ bool CViewItem::handleEvent(CMouseMoveMsg &msg) { return true; } -bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) { - const CMouseButtonUpMsg *upMsg = dynamic_cast(msg); +bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { + CMouseButtonUpMsg *upMsg = dynamic_cast(msg); if (msg->isButtonUpMsg()) { handleButtonUpMsg(upMsg); return true; @@ -272,7 +272,7 @@ bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) { return result; } -void CViewItem::handleButtonUpMsg(const CMouseButtonUpMsg *msg) { +void CViewItem::handleButtonUpMsg(CMouseButtonUpMsg *msg) { CTreeItem *&target = _buttonUpTargets[msg->_buttons >> 1]; if (target) { diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index bc66122314..3b071e53a5 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -39,12 +39,12 @@ private: /** * Called to handle mouse messagaes on the view */ - bool handleMouseMsg(const CMouseMsg *msg, bool flag); + bool handleMouseMsg(CMouseMsg *msg, bool flag); /** * Handles mouse button up messages */ - void handleButtonUpMsg(const CMouseButtonUpMsg *msg); + void handleButtonUpMsg(CMouseButtonUpMsg *msg); protected: int _field24; double _field28; @@ -52,10 +52,10 @@ protected: int _field50; int _field54; protected: - virtual bool handleEvent(CMouseButtonDownMsg &msg); - virtual bool handleEvent(CMouseButtonUpMsg &msg); - virtual bool handleEvent(CMouseMoveMsg &msg); - virtual bool handleEvent(CMouseDoubleClickMsg &msg); + virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CMouseButtonUpMsg &msg); + virtual bool handleMessage(CMouseMoveMsg &msg); + virtual bool handleMessage(CMouseDoubleClickMsg &msg); public: int _viewNumber; public: diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index a892e65fc8..6770430cdc 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -133,17 +133,17 @@ void CArboretumGate::load(SimpleFile *file) { CBackground::load(file); } -bool CArboretumGate::handleEvent(CActMsg &msg) { return false; } -bool CArboretumGate::handleEvent(CLeaveViewMsg &msg) { return false; } -bool CArboretumGate::handleEvent(CTurnOff &msg) { return false; } -bool CArboretumGate::handleEvent(CMouseButtonDownMsg &msg) { return false; } +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::handleEvent(CEnterViewMsg &msg) { +bool CArboretumGate::handleMessage(CEnterViewMsg &msg) { warning("CArboretumGate::handleEvent"); return false; } -bool CArboretumGate::handleEvent(CTurnOn &msg) { return false; } -bool CArboretumGate::handleEvent(CMovieEndMsg &msg) { return false; } +bool CArboretumGate::handleMessage(CTurnOn &msg) { return false; } +bool CArboretumGate::handleMessage(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 7432799460..34569a0fc0 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -69,13 +69,13 @@ private: int _field150; CString _string2; protected: - virtual bool handleEvent(CActMsg &msg); - virtual bool handleEvent(CLeaveViewMsg &msg); - virtual bool handleEvent(CTurnOff &msg); - virtual bool handleEvent(CMouseButtonDownMsg &msg); - virtual bool handleEvent(CEnterViewMsg &msg); - virtual bool handleEvent(CTurnOn &msg); - virtual bool handleEvent(CMovieEndMsg &msg); + 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); public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index 958200f4cc..2a3f3719e6 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -40,7 +40,7 @@ void CAutoAnimate::load(SimpleFile *file) { CBackground::load(file); } -bool CAutoAnimate::handleEvent(CEnterViewMsg &msg) { +bool CAutoAnimate::handleMessage(CEnterViewMsg &msg) { warning("CAutoAnimate::handleEvent"); return true; } diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 56e40a470c..6fb85117ee 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -34,7 +34,7 @@ private: int _fieldE4; int _fieldE8; protected: - virtual bool handleEvent(CEnterViewMsg &msg); + virtual bool handleMessage(CEnterViewMsg &msg); public: CLASSDEF CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index 1ac7568b0f..84a4d04b49 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -50,7 +50,7 @@ void CBarBell::load(SimpleFile *file) { CGameObject::load(file); } -bool CBarBell::handleEvent(CEnterRoomMsg &msg) { +bool CBarBell::handleMessage(CEnterRoomMsg &msg) { _fieldBC = 0; return true; } diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 111b0ac267..30d71955ec 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -36,7 +36,7 @@ public: int _fieldC8; int _fieldCC; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBarBell(); diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index a8bf15ec33..390ac2cd4e 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -70,7 +70,7 @@ void CBomb::load(SimpleFile *file) { CBackground::load(file); } -bool CBomb::handleEvent(CEnterRoomMsg &msg) { +bool CBomb::handleMessage(CEnterRoomMsg &msg) { _fieldE8 = 12; _fieldEC = 9; _fieldF0 = 0; diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 9cbdf84081..8e9dcdf826 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -41,7 +41,7 @@ private: int _startingTicks; int _field104; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBomb(); diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index 4ece0d6d05..ff7aae7323 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -40,7 +40,7 @@ void CChickenCooler::load(SimpleFile *file) { CGameObject::load(file); } -bool CChickenCooler::handleEvent(CEnterRoomMsg &msg) { +bool CChickenCooler::handleMessage(CEnterRoomMsg &msg) { warning("CChickenCoolor::handlEvent"); return true; } diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 210183a474..176c8c9c4d 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -33,7 +33,7 @@ private: int _fieldBC; int _fieldC0; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index 718a464bf3..257b663246 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -40,7 +40,7 @@ void CDoorbotElevatorHandler::load(SimpleFile *file) { CGameObject::load(file); } -bool CDoorbotElevatorHandler::handleEvent(CEnterNodeMsg &msg) { +bool CDoorbotElevatorHandler::handleMessage(CEnterNodeMsg &msg) { warning("CDoorbotElevatorHandler::handleEvent"); return true; } diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 04f3a75b18..d6c5be94d6 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -33,7 +33,7 @@ private: static int _v1; int _value; protected: - virtual bool handleEvent(CEnterNodeMsg &msg); + virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index c3f5a2a007..41bbc9d93c 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -34,7 +34,7 @@ void CEndSequenceControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CEndSequenceControl::handleEvent(CEnterRoomMsg &msg) { +bool CEndSequenceControl::handleMessage(CEnterRoomMsg &msg) { warning("TODO: CEndSequenceControl::handleEvent"); return true; } diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index d0ddd9c920..5eb36943ea 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -30,7 +30,7 @@ namespace Titanic { class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index 7ec55c46f9..d7dd4e28b3 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -55,7 +55,7 @@ void CFanNoises::load(SimpleFile *file) { CGameObject::load(file); } -bool CFanNoises::handleEvent(CEnterRoomMsg &msg) { +bool CFanNoises::handleMessage(CEnterRoomMsg &msg) { warning("CFanNoises::handleEvent"); return true; } diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 835d853d09..6daf8020c5 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -38,7 +38,7 @@ private: int _fieldD0; int _fieldD4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CFanNoises(); diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index 7894c5ef58..5f3fac315d 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -46,7 +46,7 @@ void CGetLiftEye2::load(SimpleFile *file) { CGameObject::load(file); } -bool CGetLiftEye2::handleEvent(CEnterRoomMsg &msg) { +bool CGetLiftEye2::handleMessage(CEnterRoomMsg &msg) { warning("CGetLiftEye2::handleEvent"); return true; } diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 5803ad03bd..8ce181f3c6 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -31,7 +31,7 @@ class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget { private: static CString *_v1; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF static void init(); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index 3d0a0e1f19..2bd3313d47 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -57,7 +57,7 @@ void CGondolierMixer::load(SimpleFile *file) { CGondolierBase::load(file); } -bool CGondolierMixer::handleEvent(CEnterRoomMsg &msg) { +bool CGondolierMixer::handleMessage(CEnterRoomMsg &msg) { CRoomItem *parentRoom = dynamic_cast(getParent()); if (parentRoom == msg._newRoom) msg.execute(parentRoom); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 1288290d6f..dd7288352b 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -38,7 +38,7 @@ private: CString _string2; int _fieldE4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CGondolierMixer(); diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index 856e6a463f..c0b7df300f 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -57,7 +57,7 @@ void CLight::load(SimpleFile *file) { CBackground::load(file); } -bool CLight::handleEvent(CEnterRoomMsg &msg) { +bool CLight::handleMessage(CEnterRoomMsg &msg) { warning("CLight::handleEvent"); return true; } diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index 42e7224a72..66d60bedf7 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -39,7 +39,7 @@ private: int _fieldF8; int _fieldFC; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLight(); diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp index b857bfb159..0e68dda0dc 100644 --- a/engines/titanic/game/light_switch.cpp +++ b/engines/titanic/game/light_switch.cpp @@ -50,7 +50,7 @@ void CLightSwitch::load(SimpleFile *file) { CBackground::load(file); } -bool CLightSwitch::handleEvent(CEnterRoomMsg &msg) { +bool CLightSwitch::handleMessage(CEnterRoomMsg &msg) { warning("CLightSwitch::handleEvent"); return true; } diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 1cda539dd0..2c43edd5b9 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -36,7 +36,7 @@ private: int _fieldE4; int _fieldE8; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLightSwitch(); diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index 5d7df1df12..9511d7b017 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -42,7 +42,7 @@ void CLongStickDispenser::load(SimpleFile *file) { CGameObject::load(file); } -bool CLongStickDispenser::handleEvent(CEnterRoomMsg &msg) { +bool CLongStickDispenser::handleMessage(CEnterRoomMsg &msg) { _fieldC0 = 0; _fieldC4 = 1; return true; diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 14785a785b..5e43bfa62f 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -34,7 +34,7 @@ private: int _fieldC0; int _fieldC4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLongStickDispenser() : CGameObject(), _fieldBC(0), diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index adb2dc5d36..16c8f480dd 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -34,7 +34,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) { CGameObject::load(file); } -bool CPlayerMeetsParrot::handleEvent(CEnterRoomMsg &msg) { +bool CPlayerMeetsParrot::handleMessage(CEnterRoomMsg &msg) { warning("CPlayerMeetsParrot::handleEvent"); return true; } diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 9b8138f124..960b679fd4 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -30,7 +30,7 @@ namespace Titanic { class CPlayerMeetsParrot : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp index 44d24f264e..afe0836e65 100644 --- a/engines/titanic/game/pet/pet_monitor.cpp +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -34,7 +34,7 @@ void CPETMonitor::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETMonitor::handleEvent(CEnterRoomMsg &msg) { +bool CPETMonitor::handleMessage(CEnterRoomMsg &msg) { warning("CPETMonitor::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 1d66a58d29..f8a35292fa 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETMonitor : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp index b25111f62c..e1dab2218f 100644 --- a/engines/titanic/game/pet/pet_position.cpp +++ b/engines/titanic/game/pet/pet_position.cpp @@ -34,7 +34,7 @@ void CPETPosition::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETPosition::handleEvent(CEnterRoomMsg &msg) { +bool CPETPosition::handleMessage(CEnterRoomMsg &msg) { warning("CPETPosition::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 8a0623932b..fe28a13777 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETPosition : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp index a88b703b10..36685676ac 100644 --- a/engines/titanic/game/pet/pet_transport.cpp +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -34,7 +34,7 @@ void CPETTransport::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETTransport::handleEvent(CEnterRoomMsg &msg) { +bool CPETTransport::handleMessage(CEnterRoomMsg &msg) { warning("CPETTransport::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 3dc856d5b2..e43cbef849 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETTransport : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index f7a696e549..749bf33b24 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -55,7 +55,7 @@ void CPhonograph::load(SimpleFile *file) { CMusicPlayer::load(file); } -bool CPhonograph::handleEvent(CEnterRoomMsg &msg) { +bool CPhonograph::handleMessage(CEnterRoomMsg &msg) { warning("CPhonograph::handleEvent"); return true; } diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 6efe10bab2..102edd2ace 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -38,7 +38,7 @@ protected: int _fieldF0; int _fieldF4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CPhonograph(); diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index cf735dd6d0..9baae69afb 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -90,7 +90,7 @@ void CSGTStateRoom::load(SimpleFile *file) { CBackground::load(file); } -bool CSGTStateRoom::handleEvent(CEnterRoomMsg &msg) { +bool CSGTStateRoom::handleMessage(CEnterRoomMsg &msg) { warning("CSGTStateRoom::handleEvent"); return true; } diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index 4ec1617875..a730473580 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -55,7 +55,7 @@ private: int _fieldEC; int _fieldF0; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CSGTStateRoom(); diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp index 6d12e59c81..1da27923c5 100644 --- a/engines/titanic/game/ship_setting.cpp +++ b/engines/titanic/game/ship_setting.cpp @@ -48,7 +48,7 @@ void CShipSetting::load(SimpleFile *file) { CBackground::load(file); } -bool CShipSetting::handleEvent(CEnterRoomMsg &msg) { +bool CShipSetting::handleMessage(CEnterRoomMsg &msg) { warning("CShipSetting::handleEvent"); return true; } diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 2525224a28..6ea38be052 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -35,7 +35,7 @@ private: CString _string4; CString _string5; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CShipSetting(); diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index edf69fe31a..a795a15a16 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -57,7 +57,7 @@ void CLift::load(SimpleFile *file) { CTransport::load(file); } -bool CLift::handleEvent(CEnterRoomMsg &msg) { +bool CLift::handleMessage(CEnterRoomMsg &msg) { warning("CLift::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 439e65bb30..4f628231e8 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -39,7 +39,7 @@ private: int _fieldF8; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLift() : CTransport(), _fieldF8(1) {} diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index 80f8b0d05b..7cc5585d3b 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -35,7 +35,7 @@ private: int _field108; int _field10C; protected: - virtual bool handleEvent(CEnterRoomMsg &msg) { return true; } + virtual bool handleMessage(CEnterRoomMsg &msg) { return true; } public: CLASSDEF CLiftindicator(); diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 16f42772c3..eca1037128 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -43,7 +43,7 @@ void CPellerator::load(SimpleFile *file) { CTransport::load(file); } -bool CPellerator::handleEvent(CEnterRoomMsg &msg) { +bool CPellerator::handleMessage(CEnterRoomMsg &msg) { warning("CPellerator::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index c997373382..03e45751b2 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -33,7 +33,7 @@ private: static int _v1; static int _v2; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index 817b179e3e..819dc9435a 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -48,7 +48,7 @@ void CUpLighter::load(SimpleFile *file) { CDropTarget::load(file); } -bool CUpLighter::handleEvent(CEnterRoomMsg &msg) { +bool CUpLighter::handleMessage(CEnterRoomMsg &msg) { warning("CUpLighter::handleEvent"); return true; } diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index 6c722ddc2a..add941f325 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -35,7 +35,7 @@ private: int _field120; int _field124; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CUpLighter(); diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp index 801dfd1b60..bb58deebce 100644 --- a/engines/titanic/game/volume_control.cpp +++ b/engines/titanic/game/volume_control.cpp @@ -45,7 +45,7 @@ void CVolumeControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CVolumeControl::handleEvent(CEnterNodeMsg &msg) { +bool CVolumeControl::handleMessage(CEnterNodeMsg &msg) { warning("CVolumeControl::handleEvent"); return true; } diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index f3f6a75278..5586c9cb45 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -34,7 +34,7 @@ private: CString _string1; int _fieldCC; protected: - virtual bool handleEvent(CEnterNodeMsg &msg); + virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF CVolumeControl(); diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 110bddfd90..2eb4427a46 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -48,7 +48,7 @@ void CInputHandler::decLockCount() { } } -void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { +void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { if (!respectLock || _lockCount <= 0) { if (_gameManager->_gameState._mode == GSMODE_1) { processMessage(&msg); @@ -58,7 +58,7 @@ void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { } } -void CInputHandler::processMessage(const CMessage *msg) { +void CInputHandler::processMessage(CMessage *msg) { const CMouseMsg *mouseMsg = dynamic_cast(msg); _field24 = 0; dispatchMessage(msg); @@ -126,7 +126,7 @@ void CInputHandler::processMessage(const CMessage *msg) { } } -void CInputHandler::dispatchMessage(const CMessage *msg) { +void CInputHandler::dispatchMessage(CMessage *msg) { CPetControl *pet = _gameManager->_project->getPetControl(); if (!pet || !msg->execute(pet, nullptr, MSGFLAG_BREAK_IF_HANDLED)) { CViewItem *view = _gameManager->getView(); diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index a81874f0c5..7495082ddf 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -36,12 +36,12 @@ private: /** * Process and dispatch a passed message */ - void processMessage(const CMessage *msg); + void processMessage(CMessage *msg); /** * Dispatches a message to the project */ - void dispatchMessage(const CMessage *msg); + void dispatchMessage(CMessage *msg); /** * Called when a drag operation has ended @@ -75,7 +75,7 @@ public: /** * Handles a genereated mouse message */ - void handleMessage(const CMessage &msg, bool respectLock = true); + void handleMessage(CMessage &msg, bool respectLock = true); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index c20fe10992..e17494c5e2 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -34,7 +34,7 @@ void CBilgeDispensorEvent::load(SimpleFile *file) { CAutoSoundEvent::load(file); } -bool CBilgeDispensorEvent::handleEvent(CEnterRoomMsg &msg) { +bool CBilgeDispensorEvent::handleMessage(CEnterRoomMsg &msg) { _value1 = 0; return true; } diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index 9f91b61ef9..de8705f604 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -30,7 +30,7 @@ namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 9202305353..28b8856578 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -39,7 +39,7 @@ void CMessage::load(SimpleFile *file) { CSaveableObject::load(file); } -bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) const { +bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { // If no target was specified, then there's nothing to do if (!target) return false; @@ -51,7 +51,7 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) c if (flags & MSGFLAG_SCAN) nextItem = item->scan(target); - if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(classDef)) { + if (!classDef || item->isInstanceOf(classDef)) { bool handled = perform(item); if (handled) { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index ccea453a26..c945ad7736 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -35,7 +35,7 @@ enum MessageFlag { }; #define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ - virtual bool handleEvent(NAME &msg) = 0; } + virtual bool handleMessage(NAME &msg) = 0; } class CGameObject; class CRoomItem; @@ -47,10 +47,14 @@ public: CLASSDEF CMessage(); + /** + * Executes the message, passing it on to the designated target, + * and optionally it's children + */ bool execute(CTreeItem *target, const ClassDef *classDef = nullptr, - int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED) const; + int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); - virtual bool perform(CTreeItem *treeItem) const { return false; } + virtual bool perform(CTreeItem *treeItem) { return false; } /** * Save the data for the class to file @@ -80,8 +84,6 @@ public: MSGTARGET(CEditControlMsg); class CEditControlMsg : public CMessage { -protected: - virtual bool handleMessage(const CEditControlMsg &msg) { return false; } public: int _field4; int _field8; @@ -95,19 +97,17 @@ public: _field1C(0), _field20(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool perform(CTreeItem *treeItem) const { - CEditControlMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CEditControlMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CLightsMsg); class CLightsMsg : public CMessage { -protected: - virtual bool handleMessage(const CLightsMsg &msg) { return false; } public: int _field4; int _field8; @@ -119,19 +119,16 @@ public: _fieldC(0), _field10(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CLightsMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CLightsMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CIsHookedOnMsg); class CIsHookedOnMsg : public CMessage { -protected: - virtual bool handleMessage(const CIsHookedOnMsg &msg) { return false; } public: int _field4; int _field8; @@ -145,19 +142,16 @@ public: _field18(0), _field1C(0), _field20(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CIsHookedOnMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CIsHookedOnMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CSubAcceptCCarryMsg); class CSubAcceptCCarryMsg : public CMessage { -protected: - virtual bool handleMessage(const CSubAcceptCCarryMsg &msg) { return false; } public: CString _string1; int _value1, _value2, _value3; @@ -166,19 +160,16 @@ public: CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CSubAcceptCCarryMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CSubAcceptCCarryMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CTransportMsg); class CTransportMsg : public CMessage { -protected: - virtual bool handleMessage(const CTransportMsg &msg) { return false; } public: CString _string; int _value1, _value2; @@ -187,11 +178,10 @@ public: CTransportMsg() : _value1(0), _value2(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CTransportMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CTransportMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -201,10 +191,9 @@ public: public: NAME() : CMessage() {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ - virtual bool perform(CTreeItem *treeItem) const { \ - NAME *dest = dynamic_cast(treeItem); \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ @@ -214,10 +203,9 @@ public: NAME(F1 N1) : CMessage(), _##N1(N1) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ @@ -227,10 +215,9 @@ public: NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ @@ -240,10 +227,9 @@ public: NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ @@ -253,10 +239,9 @@ public: 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(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 6e2a74a046..7fe7ef960f 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -30,6 +30,7 @@ namespace Titanic { enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; +MSGTARGET(CMouseMsg); class CMouseMsg : public CMessage { public: int _buttons; @@ -39,6 +40,11 @@ public: static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; } + virtual bool perform(CTreeItem *treeItem) { + CMouseMsgTarget *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } + CMouseMsg() : _buttons(0) {} CMouseMsg(const Point &pt, int buttons) : _mousePos(pt), _buttons(buttons) {} @@ -52,15 +58,15 @@ public: CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseMoveMsg *dest = dynamic_cast(treeItem); + CMouseMoveMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; +MSGTARGET(CMouseButtonMsg); class CMouseButtonMsg : public CMouseMsg { public: int _field10; @@ -70,7 +76,7 @@ public: CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } }; @@ -82,11 +88,10 @@ public: CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseButtonDownMsg *dest = dynamic_cast(treeItem); + CMouseButtonDownMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -101,9 +106,8 @@ public: static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseButtonUpMsg *dest = dynamic_cast(treeItem); + CMouseButtonUpMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -116,15 +120,15 @@ public: CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDoubleClickMsg *dest = dynamic_cast(treeItem); + CMouseDoubleClickMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; +MSGTARGET(CMouseDragMsg); class CMouseDragMsg : public CMouseMsg { public: CLASSDEF @@ -136,6 +140,7 @@ public: } }; +MSGTARGET(CMouseDragMoveMsg); class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF @@ -143,11 +148,10 @@ public: CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDragMoveMsg *dest = dynamic_cast(treeItem); + CMouseDragMoveMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -164,11 +168,10 @@ public: _dragItem(nullptr), _field14(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDragStartMsg *dest = dynamic_cast(treeItem); + CMouseDragStartMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -184,11 +187,10 @@ public: CMouseDragMsg(pt), _dragItem(dragItem) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDragEndMsg *dest = dynamic_cast(treeItem); + CMouseDragEndMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index 359cfcb48f..8916fa90e7 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -36,7 +36,7 @@ void CEnterBridge::load(SimpleFile *file) { CGameObject::load(file); } -bool CEnterBridge::handleEvent(CEnterRoomMsg &msg) { +bool CEnterBridge::handleMessage(CEnterRoomMsg &msg) { warning("CEnterBridge::handlEvent"); return true; } diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 39343ef904..9f7a64cf73 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -32,7 +32,7 @@ class CEnterBridge : public CGameObject, CEnterRoomMsgTarget { private: int _value; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CEnterBridge() : CGameObject(), _value(1) {} diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index 907d3c0c71..e487dc1ecb 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -233,7 +233,7 @@ void CBarbot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CBarbot::handleEvent(CEnterRoomMsg &msg) { +bool CBarbot::handleMessage(CEnterRoomMsg &msg) { warning("TODO: Barbot::CEnterRoomMsg"); return true; } diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 442578ef6c..d407ef74c8 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -174,7 +174,7 @@ private: int _field33C; int _field340; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBarbot(); diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp index dfc0a4f0ad..a412d43ff1 100644 --- a/engines/titanic/npcs/liftbot.cpp +++ b/engines/titanic/npcs/liftbot.cpp @@ -48,7 +48,7 @@ void CLiftBot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CLiftBot::handleEvent(CEnterRoomMsg &msg) { +bool CLiftBot::handleMessage(CEnterRoomMsg &msg) { warning("CLiftBot::handleEvent"); return true; } diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index 3a41bf3a96..373147bdb7 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -35,7 +35,7 @@ private: private: int _field108; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLiftBot(); diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index 638cac8c26..5981a707bd 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -41,7 +41,7 @@ void CAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayerBase::load(file); } -bool CAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { if (!_fieldCC) { warning("TODO"); } diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index d2f42ac5c5..bcf4126264 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -32,7 +32,7 @@ class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget { private: CString _string2; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CAutoMusicPlayer(); diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index 25f73b0dc5..eaad635dd3 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -44,7 +44,7 @@ void CMusicPlayer::load(SimpleFile *file) { CGameObject::load(file); } -bool CMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CMusicPlayer::handleMessage(CEnterRoomMsg &msg) { warning("TODO: CMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 96a6968c6d..6b8bc83b05 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -35,7 +35,7 @@ protected: int _fieldCC; int _fieldD0; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CMusicPlayer() : CGameObject(), diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp index 0ef6c8d2ac..5af8ca25d3 100644 --- a/engines/titanic/sound/node_auto_sound_player.cpp +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -36,7 +36,7 @@ void CNodeAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CNodeAutoSoundPlayer::handleEvent(CEnterNodeMsg &msg) { +bool CNodeAutoSoundPlayer::handleMessage(CEnterNodeMsg &msg) { warning("CNodeAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 258aa47eea..acc766abec 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -32,7 +32,7 @@ class CNodeAutoSoundPlayer : public CAutoSoundPlayer, CEnterNodeMsgTarget { private: int _fieldEC; protected: - virtual bool handleEvent(CEnterNodeMsg &msg); + virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp index 2ee8f2d082..7b5ba707c2 100644 --- a/engines/titanic/sound/restricted_auto_music_player.cpp +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -44,7 +44,7 @@ void CRestrictedAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayer::load(file); } -bool CRestrictedAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CRestrictedAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { warning("CRestrictedAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index efb3dc2892..3553d1c63b 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -35,7 +35,7 @@ private: CString _string5; CString _string6; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp index 549f27be63..c24ef2a211 100644 --- a/engines/titanic/sound/room_auto_sound_player.cpp +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -34,7 +34,7 @@ void CRoomAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CRoomAutoSoundPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CRoomAutoSoundPlayer::handleMessage(CEnterRoomMsg &msg) { warning("CRoomAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index a3ec35cb04..82d23a79c3 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -30,7 +30,7 @@ namespace Titanic { class CRoomAutoSoundPlayer : public CAutoSoundPlayer, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_trigger_auto_music_player.cpp b/engines/titanic/sound/room_trigger_auto_music_player.cpp index 3c0ac0536b..5ec35c3903 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.cpp +++ b/engines/titanic/sound/room_trigger_auto_music_player.cpp @@ -34,7 +34,7 @@ void CRoomTriggerAutoMusicPlayer::load(SimpleFile *file) { CTriggerAutoMusicPlayer::load(file); } -bool CRoomTriggerAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CRoomTriggerAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { warning("CRoomTriggerAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index 9a478a0a08..4ce4bae7fa 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -30,7 +30,7 @@ namespace Titanic { class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index 16a88e40ec..c530a9ac70 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -40,7 +40,7 @@ void CTitaniaSpeech::load(SimpleFile *file) { CGameObject::load(file); } -bool CTitaniaSpeech::handleEvent(CEnterRoomMsg &msg) { +bool CTitaniaSpeech::handleMessage(CEnterRoomMsg &msg) { warning("CTitaniaSpeech::handleEvent"); return true; } diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index 09a8495fef..b894eeead1 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -32,7 +32,7 @@ class CTitaniaSpeech : public CGameObject { private: int _value1, _value2; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} -- cgit v1.2.3