aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-09-04 10:15:53 -0400
committerPaul Gilbert2017-09-04 10:15:53 -0400
commitf9bec828de2d858f10ec6980ce1bc984f0eb43ce (patch)
treea20e72395f9496315d9f4d129010894b4e348247
parent67090d3cda86020d701106a8a53100f4c4178edf (diff)
downloadscummvm-rg350-f9bec828de2d858f10ec6980ce1bc984f0eb43ce.tar.gz
scummvm-rg350-f9bec828de2d858f10ec6980ce1bc984f0eb43ce.tar.bz2
scummvm-rg350-f9bec828de2d858f10ec6980ce1bc984f0eb43ce.zip
TITANIC: Support full view specification in debugger room command
-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
-rw-r--r--engines/titanic/debugger.cpp15
4 files changed, 49 insertions, 22 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
diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp
index a8b580b636..dd363f861f 100644
--- a/engines/titanic/debugger.cpp
+++ b/engines/titanic/debugger.cpp
@@ -168,9 +168,18 @@ bool Debugger::cmdRoom(int argc, const char **argv) {
} else if (argc >= 2) {
CRoomItem *roomItem = findRoom(argv[1]);
- if (!roomItem)
- debugPrintf("Could not find room - %s\n", argv[1]);
- else if (argc == 2)
+ if (!roomItem && argc == 2) {
+ // Presume it's a full view specified
+ CProjectItem *project = g_vm->_window->_project;
+ CViewItem *view = project->parseView(argv[1]);
+
+ if (view) {
+ project->changeView(argv[1]);
+ return false;
+ } else {
+ debugPrintf("Could not find view - %s\n", argv[1]);
+ }
+ } else if (argc == 2)
listRoom(roomItem);
else {
CNodeItem *nodeItem = findNode(roomItem, argv[2]);