diff options
author | Torbjörn Andersson | 2014-12-30 03:45:14 +0100 |
---|---|---|
committer | Torbjörn Andersson | 2014-12-30 03:45:14 +0100 |
commit | f74ba29753de23bad9a07f531fc4c03ea3375594 (patch) | |
tree | 6ef69cc19956d168c7e468ec959b6708b9ecc244 /base | |
parent | 6c3af3c2e7b8d2852669c141944964c82a11ce1b (diff) | |
download | scummvm-rg350-f74ba29753de23bad9a07f531fc4c03ea3375594.tar.gz scummvm-rg350-f74ba29753de23bad9a07f531fc4c03ea3375594.tar.bz2 scummvm-rg350-f74ba29753de23bad9a07f531fc4c03ea3375594.zip |
SCUMM: Enable Day of the Tentacle easter egg
Instead of returning to the launcher, a game may now specify a list
of "chained" games and optional save slots. The first game is popped
from the list and started. Quitting still quits the entire ScummVM.
It seemed like the sensible thing to do.
Diffstat (limited to 'base')
-rw-r--r-- | base/main.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/base/main.cpp b/base/main.cpp index b5de7d94d2..b9bd97dbef 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -523,22 +523,64 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { } #endif + // At this point, we usually return to the launcher. However, the + // game may have requested that one or more other games be "chained" + // to the current one, with optional save slots to start the games + // at. At the time of writing, this is used for the Maniac Mansion + // easter egg in Day of the Tentacle. + + Common::String chainedGames, nextGame, saveSlot; + + if (ConfMan.hasKey("chained_games", Common::ConfigManager::kTransientDomain)) { + chainedGames = ConfMan.get("chained_games", Common::ConfigManager::kTransientDomain); + } + // Discard any command line options. It's unlikely that the user // wanted to apply them to *all* games ever launched. ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear(); - // Clear the active config domain - ConfMan.setActiveDomain(""); + if (!chainedGames.empty()) { + if (chainedGames.contains(',')) { + for (uint i = 0; i < chainedGames.size(); i++) { + if (chainedGames[i] == ',') { + chainedGames.erase(0, i + 1); + break; + } + nextGame += chainedGames[i]; + } + ConfMan.set("chained_games", chainedGames, Common::ConfigManager::kTransientDomain); + } else { + nextGame = chainedGames; + chainedGames.clear(); + ConfMan.removeKey("chained_games", Common::ConfigManager::kTransientDomain); + } + if (nextGame.contains(':')) { + for (int i = nextGame.size() - 1; i >= 0; i--) { + if (nextGame[i] == ':') { + nextGame.erase(i); + break; + } + saveSlot = nextGame[i] + saveSlot; + } + ConfMan.setInt("save_slot", atoi(saveSlot.c_str()), Common::ConfigManager::kTransientDomain); + } + // Start the next game + ConfMan.setActiveDomain(nextGame); + } else { + // Clear the active config domain + ConfMan.setActiveDomain(""); + } PluginManager::instance().loadAllPlugins(); // only for cached manager - } else { GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game")); } // reset the graphics to default setupGraphics(system); - launcherDialog(); + if (0 == ConfMan.getActiveDomain()) { + launcherDialog(); + } } PluginManager::instance().unloadAllPlugins(); PluginManager::destroy(); |