aboutsummaryrefslogtreecommitdiff
path: root/engines/cryomni3d
diff options
context:
space:
mode:
authorLe Philousophe2019-06-08 12:22:11 +0200
committerLe Philousophe2019-06-08 12:43:22 +0200
commit3915be8ff1cbb0a5aa9a63cb443829578d97e745 (patch)
tree890e8e152b28332a7b115979eb428a260dad0050 /engines/cryomni3d
parent70c7133e4b23adff5d630d4d2a37ac81ef070566 (diff)
downloadscummvm-rg350-3915be8ff1cbb0a5aa9a63cb443829578d97e745.tar.gz
scummvm-rg350-3915be8ff1cbb0a5aa9a63cb443829578d97e745.tar.bz2
scummvm-rg350-3915be8ff1cbb0a5aa9a63cb443829578d97e745.zip
CRYOMNI3D: Implement load/save in-game with GMM
Diffstat (limited to 'engines/cryomni3d')
-rw-r--r--engines/cryomni3d/cryomni3d.cpp3
-rw-r--r--engines/cryomni3d/cryomni3d.h5
-rw-r--r--engines/cryomni3d/fixed_image.cpp10
-rw-r--r--engines/cryomni3d/versailles/engine.cpp8
-rw-r--r--engines/cryomni3d/versailles/engine.h4
-rw-r--r--engines/cryomni3d/versailles/saveload.cpp10
6 files changed, 39 insertions, 1 deletions
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index ee788d6d8c..05d370c0a4 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -42,7 +42,8 @@ namespace CryOmni3D {
CryOmni3DEngine::CryOmni3DEngine(OSystem *syst,
const CryOmni3DGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc),
- _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), _autoRepeatNextEvent(-1u) {
+ _canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag),
+ _autoRepeatNextEvent(-1u) {
if (!_mixer->isReady()) {
error("Sound initialization failed");
}
diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h
index df62764a9a..d1855a80e4 100644
--- a/engines/cryomni3d/cryomni3d.h
+++ b/engines/cryomni3d/cryomni3d.h
@@ -100,7 +100,10 @@ public:
Common::Language getLanguage() const;
bool hasFeature(EngineFeature f) const override;
+ bool canLoadGameStateCurrently() override { return _canLoadSave; }
+ bool canSaveGameStateCurrently() override { return _canLoadSave; }
+ void setCanLoadSave(bool canLoadSave) { _canLoadSave = canLoadSave; }
static const uint kSaveDescriptionLen = 20;
private:
void pauseEngineIntern(bool);
@@ -157,6 +160,8 @@ protected:
void setBlackPalette();
protected:
+ bool _canLoadSave;
+
FontManager _fontManager;
Sprites _sprites;
Objects _objects;
diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp
index 3e8428ab44..16a35f8f1a 100644
--- a/engines/cryomni3d/fixed_image.cpp
+++ b/engines/cryomni3d/fixed_image.cpp
@@ -188,10 +188,15 @@ void ZonFixedImage::manage() {
_usedObject = nullptr;
_key.reset();
+ // As the game lets load/save from main menu displayed by cliking from the toolbar,
+ // it's safe to enable GMM Load/Save there
+ _engine.setCanLoadSave(true);
+
// Force poll events even when we must refresh the cursor
if (!_engine.pollEvents() && !_refreshCursor) {
g_system->updateScreen();
g_system->delayMillis(10);
+ _engine.setCanLoadSave(false);
return;
}
_refreshCursor = false;
@@ -202,9 +207,11 @@ void ZonFixedImage::manage() {
if (_key == Common::KEYCODE_ESCAPE) {
_exit = true;
+ _engine.setCanLoadSave(false);
return;
} else if (_engine.shouldAbort()) {
_exit = true;
+ _engine.setCanLoadSave(false);
return;
}
@@ -221,6 +228,7 @@ void ZonFixedImage::manage() {
}
// Return without any event to redo the loop and force refresh
_refreshCursor = true;
+ _engine.setCanLoadSave(false);
return;
}
@@ -268,6 +276,8 @@ void ZonFixedImage::manage() {
g_system->updateScreen();
g_system->delayMillis(10);
+
+ _engine.setCanLoadSave(false);
}
void ZonFixedImage::handleMouseZones(const Common::Array<Zone>::const_iterator &currentZone) {
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index c8a8b110ad..ab9318f8c3 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -67,6 +67,12 @@ CryOmni3DEngine_Versailles::~CryOmni3DEngine_Versailles() {
delete _fixedImage;
}
+bool CryOmni3DEngine_Versailles::hasFeature(EngineFeature f) const {
+ return CryOmni3DEngine::hasFeature(f)
+ || (f == kSupportsSavingDuringRuntime)
+ || (f == kSupportsLoadingDuringRuntime);
+}
+
Common::Error CryOmni3DEngine_Versailles::run() {
CryOmni3DEngine::run();
@@ -1135,6 +1141,7 @@ int CryOmni3DEngine_Versailles::handleWarp() {
bool moving = true;
uint actionId;
showMouse(true);
+ _canLoadSave = true;
while (!leftButtonPressed && !exit) {
int xDelta = 0, yDelta = 0;
uint movingCursor = -1;
@@ -1219,6 +1226,7 @@ int CryOmni3DEngine_Versailles::handleWarp() {
// Slow down loop but after updating screen
g_system->delayMillis(10);
}
+ _canLoadSave = false;
showMouse(false);
return actionId;
}
diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h
index 369f69ade9..83beddbd4b 100644
--- a/engines/cryomni3d/versailles/engine.h
+++ b/engines/cryomni3d/versailles/engine.h
@@ -217,6 +217,10 @@ public:
CryOmni3DEngine_Versailles(OSystem *syst, const CryOmni3DGameDescription *gamedesc);
virtual ~CryOmni3DEngine_Versailles();
+ bool hasFeature(EngineFeature f) const override;
+ virtual Common::Error loadGameState(int slot) override;
+ virtual Common::Error saveGameState(int slot, const Common::String &desc) override;
+
Common::String prepareFileName(const Common::String &baseName, const char *extension) const {
const char *const extensions[] = { extension, nullptr };
return prepareFileName(baseName, extensions);
diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp
index 5aec69e5ff..2c14c3d624 100644
--- a/engines/cryomni3d/versailles/saveload.cpp
+++ b/engines/cryomni3d/versailles/saveload.cpp
@@ -30,6 +30,16 @@
namespace CryOmni3D {
namespace Versailles {
+Common::Error CryOmni3DEngine_Versailles::loadGameState(int slot) {
+ _loadedSave = slot + 1;
+ _abortCommand = kAbortLoadGame;
+ return Common::kNoError;
+}
+
+Common::Error CryOmni3DEngine_Versailles::saveGameState(int slot, const Common::String &desc) {
+ saveGame(_isVisiting, slot + 1, desc);
+ return Common::kNoError;
+}
Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint saveNum) const {
return Common::String::format("%s%s.%04u", _targetName.c_str(), visit ? "_visit" : "", saveNum);