diff options
author | Paul Gilbert | 2018-04-03 22:00:18 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-04-03 22:00:18 -0400 |
commit | 4fefa8828283d7f6857327b3e19ccaf8cbee33a5 (patch) | |
tree | 63f2f11073d658ffbf55a298e113dd4d70aaa2c7 | |
parent | e5c4adb3c0ecdc74df2f5edc69f19af265f93be2 (diff) | |
download | scummvm-rg350-4fefa8828283d7f6857327b3e19ccaf8cbee33a5.tar.gz scummvm-rg350-4fefa8828283d7f6857327b3e19ccaf8cbee33a5.tar.bz2 scummvm-rg350-4fefa8828283d7f6857327b3e19ccaf8cbee33a5.zip |
XEEN: Don't allow saving in the war zone
-rw-r--r-- | devtools/create_xeen/constants.cpp | 3 | ||||
-rw-r--r-- | engines/xeen/dialogs/dialogs_control_panel.cpp | 3 | ||||
-rw-r--r-- | engines/xeen/resources.cpp | 1 | ||||
-rw-r--r-- | engines/xeen/resources.h | 1 | ||||
-rw-r--r-- | engines/xeen/saves.cpp | 25 | ||||
-rw-r--r-- | engines/xeen/xeen.cpp | 2 |
6 files changed, 23 insertions, 12 deletions
diff --git a/devtools/create_xeen/constants.cpp b/devtools/create_xeen/constants.cpp index 8bea0fd22c..9465e359df 100644 --- a/devtools/create_xeen/constants.cpp +++ b/devtools/create_xeen/constants.cpp @@ -1922,6 +1922,8 @@ const char *const MUSIC_FILES2[6][7] = { }; const char *const DIFFICULTY_TEXT = "\v000\t000\x3""cSelect Game Preference"; +const char *const SAVE_OFF_LIMITS = "\x3""c\v002\t000The Gods of Game Restoration deem this area off limits!\n" + "Sorry, no saving in this maze."; void writeConstants(CCArchive &cc) { Common::MemFile file; @@ -2261,6 +2263,7 @@ void writeConstants(CCArchive &cc) { file.syncStrings(MUSIC_FILES1, 5); file.syncStrings2D((const char *const *)MUSIC_FILES2, 6, 7); file.syncString(DIFFICULTY_TEXT); + file.syncString(SAVE_OFF_LIMITS); cc.add("CONSTANTS", file); } diff --git a/engines/xeen/dialogs/dialogs_control_panel.cpp b/engines/xeen/dialogs/dialogs_control_panel.cpp index 5c4ed16712..f589c8b0c3 100644 --- a/engines/xeen/dialogs/dialogs_control_panel.cpp +++ b/engines/xeen/dialogs/dialogs_control_panel.cpp @@ -172,8 +172,7 @@ int ControlPanel::execute() { if (g_vm->canLoadGameStateCurrently()) saves.loadGame(); } else if (result == 4) { - if (g_vm->canSaveGameStateCurrently()) - saves.saveGame(); + saves.saveGame(); } return result; diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index c599480e2f..f333edea08 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -398,6 +398,7 @@ void Resources::loadData() { file.syncStrings(MUSIC_FILES1, 5); file.syncStrings2D(&MUSIC_FILES2[0][0], 6, 7); file.syncString(DIFFICULTY_TEXT); + file.syncString(SAVE_OFF_LIMITS); } } // End of namespace Xeen diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index bfd5cce41b..d93f7ecd19 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -453,6 +453,7 @@ public: const char *MUSIC_FILES1[5]; const char *MUSIC_FILES2[6][7]; const char *DIFFICULTY_TEXT; + const char *SAVE_OFF_LIMITS; public: /** * Constructor diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index a055627af4..7eadac139c 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -258,18 +258,25 @@ bool SavesManager::loadGame() { } bool SavesManager::saveGame() { - if (!g_vm->canSaveGameStateCurrently()) + Map &map = *g_vm->_map; + Windows &windows = *g_vm->_windows; + + if (map.mazeData()._mazeFlags & RESTRICTION_SAVE) { + ErrorScroll::show(g_vm, Res.SAVE_OFF_LIMITS, WT_NONFREEZED_WAIT); return false; + } else if (!g_vm->canSaveGameStateCurrently()) { + return false; + } else { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + int slotNum = dialog->runModalWithCurrentTarget(); + Common::String saveName = dialog->getResultString(); + delete dialog; - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); - int slotNum = dialog->runModalWithCurrentTarget(); - Common::String saveName = dialog->getResultString(); - delete dialog; - - if (slotNum != -1) - saveGameState(slotNum, saveName); + if (slotNum != -1) + saveGameState(slotNum, saveName); - return slotNum != -1; + return slotNum != -1; + } } } // End of namespace Xeen diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 854ac87dc3..5f6243c045 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -193,7 +193,7 @@ bool XeenEngine::canLoadGameStateCurrently() { } bool XeenEngine::canSaveGameStateCurrently() { - return _mode != MODE_COMBAT && _mode != MODE_STARTUP; + return _mode != MODE_COMBAT && _mode != MODE_STARTUP && (_map->mazeData()._mazeFlags & RESTRICTION_SAVE) == 0; } void XeenEngine::playGame() { |