diff options
author | Paul Gilbert | 2017-09-04 10:15:53 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-09-04 10:15:53 -0400 |
commit | f9bec828de2d858f10ec6980ce1bc984f0eb43ce (patch) | |
tree | a20e72395f9496315d9f4d129010894b4e348247 /engines/titanic/core | |
parent | 67090d3cda86020d701106a8a53100f4c4178edf (diff) | |
download | scummvm-rg350-f9bec828de2d858f10ec6980ce1bc984f0eb43ce.tar.gz scummvm-rg350-f9bec828de2d858f10ec6980ce1bc984f0eb43ce.tar.bz2 scummvm-rg350-f9bec828de2d858f10ec6980ce1bc984f0eb43ce.zip |
TITANIC: Support full view specification in debugger room command
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 21 | ||||
-rw-r--r-- | engines/titanic/core/project_item.cpp | 26 | ||||
-rw-r--r-- | engines/titanic/core/project_item.h | 9 |
3 files changed, 37 insertions, 19 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ae517a2689..55dbbad7f0 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1205,28 +1205,11 @@ void CGameObject::loadSurface() { } bool CGameObject::changeView(const CString &viewName) { - return changeView(viewName, ""); + return getRoot()->changeView(viewName, ""); } bool CGameObject::changeView(const CString &viewName, const CString &clipName) { - CViewItem *newView = parseView(viewName); - CGameManager *gameManager = getGameManager(); - CViewItem *oldView = gameManager->getView(); - - if (!oldView || !newView) - return false; - - CMovieClip *clip = nullptr; - if (!clipName.empty()) { - clip = oldView->findNode()->findRoom()->findClip(clipName); - } else { - CLinkItem *link = oldView->findLink(newView); - if (link) - clip = link->getClip(); - } - - gameManager->_gameState.changeView(newView, clip); - return true; + return getRoot()->changeView(viewName, clipName); } void CGameObject::dragMove(const Point &pt) { diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 0fa5d44511..92faebcaeb 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -626,4 +626,30 @@ CViewItem *CProjectItem::parseView(const CString &viewString) { return view; } +bool CProjectItem::changeView(const CString &viewName) { + return changeView(viewName, ""); +} + +bool CProjectItem::changeView(const CString &viewName, const CString &clipName) { + CViewItem *newView = parseView(viewName); + CGameManager *gameManager = getGameManager(); + CViewItem *oldView = gameManager->getView(); + + if (!oldView || !newView) + return false; + + CMovieClip *clip = nullptr; + if (!clipName.empty()) { + clip = oldView->findNode()->findRoom()->findClip(clipName); + } else { + CLinkItem *link = oldView->findLink(newView); + if (link) + clip = link->getClip(); + } + + gameManager->_gameState.changeView(newView, clip); + return true; +} + + } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 4a87e64e2e..c9fd6f97cb 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -242,6 +242,15 @@ public: */ CViewItem *parseView(const CString &viewString); + /** + * Change the view + */ + bool changeView(const CString &viewName, const CString &clipName); + + /** + * Change the view + */ + bool changeView(const CString &viewName); }; } // End of namespace Titanic |