aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2014-07-04 19:07:38 +0200
committeruruk2014-07-04 19:07:38 +0200
commite15f40978a6904dec7a50cfefbb2a05c454c6c74 (patch)
tree1aba6adf2ccf1e402fac7c83b33998f8501c069b /engines
parent31bba2e38c0bfad3b990ccf9884c6f8f578a19ee (diff)
downloadscummvm-rg350-e15f40978a6904dec7a50cfefbb2a05c454c6c74.tar.gz
scummvm-rg350-e15f40978a6904dec7a50cfefbb2a05c454c6c74.tar.bz2
scummvm-rg350-e15f40978a6904dec7a50cfefbb2a05c454c6c74.zip
CGE2: Implement loading from the Launcher.
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/cge2.cpp4
-rw-r--r--engines/cge2/cge2.h1
-rw-r--r--engines/cge2/cge2_main.cpp18
-rw-r--r--engines/cge2/detection.cpp4
-rw-r--r--engines/cge2/saveload.cpp9
5 files changed, 26 insertions, 10 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index e6df241ea9..aa87f99a3b 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -26,7 +26,7 @@
*/
#include "engines/util.h"
-
+#include "common/config-manager.h"
#include "cge2/cge2.h"
#include "cge2/bitmap.h"
#include "cge2/vga13h.h"
@@ -123,6 +123,8 @@ void CGE2Engine::init() {
_sys = new System(this);
_eventManager = new EventManager(this);
_map = new Map(this);
+
+ _startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
void CGE2Engine::deinit() {
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index f126da591f..a2cd13107e 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -284,6 +284,7 @@ public:
int _req;
NotifyFunctionType _midiNotify;
NotifyFunctionType _spriteNotify;
+ int _startGameSlot;
ResourceManager *_resman;
Vga *_vga;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 77df792e94..b9787b07e1 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -696,11 +696,13 @@ void CGE2Engine::runGame() {
}
void CGE2Engine::loadUser() {
- warning("STUB: CGE2Engine::loadUser()");
- // Missing loading from file. TODO: Implement it with the saving/loading!
- loadScript("CGE.INI");
- loadHeroes();
loadPos();
+ if (_startGameSlot != -1)
+ loadGame(_startGameSlot);
+ else {
+ loadScript("CGE.INI");
+ loadHeroes();
+ }
}
void CGE2Engine::loadHeroes() { // Original name: loadGame()
@@ -847,7 +849,11 @@ void CGE2Engine::cge2_main() {
loadTab();
- _mode++;
+ if (_startGameSlot != -1) {
+ // Starting up a savegame from the launcher
+ _mode++;
+ runGame();
+ }
if (showTitle("WELCOME")) {
#if 0
@@ -900,6 +906,8 @@ int CGE2Engine::newRandom(int range) {
bool CGE2Engine::showTitle(const char *name) {
if (_quitFlag)
return false;
+
+ _mode++;
_bitmapPalette = _vga->_sysPal;
BitmapPtr LB = new Bitmap[1];
diff --git a/engines/cge2/detection.cpp b/engines/cge2/detection.cpp
index 599934b57d..6d4f6339d9 100644
--- a/engines/cge2/detection.cpp
+++ b/engines/cge2/detection.cpp
@@ -41,7 +41,9 @@ bool CGE2MetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
- (f == kSavesSupportCreationDate);
+ (f == kSavesSupportCreationDate) ||
+ (f == kSupportsListSaves) ||
+ (f == kSupportsLoadingDuringStartup);
}
const ADGameDescription *CGE2MetaEngine::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
diff --git a/engines/cge2/saveload.cpp b/engines/cge2/saveload.cpp
index 0ea957f9e1..3890e74341 100644
--- a/engines/cge2/saveload.cpp
+++ b/engines/cge2/saveload.cpp
@@ -311,11 +311,8 @@ void CGE2Engine::syncHeader(Common::Serializer &s) {
Common::Error CGE2Engine::loadGameState(int slot) {
sceneDown();
- resetGame();
if (!loadGame(slot))
return Common::kReadingFailed;
- initToolbar();
- loadHeroes();
sceneUp(_now);
return Common::kNoError;
}
@@ -365,10 +362,16 @@ bool CGE2Engine::loadGame(int slotNumber) {
delete saveHeader.thumbnail;
}
+ resetGame();
+
// Get in the savegame
syncGame(readStream, nullptr);
delete readStream;
+
+ initToolbar();
+ loadHeroes();
+
return true;
}