diff options
-rw-r--r-- | engines/zvision/detection.cpp | 66 | ||||
-rw-r--r-- | engines/zvision/zvision.cpp | 78 |
2 files changed, 95 insertions, 49 deletions
diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 4fcb5c040b..c613278fec 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -55,6 +55,10 @@ static const PlainGameDescriptor zVisionGames[] = { namespace ZVision { +#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1 +#define GAMEOPTION_DOUBLE_FPS GUIO_GAMEOPTIONS2 +#define GAMEOPTION_ENABLE_VENUS GUIO_GAMEOPTIONS3 + static const ZVisionGameDescription gameDescriptions[] = { { @@ -66,7 +70,7 @@ static const ZVisionGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO3(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_DOUBLE_FPS, GAMEOPTION_ENABLE_VENUS) }, GID_NEMESIS }, @@ -80,7 +84,7 @@ static const ZVisionGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, - GUIO1(GUIO_NONE) + GUIO3(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_DOUBLE_FPS, GAMEOPTION_ENABLE_VENUS) }, GID_NEMESIS }, @@ -94,7 +98,7 @@ static const ZVisionGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_DOUBLE_FPS) }, GID_GRANDINQUISITOR }, @@ -108,7 +112,7 @@ static const ZVisionGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) + GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_DOUBLE_FPS) }, GID_GRANDINQUISITOR }, @@ -122,7 +126,7 @@ static const ZVisionGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, - GUIO1(GUIO_NONE) + GUIO2(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_DOUBLE_FPS) }, GID_GRANDINQUISITOR }, @@ -140,23 +144,43 @@ static const char *directoryGlobs[] = { 0 }; -static const ExtraGuiOption ZVisionExtraGuiOption = { - _s("Use original save/load screens"), - _s("Use the original save/load screens, instead of the ScummVM ones"), - "originalsaveload", - false -}; +static const ADExtraGuiOptionsMap optionsList[] = { + { + GAMEOPTION_ORIGINAL_SAVELOAD, + { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false + } + }, -static const ExtraGuiOption ZVisionExtraGuiOption2 = { - _s("Double FPS"), - _s("Halve the update delay"), - "doublefps", - false + { + GAMEOPTION_DOUBLE_FPS, + { + _s("Double FPS"), + _s("Halve the update delay"), + "doublefps", + false + } + }, + + { + GAMEOPTION_ENABLE_VENUS, + { + _s("Enable Venus"), + _s("Enable the Venus help system"), + "venusenabled", + true + } + }, + + AD_EXTRA_GUI_OPTIONS_TERMINATOR }; class ZVisionMetaEngine : public AdvancedMetaEngine { public: - ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames) { + ZVisionMetaEngine() : AdvancedMetaEngine(ZVision::gameDescriptions, sizeof(ZVision::ZVisionGameDescription), zVisionGames, optionsList) { _maxScanDepth = 2; _directoryGlobs = directoryGlobs; _singleid = "zvision"; @@ -172,7 +196,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; - virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; @@ -223,13 +246,6 @@ bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADG return gd != 0; } -const ExtraGuiOptions ZVisionMetaEngine::getExtraGuiOptions(const Common::String &target) const { - ExtraGuiOptions options; - options.push_back(ZVisionExtraGuiOption); - options.push_back(ZVisionExtraGuiOption2); - return options; -} - SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); ZVision::SaveGameHeader header; diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 7c26eba030..5f4924d7cf 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -57,25 +57,29 @@ namespace ZVision { struct zvisionIniSettings { const char *name; int16 slot; - int16 deflt; + int16 defaultValue; // -1: use the bool value + bool defaultBoolValue; + bool allowEditing; } 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} + // Hardcoded settings + {"qsoundenabled", StateKey_Qsound, 1, false, false}, + {"highquality", StateKey_HighQuality, 1, false, false}, + {"platform", StateKey_Platform, 0, false, false}, + {"installlevel", StateKey_InstallLevel, 0, false, false}, + {"countrycode", StateKey_CountryCode, 0, false, false}, + {"cpu", StateKey_CPU, 1, false, false}, + {"moviecursor", StateKey_MovieCursor, 1, false, false}, + {"noanimwhileturning", StateKey_NoTurnAnim, 0, false, false}, + {"win958", StateKey_WIN958, 0, false, false}, + {"showerrordialogs", StateKey_ShowErrorDlg, 0, false, false}, + {"japanesefonts", StateKey_JapanFonts, 0, false, false}, + {"brightness", StateKey_Brightness, 0, false, false}, + {"debugcheats", StateKey_DebugCheats, 1, false, false}, + // Editable settings + {"keyboardturnspeed", StateKey_KbdRotateSpeed, 5, false, true}, + {"panarotatespeed", StateKey_RotateSpeed, 540, false, true}, + {"venusenabled", StateKey_VenusEnable, -1, true, true}, + {"subtitles", StateKey_Subtitles, -1, true, true}, }; ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) @@ -139,14 +143,33 @@ ZVision::~ZVision() { } void ZVision::registerDefaultSettings() { - for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++) - ConfMan.registerDefault(settingsKeys[i].name, settingsKeys[i].deflt); + for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++) { + if (settingsKeys[i].allowEditing) { + if (settingsKeys[i].defaultValue >= 0) + ConfMan.registerDefault(settingsKeys[i].name, settingsKeys[i].defaultValue); + else + ConfMan.registerDefault(settingsKeys[i].name, settingsKeys[i].defaultBoolValue); + } + } + + ConfMan.registerDefault("originalsaveload", false); 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)); + int16 value = 0; + bool boolValue = false; + + for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++) { + if (settingsKeys[i].defaultValue >= 0) { + value = (settingsKeys[i].allowEditing) ? ConfMan.getInt(settingsKeys[i].name) : settingsKeys[i].defaultValue; + } else { + boolValue = value = (settingsKeys[i].allowEditing) ? ConfMan.getBool(settingsKeys[i].name) : settingsKeys[i].defaultBoolValue; + value = (boolValue) ? 1 : 0; + } + + _scriptManager->setStateValue(settingsKeys[i].slot, value); + } if (getGameId() == GID_NEMESIS) _scriptManager->setStateValue(StateKey_ExecScopeStyle, 1); @@ -155,8 +178,15 @@ void ZVision::loadSettings() { } void ZVision::saveSettings() { - for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++) - ConfMan.setInt(settingsKeys[i].name, _scriptManager->getStateValue(settingsKeys[i].slot)); + for (int i = 0; i < ZVISION_SETTINGS_KEYS_COUNT; i++) { + if (settingsKeys[i].allowEditing) { + if (settingsKeys[i].defaultValue >= 0) + ConfMan.setInt(settingsKeys[i].name, _scriptManager->getStateValue(settingsKeys[i].slot)); + else + ConfMan.setBool(settingsKeys[i].name, (_scriptManager->getStateValue(settingsKeys[i].slot) == 1)); + } + } + ConfMan.flushToDisk(); } |