diff options
author | Dmitry Iskrich | 2016-06-26 18:32:51 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | cc9d17c5eb9db7fc52d8407e401a14072ab9c5d7 (patch) | |
tree | 956c6e829b4fa8c8318477b2f862b28b001d7a94 /engines/director | |
parent | 9524980508c0702ae9eb114fcddc1f0be3edfc50 (diff) | |
download | scummvm-rg350-cc9d17c5eb9db7fc52d8407e401a14072ab9c5d7.tar.gz scummvm-rg350-cc9d17c5eb9db7fc52d8407e401a14072ab9c5d7.tar.bz2 scummvm-rg350-cc9d17c5eb9db7fc52d8407e401a14072ab9c5d7.zip |
DIRECTOR: Support goto command in Score
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/director.cpp | 2 | ||||
-rw-r--r-- | engines/director/director.h | 3 | ||||
-rw-r--r-- | engines/director/lingo/lingo-funcs.cpp | 8 | ||||
-rw-r--r-- | engines/director/score.cpp | 15 | ||||
-rw-r--r-- | engines/director/score.h | 1 |
5 files changed, 26 insertions, 3 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index cb18bf6050..3c82fd9e91 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -56,7 +56,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam _mainArchive = 0; _macBinary = 0; _currentPalette = 0; - + _movies = new Common::HashMap<Common::String, Score *>(); const Common::FSNode gameDataDir(ConfMan.get("path")); SearchMan.addSubDirectoryMatching(gameDataDir, "data"); SearchMan.addSubDirectoryMatching(gameDataDir, "install"); diff --git a/engines/director/director.h b/engines/director/director.h index 8a35ac029f..74dc651ef7 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -66,6 +66,8 @@ public: bool hasFeature(EngineFeature f) const; const byte *getPalette() const { return _currentPalette; } uint16 getPaletteColorCount() const { return _currentPaletteLength; } + Common::HashMap<Common::String, Score *> *_movies; + Score *_currentScore; protected: virtual Common::Error run(); @@ -90,7 +92,6 @@ private: byte *_currentPalette; uint16 _currentPaletteLength; Lingo *_lingo; - Score *_currentScore; }; } // End of namespace Director diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp index 6975df6d4d..74897bd345 100644 --- a/engines/director/lingo/lingo-funcs.cpp +++ b/engines/director/lingo/lingo-funcs.cpp @@ -191,6 +191,14 @@ void Lingo::func_mciwait(Common::String &s) { void Lingo::func_goto(Common::String &frame, Common::String &movie) { warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str()); + if (!_vm->_movies->contains(movie)) + error("Movie %s does not exist", movie.c_str()); + + _vm->_currentScore = _vm->_movies->getVal(movie); + _vm->_currentScore->loadArchive(); + + if (frame.c_str() != "") + _vm->_currentScore->setStartToLabel(frame); } } diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 74285a6866..da220439ea 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -338,6 +338,19 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) { _movieScriptCount++; } +void Score::setStartToLabel(Common::String label) { + Common::HashMap<uint16, Common::String>::iterator i; + + for (i = _labels.begin(); i != _labels.end(); ++i) { + if (i->_value == label) { + _currentFrame = i->_key; + return; + } + } + + warning("Label %s not found", label.c_str()); +} + void Score::dumpScript(uint16 id, ScriptType type, Common::String script) { Common::DumpFile out; Common::String typeName; @@ -556,7 +569,7 @@ void Score::startLoop() { _trailSurface->create(_movieRect.width(), _movieRect.height()); if (_stageColor == 0) - _trailSurface->clear(15); + _trailSurface->clear(_vm->getPaletteColorCount() - 1); else _trailSurface->clear(_stageColor); diff --git a/engines/director/score.h b/engines/director/score.h index a1d7281ae8..a876a663ee 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -333,6 +333,7 @@ public: static Common::Rect readRect(Common::SeekableReadStream &stream); void loadArchive(); + void setStartToLabel(Common::String label); void startLoop(); void processEvents(); |