HDB: Added more code for loading save states from the command line

This commit is contained in:
Eugene Sandulenko 2019-07-09 14:42:04 +02:00
parent c71426e2f8
commit 8403960c99
3 changed files with 15 additions and 2 deletions

View file

@ -107,13 +107,17 @@ public:
}
virtual bool hasFeature(MetaEngineFeature f) const;
virtual int getMaximumSaveSlot() const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};
bool HDBMetaEngine::hasFeature(MetaEngineFeature f) const {
return false;
return
(f == kSupportsLoadingDuringStartup);
}
int HDBMetaEngine::getMaximumSaveSlot() const { return 9; }
bool HDBMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (desc) {
*engine = new HDB::HDBGame(syst, desc);

View file

@ -775,9 +775,13 @@ Common::Error HDBGame::run() {
snprintf(mapname, 10, "MAP%02d", level);
startMap(mapname);
} else {
if (ConfMan.hasKey("save_slot")) {
loadGameState(ConfMan.getInt("save_slot"));
} else {
startMap("MAP00");
}
}
//_window->openDialog("Sgt. Filibuster", 0, "You address me as 'sarge' or 'sergeant' or get your snappin' teeth kicked in! Got me?", 0, NULL);

View file

@ -67,6 +67,11 @@ Common::Error HDBGame::loadGameState(int slot) {
// Actual Save Data
loadGame(in);
_lua->loadLua(_currentLuaName); // load the Lua code FIRST! (if no file, it's ok)
saveFileName = Common::String::format("%s.l.%03d", _targetName.c_str(), slot);
_lua->loadSaveFile(in, saveFileName.c_str());
delete in;
return Common::kNoError;