NANCY: Allow later games to have 999 saves

Added a hidden ConfMan property that controls how many
saves are allowed, and added code that sets it to 8 at
startup, provided the game is nancy7 or earlier. This makes
sure that later games, which had infinite saves, can have
their save menus supported correctly.
This commit is contained in:
Kaloyan Chehlarski 2024-02-11 01:56:14 +01:00
parent 3c6efd65a1
commit e25018f892
2 changed files with 9 additions and 1 deletions

View File

@ -146,7 +146,7 @@ Common::Error NancyMetaEngine::createInstance(OSystem *syst, Engine **engine, co
}
}
int NancyMetaEngine::getMaximumSaveSlot() const { return 8; }
int NancyMetaEngine::getMaximumSaveSlot() const { int r = ConfMan.getInt("nancy_max_saves"); return r ? r : AdvancedMetaEngine::getMaximumSaveSlot(); }
SaveStateDescriptor NancyMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
SaveStateDescriptor ret = AdvancedMetaEngine::querySaveMetaInfos(target, slot);
@ -186,6 +186,7 @@ void NancyMetaEngine::registerDefaultSettings(const Common::String &target) cons
ConfMan.registerDefault("player_speech", true);
ConfMan.registerDefault("character_speech", true);
ConfMan.registerDefault("nancy_max_saves", 999);
}
const ADExtraGuiOptionsMap *NancyMetaEngine::getAdvancedExtraGuiOptions() const {

View File

@ -254,6 +254,13 @@ void NancyEngine::addDeferredLoader(Common::SharedPtr<DeferredLoader> &loaderPtr
Common::Error NancyEngine::run() {
setDebugger(new NancyConsole());
// Set the default number of saves for earlier games
if (!ConfMan.hasKey("nancy_max_saves", ConfMan.getActiveDomainName())) {
if (getGameType() <= kGameTypeNancy7) {
ConfMan.setInt("nancy_max_saves", 8, ConfMan.getActiveDomainName());
}
}
// Boot the engine
setState(NancyState::kBoot);