LAB: Add support for saving and loading games from the GMM

This commit is contained in:
Filippos Karapetis 2015-12-27 23:22:54 +02:00
parent 4548cbddb5
commit 3977a7ffa1
5 changed files with 33 additions and 9 deletions

View file

@ -96,6 +96,8 @@ public:
void stopDiffEnd();
uint16 getDIFFHeight();
bool isPlaying() const { return _isPlaying; }
};
} // End of namespace Lab

View file

@ -155,9 +155,10 @@ bool LabMetaEngine::hasFeature(MetaEngineFeature f) const {
}
bool Lab::LabEngine::hasFeature(EngineFeature f) const {
return (f == kSupportsRTL);
//(f == kSupportsLoadingDuringRuntime) ||
//(f == kSupportsSavingDuringRuntime);
return
(f == kSupportsRTL) ||
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime);
}
SaveStateList LabMetaEngine::listSaves(const char *target) const {

View file

@ -1036,9 +1036,11 @@ void LabEngine::go() {
// If the user has requested to load a game from the launcher, skip the intro
if (!ConfMan.hasKey("save_slot")) {
_event->mouseHide();
_introPlaying = true;
Intro *intro = new Intro(this);
intro->play();
delete intro;
_introPlaying = false;
_event->mouseShow();
}

View file

@ -128,12 +128,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_monitorButtonHeight = 1;
for (int i = 0; i < 20; i++)
_highPalette[i] = 0;
//const Common::FSNode gameDataDir(ConfMan.get("path"));
//SearchMan.addSubDirectoryMatching(gameDataDir, "game");
//SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict");
//SearchMan.addSubDirectoryMatching(gameDataDir, "game/spict");
//SearchMan.addSubDirectoryMatching(gameDataDir, "music");
_introPlaying = false;
}
LabEngine::~LabEngine() {
@ -248,4 +243,22 @@ void LabEngine::updateEvents() {
_event->updateMouse();
}
Common::Error LabEngine::loadGameState(int slot) {
bool result = loadGame(slot);
return (result) ? Common::kNoError : Common::kUserCanceled;
}
Common::Error LabEngine::saveGameState(int slot, const Common::String &desc) {
bool result = saveGame(slot, desc);
return (result) ? Common::kNoError : Common::kUserCanceled;
}
bool LabEngine::canLoadGameStateCurrently() {
return !_anim->isPlaying() && !_introPlaying;
}
bool LabEngine::canSaveGameStateCurrently() {
return !_anim->isPlaying() && !_introPlaying;
}
} // End of namespace Lab

View file

@ -160,6 +160,7 @@ private:
Image *_monitorButton;
Image *_journalBackImage;
TextFont *_journalFont;
bool _introPlaying;
public:
bool _alternate;
@ -225,6 +226,11 @@ public:
void updateEvents();
void waitTOF();
Common::Error loadGameState(int slot);
Common::Error saveGameState(int slot, const Common::String &desc);
bool canLoadGameStateCurrently();
bool canSaveGameStateCurrently();
private:
/**
* Checks whether all the conditions in a condition list are met.