aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/core/project_item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/core/project_item.cpp')
-rw-r--r--engines/titanic/core/project_item.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp
index 16fe0e6ec1..b2bd5cd92b 100644
--- a/engines/titanic/core/project_item.cpp
+++ b/engines/titanic/core/project_item.cpp
@@ -631,4 +631,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