Skip to content

Commit

Permalink
ACCESS: Implement loading savegames from launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 30, 2014
1 parent f12fa2d commit 949033e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
8 changes: 8 additions & 0 deletions engines/access/access.cpp
Expand Up @@ -108,6 +108,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_narateFile = 0;
_txtPages = 0;
_sndSubFile = 0;
_loadSaveSlot = -1;
}

AccessEngine::~AccessEngine() {
Expand Down Expand Up @@ -173,6 +174,13 @@ void AccessEngine::initialize() {

_buffer1.create(g_system->getWidth() + TILE_WIDTH, g_system->getHeight());
_buffer2.create(g_system->getWidth(), g_system->getHeight());

// If requested, load a savegame instead of showing the intro
if (ConfMan.hasKey("save_slot")) {
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0 && saveSlot <= 999)
_loadSaveSlot = saveSlot;
}
}

Common::Error AccessEngine::run() {
Expand Down
1 change: 1 addition & 0 deletions engines/access/access.h
Expand Up @@ -106,6 +106,7 @@ class AccessEngine : public Engine {
protected:
const AccessGameDescription *_gameDescription;
Common::RandomSource _randomSource;
int _loadSaveSlot;

/**
* Main handler for showing game rooms
Expand Down
23 changes: 15 additions & 8 deletions engines/access/amazon/amazon_game.cpp
Expand Up @@ -64,23 +64,30 @@ AmazonEngine::~AmazonEngine() {
}

void AmazonEngine::playGame() {
// Do introduction
doIntroduction();
if (shouldQuit())
return;
// Initialise Amazon game-specific objects
_room = new AmazonRoom(this);
_scripts = new AmazonScripts(this);

if (_loadSaveSlot != -1) {
// Do introduction
doIntroduction();
if (shouldQuit())
return;
}

// Setup the game
setupGame();

_screen->clearScreen();
_screen->setPanel(0);
_screen->forceFadeOut();

_events->showCursor();

// Setup and execute the room
_room = new AmazonRoom(this);
_scripts = new AmazonScripts(this);
// If there's a pending savegame to load, load it
if (_loadSaveSlot != -1)
loadGameState(_loadSaveSlot);

// Execute the room
_room->doRoom();
}

Expand Down

0 comments on commit 949033e

Please sign in to comment.