aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/drascula/drascula.cpp15
-rw-r--r--engines/drascula/drascula.h10
-rw-r--r--engines/drascula/saveload.cpp26
3 files changed, 43 insertions, 8 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 655af480f2..56a2d638f7 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -76,7 +76,8 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
framesWithoutAction = 0;
term_int = 0;
currentChapter = 0;
- _loadedDifferentChapter = 0;
+ _loadedDifferentChapter = false;
+ _canSaveLoad = false;
musicStopped = 0;
FrameSSN = 0;
globalSpeed = 0;
@@ -230,7 +231,7 @@ DrasculaEngine::~DrasculaEngine() {
bool DrasculaEngine::hasFeature(EngineFeature f) const {
return
- (f == kSupportsRTL);
+ (f == kSupportsRTL || f == kSupportsLoadingDuringRuntime || f == kSupportsSavingDuringRuntime);
}
Common::Error DrasculaEngine::run() {
@@ -575,6 +576,7 @@ bool DrasculaEngine::runCurrentChapter() {
playMusic(roomMusic);
}
+ _canSaveLoad = true;
delay(25);
#ifndef _WIN32_WCE
// FIXME
@@ -585,6 +587,9 @@ bool DrasculaEngine::runCurrentChapter() {
// events in the wince port.
updateEvents();
#endif
+ _canSaveLoad = false;
+ if (_loadedDifferentChapter)
+ return true;
if (!_menuScreen && takeObject == 1)
checkObjects();
@@ -663,7 +668,11 @@ bool DrasculaEngine::runCurrentChapter() {
_menuBar = (_mouseY < 24 && !_menuScreen) ? true : false;
+ _canSaveLoad = true;
Common::KeyCode key = getScan();
+ _canSaveLoad = false;
+ if (_loadedDifferentChapter)
+ return true;
if (key == Common::KEYCODE_F1 && !_menuScreen) {
selectVerb(kVerbLook);
} else if (key == Common::KEYCODE_F2 && !_menuScreen) {
@@ -881,7 +890,7 @@ void DrasculaEngine::delay(int ms) {
_system->delayMillis(10);
updateEvents();
_system->updateScreen();
- } while (_system->getMillis() < end && !shouldQuit());
+ } while (_system->getMillis() < end && !shouldQuit() && !_loadedDifferentChapter);
}
void DrasculaEngine::pause(int duration) {
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 5265324d91..2f8fc86209 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -327,6 +327,11 @@ public:
virtual void syncSoundSettings();
+ virtual Common::Error loadGameState(int slot);
+ virtual bool canLoadGameStateCurrently();
+ virtual Common::Error saveGameState(int slot, const Common::String &desc);
+ virtual bool canSaveGameStateCurrently();
+
Common::RandomSource *_rnd;
const DrasculaGameDescription *_gameDescription;
uint32 getFeatures() const;
@@ -457,6 +462,7 @@ public:
int currentChapter;
bool _loadedDifferentChapter;
int _currentSaveSlot;
+ bool _canSaveLoad;
int _color;
int musicStopped;
int _mouseX, _mouseY, _leftMouseButton, _rightMouseButton;
@@ -497,10 +503,10 @@ public:
bool scummVMSaveLoadDialog(bool isSave);
Common::String enterName(Common::String &selectedName);
void loadSaveNames();
- void saveGame(int slot, Common::String &desc);
+ void saveGame(int slot, const Common::String &desc);
bool loadGame(int slot);
void checkForOldSaveGames();
- void convertSaveGame(int slot, Common::String &desc);
+ void convertSaveGame(int slot, const Common::String &desc);
void print_abc(const char *, int, int);
void delay(int ms);
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index eb65486687..f0484e29b4 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -138,7 +138,7 @@ SaveStateDescriptor loadMetaData(Common::ReadStream *s, int slot, bool setPlayTi
return desc;
}
-void saveMetaData(Common::WriteStream *s, Common::String &desc) {
+void saveMetaData(Common::WriteStream *s, const Common::String &desc) {
TimeDate curTime;
g_system->getTimeAndDate(curTime);
@@ -155,7 +155,7 @@ void saveMetaData(Common::WriteStream *s, Common::String &desc) {
s->writeUint32LE(playTime);
}
-void DrasculaEngine::convertSaveGame(int slot, Common::String &desc) {
+void DrasculaEngine::convertSaveGame(int slot, const Common::String &desc) {
Common::String oldFileName = Common::String::format("%s%02d", _targetName.c_str(), slot);
Common::String newFileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
Common::InSaveFile *oldFile = _saveFileMan->openForLoading(oldFileName);
@@ -188,6 +188,26 @@ void DrasculaEngine::convertSaveGame(int slot, Common::String &desc) {
_saveFileMan->removeSavefile(oldFileName);
}
+Common::Error DrasculaEngine::loadGameState(int slot) {
+ // The boolean returned by loadGame() indicates if loading is in the same
+ // chapter or in a different one. Thus it does not indicate an error.
+ loadGame(slot);
+ return Common::kNoError;
+}
+
+bool DrasculaEngine::canLoadGameStateCurrently() {
+ return _canSaveLoad;
+}
+
+Common::Error DrasculaEngine::saveGameState(int slot, const Common::String &desc) {
+ saveGame(slot, desc);
+ return Common::kNoError;
+}
+
+bool DrasculaEngine::canSaveGameStateCurrently() {
+ return _canSaveLoad;
+}
+
/**
* Loads the first 10 save names, to be used in Drascula's save/load screen
*/
@@ -205,7 +225,7 @@ void DrasculaEngine::loadSaveNames() {
}
}
-void DrasculaEngine::saveGame(int slot, Common::String &desc) {
+void DrasculaEngine::saveGame(int slot, const Common::String &desc) {
Common::OutSaveFile *out;
int l;