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
This commit is contained in:
parent
7f9c63239b
commit
6a49d3eadd
8 changed files with 38 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue