diff options
author | Paul Gilbert | 2016-10-05 22:44:14 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-10-05 22:44:14 -0400 |
commit | 07316afaa423a95308364290554379491317909d (patch) | |
tree | 9943a08d03004689c32b4c05b93c78186196d801 | |
parent | 5348327da664882b45bddc994660897a07d4b205 (diff) | |
download | scummvm-rg350-07316afaa423a95308364290554379491317909d.tar.gz scummvm-rg350-07316afaa423a95308364290554379491317909d.tar.bz2 scummvm-rg350-07316afaa423a95308364290554379491317909d.zip |
TITANIC: Add movie command to the debugger
-rw-r--r-- | engines/titanic/debugger.cpp | 34 | ||||
-rw-r--r-- | engines/titanic/debugger.h | 5 | ||||
-rw-r--r-- | engines/titanic/game/movie_tester.h | 8 |
3 files changed, 47 insertions, 0 deletions
diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index a9da83f724..086c6bfaaa 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -23,7 +23,9 @@ #include "titanic/debugger.h" #include "titanic/titanic.h" #include "titanic/core/tree_item.h" +#include "titanic/game/movie_tester.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/support/movie.h" namespace Titanic { @@ -33,6 +35,7 @@ Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) { registerCmd("room", WRAP_METHOD(Debugger, cmdRoom)); registerCmd("pet", WRAP_METHOD(Debugger, cmdPET)); registerCmd("item", WRAP_METHOD(Debugger, cmdItem)); + registerCmd("movie", WRAP_METHOD(Debugger, cmdMovie)); } int Debugger::strToInt(const char *s) { @@ -260,4 +263,35 @@ bool Debugger::cmdItem(int argc, const char **argv) { return true; } +bool Debugger::cmdMovie(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("movie filename.avi [startFrame endFrame]\n"); + return true; + } + + CViewItem *view = g_vm->_window->_gameManager->getView(); + CMovieTester *tester = static_cast<CMovieTester *>( + view->findChildInstanceOf(CMovieTester::_type)); + if (!tester) { + // No movie tester present, so create one + tester = new CMovieTester(); + tester->addUnder(view); + } + + CString filename(argv[1]); + if (!filename.hasSuffix(".avi")) + filename += ".avi"; + tester->loadMovie(filename); + + if (argc == 2) { + tester->playMovie(MOVIE_STOP_PREVIOUS); + } else { + uint startFrame = strToInt(argv[2]); + uint endFrame = strToInt(argv[2]); + tester->playMovie(startFrame, endFrame, MOVIE_STOP_PREVIOUS); + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/debugger.h b/engines/titanic/debugger.h index 5edb7cb324..cae8a07d80 100644 --- a/engines/titanic/debugger.h +++ b/engines/titanic/debugger.h @@ -89,6 +89,11 @@ private: * Item handling */ bool cmdItem(int argc, const char **argv); + + /** + * Shows a movie + */ + bool cmdMovie(int argc, const char **argv); protected: TitanicEngine *_vm; public: diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h index 17a7d489d8..60eacee7e9 100644 --- a/engines/titanic/game/movie_tester.h +++ b/engines/titanic/game/movie_tester.h @@ -45,6 +45,14 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Loads a movie + */ + void loadMovie(const CString &name, bool pendingFlag = true) { + CGameObject::loadMovie(name, pendingFlag); + _surface->flipVertically(); + } }; } // End of namespace Titanic |