From 5c2a39e74ac1cf8b67e17fe25e00bcca487c9f99 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 28 Jun 2016 21:18:13 -0400 Subject: TITANIC: Set up empty message targets for classes without messages --- engines/titanic/core/dont_save_file_item.cpp | 2 ++ engines/titanic/core/dont_save_file_item.h | 1 + engines/titanic/core/file_item.cpp | 2 ++ engines/titanic/core/file_item.h | 1 + engines/titanic/core/game_object.cpp | 31 +++++++++++++++++----------- engines/titanic/core/game_object.h | 16 +++++++++----- engines/titanic/core/link_item.cpp | 2 ++ engines/titanic/core/link_item.h | 1 + engines/titanic/core/message_target.h | 15 ++++++++++++++ engines/titanic/core/named_item.cpp | 3 +-- engines/titanic/core/node_item.cpp | 2 ++ engines/titanic/core/node_item.h | 1 + engines/titanic/core/project_item.cpp | 2 ++ engines/titanic/core/project_item.h | 3 +-- engines/titanic/core/room_item.cpp | 2 ++ engines/titanic/core/room_item.h | 1 + engines/titanic/core/static_image.cpp | 2 ++ engines/titanic/core/static_image.h | 1 + engines/titanic/core/tree_item.cpp | 3 +-- 19 files changed, 68 insertions(+), 23 deletions(-) (limited to 'engines/titanic/core') diff --git a/engines/titanic/core/dont_save_file_item.cpp b/engines/titanic/core/dont_save_file_item.cpp index 389cef5a9c..00b7dd22ce 100644 --- a/engines/titanic/core/dont_save_file_item.cpp +++ b/engines/titanic/core/dont_save_file_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CDontSaveFileItem, CFileItem) + void CDontSaveFileItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); } diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h index d4d5da2e4b..7517976825 100644 --- a/engines/titanic/core/dont_save_file_item.h +++ b/engines/titanic/core/dont_save_file_item.h @@ -28,6 +28,7 @@ namespace Titanic { class CDontSaveFileItem : public CFileItem { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/core/file_item.cpp b/engines/titanic/core/file_item.cpp index 0d3316dbf3..566f9104a9 100644 --- a/engines/titanic/core/file_item.cpp +++ b/engines/titanic/core/file_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CFileItem, CTreeItem) + void CFileItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); CTreeItem::save(file, indent); diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index 34ba0ae683..e8e4935de0 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -30,6 +30,7 @@ namespace Titanic { class CFileItem: public CTreeItem { + DECLARE_MESSAGE_MAP private: CString _filename; public: diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 66417ac630..d1f3a32493 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -35,8 +35,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CGameObject, CNamedItem) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CGameObject, CNamedItem) CCreditText *CGameObject::_credits; @@ -424,6 +423,10 @@ void CGameObject::soundFn5(int v1, int v2, int v3) { warning("CGameObject::soundFn5"); } +void CGameObject::sound8(bool flag) const { + getGameManager()->_sound.managerProc8(flag ? 3 : 0); +} + void CGameObject::setVisible(bool val) { if (val != _visible) { _visible = val; @@ -582,10 +585,6 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } -void CGameObject::sound8(bool flag) const { - getGameManager()->_sound.managerProc8(flag ? 3 : 0); -} - void CGameObject::loadSound(const CString &name) { CGameManager *gameManager = getGameManager(); if (gameManager) { @@ -855,15 +854,11 @@ void CGameObject::moveToView(const CString &name) { view->addUnder(this); } -void CGameObject::incState38() { - getGameManager()->_gameState.inc38(); -} - void CGameObject::stateInc14() { getGameManager()->_gameState.inc14(); } -int CGameObject::stateGet14() { +int CGameObject::stateGet14() const { return getGameManager()->_gameState._field14; } @@ -871,10 +866,22 @@ void CGameObject::stateSet24() { getGameManager()->_gameState.set24(1); } -int CGameObject::stateGet24() { +int CGameObject::stateGet24() const { return getGameManager()->_gameState.get24(); } +void CGameObject::stateInc38() { + getGameManager()->_gameState.inc38(); +} + +int CGameObject::stateGet38() const { + return getGameManager()->_gameState._field38; +} + +void CGameObject::quitGame() { + getGameManager()->_gameState._quitGame = true; +} + void CGameObject::inc54() { getGameManager()->inc54(); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 145b81ee65..ade8800e5d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -201,6 +201,8 @@ protected: void soundFn5(int v1, int v2, int v3); + void sound8(bool flag) const; + /** * Adds a timer */ @@ -287,8 +289,6 @@ protected: */ Point getControid() const; - void sound8(bool flag) const; - /** * Plays a movie */ @@ -440,11 +440,17 @@ protected: void petUnlockInput(); void setState1C(bool flag); - void incState38(); void stateInc14(); - int stateGet14(); + int stateGet14() const; void stateSet24(); - int stateGet24(); + int stateGet24() const; + void stateInc38(); + int stateGet38() const; + + /** + * Flag to quit the game + */ + void quitGame(); void surface39(int v1, int v2); diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index b172b9b4d0..a0460bd2c6 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -27,6 +27,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CLinkItem, CNamedItem) + CLinkItem::CLinkItem() : CNamedItem() { _roomNumber = -1; _nodeNumber = -1; diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 25de74104b..9c376396f7 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -34,6 +34,7 @@ class CNodeItem; class CRoomItem; class CLinkItem : public CNamedItem { + DECLARE_MESSAGE_MAP private: /** * Returns a new name for the link item, based on the diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 0f43bcd2c5..e5bdf3e08a 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -68,6 +68,21 @@ protected: \ return &messageMap; \ } +#define EMPTY_MESSAGE_MAP(theClass, baseClass) \ + const MSGMAP *theClass::getMessageMap() const \ + { return getThisMessageMap(); } \ + const MSGMAP *theClass::getThisMessageMap() \ + { \ + typedef theClass ThisClass; \ + typedef baseClass TheBaseClass; \ + static const MSGMAP_ENTRY _messageEntries[] = { \ + { (PMSG)nullptr, nullptr } \ + }; \ + static const MSGMAP messageMap = \ + { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ + return &messageMap; \ + } + class CMessageTarget: public CSaveableObject { DECLARE_MESSAGE_MAP public: diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 72d3fd9f42..981627a280 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -27,8 +27,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CNamedItem, CTreeItem) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CNamedItem, CTreeItem) CString CNamedItem::dumpItem(int indent) const { CString result = CTreeItem::dumpItem(indent); diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 6b7d6452cb..57acbdb3b8 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CNodeItem, CNamedItem) + CNodeItem::CNodeItem() : CNamedItem(), _nodeNumber(0) { } diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 32db1c1401..85003bf97c 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -28,6 +28,7 @@ namespace Titanic { class CNodeItem : public CNamedItem { + DECLARE_MESSAGE_MAP public: int _nodeNumber; Point _nodePos; diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index c6a5c2eb61..586301b9f4 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -41,6 +41,8 @@ namespace Titanic { static const char *const SAVEGAME_STR = "TNIC"; #define SAVEGAME_STR_SIZE 4 +EMPTY_MESSAGE_MAP(CProjectItem, CFileItem) + void CFileListItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 213fa9d638..d0b8d77598 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -73,11 +73,10 @@ public: * Filename list */ class CFileList: public List { -public: }; - class CProjectItem : public CFileItem { + DECLARE_MESSAGE_MAP private: CString _filename; CFileList _files; diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index e33d0c41dd..b3a3fe41cc 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CRoomItem, CNamedItem) + CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), _roomDimensionX(0.0), _roomDimensionY(0.0) { } diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 4692318419..f44a525b60 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -32,6 +32,7 @@ namespace Titanic { class CRoomItem : public CNamedItem { + DECLARE_MESSAGE_MAP private: /** * Handles post-load processing diff --git a/engines/titanic/core/static_image.cpp b/engines/titanic/core/static_image.cpp index 54a041fff5..cc8e1ddc1a 100644 --- a/engines/titanic/core/static_image.cpp +++ b/engines/titanic/core/static_image.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CStaticImage, CGameObject) + void CStaticImage::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h index 2b0a3ad071..953cf4d6bf 100644 --- a/engines/titanic/core/static_image.h +++ b/engines/titanic/core/static_image.h @@ -28,6 +28,7 @@ namespace Titanic { class CStaticImage : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 190dc997e7..21496ee8a5 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -38,8 +38,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CTreeItem, CMessageTarget) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CTreeItem, CMessageTarget) CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { -- cgit v1.2.3