From d10fc79836c03647c5332475a5a43ccf489fc7c3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 31 Dec 2009 18:52:42 +0000 Subject: Add support for Chinese translated games. svn-id: r46805 --- engines/scumm/charset.cpp | 19 ++++++++++++++++++- engines/scumm/detection.cpp | 18 +++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'engines/scumm') 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::Listid); // Add the game/variant to the candidates list if it is consistent // with the file(s) we are seeing. -- cgit v1.2.3