diff options
author | Paul Gilbert | 2017-09-24 12:18:15 -0400 |
---|---|---|
committer | GitHub | 2017-09-24 12:18:15 -0400 |
commit | 47f6c2e9b9687150da6d5d1498fce90523706c28 (patch) | |
tree | 2b9c3b5424ce427098cfd770ef09784d482b2b24 /engines | |
parent | 3333432b4dc35b65d27423ab7860fae068b13d5e (diff) | |
parent | 1ecb27e6cc32eba24079e9b28aea414319c6cbcf (diff) | |
download | scummvm-rg350-47f6c2e9b9687150da6d5d1498fce90523706c28.tar.gz scummvm-rg350-47f6c2e9b9687150da6d5d1498fce90523706c28.tar.bz2 scummvm-rg350-47f6c2e9b9687150da6d5d1498fce90523706c28.zip |
Merge pull request #1010 from dreammaster/debugger_params
GUI: Support double quoted debugger parameters
Diffstat (limited to 'engines')
-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 | ||||
-rw-r--r-- | engines/titanic/debugger.cpp | 18 |
4 files changed, 49 insertions, 25 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 4534d09724..d52fa27669 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1206,28 +1206,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 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 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 5119f23c94..7438a0053b 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]); @@ -322,9 +331,6 @@ bool Debugger::cmdMovie(int argc, const char **argv) { bool Debugger::cmdSound(int argc, const char **argv) { if (argc == 2) { Common::String name = argv[1]; - const char *ch = strchr(argv[1], '!'); - if (ch) - name.setChar('#', ch - argv[1]); if (!name.contains("#")) name = "z#" + name; |