diff options
author | athrxx | 2012-02-19 16:26:09 +0100 |
---|---|---|
committer | athrxx | 2012-02-21 21:48:35 +0100 |
commit | d9c05f7121f6d3cdd800f295c2ec33783babdee2 (patch) | |
tree | af93a7035900cb7c39d4bdd064dcc1cd008a9173 | |
parent | 9f19bace4491753235051bc2f4f4037b79b5c9ac (diff) | |
download | scummvm-rg350-d9c05f7121f6d3cdd800f295c2ec33783babdee2.tar.gz scummvm-rg350-d9c05f7121f6d3cdd800f295c2ec33783babdee2.tar.bz2 scummvm-rg350-d9c05f7121f6d3cdd800f295c2ec33783babdee2.zip |
COMMON: add gui options for rendering modes
The purpose is the same as for the sound gui options: users shouldn't be offered modes that the engine doesn't support.
-rw-r--r-- | common/util.cpp | 12 | ||||
-rw-r--r-- | common/util.h | 23 | ||||
-rw-r--r-- | gui/options.cpp | 35 | ||||
-rw-r--r-- | gui/options.h | 2 |
4 files changed, 64 insertions, 8 deletions
diff --git a/common/util.cpp b/common/util.cpp index 3f97308d8e..05d29fac94 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -286,7 +286,10 @@ const RenderModeDescription g_renderModes[] = { { "hercAmber", _s("Hercules Amber"), kRenderHercA }, { "cga", "CGA", kRenderCGA }, { "ega", "EGA", kRenderEGA }, + { "vga", "VGA", kRenderVGA }, { "amiga", "Amiga", kRenderAmiga }, + { "fmtowns", "FM-Towns", kRenderFMTowns }, + { "pc98", "PC-98", kRenderPC98 }, {0, 0, kRenderDefault} }; @@ -351,6 +354,15 @@ const struct GameOpt { { GUIO_NOASPECT, "noAspect" }, { GUIO_EGAUNDITHER, "egaUndither" }, + { GUIO_RENDERHERCGREEN, "hercGreen" }, + { GUIO_RENDERHERCAMBER, "hercAmber" }, + { GUIO_RENDERCGA, "cga" }, + { GUIO_RENDEREGA, "ega" }, + { GUIO_RENDERVGA, "vga" }, + { GUIO_RENDERAMIGA, "amiga" }, + { GUIO_RENDERFMTOWNS, "fmtowns" }, + { GUIO_RENDERPC98, "pc98" }, + { GUIO_NONE, 0 } }; diff --git a/common/util.h b/common/util.h index 617bc3dcfa..b6f63702d4 100644 --- a/common/util.h +++ b/common/util.h @@ -101,12 +101,22 @@ template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; } #define GUIO_NOASPECT "\022" #define GUIO_EGAUNDITHER "\023" +#define GUIO_RENDERHERCGREEN "\030" +#define GUIO_RENDERHERCAMBER "\031" +#define GUIO_RENDERCGA "\032" +#define GUIO_RENDEREGA "\033" +#define GUIO_RENDERVGA "\034" +#define GUIO_RENDERAMIGA "\035" +#define GUIO_RENDERFMTOWNS "\036" +#define GUIO_RENDERPC98 "\037" + #define GUIO0() (GUIO_NONE) #define GUIO1(a) (a) #define GUIO2(a,b) (a b) #define GUIO3(a,b,c) (a b c) #define GUIO4(a,b,c,d) (a b c d) #define GUIO5(a,b,c,d,e) (a b c d e) +#define GUIO6(a,b,c,d,e,f) (a b c d e f) namespace Common { @@ -299,11 +309,14 @@ extern const char *getPlatformDescription(Platform id); */ enum RenderMode { kRenderDefault = 0, - kRenderEGA = 1, - kRenderCGA = 2, - kRenderHercG = 3, - kRenderHercA = 4, - kRenderAmiga = 5 + kRenderVGA = 1, + kRenderEGA = 2, + kRenderCGA = 3, + kRenderHercG = 4, + kRenderHercA = 5, + kRenderAmiga = 6, + kRenderFMTowns = 7, + kRenderPC98 = 8 }; struct RenderModeDescription { diff --git a/gui/options.cpp b/gui/options.cpp index 4fa5a821fb..bfad81c07b 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -191,9 +191,9 @@ void OptionsDialog::open() { int sel = 0; for (int i = 0; p->code; ++p, ++i) { if (renderMode == p->id) - sel = i + 2; + sel = p->id; } - _renderModePopUp->setSelected(sel); + _renderModePopUp->setSelectedTag(sel); } #ifdef SMALL_SCREEN_DEVICE @@ -748,13 +748,18 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr } // RenderMode popup + const Common::String allFlags = renderType2GUIO((uint32)-1); + bool renderingTypeDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != NULL); + _renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"), _("Special dithering modes supported by some games")); _renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", _("Special dithering modes supported by some games")); _renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault); _renderModePopUp->appendEntry(""); const Common::RenderModeDescription *rm = Common::g_renderModes; for (; rm->code; ++rm) { - _renderModePopUp->appendEntry(_c(rm->description, context), rm->id); + Common::String renderGuiOption = renderType2GUIO(rm->id); + if ((_domain == Common::ConfigManager::kApplicationDomain) || (_domain != Common::ConfigManager::kApplicationDomain && !renderingTypeDefined) || (_guioptions.contains(renderGuiOption))) + _renderModePopUp->appendEntry(_c(rm->description, context), rm->id); } // Fullscreen checkbox @@ -1033,6 +1038,30 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se ConfMan.removeKey(setting, _domain); } +Common::String OptionsDialog::renderType2GUIO(uint32 renderType) { + static const struct { + Common::RenderMode type; + const char *guio; + } renderGUIOMapping[] = { + { Common::kRenderHercG, GUIO_RENDERHERCGREEN }, + { Common::kRenderHercA, GUIO_RENDERHERCAMBER }, + { Common::kRenderCGA, GUIO_RENDERCGA }, + { Common::kRenderEGA, GUIO_RENDEREGA }, + { Common::kRenderVGA, GUIO_RENDERVGA }, + { Common::kRenderAmiga, GUIO_RENDERAMIGA }, + { Common::kRenderFMTowns, GUIO_RENDERFMTOWNS }, + { Common::kRenderPC98, GUIO_RENDERPC98 } + }; + Common::String res; + + for (int i = 0; i < ARRAYSIZE(renderGUIOMapping); i++) { + if (renderType == renderGUIOMapping[i].type || renderType == (uint32)-1) + res += renderGUIOMapping[i].guio; + } + + return res; +} + int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { if (_guioptions.contains(GUIO_NOSUBTITLES)) return kSubtitlesSpeech; // Speech only diff --git a/gui/options.h b/gui/options.h index 92ce3e5df4..4e0187f50f 100644 --- a/gui/options.h +++ b/gui/options.h @@ -85,6 +85,8 @@ protected: bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicType preferredType = MT_AUTO); void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting); + Common::String renderType2GUIO(uint32 renderType); + TabWidget *_tabWidget; int _graphicsTabId; |