diff options
author | Eugene Sandulenko | 2006-04-25 14:59:42 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-04-25 14:59:42 +0000 |
commit | 58462fa682fc0c6a408cacd5879491503ddff812 (patch) | |
tree | 4d27fa49a91d25ee8fe1cdb96434ca49bd604648 /gui/theme-config.cpp | |
parent | 869622cf005e7989ae6ad8b95acbefac9ada436e (diff) | |
download | scummvm-rg350-58462fa682fc0c6a408cacd5879491503ddff812.tar.gz scummvm-rg350-58462fa682fc0c6a408cacd5879491503ddff812.tar.bz2 scummvm-rg350-58462fa682fc0c6a408cacd5879491503ddff812.zip |
- minor cleanup in modern.ini
- implement skipFor theme section keyword
svn-id: r22151
Diffstat (limited to 'gui/theme-config.cpp')
-rw-r--r-- | gui/theme-config.cpp | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index 12e8090ce0..708a84ba09 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -517,6 +517,58 @@ bool Theme::isThemeLoadingRequired() { return true; } +bool Theme::sectionIsSkipped(Common::ConfigFile &config, const char *name, int w, int h) { + if (!config.hasKey("skipFor", name)) + return false; + + String res; + + config.getKey("skipFor", name, res); + + int x, y; + int phase = 0; + const char *ptr = res.c_str(); + + x = y = 0; + + while (ptr && phase != 2) { + switch (phase) { + case 0: + if (*ptr >= '0' && *ptr <= '9') { + x = x * 10 + *ptr - '0'; + } else if (*ptr == 'X') { + phase = 1; + } else if (*ptr == 'x') { + phase = 1; + } else { + error("Syntax error. Wrong resolution in skipFor in section %s", name); + } + break; + case 1: + if (*ptr >= '0' && *ptr <= '9') { + x = x * 10 + *ptr - '0'; + } else if (*ptr == 'Y') { + phase = 2; + } else { + error("Syntax error. Wrong resolution in skipFor in section %s", name); + } + break; + default: + break; + } + + ptr++; + } + + if (x != w && x) + return false; + + if (y != h && y) + return false; + + return true; +} + void Theme::loadTheme(Common::ConfigFile &config, bool reset) { char name[80]; int x = g_system->getOverlayWidth(), y = g_system->getOverlayHeight(); @@ -525,19 +577,19 @@ void Theme::loadTheme(Common::ConfigFile &config, bool reset) { _evaluator->reset(); strcpy(name, "XxY"); - if (config.hasSection(name)) + if (config.hasSection(name) && !sectionIsSkipped(config, "XxY", x, y)) processResSection(config, name); sprintf(name, "%dxY", x); - if (config.hasSection(name)) + if (config.hasSection(name) && !sectionIsSkipped(config, name, x, y)) processResSection(config, name); sprintf(name, "Xx%d", y); - if (config.hasSection(name)) + if (config.hasSection(name) && !sectionIsSkipped(config, name, x, y)) processResSection(config, name); sprintf(name, "%dx%d", x, y); - if (config.hasSection(name)) + if (config.hasSection(name) && !sectionIsSkipped(config, name, x, y)) processResSection(config, name); debug(3, "Number of variables: %d", _evaluator->getNumVars()); |