diff options
author | Paul Gilbert | 2016-06-26 23:00:00 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:25:19 -0400 |
commit | ef1d10e926fcf31ffeb5c594a305ec0cd8bf7064 (patch) | |
tree | e475bdb1a91a7f87f96a9582addd861ea66a4a66 /engines/titanic/core | |
parent | b6f476c70f90dd451e7e931fe91ce7c86b922b20 (diff) | |
download | scummvm-rg350-ef1d10e926fcf31ffeb5c594a305ec0cd8bf7064.tar.gz scummvm-rg350-ef1d10e926fcf31ffeb5c594a305ec0cd8bf7064.tar.bz2 scummvm-rg350-ef1d10e926fcf31ffeb5c594a305ec0cd8bf7064.zip |
TITANIC: Implemented remaining CGameManager methods and others
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 50 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 30 | ||||
-rw-r--r-- | engines/titanic/core/mail_man.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/core/room_item.cpp | 9 | ||||
-rw-r--r-- | engines/titanic/core/room_item.h | 4 |
5 files changed, 72 insertions, 27 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 154d2aeefc..0bf54647f5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -63,7 +63,7 @@ CGameObject::CGameObject(): CNamedItem() { _field4C = 0xFF; _isMail = false; _id = 0; - _field58 = 0; + _roomFlags = 0; _visible = true; _field60 = 0; _cursorId = CURSOR_ARROW; @@ -126,7 +126,7 @@ void CGameObject::load(SimpleFile *file) { _visible = file->readNumber() != 0; _isMail = file->readNumber(); _id = file->readNumber(); - _field58 = file->readNumber(); + _roomFlags = file->readNumber(); resourceKey.load(file); _surface = nullptr; @@ -688,24 +688,29 @@ CGameObject *CGameObject::getMailManNextObject(CGameObject *prior) const { return mailMan ? mailMan->getNextObject(prior) : nullptr; } -CGameObject *CGameObject::findRoomObject(const CString &name) const { - return static_cast<CGameObject *>(findRoom()->findByName(name)); -} - -CGameObject *CGameObject::findUnder(CTreeItem *parent, const CString &name) { - if (!parent) +CGameObject *CGameObject::findMailByFlags(int mode, uint roomFlags) { + CMailMan *mailMan = getMailMan(); + if (!mailMan) return nullptr; - - for (CTreeItem *treeItem = parent->getFirstChild(); treeItem; - treeItem = treeItem->scan(parent)) { - if (!treeItem->getName().compareTo(name)) { - return dynamic_cast<CGameObject *>(treeItem); - } + + for (CGameObject *obj = mailMan->getFirstObject(); obj; + obj = mailMan->getNextObject(obj)) { + if (compareRoomFlags(mode, roomFlags, obj->_roomFlags)) + return obj; } return nullptr; } +CGameObject *CGameObject::getNextMail(CGameObject *prior) { + CMailMan *mailMan = getMailMan(); + return mailMan ? mailMan->getNextObject(prior) : nullptr; +} + +CGameObject *CGameObject::findRoomObject(const CString &name) const { + return static_cast<CGameObject *>(findRoom()->findByName(name)); +} + Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) { CGameObject *go; *item = nullptr; @@ -897,6 +902,23 @@ CRoomItem *CGameObject::getHiddenRoom() const { return root ? root->findHiddenRoom() : nullptr; } +CGameObject *CGameObject::getHiddenObject(const CString &name) const { + CRoomItem *room = getHiddenRoom(); + return room ? static_cast<CGameObject *>(findUnder(room, name)) : nullptr; +} + +CTreeItem *CGameObject::findUnder(CTreeItem *parent, const CString &name) const { + if (!parent) + return nullptr; + + for (CTreeItem *item = parent->getFirstChild(); item; item = item->scan(parent)) { + if (item->getName() == name) + return item; + } + + return nullptr; +} + CMusicRoom *CGameObject::getMusicRoom() const { CGameManager *gameManager = getGameManager(); return gameManager ? &gameManager->_musicRoom : nullptr; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index d372b40f88..67bf13141d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -196,11 +196,6 @@ protected: int compareRoomNameTo(const CString &name); /** - * Display a message - */ - void displayMessage(const CString &msg) const; - - /** * Gets the first object under the system MailMan */ CGameObject *getMailManFirstObject() const; @@ -211,14 +206,19 @@ protected: CGameObject *getMailManNextObject(CGameObject *prior) const; /** - * Finds an object by name within the object's room + * Find mail by room flags */ - CGameObject *findRoomObject(const CString &name) const; + CGameObject *findMailByFlags(int mode, uint roomFlags); /** - * Scan the specified room for an item by name + * Find next mail from a given prior one + */ + CGameObject *getNextMail(CGameObject *prior); + + /** + * Finds an object by name within the object's room */ - static CGameObject *findUnder(CTreeItem *parent, const CString &name); + CGameObject *findRoomObject(const CString &name) const; /** * Moves the item from it's original position to be under the current view @@ -300,6 +300,16 @@ protected: CRoomItem *getHiddenRoom() const; /** + * Returns a hidden object + */ + CGameObject *getHiddenObject(const CString &name) const; + + /** + * Scan the specified room for an item by name + */ + CTreeItem *findUnder(CTreeItem *parent, const CString &name) const; + + /** * Returns the music room instance from the game manager */ CMusicRoom *getMusicRoom() const; @@ -366,7 +376,7 @@ protected: public: bool _isMail; int _id; - int _field58; + uint _roomFlags; int _field60; CursorId _cursorId; bool _visible; diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp index 8ac50e9767..8226ebfc80 100644 --- a/engines/titanic/core/mail_man.cpp +++ b/engines/titanic/core/mail_man.cpp @@ -55,7 +55,7 @@ void CMailMan::addMail(CGameObject *obj, int id) { void CMailMan::setMailId(CGameObject *obj, int id) { obj->_id = id; - obj->_field58 = 0; + obj->_roomFlags = 0; obj->_isMail = true; } @@ -68,11 +68,11 @@ CGameObject *CMailMan::findMail(int id) const { return nullptr; } -void CMailMan::removeMail(int id, int v) { +void CMailMan::removeMail(int id, int roomFlags) { for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) { if (obj->_isMail && obj->_id == id) { obj->_isMail = false; - obj->_field58 = v; + obj->_roomFlags = roomFlags; break; } } diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index 6143849661..e33d0c41dd 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -183,4 +183,13 @@ int CRoomItem::getScriptId() const { return 0; } +CResourceKey CRoomItem::getTransitionMovieKey() { + _transitionMovieKey.scanForFile(); + return _transitionMovieKey; +} + +CResourceKey CRoomItem::getExitMovieKey() { + return _exitMovieKey; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index e3ba71c0ae..4692318419 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -72,6 +72,10 @@ public: * Get the TrueTalk script Id associated with the room */ int getScriptId() const; + + CResourceKey getTransitionMovieKey(); + + CResourceKey getExitMovieKey(); }; } // End of namespace Titanic |