diff options
-rw-r--r-- | engines/director/director.cpp | 6 | ||||
-rw-r--r-- | engines/director/director.h | 1 | ||||
-rw-r--r-- | engines/director/lingo/lingo-funcs.cpp | 5 | ||||
-rw-r--r-- | engines/director/resource.cpp | 2 | ||||
-rw-r--r-- | engines/director/util.cpp | 4 | ||||
-rw-r--r-- | engines/director/util.h | 2 |
6 files changed, 13 insertions, 7 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 848553b4b8..779ca732a1 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -154,7 +154,7 @@ Common::Error DirectorEngine::run() { //_mainArchive->openFile("bookshelf_example.mmm"); _currentScore = new Score(this); - _currentPath = getPath(getEXEName()); + _currentPath = getPath(getEXEName(), _currentPath); if (getVersion() < 4) { if (getPlatform() == Common::kPlatformWindows) { @@ -210,11 +210,11 @@ Common::Error DirectorEngine::run() { delete _currentScore; - _currentPath = getPath(_nextMovie.movie); + _currentPath = getPath(_nextMovie.movie, _currentPath); loadSharedCastsFrom(_currentPath + _sharedCastFile); - Archive *mov = openMainArchive(_nextMovie.movie); + Archive *mov = openMainArchive(_currentPath + Common::lastPathComponent(_nextMovie.movie, '/')); if (!mov) { warning("nextMovie: No score is loaded"); diff --git a/engines/director/director.h b/engines/director/director.h index 3b0a647800..344d53a84f 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -100,6 +100,7 @@ public: Lingo *getLingo() const { return _lingo; } Score *getCurrentScore() const { return _currentScore; } Score *getSharedScore() const { return _sharedScore; } + Common::String getCurrentPath() const { return _currentPath; } void setPalette(byte *palette, uint16 count); bool hasFeature(EngineFeature f) const; const byte *getPalette() const { return _currentPalette; } diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp index fd0bd1a4c0..7263e54ae8 100644 --- a/engines/director/lingo/lingo-funcs.cpp +++ b/engines/director/lingo/lingo-funcs.cpp @@ -182,7 +182,7 @@ void Lingo::func_goto(Datum &frame, Datum &movie) { if (movie.type != VOID) { movie.toString(); - Common::String movieFilename = convertPath(*movie.u.s); + Common::String movieFilename = Common::normalizePath(g_director->getCurrentPath() + convertPath(*movie.u.s), '/'); Common::String cleanedFilename; bool fileExists = false; @@ -212,6 +212,9 @@ void Lingo::func_goto(Datum &frame, Datum &movie) { } } + debug(1, "func_goto: '%s' -> '%s' -> '%s", movie.u.s->c_str(), movieFilename.c_str(), + cleanedFilename.c_str()); + if (!fileExists) { warning("Movie %s does not exist", movieFilename.c_str()); return; diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index 73d08d9fe3..1e93ebf136 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -57,6 +57,8 @@ void DirectorEngine::loadInitialMovie(const Common::String movie) { } Archive *DirectorEngine::openMainArchive(const Common::String movie) { + debug(1, "openMainArchive(\"%s\")", movie.c_str()); + delete _mainArchive; _mainArchive = createArchive(); diff --git a/engines/director/util.cpp b/engines/director/util.cpp index 1774630b95..9afc19171f 100644 --- a/engines/director/util.cpp +++ b/engines/director/util.cpp @@ -142,13 +142,13 @@ Common::String convertPath(Common::String &path) { return res; } -Common::String getPath(Common::String path) { +Common::String getPath(Common::String path, Common::String cwd) { const char *s; if ((s = strrchr(path.c_str(), '/'))) { return Common::String(path.c_str(), s + 1); } - return ""; + return cwd; // The path is not altered } } // End of namespace Director diff --git a/engines/director/util.h b/engines/director/util.h index 0d06ee36da..c6d2cf8efd 100644 --- a/engines/director/util.h +++ b/engines/director/util.h @@ -36,7 +36,7 @@ Common::String *toLowercaseMac(Common::String *s); Common::String convertPath(Common::String &path); -Common::String getPath(Common::String path); +Common::String getPath(Common::String path, Common::String cwd); void processQuitEvent(); // events.cpp |