diff options
Diffstat (limited to 'engines/titanic/messages')
| -rw-r--r-- | engines/titanic/messages/auto_sound_event.cpp | 57 | ||||
| -rw-r--r-- | engines/titanic/messages/auto_sound_event.h | 53 | ||||
| -rw-r--r-- | engines/titanic/messages/bilge_auto_sound_event.cpp | 37 | ||||
| -rw-r--r-- | engines/titanic/messages/bilge_auto_sound_event.h | 47 | ||||
| -rw-r--r-- | engines/titanic/messages/bilge_dispensor_event.cpp | 77 | ||||
| -rw-r--r-- | engines/titanic/messages/bilge_dispensor_event.h | 54 | ||||
| -rw-r--r-- | engines/titanic/messages/door_auto_sound_event.cpp | 65 | ||||
| -rw-r--r-- | engines/titanic/messages/door_auto_sound_event.h | 59 | ||||
| -rw-r--r-- | engines/titanic/messages/messages.cpp | 166 | ||||
| -rw-r--r-- | engines/titanic/messages/messages.h | 345 | ||||
| -rw-r--r-- | engines/titanic/messages/mouse_messages.cpp | 47 | ||||
| -rw-r--r-- | engines/titanic/messages/mouse_messages.h | 210 | ||||
| -rw-r--r-- | engines/titanic/messages/pet_messages.h | 64 | ||||
| -rw-r--r-- | engines/titanic/messages/service_elevator_door.cpp | 58 | ||||
| -rw-r--r-- | engines/titanic/messages/service_elevator_door.h | 50 |
15 files changed, 1389 insertions, 0 deletions
diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp new file mode 100644 index 0000000000..bc2cd7d074 --- /dev/null +++ b/engines/titanic/messages/auto_sound_event.cpp @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CAutoSoundEvent, CGameObject) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +bool CAutoSoundEvent::FrameMsg(CFrameMsg *msg) { + if (_value1 >= 0) + _value1 = (_value1 + 1) & _value2; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h new file mode 100644 index 0000000000..d88976708e --- /dev/null +++ b/engines/titanic/messages/auto_sound_event.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { + DECLARE_MESSAGE_MAP; + bool FrameMsg(CFrameMsg *msg); +public: + int _value1; + int _value2; +public: + CLASSDEF; + CAutoSoundEvent(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/bilge_auto_sound_event.cpp b/engines/titanic/messages/bilge_auto_sound_event.cpp new file mode 100644 index 0000000000..fa87b4b79c --- /dev/null +++ b/engines/titanic/messages/bilge_auto_sound_event.cpp @@ -0,0 +1,37 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/messages/bilge_auto_sound_event.h" + +namespace Titanic { + +void CBilgeAutoSoundEvent::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CAutoSoundEvent::save(file, indent); +} + +void CBilgeAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_auto_sound_event.h b/engines/titanic/messages/bilge_auto_sound_event.h new file mode 100644 index 0000000000..9a7fbd6261 --- /dev/null +++ b/engines/titanic/messages/bilge_auto_sound_event.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_BILGE_AUTO_SOUND_EVENT_H +#define TITANIC_BILGE_AUTO_SOUND_EVENT_H + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +class CBilgeAutoSoundEvent : public CAutoSoundEvent { +public: + CLASSDEF; + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BILGE_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp new file mode 100644 index 0000000000..584da00a6f --- /dev/null +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -0,0 +1,77 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/messages/bilge_dispensor_event.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CBilgeDispensorEvent, CAutoSoundEvent) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + +void CBilgeDispensorEvent::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CAutoSoundEvent::save(file, indent); +} + +void CBilgeDispensorEvent::load(SimpleFile *file) { + file->readNumber(); + CAutoSoundEvent::load(file); +} + +bool CBilgeDispensorEvent::EnterRoomMsg(CEnterRoomMsg *msg) { + _value1 = 0; + return true; +} + +bool CBilgeDispensorEvent::LeaveRoomMsg(CLeaveRoomMsg *msg) { + _value1 = -1; + return true; +} + +bool CBilgeDispensorEvent::FrameMsg(CFrameMsg *msg) { + if (_value1 >= 0 && (_value1 & 0xffff) == 0x4000) { + int volume = 20 + getRandomNumber(30); + int val3 = getRandomNumber(20) - 10; + + if (getRandomNumber(2) == 0) { + playSound("b#18.wav", volume, val3); + } + } + + CAutoSoundEvent::FrameMsg(msg); + return true; +} + +bool CBilgeDispensorEvent::StatusChangeMsg(CStatusChangeMsg *msg) { + if (msg->_newStatus == 1) + _value1 = -1; + else if (msg->_newStatus == 2) + _value1 = 0; + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h new file mode 100644 index 0000000000..61d3116db4 --- /dev/null +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_BILGE_DISPENSOR_EVENT_H +#define TITANIC_BILGE_DISPENSOR_EVENT_H + +#include "titanic/messages/auto_sound_event.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CBilgeDispensorEvent : public CAutoSoundEvent { + DECLARE_MESSAGE_MAP; + bool EnterRoomMsg(CEnterRoomMsg *msg); + bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); +public: + CLASSDEF; + CBilgeDispensorEvent() : CAutoSoundEvent() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BILGE_DISPENSOR_EVENT_H */ diff --git a/engines/titanic/messages/door_auto_sound_event.cpp b/engines/titanic/messages/door_auto_sound_event.cpp new file mode 100644 index 0000000000..7618577e50 --- /dev/null +++ b/engines/titanic/messages/door_auto_sound_event.cpp @@ -0,0 +1,65 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/messages/door_auto_sound_event.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CDoorAutoSoundEvent, CAutoSoundEvent) + ON_MESSAGE(PreEnterNodeMsg) + ON_MESSAGE(LeaveNodeMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +bool CDoorAutoSoundEvent::PreEnterNodeMsg(CPreEnterNodeMsg *msg) { + return true; +} + +bool CDoorAutoSoundEvent::LeaveNodeMsg(CLeaveNodeMsg *msg) { + return true; +} + +bool CDoorAutoSoundEvent::TimerMsg(CTimerMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h new file mode 100644 index 0000000000..8b064a7221 --- /dev/null +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H +#define TITANIC_DOOR_AUTO_SOUND_EVENT_H + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +class CDoorAutoSoundEvent : public CAutoSoundEvent { + DECLARE_MESSAGE_MAP; + bool PreEnterNodeMsg(CPreEnterNodeMsg *msg); + bool LeaveNodeMsg(CLeaveNodeMsg *msg); + bool TimerMsg(CTimerMsg *msg); +public: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CLASSDEF; + CDoorAutoSoundEvent() : CAutoSoundEvent(), + _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { + } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp new file mode 100644 index 0000000000..5f587c975d --- /dev/null +++ b/engines/titanic/messages/messages.cpp @@ -0,0 +1,166 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#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" + +namespace Titanic { + +CMessage::CMessage() : CSaveableObject() { +} + +void CMessage::save(SimpleFile *file, int indent) { + file->writeNumberLine(0, indent); +} + +void CMessage::load(SimpleFile *file) { + file->readNumber(); + CSaveableObject::load(file); +} + +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; + + bool result = false; + CTreeItem *item = target; + CTreeItem *nextItem = nullptr; + do { + if (flags & MSGFLAG_SCAN) + nextItem = item->scan(target); + + if (!classDef || item->isInstanceOf(classDef)) { + bool handled = perform(item); + + if (handled) { + result = true; + if (flags & MSGFLAG_BREAK_IF_HANDLED) + return true; + } + } + + item = nextItem; + } while (nextItem); + + return result; +} + +bool CMessage::execute(const CString &target, const ClassDef *classDef, int flags) { + // Scan for the target by name + CProjectItem *project = g_vm->_window->_project; + for (CTreeItem *treeItem = project; treeItem; treeItem = treeItem->scan(project)) { + if (!treeItem->getName().compareToIgnoreCase(target)) + return execute(treeItem, classDef, flags); + } + + 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; +} + +bool CMessage::isButtonDownMsg() const { + return dynamic_cast<const CMouseButtonDownMsg *>(this) != nullptr; +} + +bool CMessage::isButtonUpMsg() const { + return dynamic_cast<const CMouseButtonUpMsg *>(this) != nullptr; +} + +bool CMessage::isMouseMoveMsg() const { + return dynamic_cast<const CMouseMoveMsg *>(this) != nullptr; +} + +bool CMessage::isDoubleClickMsg() const { + return dynamic_cast<const CMouseDoubleClickMsg *>(this) != nullptr; +} + +bool CMessage::isEnterRoomMsg() const { + return dynamic_cast<const CEnterRoomMsg *>(this) != nullptr; +} + +bool CMessage::isPreEnterRoomMsg() const { + return dynamic_cast<const CPreEnterRoomMsg *>(this) != nullptr; +} + +bool CMessage::isleaveRoomMsg() const { + return dynamic_cast<const CLeaveRoomMsg *>(this) != nullptr; +} + +bool CMessage::isEnterNodeMsg() const { + return dynamic_cast<const CEnterNodeMsg *>(this) != nullptr; +} + +bool CMessage::isPreEnterNodeMsg() const { + return dynamic_cast<const CPreEnterNodeMsg *>(this) != nullptr; +} + +bool CMessage::isLeaveNodeMsg() const { + return dynamic_cast<const CLeaveNodeMsg *>(this) != nullptr; +} + +bool CMessage::isEnterViewMsg() const { + return dynamic_cast<const CEnterViewMsg *>(this) != nullptr; +} + +bool CMessage::isPreEnterViewMsg() const { + return dynamic_cast<const CPreEnterViewMsg *>(this) != nullptr; +} + +bool CMessage::isLeaveViewMsg() const { + return dynamic_cast<const CLeaveViewMsg *>(this) != nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h new file mode 100644 index 0000000000..b70bc5e16c --- /dev/null +++ b/engines/titanic/messages/messages.h @@ -0,0 +1,345 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_MESSAGES_H +#define TITANIC_MESSAGES_H + +#include "common/keyboard.h" +#include "titanic/core/saveable_object.h" +#include "titanic/core/tree_item.h" + +namespace Titanic { + +enum MessageFlag { + MSGFLAG_SCAN = 1, + MSGFLAG_BREAK_IF_HANDLED = 2, + MSGFLAG_CLASS_DEF = 4 +}; + +#define MESSAGE0(NAME) \ + class NAME: public CMessage { \ + public: NAME() : CMessage() {} \ + CLASSDEF; \ + static bool isSupportedBy(const CTreeItem *item) { \ + 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 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 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 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 supports(item, _type); } \ +} + +class CCarry; +class CCharacter; +class CGameObject; +class CRoomItem; +class CNodeItem; +class CViewItem; +class CMusicPlayer; + +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(); + + /** + * 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); + + /** + * Executes the message, passing it on to the designated target, + * and optionally it's children + */ + bool execute(const CString &target, const ClassDef *classDef = nullptr, + int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); + + /** + * 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 + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + virtual bool isMouseMsg() const; + virtual bool isButtonDownMsg() const; + virtual bool isButtonUpMsg() const; + virtual bool isMouseMoveMsg() const; + virtual bool isDoubleClickMsg() const; + virtual bool isEnterRoomMsg() const; + virtual bool isPreEnterRoomMsg() const; + virtual bool isleaveRoomMsg() const; + virtual bool isEnterNodeMsg() const; + virtual bool isPreEnterNodeMsg() const; + virtual bool isLeaveNodeMsg() const; + virtual bool isEnterViewMsg() const; + virtual bool isPreEnterViewMsg() const; + virtual bool isLeaveViewMsg() const; +}; + +class CEditControlMsg : public CMessage { +public: + int _mode; + int _param; + CString _text; + byte _textR; + byte _textG; + byte _textB; +public: + CLASSDEF; + CEditControlMsg() : _mode(0), _param(0), _textR(0), _textG(0), _textB(0) {} + + static bool isSupportedBy(const CTreeItem *item) { + return CMessage::supports(item, _type); + } +}; + +MESSAGE1(CTimeMsg, uint, _ticks, 0); + +class CTimerMsg : public CTimeMsg { +public: + uint _timerCtr; + int _actionVal; + CString _action; +public: + CLASSDEF; + CTimerMsg() : CTimeMsg(), _timerCtr(0), _actionVal(0) {} + CTimerMsg(uint ticks, uint timerCtr, int actionVal, const CString &action) : + CTimeMsg(ticks), _timerCtr(timerCtr), _actionVal(actionVal), _action(action) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +MESSAGE1(CActMsg, CString, action, ""); +MESSAGE1(CActivationmsg, CString, value, ""); +MESSAGE1(CAddHeadPieceMsg, CString, value, "NULL"); +MESSAGE1(CAnimateMaitreDMsg, int, value, 0); +MESSAGE1(CArboretumGateMsg, int, value, 0); +MESSAGE0(CArmPickedUpFromTableMsg); +MESSAGE0(CBodyInBilgeRoomMsg); +MESSAGE1(CBowlStateChangeMsg, int, state, 0); +MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0); +MESSAGE2(CChangeMusicMsg, CString, filename, "", int, flags, 0); +MESSAGE1(CChangeSeasonMsg, CString, season, "Summer"); +MESSAGE0(CCheckAllPossibleCodes); +MESSAGE2(CCheckChevCode, int, classNum, 0, uint, chevCode, 0); +MESSAGE1(CChildDragEndMsg, int, value, 0); +MESSAGE0(CClearChevPanelBits); +MESSAGE0(CCorrectMusicPlayedMsg); +MESSAGE0(CCreateMusicPlayerMsg); +MESSAGE0(CCylinderHolderReadyMsg); +MESSAGE0(CDeactivationMsg); +MESSAGE1(CDeliverCCarryMsg, CString, value, ""); +MESSAGE0(CDisableMaitreDProdReceptor); +MESSAGE0(CDismissBotMsg); +MESSAGE0(CDoffNavHelmet); +MESSAGE0(CDonNavHelmet); +MESSAGE1(CDoorbotNeededInElevatorMsg, int, value, 0); +MESSAGE0(CDoorbotNeededInHomeMsg); +MESSAGE1(CDropObjectMsg, CCarry *, item, nullptr); +MESSAGE1(CDropZoneGotObjectMsg, CGameObject *, object, nullptr); +MESSAGE1(CDropZoneLostObjectMsg, CGameObject *, object, nullptr); +MESSAGE1(CEjectCylinderMsg, int, value, 0); +MESSAGE2(CPreEnterNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); +MESSAGE2(CPreEnterRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); +MESSAGE2(CPreEnterViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); +MESSAGE2(CEnterNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); +MESSAGE2(CEnterRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); +MESSAGE2(CEnterViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); +MESSAGE0(CErasePhonographCylinderMsg); +MESSAGE1(CFrameMsg, uint, ticks, 0); +MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 1); +MESSAGE1(CGetChevClassBits, int, classBits, 0); +MESSAGE1(CGetChevClassNum, int, classNum, 0); +MESSAGE2(CGetChevCodeFromRoomNameMsg, CString, roomName, "", uint, chevCode, 0); +MESSAGE1(CGetChevFloorBits, int, floorBits, 0); +MESSAGE1(CGetChevFloorNum, int, floorNum, 0); +MESSAGE1(CGetChevLiftBits, int, liftBits, 0); +MESSAGE1(CGetChevLiftNum, int, liftNum, 0); +MESSAGE1(CGetChevRoomBits, int, roomNum, 0); +MESSAGE1(CGetChevRoomNum, int, roomNum, 0); +MESSAGE2(CHoseConnectedMsg, int, value, 1, CGameObject *, object, nullptr); +MESSAGE0(CInitializeAnimMsg); +MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); +MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); +MESSAGE1(CIsParrotPresentMsg, bool, value, false); +MESSAGE1(CKeyCharMsg, int, key, 32); +MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); +MESSAGE2(CLeaveRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); +MESSAGE2(CLeaveViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); +MESSAGE1(CLemonFallsFromTreeMsg, Point, pt, Point()); +MESSAGE4(CLightsMsg, bool, flag1, false, bool, flag2, false, bool, flag3, false, bool, flag4, false); +MESSAGE1(CLoadSuccessMsg, int, ticks, 0); +MESSAGE1(CLockPhonographMsg, int, value, 0); +MESSAGE0(CMaitreDDefeatedMsg); +MESSAGE0(CMaitreDHappyMsg); +MESSAGE1(CMissiveOMatActionMsg, int, action, 0); +MESSAGE0(CMoveToStartPosMsg); +MESSAGE2(CMovieEndMsg, int, startFrame, 0, int, endFrame, 0); +MESSAGE2(CMovieFrameMsg, int, frameNumber, 0, int, value2, 0); +MESSAGE0(CMusicHasStartedMsg); +MESSAGE0(CMusicHasStoppedMsg); +MESSAGE0(CMusicSettingChangedMsg); +MESSAGE2(CNPCPlayAnimationMsg, const char *const *, names, nullptr, int, maxDuration, 0); +MESSAGE1(CNPCPlayIdleAnimationMsg, const char *const *, names, 0); +MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, const char *const *, names, nullptr); +MESSAGE0(CNPCQueueIdleAnimMsg); +MESSAGE1(CNutPuzzleMsg, CString, value, ""); +MESSAGE1(COnSummonBotMsg, int, value, 0); +MESSAGE0(COpeningCreditsMsg); +MESSAGE1(CPanningAwayFromParrotMsg, CTreeItem *, target, nullptr); +MESSAGE2(CParrotSpeakMsg, CString, target, "", CString, action, ""); +MESSAGE2(CParrotTriesChickenMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CPhonographPlayMsg, int, value, 0); +MESSAGE0(CPhonographReadyToPlayMsg); +MESSAGE1(CPhonographRecordMsg, int, value, 0); +MESSAGE3(CPhonographStopMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE2(CPlayRangeMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CPlayerTriesRestaurantTableMsg, int, tableId, 0, bool, result, false); +MESSAGE1(CPreSaveMsg, int, value, 0); +MESSAGE1(CProdMaitreDMsg, int, value, 0); +MESSAGE2(CPumpingMsg, int, value, 0, CGameObject *, object, nullptr); +MESSAGE1(CPutBotBackInHisBoxMsg, int, value, 0); +MESSAGE1(CPutParrotBackMsg, int, value, 0); +MESSAGE0(CPuzzleSolvedMsg); +MESSAGE3(CQueryCylinderHolderMsg, int, value1, 0, int, value2, 0, CTreeItem *, target, (CTreeItem *)nullptr); +MESSAGE1(CQueryCylinderMsg, CString, name, ""); +MESSAGE1(CQueryCylinderNameMsg, CString, name, ""); +MESSAGE3(CQueryCylinderTypeMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE1(CQueryMusicControlSettingMsg, int, value, 0); +MESSAGE1(CQueryPhonographState, int, value, 0); +MESSAGE0(CRecordOntoCylinderMsg); +MESSAGE0(CRemoveFromGameMsg); +MESSAGE0(CReplaceBowlAndNutsMsg); +MESSAGE1(CRestaurantMusicChanged, CString, value, ""); +MESSAGE2(CSendCCarryMsg, CString, strValue, "", int, numValue, 0); +MESSAGE1(CSenseWorkingMsg, CString, value, "Not Working"); +MESSAGE2(CServiceElevatorFloorChangeMsg, int, value1, 0, int, value2, 0); +MESSAGE0(CServiceElevatorFloorRequestMsg); +MESSAGE1(CServiceElevatorMsg, int, value, 4); +MESSAGE2(CSetChevButtonImageMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CSetChevClassBits, int, classNum, 0); +MESSAGE1(CSetChevFloorBits, int, floorNum, 0); +MESSAGE1(CSetChevLiftBits, int, liftNum, 0); +MESSAGE2(CSetChevPanelBitMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CSetChevPanelButtonsMsg, int, chevCode, 0); +MESSAGE1(CSetChevRoomBits, int, roomNum, 0); +MESSAGE1(CSetFrameMsg, int, frameNumber, 0); +MESSAGE0(CSetMusicControlsMsg); +MESSAGE2(CSetVarMsg, CString, varName, "", int, value, 0); +MESSAGE2(CSetVolumeMsg, int, volume, 70, int, secondsTransition, 0); +MESSAGE2(CShipSettingMsg, int, value, 0, CString, name, ""); +MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!"); +MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0); +MESSAGE1(CSpeechFallsFromTreeMsg, Point, pos, Point()); +MESSAGE1(CStartMusicMsg, CMusicPlayer *, musicPlayer, (CMusicPlayer *)nullptr); +MESSAGE3(CStatusChangeMsg, int, oldStatus, 0, int, newStatus, 0, bool, success, false); +MESSAGE1(CStopMusicMsg, CMusicPlayer *, musicPlayer, (CMusicPlayer *)nullptr); +MESSAGE4(CSubAcceptCCarryMsg, CString, string1, "", int, value1, 0, int, value2, 0, CCarry *, item, nullptr); +MESSAGE0(CSubDeliverCCarryMsg); +MESSAGE0(CSubSendCCarryMsg); +MESSAGE0(CSUBTransition); +MESSAGE0(CSubTurnOffMsg); +MESSAGE0(CSubTurnOnMsg); +MESSAGE2(CSummonBotMsg, CString, npcName, "", int, value, 0); +MESSAGE1(CSummonBotQueryMsg, CString, npcName, ""); +MESSAGE1(CTakeHeadPieceMsg, CString, value, "NULL"); +MESSAGE2(CTextInputMsg, CString, input, "", CString, response, ""); +MESSAGE1(CTimeDilationMsg, int, value, 0); +MESSAGE0(CTitleSequenceEndedMsg); +MESSAGE0(CTransitMsg); +MESSAGE1(CTranslateObjectMsg, Point, delta, Point()); +MESSAGE3(CTransportMsg, CString, roomName, "", int, value1, 0, int, value2, 0); +MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); +MESSAGE1(CTriggerNPCEvent, int, value, 0); +MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFrame, 0, uint, endFrame, 0); +MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); +MESSAGE2(CTrueTalkGetStateValueMsg, int, stateNum, 0, int, stateVal, -1000); +MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, dialogueId, 0); +MESSAGE3(CTrueTalkNotifySpeechStartedMsg, uint, soundId, 0, uint, dialogueId, 0, int, value, 0); +MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0); +MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); +MESSAGE3(CTrueTalkTriggerActionMsg, int, action, 0, int, param1, 0, int, param2, 0); +MESSAGE0(CTurnOff); +MESSAGE0(CTurnOn); +MESSAGE1(CUse, CGameObject *, item, nullptr); +MESSAGE1(CUseWithCharMsg, CCharacter *, character, nullptr); +MESSAGE1(CUseWithOtherMsg, CGameObject *, other, 0); +MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState()); +MESSAGE1(CVisibleMsg, bool, visible, true); + +} // End of namespace Titanic + +#endif /* TITANIC_MESSAGE_H */ diff --git a/engines/titanic/messages/mouse_messages.cpp b/engines/titanic/messages/mouse_messages.cpp new file mode 100644 index 0000000000..18fa625c1c --- /dev/null +++ b/engines/titanic/messages/mouse_messages.cpp @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/messages/mouse_messages.h" +#include "titanic/support/mouse_cursor.h" +#include "titanic/support/screen_manager.h" + +namespace Titanic { + +void CMouseButtonDownMsg::generate() { + CInputHandler &inputHandler = *CScreenManager::_screenManagerPtr->_inputHandler; + const Point &mousePos = inputHandler._mousePos; + + CMouseButtonDownMsg msg(mousePos, MB_LEFT); + inputHandler.handleMessage(msg, false); +} + +/*------------------------------------------------------------------------*/ + +void CMouseButtonUpMsg::generate() { + CInputHandler &inputHandler = *CScreenManager::_screenManagerPtr->_inputHandler; + const Point &mousePos = inputHandler._mousePos; + + CMouseButtonUpMsg msg(mousePos, MB_LEFT); + inputHandler.handleMessage(msg, false); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h new file mode 100644 index 0000000000..e7c419bbdc --- /dev/null +++ b/engines/titanic/messages/mouse_messages.h @@ -0,0 +1,210 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_MOUSE_MESSAGES_H +#define TITANIC_MOUSE_MESSAGES_H + +#include "titanic/support/rect.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; + +class CMouseMsg : public CMessage { +public: + int _buttons; + Point _mousePos; +public: + CLASSDEF; + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } + + CMouseMsg() : _buttons(0) {} + CMouseMsg(const Point &pt, int buttons) : + _mousePos(pt), _buttons(buttons) {} +}; + +class CMouseMoveMsg : public CMouseMsg { +public: + CLASSDEF; + CMouseMoveMsg() : CMouseMsg() {} + CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CMouseButtonMsg : public CMouseMsg { +public: + int _field10; +public: + CLASSDEF; + CMouseButtonMsg() : CMouseMsg(), _field10(0) {} + CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CMouseButtonDownMsg : public CMouseButtonMsg { +public: + CLASSDEF; + CMouseButtonDownMsg() : CMouseButtonMsg() {} + CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } + + /** + * Generate a dummy mouse down message at the current mouse position + */ + static void generate(); +}; + +class CMouseButtonUpMsg : public CMouseButtonMsg { +public: + CLASSDEF; + CMouseButtonUpMsg() : CMouseButtonMsg() {} + CMouseButtonUpMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } + + /** + * Generate a dummy mouse up message at the current mouse position + */ + static void generate(); +}; + +class CMouseDoubleClickMsg : public CMouseButtonMsg { +public: + CLASSDEF; + CMouseDoubleClickMsg() : CMouseButtonMsg() {} + CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CMouseDragMsg : public CMouseMsg { +public: + CLASSDEF; + CMouseDragMsg() : CMouseMsg() {} + CMouseDragMsg(const Point &pt) : CMouseMsg(pt, 0) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CMouseDragMoveMsg : public CMouseDragMsg { +public: + CLASSDEF; + CMouseDragMoveMsg() : CMouseDragMsg() {} + CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CMouseDragStartMsg : public CMouseDragMsg { +public: + CTreeItem *_dragItem; + bool _handled; +public: + CLASSDEF; + CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _handled(false) {} + CMouseDragStartMsg(const Point &pt) : CMouseDragMsg(pt), + _dragItem(nullptr), _handled(false) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CPassOnDragStartMsg : public CMessage { +public: + Point _mousePos; + int _value3; + int _value4; +public: + CLASSDEF; + CPassOnDragStartMsg() : CMessage() {} + CPassOnDragStartMsg(const Point &pt, int v3 = 0, int v4 = 0) : + CMessage(), _mousePos(pt), _value3(v3), _value4(v4) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CMouseDragEndMsg : public CMouseDragMsg { +public: + CGameObject *_dropTarget; +public: + CLASSDEF; + CMouseDragEndMsg() : CMouseDragMsg(), _dropTarget(nullptr) {} + CMouseDragEndMsg(const Point &pt, CGameObject *dropTarget = nullptr) : + CMouseDragMsg(pt), _dropTarget(dropTarget) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CChildDragMoveMsg : public CMessage { +public: + Point _mousePos; +public: + CLASSDEF; + CChildDragMoveMsg() : CMessage() {} + CChildDragMoveMsg(const Point &pt) : CMessage(), _mousePos(pt) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +class CChildDragStartMsg : public CMessage { +public: + Point _mousePos; +public: + CLASSDEF; + CChildDragStartMsg() : CMessage() {} + CChildDragStartMsg(const Point &pt) : CMessage(), _mousePos(pt) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOUSE_MESSAGES_H */ diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h new file mode 100644 index 0000000000..60981726ed --- /dev/null +++ b/engines/titanic/messages/pet_messages.h @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PET_MESSAGES_H +#define TITANIC_PET_MESSAGES_H + +#include "titanic/messages/messages.h" + +namespace Titanic { + +MESSAGE0(CPETDeliverMsg); +MESSAGE0(CPETGainedObjectMsg); +MESSAGE0(CPETHelmetOnOffMsg); +MESSAGE0(CPETKeyboardOnOffMsg); +MESSAGE0(CPETLostObjectMsg); +MESSAGE0(CPETObjectSelectedMsg); +MESSAGE1(CPETObjectStateMsg, int, value, 0); +MESSAGE0(CPETPhotoOnOffMsg); +MESSAGE1(CPETPlaySoundMsg, int, soundNum, 0); +MESSAGE0(CPETReceiveMsg); +MESSAGE0(CPETSetStarDestinationMsg); +MESSAGE1(CPETStarFieldLockMsg, int, value, 0); +MESSAGE0(CPETStereoFieldOnOffMsg); +MESSAGE2(CPETTargetMsg, CString, name, "", int, numValue, -1); + +#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 supports(item, _type); \ + } \ +} + +PET_MESSAGE(CPETDownMsg); +PET_MESSAGE(CPETUpMsg); +PET_MESSAGE(CPETLeftMsg); +PET_MESSAGE(CPETRightMsg); +PET_MESSAGE(CPETActivateMsg); + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MESSAGES_H */ diff --git a/engines/titanic/messages/service_elevator_door.cpp b/engines/titanic/messages/service_elevator_door.cpp new file mode 100644 index 0000000000..7011b1ad44 --- /dev/null +++ b/engines/titanic/messages/service_elevator_door.cpp @@ -0,0 +1,58 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/messages/service_elevator_door.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CServiceElevatorDoor, CDoorAutoSoundEvent) + ON_MESSAGE(PreEnterNodeMsg) +END_MESSAGE_MAP() + +CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { + _string1 = "z#31.wav"; + _string2 = "z#32.wav"; +} + +void CServiceElevatorDoor::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string1, indent); + + CDoorAutoSoundEvent::save(file, indent); +} + +void CServiceElevatorDoor::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string1 = file->readString(); + + CDoorAutoSoundEvent::load(file); +} + +bool CServiceElevatorDoor::PreEnterNodeMsg(CPreEnterNodeMsg *msg) { + if (!findRoom()->isEquals("BilgeRoomWith")) + CDoorAutoSoundEvent::PreEnterNodeMsg(msg); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/service_elevator_door.h b/engines/titanic/messages/service_elevator_door.h new file mode 100644 index 0000000000..69ad1e15b9 --- /dev/null +++ b/engines/titanic/messages/service_elevator_door.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H +#define TITANIC_SERVICE_ELEVATOR_DOOR_H + +#include "titanic/messages/door_auto_sound_event.h" + +namespace Titanic { + +class CServiceElevatorDoor : public CDoorAutoSoundEvent { + DECLARE_MESSAGE_MAP; + bool PreEnterNodeMsg(CPreEnterNodeMsg *msg); +public: + CLASSDEF; + CServiceElevatorDoor(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SERVICE_ELEVATOR_DOOR_H */ |
