Enabled runtime save/loading from the GMM menu, and fixed launcher listing of savegames

svn-id: r36164
This commit is contained in:
Paul Gilbert 2009-01-31 12:15:21 +00:00
parent 71dcc140f9
commit e2baabcab9
3 changed files with 22 additions and 3 deletions

View File

@ -26,6 +26,7 @@
#include "base/plugins.h"
#include "engines/advancedDetector.h"
#include "engines/engine.h"
#include "common/savefile.h"
#include "lure/lure.h"
@ -201,7 +202,9 @@ bool LureMetaEngine::hasFeature(MetaEngineFeature f) const {
bool Lure::LureEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL);
(f == kSupportsRTL) ||
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime);
}
bool LureMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
@ -216,8 +219,7 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringList filenames;
Common::String saveDesc;
Common::String pattern = target;
pattern += ".???";
Common::String pattern = "lure.???";
filenames = saveFileMan->listSavefiles(pattern.c_str());
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)

View File

@ -51,6 +51,7 @@ LureEngine::LureEngine(OSystem *system, const LureGameDescription *gameDesc): En
Common::Error LureEngine::init() {
int_engine = this;
_initialised = false;
_saveLoadAllowed = false;
initGraphics(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT, false);
@ -150,6 +151,7 @@ Common::Error LureEngine::go() {
// Play the game
if (!shouldQuit()) {
// Play the game
_saveLoadAllowed = true;
Sound.loadSection(Sound.isRoland() ? ROLAND_MAIN_SOUND_RESOURCE_ID : ADLIB_MAIN_SOUND_RESOURCE_ID);
gameInstance->execute();
}

View File

@ -68,6 +68,7 @@ public:
LureEngine(OSystem *system, const LureGameDescription *gameDesc);
~LureEngine();
static LureEngine &getReference();
bool _saveLoadAllowed;
// Engine APIs
virtual Common::Error init();
@ -90,6 +91,20 @@ public:
Common::Platform getPlatform() const;
virtual GUI::Debugger *getDebugger();
bool isEGA() const { return (getFeatures() & GF_EGA) != 0; }
virtual Common::Error loadGameState(int slot) {
return loadGame(slot) ? Common::kReadingFailed : Common::kNoError;
}
virtual Common::Error saveGameState(int slot, const char *desc) {
String s(desc);
return saveGame(slot, s) ? Common::kReadingFailed : Common::kNoError;
}
virtual bool canLoadGameStateCurrently() {
return _saveLoadAllowed && !Fights.isFighting();
}
virtual bool canSaveGameStateCurrently() {
return _saveLoadAllowed && !Fights.isFighting();
}
};
Common::String getSaveName(Common::InSaveFile *in);
} // End of namespace Lure