[Scummvm-cvs-logs] SF.net SVN: scummvm:[46805] scummvm/trunk
sev at users.sourceforge.net
sev at users.sourceforge.net
Thu Dec 31 19:52:43 CET 2009
Revision: 46805
http://scummvm.svn.sourceforge.net/scummvm/?rev=46805&view=rev
Author: sev
Date: 2009-12-31 18:52:42 +0000 (Thu, 31 Dec 2009)
Log Message:
-----------
Add support for Chinese translated games.
Modified Paths:
--------------
scummvm/trunk/common/util.cpp
scummvm/trunk/common/util.h
scummvm/trunk/engines/scumm/charset.cpp
scummvm/trunk/engines/scumm/detection.cpp
Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp 2009-12-31 18:25:35 UTC (rev 46804)
+++ scummvm/trunk/common/util.cpp 2009-12-31 18:52:42 UTC (rev 46805)
@@ -181,6 +181,7 @@
const LanguageDescription g_languages[] = {
+ {"zh-cn", "Chinese (China)", ZH_CNA},
{"zh", "Chinese (Taiwan)", ZH_TWN},
{"cz", "Czech", CZ_CZE},
{"nl", "Dutch", NL_NLD},
Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h 2009-12-31 18:25:35 UTC (rev 46804)
+++ scummvm/trunk/common/util.h 2009-12-31 18:52:42 UTC (rev 46805)
@@ -154,6 +154,7 @@
* List of game language.
*/
enum Language {
+ ZH_CNA,
ZH_TWN,
CZ_CZE,
NL_NLD,
Modified: scummvm/trunk/engines/scumm/charset.cpp
===================================================================
--- scummvm/trunk/engines/scumm/charset.cpp 2009-12-31 18:25:35 UTC (rev 46804)
+++ scummvm/trunk/engines/scumm/charset.cpp 2009-12-31 18:52:42 UTC (rev 46805)
@@ -94,7 +94,8 @@
_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 @@
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 @@
_2byteHeight = 15;
_newLineCharacter = 0x21;
break;
+ case Common::ZH_CNA:
+ _2byteWidth = 12;
+ _2byteHeight = 12;
+ _newLineCharacter = 0x21;
+ break;
default:
break;
}
@@ -356,6 +370,9 @@
return _2byteFontPtr + base;
break;
}
+ case Common::ZH_CNA:
+ idx = ((idx % 256) - 0xa1)* 94 + ((idx / 256) - 0xa1);
+ break;
default:
idx = 0;
}
Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp 2009-12-31 18:25:35 UTC (rev 46804)
+++ scummvm/trunk/engines/scumm/detection.cpp 2009-12-31 18:52:42 UTC (rev 46805)
@@ -210,8 +210,18 @@
// 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.
// If found, we match based on the file size (should we
@@ -314,8 +324,8 @@
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 @@
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.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list