Per-engine and per-game GUI options (version 3) #181

Closed
wants to merge 10 commits into
from
Jump to file
+576 −41
Split
View
@@ -195,7 +195,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
}
// On creation the engine should have set up all debug levels so we can use
- // the command line arugments here
+ // the command line arguments here
Common::StringTokenizer tokenizer(edebuglevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
@@ -206,6 +206,12 @@ 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());
+ for (uint i = 0; i < engineOptions.size(); i++) {
+ ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState);
+ }
+
// Inform backend that the engine is about to be run
system.engineInit();
@@ -1 +1 @@
-[SCUMMVM_STX0.8.3:ScummVM Mobile Theme:No Author]
+[SCUMMVM_STX0.8.9:ScummVM Mobile Theme:No Author]
@@ -621,6 +621,32 @@
</layout>
</dialog>
+ <dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget' shading = 'dim'>
+ <layout type = 'vertical' padding = '16, 16, 16, 16'>
+ <widget name = 'customOption1Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption2Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption3Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption4Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption5Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption6Checkbox'
+ type = 'Checkbox'
+ />
+ <widget name = 'customOption7Checkbox'
+ type = 'Checkbox'
+ />
+ </layout>
+ </dialog>
+
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
<layout type = 'vertical' padding = '16, 16, 16, 16' center = 'true'>
<widget name = 'Logo'
@@ -24,6 +24,7 @@
#include "common/algorithm.h"
#include "common/system.h"
+#include "common/translation.h"
#include "engines/advancedDetector.h"
@@ -62,6 +63,7 @@ class DreamWebMetaEngine : public AdvancedMetaEngine {
virtual int getMaximumSaveSlot() const;
virtual void removeSaveState(const char *target, int slot) const;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
};
bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -193,6 +195,32 @@ SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, i
return SaveStateDescriptor();
}
+const ExtraGuiOptions DreamWebMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ static const ExtraGuiOption optionsList[] = {
+ {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens, instead of the ScummVM ones"),
+ "dreamweb_originalsaveload",
+ false
+ },
+ {
+ _s("Use bright palette mode"),
+ _s("Display graphics using the game's bright palette"),
+ "bright_palette",
+ true
+ },
+ { 0, 0, 0, 0 }
+ };
+
+ ExtraGuiOptions returnList;
+ uint i = 0;
+ while (optionsList[i].configOption) {
+ returnList.push_back(optionsList[i++]);
+ }
+
+ return returnList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(DREAMWEB)
REGISTER_PLUGIN_DYNAMIC(DREAMWEB, PLUGIN_TYPE_ENGINE, DreamWebMetaEngine);
#else
@@ -89,7 +89,7 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_speechCount = 0;
_charShift = 0;
_kerning = 0;
- _brightness = 0;
+ _brightPalette = true;
_roomLoaded = 0;
_didZoom = 0;
_lineSpacing = 10;
@@ -365,7 +365,6 @@ Common::Error DreamWebEngine::run() {
syncSoundSettings();
_console = new DreamWebConsole(this);
- ConfMan.registerDefault("dreamweb_originalsaveload", "false");
_hasSpeech = Common::File::exists("speech/r01c0000.raw") && !ConfMan.getBool("speech_mute");
_timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
@@ -341,7 +341,7 @@ class DreamWebEngine : public Engine {
uint8 _speechCount;
uint16 _charShift;
uint8 _kerning;
- uint8 _brightness;
@sev-
sev- Feb 29, 2012 ScummVM member

In fact this should be split into a separate commit. First is the rename and refactoring, then adding the option.

+ bool _brightPalette;
uint8 _roomLoaded;
uint8 _didZoom;
uint16 _lineSpacing;
@@ -952,7 +952,6 @@ class DreamWebEngine : public Engine {
void screenUpdate();
void startup1();
void readOneBlock();
- void seeCommandTail();
bool checkIfPerson(uint8 x, uint8 y);
bool checkIfFree(uint8 x, uint8 y);
bool checkIfEx(uint8 x, uint8 y);
@@ -565,7 +565,7 @@ void DreamWebEngine::dreamweb() {
break;
}
- seeCommandTail();
+ _brightPalette = ConfMan.getBool("bright_palette");
allocateBuffers();
// setMouse
@@ -877,10 +877,6 @@ void DreamWebEngine::hangOnCurs(uint16 frameCount) {
}
}
-void DreamWebEngine::seeCommandTail() {
- _brightness = 1;
-}
-
void DreamWebEngine::readMouse() {
_oldButton = _mouseButton;
uint16 state = readMouseState();
@@ -417,7 +417,7 @@ void DreamWebEngine::loadPalFromIFF() {
uint8 *dst = _mainPal;
for (size_t i = 0; i < 256*3; ++i) {
uint8 c = src[i] / 4;
- if (_brightness == 1) {
+ if (_brightPalette) {
if (c) {
c = c + c / 2 + c / 4;
if (c > 63)
@@ -30,6 +30,7 @@
#include "common/config-manager.h"
#include "common/system.h"
#include "common/savefile.h"
+#include "common/translation.h"
#include "engines/advancedDetector.h"
@@ -80,6 +81,7 @@ class KyraMetaEngine : public AdvancedMetaEngine {
virtual int getMaximumSaveSlot() const;
void removeSaveState(const char *target, int slot) const;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
};
bool KyraMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -245,6 +247,97 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s
return desc;
}
+const ExtraGuiOptions KyraMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ static const ExtraGuiOption optionsList[] = {
+ // Kyrandia 3 options
+ // Studio audience adds an applause and cheering sounds whenever
+ // Malcolm makes a joke.
+ {
+ _s("Studio audience"),
+ _s("Enable studio audience"),
+ "studio_audience",
+ true
+ },
+ // When enabled, this option allows the user to skip text and cutscenes.
+ {
+ _s("Skip support"),
+ _s("Allow text and cutscenes to be skipped"),
+ "skip_support",
+ true
+ },
+ // Helium mode makes Malcolm sound like he's inhaled Helium.
+ {
+ _s("Helium mode"),
+ _s("Enable helium mode"),
+ "helium_mode",
+ false
+ },
+#ifdef ENABLE_LOL
+ // LoL options
+ // When enabled, this option makes scrolling smoother when changing
+ // from one screen to another.
+ {
+ _s("Smooth scrolling"),
+ _s("Enable smooth scrolling when walking"),
+ "smooth_scrolling",
+ true
+ },
+ // When enabled, this option changes the cursor when it floats to the
+ // edge of the screen to a directional arrow. The player can then click
+ // to walk towards that direction.
+ {
+ _s("Floating cursors"),
+ _s("Enable floating cursors"),
+ "floating_cursors",
+ false
+ },
+#endif
+#ifdef ENABLE_EOB
+ // EOB options
+ {
+ _s("HP bar graphs"),
+ _s("Enable hit point bar graphs"),
+ "hpbargraphs",
+ true
+ },
+#endif
+ { 0, 0, 0, 0 }
+ };
+
+ Common::String gameId = ConfMan.getDomain(target)->getVal("gameid");
+ ExtraGuiOptions returnList;
+ uint i = 0;
+ while (optionsList[i].configOption) {
+ Common::String curOption = optionsList[i].configOption;
+ // Only add game specific options to the games that apply
+ if (curOption == "studio_audience" || curOption == "skip_support" || curOption == "helium_mode") {
+ if (!gameId.equalsIgnoreCase("kyra3")) {
+ i++;
+ continue;
+ }
+ }
+#ifdef ENABLE_LOL
+ if (curOption == "smooth_scrolling" || curOption == "floating_cursors") {
+ if (!gameId.equalsIgnoreCase("lol")) {
+ i++;
+ continue;
+ }
+ }
+#endif
+#ifdef ENABLE_EOB
+ if (curOption == "hpbargraphs") {
+ if (!!gameId.equalsIgnoreCase("eob")) {
+ i++;
+ continue;
+ }
+ }
+#endif
+ returnList.push_back(optionsList[i++]);
+ }
+
+ return returnList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(KYRA)
REGISTER_PLUGIN_DYNAMIC(KYRA, PLUGIN_TYPE_ENGINE, KyraMetaEngine);
#else
View
@@ -24,6 +24,7 @@
#include "common/scummsys.h"
#include "common/error.h"
+#include "common/array.h"
#include "engines/game.h"
#include "engines/savestate.h"
@@ -39,6 +40,19 @@ class String;
}
/**
+ * Per-game extra GUI options structure.
+ * Currently, this can only be used for options with checkboxes.
+ */
+struct ExtraGuiOption {
+ const char *label; // option label, e.g. "Fullscreen mode"
+ const char *tooltip; // option tooltip (when the mouse hovers above it)
+ const char *configOption; // confMan key, e.g. "fullscreen"
+ bool defaultState; // the detault state of the checkbox (checked or not)
+};
+
+typedef Common::Array<ExtraGuiOption> ExtraGuiOptions;
+
+/**
* A meta engine is essentially a factory for Engine instances with the
* added ability of listing and detecting supported games.
* Every engine "plugin" provides a hook to get an instance of a MetaEngine
@@ -98,6 +112,16 @@ class MetaEngine : public PluginObject {
}
/**
+ * Return a list of extra GUI options.
+ * Currently, this only supports options with checkboxes.
+ *
+ * The default implementation returns an empty list.
+ */
+ virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const {
+ return ExtraGuiOptions();
+ }
+
+ /**
* Return the maximum save slot that the engine supports.
*
* @note MetaEngines must indicate that this function has been implemented
@@ -30,6 +30,7 @@
#include "common/system.h"
#include "common/events.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "engines/util.h"
@@ -65,6 +66,7 @@ class QueenMetaEngine : public MetaEngine {
virtual GameList detectGames(const Common::FSList &fslist) const;
virtual SaveStateList listSaves(const char *target) const;
virtual void removeSaveState(const char *target, int slot) const;
+ const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
};
@@ -181,6 +183,38 @@ Common::Error QueenMetaEngine::createInstance(OSystem *syst, Engine **engine) co
return Common::kNoError;
}
+const ExtraGuiOptions QueenMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+ static const ExtraGuiOption optionsList[] = {
+ {
+ _s("Show alternative intro"),
+ _s("Show the intro of the floppy version in the CD version"),
+ "alt_intro",
+ false
+ },
+ { 0, 0, 0, 0 }
+ };
+
+ Common::String guiOptions;
+ if (ConfMan.hasKey("guioptions", target)) {
+ guiOptions = ConfMan.get("guioptions", target);
+ guiOptions = parseGameGUIOptions(guiOptions);
+ }
+
+ ExtraGuiOptions returnList;
+ uint i = 0;
+ while (optionsList[i].configOption) {
+ Common::String curOption = optionsList[i].configOption;
+ // Only add game specific options to the games that apply
+ if (curOption == "alt_intro" && guiOptions.contains(GUIO_NOSPEECH)) {
+ i++;
+ continue;
+ }
+ returnList.push_back(optionsList[i++]);
+ }
+
+ return returnList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(QUEEN)
REGISTER_PLUGIN_DYNAMIC(QUEEN, PLUGIN_TYPE_ENGINE, QueenMetaEngine);
#else
Oops, something went wrong. Retry.