diff options
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 28 | ||||
-rw-r--r-- | engines/wintermute/base/base_game.h | 2 |
2 files changed, 25 insertions, 5 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index d2cf7d12da..0f0d928285 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -1276,11 +1276,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->correctParams(2); const char *key = stack->pop()->getString(); const char *initVal = stack->pop()->getString(); - Common::String privKey = "wme_" + StringUtil::encodeSetting(key); - Common::String result = initVal; - if (ConfMan.hasKey(privKey)) { - result = StringUtil::decodeSetting(ConfMan.get(key)); - } + Common::String result = readRegistryString(key, initVal); stack->pushString(result.c_str()); return STATUS_OK; } @@ -3902,4 +3898,26 @@ char *BaseGame::getKeyFromStringTable(const char *str) const { return _settings->getKeyFromStringTable(str); } +Common::String BaseGame::readRegistryString(const Common::String &key, const Common::String &initValue) const { + // Game specific hacks: + Common::String result = initValue; + // James Peris: + if (BaseEngine::instance().getGameId() == "jamesperis" && key == "Language") { + Common::Language language = BaseEngine::instance().getLanguage(); + if (language == Common::EN_ANY) { + result = "english"; + } else if (language == Common::ES_ESP) { + result = "spanish"; + } else { + error("Invalid language set for James Peris"); + } + } else { // Just fallback to using ConfMan for now + Common::String privKey = "wme_" + StringUtil::encodeSetting(key); + if (ConfMan.hasKey(privKey)) { + result = StringUtil::decodeSetting(ConfMan.get(key)); + } + } + return result; +} + } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index 1943024db8..f635339286 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -343,6 +343,8 @@ private: bool isDoubleClick(int32 buttonIndex); uint32 _usedMem; +// TODO: This should be expanded into a proper class eventually: + Common::String readRegistryString(const Common::String &key, const Common::String &initValue) const; protected: |