diff options
author | Eugene Sandulenko | 2015-12-09 06:17:16 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:33:58 +0100 |
commit | 0af299d3c78d59de20fe5ad41169f755fda297f4 (patch) | |
tree | 23f9aa4f5b10cc466f1f27fcd951f62aebb5b9c6 /engines | |
parent | c42629674bc58f46a27a91c3c8325f68ed9f222c (diff) | |
download | scummvm-rg350-0af299d3c78d59de20fe5ad41169f755fda297f4.tar.gz scummvm-rg350-0af299d3c78d59de20fe5ad41169f755fda297f4.tar.bz2 scummvm-rg350-0af299d3c78d59de20fe5ad41169f755fda297f4.zip |
LAB: Move saveRestoreGame() to saveload.cpp
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/lab.h | 2 | ||||
-rw-r--r-- | engines/lab/savegame.cpp | 49 | ||||
-rw-r--r-- | engines/lab/special.cpp | 49 |
3 files changed, 51 insertions, 49 deletions
diff --git a/engines/lab/lab.h b/engines/lab/lab.h index ac27c94d93..3e545cc4b1 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -70,6 +70,8 @@ enum GameFeatures { #define UPSCROLL 3 #define DOWNSCROLL 4 +#define QUARTERNUM 30 + typedef Common::List<Gadget *> GadgetList; struct CrumbData { diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index 1e2c8afc7b..0f0c772e4d 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -28,6 +28,11 @@ * */ +#include "common/translation.h" + +#include "gui/message.h" +#include "gui/saveload.h" + #include "graphics/thumbnail.h" #include "engines/savestate.h" @@ -35,9 +40,12 @@ #include "lab/dispman.h" #include "lab/labsets.h" +#include "lab/music.h" +#include "lab/processroom.h" #include "lab/savegame.h" namespace Lab { + #define SAVEGAME_ID MKTAG('L', 'O', 'T', 'S') #define SAVEGAME_VERSION 1 @@ -216,5 +224,46 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) { return true; } +bool LabEngine::saveRestoreGame() { + bool isOK = false; + + //g_lab->showMainMenu(); + + // The original had one screen for saving/loading. We have two. + // Ask the user which screen to use. + GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); + + int choice = saveOrLoad.runModal(); + if (choice == GUI::kMessageOK) { + // Save + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + int slot = dialog->runModalWithCurrentTarget(); + if (slot >= 0) { + Common::String desc = dialog->getResultString(); + + if (desc.empty()) { + // create our own description for the saved game, the user didn't enter it + desc = dialog->createDefaultSaveDescription(slot); + } + + isOK = saveGame(_direction, _inventory[QUARTERNUM]._many, slot, desc); + } + } else { + // Restore + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + int slot = dialog->runModalWithCurrentTarget(); + if (slot >= 0) { + isOK = loadGame(&_direction, &(_inventory[QUARTERNUM]._many), slot); + if (isOK) + _music->resetMusic(); + } + } + + _alternate = false; + _mainDisplay = true; + _graphics->screenUpdate(); + + return isOK; +} } // End of namespace Lab diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 8bb57adfed..63b8109e2f 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -28,11 +28,6 @@ * */ -#include "common/translation.h" - -#include "gui/message.h" -#include "gui/saveload.h" - #include "lab/lab.h" #include "lab/anim.h" @@ -44,7 +39,6 @@ #include "lab/music.h" #include "lab/processroom.h" #include "lab/resource.h" -#include "lab/savegame.h" #include "lab/utils.h" namespace Lab { @@ -71,7 +65,6 @@ Image *MonButton; #define DIRTY 175 #define NONEWS 135 #define NOCLEAN 152 -#define QUARTERNUM 30 static byte *loadBackPict(const char *fileName, bool tomem) { @@ -385,48 +378,6 @@ void LabEngine::doJournal() { _graphics->blackScreen(); } -bool LabEngine::saveRestoreGame() { - bool isOK = false; - - //g_lab->showMainMenu(); - - // The original had one screen for saving/loading. We have two. - // Ask the user which screen to use. - GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); - - int choice = saveOrLoad.runModal(); - if (choice == GUI::kMessageOK) { - // Save - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); - int slot = dialog->runModalWithCurrentTarget(); - if (slot >= 0) { - Common::String desc = dialog->getResultString(); - - if (desc.empty()) { - // create our own description for the saved game, the user didn't enter it - desc = dialog->createDefaultSaveDescription(slot); - } - - isOK = saveGame(_direction, _inventory[QUARTERNUM]._many, slot, desc); - } - } else { - // Restore - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); - int slot = dialog->runModalWithCurrentTarget(); - if (slot >= 0) { - isOK = loadGame(&_direction, &(_inventory[QUARTERNUM]._many), slot); - if (isOK) - _music->resetMusic(); - } - } - - _alternate = false; - _mainDisplay = true; - _graphics->screenUpdate(); - - return isOK; -} - /** * Draws the text for the monitor. */ |