[Scummvm-cvs-logs] scummvm master -> 6a49d3eadd7555a4f5f539ceb73fdfe370fce9da

bluegr md5 at scummvm.org
Sat Mar 31 12:56:03 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6a49d3eadd ENGINES: Return all available custom GUI options if no target is specified


Commit: 6a49d3eadd7555a4f5f539ceb73fdfe370fce9da
    https://github.com/scummvm/scummvm/commit/6a49d3eadd7555a4f5f539ceb73fdfe370fce9da
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-03-31T03:55:03-07:00

Commit Message:
ENGINES: Return all available custom GUI options if no target is specified

This is used to set default settings for all custom game options when an
engine starts

Changed paths:
    base/main.cpp
    engines/advancedDetector.cpp
    engines/metaengine.h
    engines/queen/queen.cpp
    engines/sci/engine/features.cpp
    engines/sci/sci.cpp
    engines/sci/sound/soundcmd.cpp
    engines/sky/detection.cpp



diff --git a/base/main.cpp b/base/main.cpp
index 99dcac6..283c64e 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -206,8 +206,8 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
 	// Initialize any game-specific keymaps
 	engine->initKeymap();
 
-	// Set default values to the custom engine options
-	const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(ConfMan.getActiveDomainName());
+	// Set default values for all of the custom engine options
+	const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions("");
 	for (uint i = 0; i < engineOptions.size(); i++) {
 		ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState);
 	}
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index dc7f7e0..ac06e74 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -171,12 +171,21 @@ const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::Strin
 	if (!_extraGuiOptions)
 		return ExtraGuiOptions();
 
+	ExtraGuiOptions options;
+
+	// If there isn't any target specified, return all available GUI options.
+	// Only used when an engine starts in order to set option defaults.
+	if (target.empty()) {
+		for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry)
+			options.push_back(entry->option);
+
+		return options;
+	}
+
 	// Query the GUI options
 	const Common::String guiOptionsString = ConfMan.get("guioptions", target);
 	const Common::String guiOptions = parseGameGUIOptions(guiOptionsString);
 
-	ExtraGuiOptions options;
-
 	// Add all the applying extra GUI options.
 	for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry) {
 		if (guiOptions.contains(entry->guioFlag))
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 632c204..ffa682f 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -112,10 +112,17 @@ public:
 	}
 
 	/**
-	 * Return a list of extra GUI options.
+	 * Return a list of extra GUI options for the specified target.
+	 * If no target is specified, all of the available custom GUI options are
+	 * Returned for the plugin (used to set default values).
+	 *
 	 * Currently, this only supports options with checkboxes.
 	 *
 	 * The default implementation returns an empty list.
+	 *
+	 * @param target    name of a config manager target
+	 * @return          a list of extra GUI options for an engine plugin and
+	 *                  target
 	 */
 	virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const {
 		return ExtraGuiOptions();
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index 1b07d3c..3acc87b 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -112,12 +112,18 @@ int QueenMetaEngine::getMaximumSaveSlot() const { return 99; }
 
 const ExtraGuiOptions QueenMetaEngine::getExtraGuiOptions(const Common::String &target) const {
 	Common::String guiOptions;
+	ExtraGuiOptions options;
+	
+	if (target.empty()) {
+		options.push_back(queenExtraGuiOption);
+		return options;
+	}
+	
 	if (ConfMan.hasKey("guioptions", target)) {
 		guiOptions = ConfMan.get("guioptions", target);
 		guiOptions = parseGameGUIOptions(guiOptions);
 	}
 
-	ExtraGuiOptions options;
 	if (!guiOptions.contains(GUIO_NOSPEECH))
 		options.push_back(queenExtraGuiOption);
 	return options;
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index a284c31..cad95b1 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -43,7 +43,7 @@ GameFeatures::GameFeatures(SegManager *segMan, Kernel *kernel) : _segMan(segMan)
 	_sci2StringFunctionType = kSci2StringFunctionUninitialized;
 #endif
 	_usesCdTrack = Common::File::exists("cdaudio.map");
-	if (ConfMan.hasKey("use_cdaudio") && !ConfMan.getBool("use_cdaudio"))
+	if (!ConfMan.getBool("use_cdaudio"))
 		_usesCdTrack = false;
 }
 
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index c77b494..9b0ee69 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -221,8 +221,7 @@ Common::Error SciEngine::run() {
 
 	// Initialize the game screen
 	_gfxScreen = new GfxScreen(_resMan);
-	bool enableUnDitheringFlag = ConfMan.hasKey("disable_dithering") && ConfMan.getBool("disable_dithering");
-	_gfxScreen->enableUndithering(enableUnDitheringFlag);
+	_gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering"));
 
 	_kernel = new Kernel(_resMan, segMan);
 
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 8481f10..05bb903 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -44,10 +44,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
 	// resource number, but it's totally unrelated to the menu music).
 	// The GK1 demo (very late SCI1.1) does the same thing
 	// TODO: Check the QFG4 demo
-
-	// If the prefer_digitalsfx key is missing, default to enable digital SFX
-	bool preferDigitalSfx = !ConfMan.hasKey("prefer_digitalsfx") || ConfMan.getBool("prefer_digitalsfx");
-	_useDigitalSFX = (getSciVersion() >= SCI_VERSION_2 || g_sci->getGameId() == GID_GK1 || preferDigitalSfx);
+	_useDigitalSFX = (getSciVersion() >= SCI_VERSION_2 || g_sci->getGameId() == GID_GK1 || ConfMan.getBool("prefer_digitalsfx"));
 
 	_music = new SciMusic(_soundVersion, _useDigitalSFX);
 	_music->init();
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 05dbe10..dfa3ded 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -118,12 +118,18 @@ GameList SkyMetaEngine::getSupportedGames() const {
 
 const ExtraGuiOptions SkyMetaEngine::getExtraGuiOptions(const Common::String &target) const {
 	Common::String guiOptions;
+	ExtraGuiOptions options;
+	
+	if (target.empty()) {
+		options.push_back(skyExtraGuiOption);
+		return options;
+	}
+	
 	if (ConfMan.hasKey("guioptions", target)) {
 		guiOptions = ConfMan.get("guioptions", target);
 		guiOptions = parseGameGUIOptions(guiOptions);
 	}
 
-	ExtraGuiOptions options;
 	if (!guiOptions.contains(GUIO_NOSPEECH))
 		options.push_back(skyExtraGuiOption);
 	return options;






More information about the Scummvm-git-logs mailing list