Skip to content

Commit

Permalink
GRIFFON: Implemented loading from launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Nov 12, 2019
1 parent 392feb9 commit cf58aef
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
7 changes: 7 additions & 0 deletions engines/griffon/detection.cpp
Expand Up @@ -81,6 +81,13 @@ bool GriffonMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSavesUseExtendedFormat);
}

bool Griffon::GriffonEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL) ||
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime);
}

bool GriffonMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (desc)
*engine = new Griffon::GriffonEngine(syst);
Expand Down
13 changes: 10 additions & 3 deletions engines/griffon/griffon.cpp
Expand Up @@ -132,13 +132,20 @@ Common::Error GriffonEngine::run() {
_console = new Console();

initialize();
showLogos();

if (ConfMan.hasKey("save_slot")) {
_saveSlot = ConfMan.getInt("save_slot");
loadGameState(_saveSlot);

_gameMode = kGameModeLoadGame;
} else {
showLogos();
_gameMode = kGameModeIntro;
}

if (_shouldQuit)
return Common::kNoError;

_gameMode = kGameModeIntro;

while (!_shouldQuit) {
switch (_gameMode) {
case kGameModeIntro:
Expand Down
12 changes: 12 additions & 0 deletions engines/griffon/griffon.h
Expand Up @@ -37,6 +37,7 @@
#define GRIFFON_GRIFFON_H

#include "common/scummsys.h"
#include "common/error.h"
#include "common/events.h"
#include "common/random.h"
#include "engines/engine.h"
Expand Down Expand Up @@ -428,6 +429,17 @@ class GriffonEngine : public Engine {
void setupAudio();
void updateMusic();

Common::Error loadGameState(int slot) {
return loadPlayer(slot) ? Common::kNoError : Common::kUnknownError;
}
Common::Error saveGameState(int slot, const Common::String &description) {
return saveState(slot) ? Common::kNoError : Common::kUnknownError;
}

virtual bool canLoadGameStateCurrently() { return true; }
virtual bool canSaveGameStateCurrently() { return _gameMode == kGameModePlay; }
virtual bool hasFeature(EngineFeature f) const;

private:
Graphics::TransparentSurface *_video, *_videoBuffer, *_videoBuffer2, *_videoBuffer3;

Expand Down

0 comments on commit cf58aef

Please sign in to comment.