aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2017-11-17 23:13:45 +0000
committerThierry Crozat2018-01-23 02:15:41 +0000
commit87ab33a8aa585be4f83a53a2aee60c674872fbb4 (patch)
tree756bbd649c2404ada47da57b6279bebf8094dd3e
parent34658bc7d4dcbb041d24d2c35539814613d4307e (diff)
downloadscummvm-rg350-87ab33a8aa585be4f83a53a2aee60c674872fbb4.tar.gz
scummvm-rg350-87ab33a8aa585be4f83a53a2aee60c674872fbb4.tar.bz2
scummvm-rg350-87ab33a8aa585be4f83a53a2aee60c674872fbb4.zip
SUPERNOVA: Fix several issues with savegames
-rw-r--r--engines/supernova/rooms.cpp1
-rw-r--r--engines/supernova/state.cpp12
-rw-r--r--engines/supernova/supernova.cpp13
-rw-r--r--engines/supernova/supernova.h2
4 files changed, 24 insertions, 4 deletions
diff --git a/engines/supernova/rooms.cpp b/engines/supernova/rooms.cpp
index d660739238..96e8eaf7d6 100644
--- a/engines/supernova/rooms.cpp
+++ b/engines/supernova/rooms.cpp
@@ -2243,6 +2243,7 @@ bool ArsanoMeetup2::interact(Action verb, Object &obj1, Object &obj2) {
_gm->loadTime();
_gm->_rooms[CAVE]->getObject(1)->_exitRoom = MEETUP3;
_gm->_state._dream = true;
+ _vm->paletteFadeIn();
}
} else {
_gm->changeRoom(MEETUP2);
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index 7cf4294c20..95f48e4ce5 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -127,6 +127,10 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) {
}
changeRoom(curRoomId);
+ // Some additional variables
+ _guiEnabled = true;
+ _animationEnabled = true;
+
return !in->err();
}
@@ -989,6 +993,9 @@ void GameManager::reply(const char *text, int aus1, int aus2) {
}
int GameManager::dialog(int num, byte rowLength[6], StringID text[6], int number) {
+ _vm->_allowLoadGame = false;
+ _guiEnabled = false;
+
bool remove[6];
for (int i = 0; i < 5; ++i)
remove[i] = _currentRoom->sentenceRemoved(i, number);
@@ -1015,18 +1022,19 @@ int GameManager::dialog(int num, byte rowLength[6], StringID text[6], int number
rq += rowLength[i];
}
- _guiEnabled = false;
_currentSentence = -1;
do {
mouseInput3();
} while (_currentSentence == -1 && !_vm->shouldQuit());
- _guiEnabled = true;
_vm->renderBox(0, 138, 320, 62, kColorBlack);
if (number && _texts[_rowsStart[_currentSentence]] != kStringDialogSeparator)
_currentRoom->removeSentence(_currentSentence, number);
+ _guiEnabled = true;
+ _vm->_allowLoadGame = true;
+
return _currentSentence;
}
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 923b8d6bc5..80a8404599 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -982,7 +982,8 @@ Common::Error SupernovaEngine::loadGameState(int slot) {
}
bool SupernovaEngine::canSaveGameStateCurrently() {
- return _allowSaveGame;
+ // Do not allow saving when either _allowSaveGame, _animationEnabled or _guiEnabled is false
+ return _allowSaveGame && _gm->_animationEnabled && _gm->_guiEnabled;
}
Common::Error SupernovaEngine::saveGameState(int slot, const Common::String &desc) {
@@ -1024,6 +1025,13 @@ bool SupernovaEngine::loadGame(int slot) {
Graphics::skipThumbnail(*savefile);
_gm->deserialize(savefile, saveVersion);
+ if (saveVersion >= 5) {
+ _menuBrightness = savefile->readByte();
+ _brightness = savefile->readByte();
+ } else {
+ _menuBrightness = _brightness = 255;
+ }
+
delete savefile;
return true;
@@ -1054,6 +1062,9 @@ bool SupernovaEngine::saveGame(int slot, const Common::String &description) {
Graphics::saveThumbnail(*savefile);
_gm->serialize(savefile);
+ savefile->writeByte(_menuBrightness);
+ savefile->writeByte(_brightness);
+
savefile->finalize();
delete savefile;
diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h
index eeb518efd1..8aace03c1f 100644
--- a/engines/supernova/supernova.h
+++ b/engines/supernova/supernova.h
@@ -43,7 +43,7 @@
namespace Supernova {
#define SAVEGAME_HEADER MKTAG('M','S','N','1')
-#define SAVEGAME_VERSION 4
+#define SAVEGAME_VERSION 5
#define SUPERNOVA_DAT "supernova.dat"
#define SUPERNOVA_DAT_VERSION 1