aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/core
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/core')
-rw-r--r--engines/titanic/core/game_object.cpp21
-rw-r--r--engines/titanic/core/project_item.cpp26
-rw-r--r--engines/titanic/core/project_item.h9
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