aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstrangerke2011-03-08 00:19:30 +0100
committerstrangerke2011-03-08 00:21:02 +0100
commit9fb28410b5ea27fa8e79ac5f0ac4ce70ae4cf3c6 (patch)
tree29af1fe706e6883c07b582181452bb6650b64f6f
parent905d5e76b463870fba69d6683c96ac93d6fda623 (diff)
downloadscummvm-rg350-9fb28410b5ea27fa8e79ac5f0ac4ce70ae4cf3c6.tar.gz
scummvm-rg350-9fb28410b5ea27fa8e79ac5f0ac4ce70ae4cf3c6.tar.bz2
scummvm-rg350-9fb28410b5ea27fa8e79ac5f0ac4ce70ae4cf3c6.zip
HUGO: Misc savegame modifications
- Add initial savegame on slot 0 - Save viewstate as it may now contain several different values when saving - Fix loading from GMM - Implement ctrl-N
-rw-r--r--engines/hugo/detection.cpp5
-rw-r--r--engines/hugo/file.cpp7
-rw-r--r--engines/hugo/hugo.cpp4
-rw-r--r--engines/hugo/hugo.h2
-rw-r--r--engines/hugo/menu.cpp2
-rw-r--r--engines/hugo/parser.cpp7
-rw-r--r--engines/hugo/parser_v1d.cpp2
-rw-r--r--engines/hugo/parser_v1w.cpp2
-rw-r--r--engines/hugo/parser_v2d.cpp2
-rw-r--r--engines/hugo/parser_v3d.cpp2
10 files changed, 17 insertions, 18 deletions
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index c99db2433f..e862e339ce 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -292,6 +292,11 @@ SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int s
desc.setSaveTime(hour, minutes);
+ // Slot 0 is used for the 'restart game' save in all Hugo games, thus
+ // we prevent it from being deleted.
+ desc.setDeletableFlag(slot != 0);
+ desc.setWriteProtectedFlag(slot == 0);
+
delete file;
return desc;
}
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index c287ebf6e8..94e1756a0d 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -411,6 +411,8 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
out->writeSint16BE(_vm->_maze.x4);
out->writeByte(_vm->_maze.firstScreenIndex);
+ out->writeByte((byte)_vm->getGameStatus().viewState);
+
out->finalize();
delete out;
@@ -507,6 +509,11 @@ bool FileManager::restoreGame(const int16 slot) {
_vm->_maze.x4 = in->readSint16BE();
_vm->_maze.firstScreenIndex = in->readByte();
+ _vm->_scheduler->restoreScreen(*_vm->_screen_p);
+ if ((_vm->getGameStatus().viewState = (vstate_t) in->readByte()) != kViewPlay)
+ _vm->_screen->hideCursor();
+
+
delete in;
return true;
}
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 9a622290f9..231b2a5d51 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -259,8 +259,8 @@ Common::Error HugoEngine::run() {
if (loadSlot >= 0) {
_status.skipIntroFl = true;
_file->restoreGame(loadSlot);
- _scheduler->restoreScreen(*_screen_p);
- _status.viewState = kViewPlay;
+ } else {
+ _file->saveGame(0, "New Game");
}
while (!_status.doQuitFl) {
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 2de442e0f7..566cb75763 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -58,7 +58,7 @@ class RandomSource;
*/
namespace Hugo {
-static const int kSavegameVersion = 5;
+static const int kSavegameVersion = 6;
static const int kInvDx = 32; // Width of an inventory icon
static const int kInvDy = 32; // Height of inventory icon
static const int kMaxTunes = 16; // Max number of tunes
diff --git a/engines/hugo/menu.cpp b/engines/hugo/menu.cpp
index 428a3e096a..7bcdea5cb1 100644
--- a/engines/hugo/menu.cpp
+++ b/engines/hugo/menu.cpp
@@ -196,8 +196,6 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d
case kCmdLoad:
close();
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- _vm->getGameStatus().viewState = kViewPlay;
break;
case kCmdRecall:
close();
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index c845e03eee..a0a3ee3350 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -286,11 +286,10 @@ void Parser::keyHandler(Common::Event event) {
break;
case Common::KEYCODE_l:
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- gameStatus.viewState = kViewPlay;
break;
case Common::KEYCODE_n:
- warning("STUB: CTRL-N (WIN) - New Game");
+ if (Utils::Box(kBoxYesNo, "%s", "Are you sure you want to start a new game?") != 0)
+ _vm->_file->restoreGame(0);
break;
case Common::KEYCODE_s:
if (gameStatus.viewState == kViewPlay) {
@@ -360,8 +359,6 @@ void Parser::keyHandler(Common::Event event) {
break;
case Common::KEYCODE_F5: // Restore game
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- gameStatus.viewState = kViewPlay;
break;
case Common::KEYCODE_F6: // Inventory
showInventory();
diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp
index 424ca66b38..df3a73feb8 100644
--- a/engines/hugo/parser_v1d.cpp
+++ b/engines/hugo/parser_v1d.cpp
@@ -380,8 +380,6 @@ void Parser_v1d::lineHandler() {
if (!strcmp("restore", _vm->_line)) {
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- gameStatus.viewState = kViewPlay;
return;
}
diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp
index 5d901e8ffe..d3424274f8 100644
--- a/engines/hugo/parser_v1w.cpp
+++ b/engines/hugo/parser_v1w.cpp
@@ -132,8 +132,6 @@ void Parser_v1w::lineHandler() {
if (!strcmp("restore", _vm->_line) && (gameStatus.viewState == kViewPlay || gameStatus.viewState == kViewIdle)) {
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- gameStatus.viewState = kViewPlay;
return;
}
diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp
index 580d78100d..d19b8b1091 100644
--- a/engines/hugo/parser_v2d.cpp
+++ b/engines/hugo/parser_v2d.cpp
@@ -132,8 +132,6 @@ void Parser_v2d::lineHandler() {
if (!strcmp("restore", _vm->_line)) {
_vm->_config.soundFl = false;
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- gameStatus.viewState = kViewPlay;
return;
}
diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp
index b3d0125d20..fcd937808b 100644
--- a/engines/hugo/parser_v3d.cpp
+++ b/engines/hugo/parser_v3d.cpp
@@ -134,8 +134,6 @@ void Parser_v3d::lineHandler() {
if (!strcmp("restore", _vm->_line)) {
_vm->_config.soundFl = false;
_vm->_file->restoreGame(-1);
- _vm->_scheduler->restoreScreen(*_vm->_screen_p);
- gameStatus.viewState = kViewPlay;
return;
}