diff options
author | Eugene Sandulenko | 2009-12-31 18:52:42 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2009-12-31 18:52:42 +0000 |
commit | d10fc79836c03647c5332475a5a43ccf489fc7c3 (patch) | |
tree | 2090e5b8b95c2f1955d9124d2214b13d9d2f1985 | |
parent | 6d879f15b7d30b623ebf66ff79e801f6ad5a017c (diff) | |
download | scummvm-rg350-d10fc79836c03647c5332475a5a43ccf489fc7c3.tar.gz scummvm-rg350-d10fc79836c03647c5332475a5a43ccf489fc7c3.tar.bz2 scummvm-rg350-d10fc79836c03647c5332475a5a43ccf489fc7c3.zip |
Add support for Chinese translated games.
svn-id: r46805
-rw-r--r-- | common/util.cpp | 1 | ||||
-rw-r--r-- | common/util.h | 1 | ||||
-rw-r--r-- | engines/scumm/charset.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 18 |
4 files changed, 35 insertions, 4 deletions
diff --git a/common/util.cpp b/common/util.cpp index da6e41544f..a0399315d8 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -181,6 +181,7 @@ uint RandomSource::getRandomNumberRng(uint min, uint max) { const LanguageDescription g_languages[] = { + {"zh-cn", "Chinese (China)", ZH_CNA}, {"zh", "Chinese (Taiwan)", ZH_TWN}, {"cz", "Czech", CZ_CZE}, {"nl", "Dutch", NL_NLD}, diff --git a/common/util.h b/common/util.h index 93ce2f2989..8e7b2555d1 100644 --- a/common/util.h +++ b/common/util.h @@ -154,6 +154,7 @@ public: * List of game language. */ enum Language { + ZH_CNA, ZH_TWN, CZ_CZE, NL_NLD, diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index a8f780ac49..f4e2f74c43 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -94,7 +94,8 @@ void ScummEngine::loadCJKFont() { _2byteFontPtr = new byte[_2byteWidth * _2byteHeight * numChar / 8]; // set byte 0 to 0xFF (0x00 when loaded) to indicate that the font was not loaded _2byteFontPtr[0] = 0xFF; - } else if (_game.version >= 7 && (_language == Common::KO_KOR || _language == Common::JA_JPN || _language == Common::ZH_TWN)) { + } else if ((_game.version >= 7 && (_language == Common::KO_KOR || _language == Common::JA_JPN || _language == Common::ZH_TWN)) || + (_game.version >= 3 && _language == Common::ZH_CNA)) { int numChar = 0; const char *fontFile = NULL; @@ -113,6 +114,14 @@ void ScummEngine::loadCJKFont() { numChar = 13630; } break; + case Common::ZH_CNA: + if (_game.id == GID_FT || _game.id == GID_LOOM || _game.id == GID_INDY3 || + _game.id == GID_INDY4 || _game.id == GID_MONKEY || _game.id == GID_MONKEY2 || + _game.id == GID_TENTACLE) { + fontFile = "chinese_gb16x12.fnt"; + numChar = 8178; + } + break; default: break; } @@ -138,6 +147,11 @@ void ScummEngine::loadCJKFont() { _2byteHeight = 15; _newLineCharacter = 0x21; break; + case Common::ZH_CNA: + _2byteWidth = 12; + _2byteHeight = 12; + _newLineCharacter = 0x21; + break; default: break; } @@ -356,6 +370,9 @@ byte *ScummEngine::get2byteCharPtr(int idx) { return _2byteFontPtr + base; break; } + case Common::ZH_CNA: + idx = ((idx % 256) - 0xa1)* 94 + ((idx / 256) - 0xa1); + break; default: idx = 0; } diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index c23d8a5529..a32c0892a7 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -210,7 +210,17 @@ static bool searchFSNode(const Common::FSList &fslist, const Common::String &nam // The following function tries to detect the language for COMI and DIG static Common::Language detectLanguage(const Common::FSList &fslist, byte id) { - assert(id == GID_CMI || id == GID_DIG); + // First try to detect Chinese translation + Common::FSNode fontFile; + + if (searchFSNode(fslist, "chinese_gb16x12.fnt", fontFile)) { + debug(0, "Chinese detected"); + return Common::ZH_CNA; + } + + // Now try to detect COMI and Dig by language files + if (id != GID_CMI && id != GID_DIG) + return Common::UNK_LANG; // Check for LANGUAGE.BND (Dig) resp. LANGUAGE.TAB (CMI). // These are usually inside the "RESOURCE" subdirectory. @@ -314,8 +324,8 @@ static void computeGameSettingsFromMD5(const Common::FSList &fslist, const GameF dr.game.features |= GF_DEMO; } - // HACK: Detect COMI & Dig languages - if (dr.language == UNK_LANG && (dr.game.id == GID_CMI || dr.game.id == GID_DIG)) { + // HACK: Try to detect languages for translated games + if (dr.language == UNK_LANG) { dr.language = detectLanguage(fslist, dr.game.id); } break; @@ -442,6 +452,8 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul continue; } + // HACK: Perhaps it is some modified translation? + dr.language = detectLanguage(fslist, g->id); // Add the game/variant to the candidates list if it is consistent // with the file(s) we are seeing. |