Add support for Chinese translated games.
svn-id: r46805
This commit is contained in:
parent
6d879f15b7
commit
d10fc79836
4 changed files with 35 additions and 4 deletions
|
@ -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},
|
||||
|
|
|
@ -154,6 +154,7 @@ public:
|
|||
* List of game language.
|
||||
*/
|
||||
enum Language {
|
||||
ZH_CNA,
|
||||
ZH_TWN,
|
||||
CZ_CZE,
|
||||
NL_NLD,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue