LAB: Add support for loading games from the launcher

This commit is contained in:
Filippos Karapetis 2015-12-27 23:07:41 +02:00
parent bb34bc94ec
commit 4548cbddb5
3 changed files with 31 additions and 14 deletions

View file

@ -145,13 +145,13 @@ public:
bool LabMetaEngine::hasFeature(MetaEngineFeature f) const { bool LabMetaEngine::hasFeature(MetaEngineFeature f) const {
return return
(f == kSupportsListSaves) || (f == kSupportsListSaves) ||
//(f == kSupportsLoadingDuringStartup) || (f == kSupportsLoadingDuringStartup) ||
(f == kSupportsDeleteSave) || (f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) || (f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) || (f == kSavesSupportThumbnail) ||
(f == kSavesSupportCreationDate) || (f == kSavesSupportCreationDate) ||
(f == kSavesSupportPlayTime); (f == kSavesSupportPlayTime);
} }
bool Lab::LabEngine::hasFeature(EngineFeature f) const { bool Lab::LabEngine::hasFeature(EngineFeature f) const {

View file

@ -28,8 +28,9 @@
* *
*/ */
#include "lab/lab.h" #include "common/config-manager.h"
#include "lab/lab.h"
#include "lab/anim.h" #include "lab/anim.h"
#include "lab/dispman.h" #include "lab/dispman.h"
#include "lab/eventman.h" #include "lab/eventman.h"
@ -404,6 +405,18 @@ void LabEngine::mainGameLoop() {
perFlipButton(actionMode); perFlipButton(actionMode);
// Load saved slot from the launcher, if requested
if (ConfMan.hasKey("save_slot")) {
loadGame(ConfMan.getInt("save_slot"));
// Since the intro hasn't been shown, init the background music here
if (getPlatform() != Common::kPlatformAmiga)
_music->changeMusic("Music:BackGrou", false, false);
else
_music->changeMusic("Music:BackGround", false, false);
_music->checkRoomMusic();
}
// Set up initial picture. // Set up initial picture.
while (1) { while (1) {
_event->processInput(); _event->processInput();
@ -1020,11 +1033,14 @@ void LabEngine::go() {
else else
_msgFont = _resource->getFont("F:Map.fon"); _msgFont = _resource->getFont("F:Map.fon");
_event->mouseHide(); // If the user has requested to load a game from the launcher, skip the intro
Intro *intro = new Intro(this); if (!ConfMan.hasKey("save_slot")) {
intro->play(); _event->mouseHide();
delete intro; Intro *intro = new Intro(this);
_event->mouseShow(); intro->play();
delete intro;
_event->mouseShow();
}
mainGameLoop(); mainGameLoop();

View file

@ -114,7 +114,8 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) {
header._descr.setSaveTime(hour, minutes); header._descr.setSaveTime(hour, minutes);
header._descr.setPlayTime(playTime * 1000); header._descr.setPlayTime(playTime * 1000);
g_engine->setTotalPlayTime(playTime * 1000); if (g_engine)
g_engine->setTotalPlayTime(playTime * 1000);
return true; return true;
} }