diff options
author | Paul Gilbert | 2016-08-13 23:43:52 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-13 23:43:52 -0400 |
commit | c6c76e7f4cdcdf8b0719cf5bd5f603219a11094f (patch) | |
tree | 6c83f87fb2d2d91d9d42957ca8de210956a38de2 /engines/titanic/core | |
parent | 14cdfa3f58455c818691eb94d3a3de5b0dda8696 (diff) | |
download | scummvm-rg350-c6c76e7f4cdcdf8b0719cf5bd5f603219a11094f.tar.gz scummvm-rg350-c6c76e7f4cdcdf8b0719cf5bd5f603219a11094f.tar.bz2 scummvm-rg350-c6c76e7f4cdcdf8b0719cf5bd5f603219a11094f.zip |
TITANIC: In-progress implementing CParrot class
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 6 | ||||
-rw-r--r-- | engines/titanic/core/named_item.h | 2 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.h | 5 |
5 files changed, 26 insertions, 8 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 723f2456f3..9a524e57a9 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -657,10 +657,10 @@ void CGameObject::playClip(uint startFrame, uint endFrame) { gameManager->playClip(clip, room, room); } -void CGameObject::playRandomClip(const char **names, uint flags) { +void CGameObject::playRandomClip(const char *const *names, uint flags) { // Count size of array int count = 0; - for (const char **p = names; *p; ++p) + for (const char *const *p = names; *p; ++p) ++count; // Play clip @@ -1206,9 +1206,9 @@ void CGameObject::dragMove(const Point &pt) { setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2)); } -bool CGameObject::isObjectDragging() const { +CGameObject *CGameObject::getDraggingObject() const { CTreeItem *item = getGameManager()->_dragItem; - return item ? static_cast<CGameObject *>(item) != nullptr : false; + return static_cast<CGameObject *>(item); } Point CGameObject::getControid() const { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 2dc539f739..b9d819fc25 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -358,7 +358,7 @@ protected: /** * Play a clip randomly from a passed list of names */ - void playRandomClip(const char **names, uint flags); + void playRandomClip(const char *const *names, uint flags); /** * Return the current view/node/room as a single string @@ -723,9 +723,9 @@ public: void dragMove(const Point &pt); /** - * Returns true if an item being dragged is a game object + * Returns the currently dragging item (if any) if it's a game object */ - bool isObjectDragging() const; + CGameObject *getDraggingObject() const; bool compareRoomFlags(int mode, uint flags1, uint flags2); diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 809cda1156..acd59f344e 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -61,7 +61,7 @@ public: /** * Compares the name of the item to a passed name */ - virtual int compareTo(const CString &name, int maxLen) const; + virtual int compareTo(const CString &name, int maxLen = 0) const; /** * Find a parent node for the item diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 6adbbe39fa..a10b8ef19d 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -252,6 +252,19 @@ void CTreeItem::detach() { _priorSibling = _nextSibling = _parent = nullptr; } +void CTreeItem::attach(CTreeItem *item) { + _nextSibling = item; + _priorSibling = item->_priorSibling; + _parent = item->_parent; + + if (item->_priorSibling) + item->_priorSibling->_nextSibling = this; + + item->_priorSibling = this; + if (item->_parent && !item->_parent->_firstChild) + item->_parent->_firstChild = this; +} + CNamedItem *CTreeItem::findByName(const CString &name, int maxLen) { CString nameLower = name; nameLower.toLowercase(); diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index db4ba30a44..45ce5164ac 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -242,6 +242,11 @@ public: void detach(); /** + * Attaches a tree item to a new node + */ + void attach(CTreeItem *item); + + /** * Finds a tree item by name */ CNamedItem *findByName(const CString &name, int maxLen = 0); |