aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMarisa-Chan2014-11-04 10:12:13 +0600
committerMarisa-Chan2014-11-04 10:12:13 +0600
commitbe8cf9767470cc8ca9d35539b768817cf74b89c6 (patch)
treec3ef373c35ba64ef07415f213a219cf7f240f170 /engines
parentd40caba5b748be38f2b6fe4c70af7eeccedd0ab8 (diff)
downloadscummvm-rg350-be8cf9767470cc8ca9d35539b768817cf74b89c6.tar.gz
scummvm-rg350-be8cf9767470cc8ca9d35539b768817cf74b89c6.tar.bz2
scummvm-rg350-be8cf9767470cc8ca9d35539b768817cf74b89c6.zip
ZVISION: Implement settings functions
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/scripting/script_manager.cpp4
-rw-r--r--engines/zvision/scripting/script_manager.h1
-rw-r--r--engines/zvision/zvision.cpp52
3 files changed, 56 insertions, 1 deletions
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index fea3c2e199..d2165734b4 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -96,7 +96,7 @@ void ScriptManager::execScope(script_scope &scope) {
for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter)
(*PuzzleIter)->addedBySetState = 0;
- if (scope.proc_count < 2 || getStateValue(76)) {
+ if (scope.proc_count < 2 || getStateValue(StateKey_ExecScopeStyle)) {
for (PuzzleList::iterator PuzzleIter = scope._puzzles.begin(); PuzzleIter != scope._puzzles.end(); ++PuzzleIter)
checkPuzzleCriteria(*PuzzleIter, scope.proc_count);
} else {
@@ -738,6 +738,8 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) {
// Place for read prefs
_engine->setRenderDelay(10);
setStateValue(StateKey_RestoreFlag, 1);
+
+ _engine->loadSettings();
}
Location ScriptManager::getCurrentLocation() const {
diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h
index 219cff9f45..3fcbad5fa4 100644
--- a/engines/zvision/scripting/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -86,6 +86,7 @@ enum StateKey {
StateKey_ShowErrorDlg = 73,
StateKey_DebugCheats = 74,
StateKey_JapanFonts = 75,
+ StateKey_ExecScopeStyle = 76,
StateKey_Brightness = 77,
StateKey_EF9_R = 91,
StateKey_EF9_G = 92,
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index 0bc5fef39a..77c47d9b1e 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -54,6 +54,32 @@
namespace ZVision {
+#define ZVISION_SETTINGS_KEYS_COUNT 17
+
+struct zvisionIniSettings {
+ const char *name;
+ int16 slot;
+ int16 deflt;
+} settingsKeys[ZVISION_SETTINGS_KEYS_COUNT] = {
+ {"ZVision_KeyboardTurnSpeed", StateKey_KbdRotateSpeed, 5},
+ {"ZVision_PanaRotateSpeed", StateKey_RotateSpeed, 540},
+ {"ZVision_QSoundEnabled", StateKey_Qsound, 1},
+ {"ZVision_VenusEnabled", StateKey_VenusEnable, 1},
+ {"ZVision_HighQuality", StateKey_HighQuality, 1},
+ {"ZVision_Platform", StateKey_Platform, 0},
+ {"ZVision_InstallLevel", StateKey_InstallLevel, 0},
+ {"ZVision_CountryCode", StateKey_CountryCode, 0},
+ {"ZVision_CPU", StateKey_CPU, 1},
+ {"ZVision_MovieCursor", StateKey_MovieCursor, 1},
+ {"ZVision_NoAnimWhileTurning", StateKey_NoTurnAnim, 0},
+ {"ZVision_Win958", StateKey_WIN958, 0},
+ {"ZVision_ShowErrorDialogs", StateKey_ShowErrorDlg, 0},
+ {"ZVision_ShowSubtitles", StateKey_Subtitles, 1},
+ {"ZVision_DebugCheats", StateKey_DebugCheats, 0},
+ {"ZVision_JapaneseFonts", StateKey_JapanFonts, 0},
+ {"ZVision_Brightness", StateKey_Brightness, 0}
+};
+
ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)
: Engine(syst),
_gameDescription(gameDesc),
@@ -93,6 +119,28 @@ ZVision::~ZVision() {
DebugMan.clearAllDebugChannels();
}
+void ZVision::registerDefaultSettings() {
+ for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++)
+ ConfMan.registerDefault(settingsKeys[i].name, settingsKeys[i].deflt);
+ ConfMan.registerDefault("doublefps", false);
+}
+
+void ZVision::loadSettings() {
+ for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++)
+ _scriptManager->setStateValue(settingsKeys[i].slot, ConfMan.getInt(settingsKeys[i].name));
+
+ if (getGameId() == GID_NEMESIS)
+ _scriptManager->setStateValue(StateKey_ExecScopeStyle, 1);
+ else
+ _scriptManager->setStateValue(StateKey_ExecScopeStyle, 0);
+}
+
+void ZVision::saveSettings() {
+ for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++)
+ ConfMan.setInt(settingsKeys[i].name, _scriptManager->getStateValue(settingsKeys[i].slot));
+ ConfMan.flushToDisk();
+}
+
void ZVision::initialize() {
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -171,6 +219,10 @@ void ZVision::initialize() {
_scriptManager->initialize();
_stringManager->initialize(_gameDescription->gameId);
+ registerDefaultSettings();
+
+ loadSettings();
+
// Create debugger console. It requires GFX to be initialized
_console = new Console(this);
_halveDelay = ConfMan.getBool("doublefps");