From 0bf57feb40dfd5eef36e2fc777ecafabdf34b919 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 9 Jan 2020 10:32:54 +0100 Subject: DIRECTOR: Added test target for executing all movies --- engines/director/detection.cpp | 1 + engines/director/detection_tables.h | 16 ++++++++++++++++ engines/director/director.cpp | 28 ++++++++++++++++++++++++++++ engines/director/director.h | 9 ++++++++- 4 files changed, 53 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp index f282bddd6d..378c287e0e 100644 --- a/engines/director/detection.cpp +++ b/engines/director/detection.cpp @@ -71,6 +71,7 @@ bool DirectorEngine::hasFeature(EngineFeature f) const { static const PlainGameDescriptor directorGames[] = { { "director", "Macromedia Director Game" }, { "directortest", "Macromedia Director Test Target" }, + { "directortest-all", "Macromedia Director All Movies Test Target" }, { "theapartment", "The Apartment, Interactive demo" }, { "gundam0079", "Gundam 0079: The War for Earth" }, { "jewels", "Jewels of the Oracle" }, diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h index 2425ebb1e6..8ca09a45f6 100644 --- a/engines/director/detection_tables.h +++ b/engines/director/detection_tables.h @@ -33,6 +33,7 @@ namespace Director { #define WINDEMO(t,e,f,m,s,v) GENGAME_(t,e,f,m,s,Common::EN_ANY,Common::kPlatformWindows,ADGF_DEMO,v) static const DirectorGameDescription gameDescriptions[] = { + // Execute all *.lingo files in game directory { { "directortest", @@ -47,6 +48,21 @@ static const DirectorGameDescription gameDescriptions[] = { 4 }, + // Executa all movies in directory + { + { + "directortest-all", + "", + AD_ENTRY1("lingotests-all", 0), + Common::EN_ANY, + Common::kPlatformMacintosh, + ADGF_NO_FLAGS, + GUIO1(GUIO_NOASPECT) + }, + GID_TESTALL, + 4 + }, + // Generic D3 Mac entry MACGAME("director", "", "D3-mac", 0, -1, 3), // Generic D4 Mac entry diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 464b24c7a4..f4c1e60101 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -145,6 +145,8 @@ Common::Error DirectorEngine::run() { _lingo->runTests(); return Common::kNoError; + } else if (getGameID() == GID_TESTALL) { + enqueueAllMovies(); } // FIXME @@ -202,6 +204,10 @@ Common::Error DirectorEngine::run() { debugC(1, kDebugEvents, "Finished playback of score '%s'", _currentScore->getMacName().c_str()); + if (getGameID() == GID_TESTALL) { + _nextMovie = getNextMovieFromQueue(); + } + // If a loop was requested, do it if (!_nextMovie.movie.empty()) { _lingo->restartLingo(); @@ -273,4 +279,26 @@ Common::HashMap *DirectorEngine::scanMovies(const Commo return nameMap; } +void DirectorEngine::enqueueAllMovies() { + Common::ArchiveMemberList fsList; + SearchMan.listMatchingMembers(fsList, "*"); + + for (Common::ArchiveMemberList::iterator it = fsList.begin(); it != fsList.end(); ++it) + _movieQueue.push_back((*it)->getName()); + + Common::sort(_movieQueue.begin(), _movieQueue.end()); + + debug(1, "Enqueued %d movies", _movieQueue.size()); +} + +MovieReference DirectorEngine::getNextMovieFromQueue() { + MovieReference res; + + res.movie = _movieQueue.front(); + + _movieQueue.remove_at(0); + + return res; +} + } // End of namespace Director diff --git a/engines/director/director.h b/engines/director/director.h index 344d53a84f..dfb221bc9d 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -25,6 +25,7 @@ #include "common/random.h" #include "common/rect.h" +#include "common/str-array.h" #include "common/hashmap.h" #include "engines/engine.h" @@ -47,7 +48,8 @@ namespace Director { enum DirectorGameID { GID_GENERIC, - GID_TEST + GID_TEST, + GID_TESTALL }; class Archive; @@ -178,9 +180,14 @@ private: uint16 _draggingSpriteId; Common::Point _draggingSpritePos; + Common::StringArray _movieQueue; + private: void testFontScaling(); void testFonts(); + + void enqueueAllMovies(); + MovieReference getNextMovieFromQueue(); }; extern DirectorEngine *g_director; -- cgit v1.2.3