Patch #2923628: "SOMI: Kanji support for japanese MegaCD version"

svn-id: r46771
This commit is contained in:
Eugene Sandulenko 2009-12-30 20:51:49 +00:00
parent ce88f5fb01
commit b0b3c6c836

View File

@ -84,6 +84,16 @@ void ScummEngine::loadCJKFont() {
fp.read(_2byteFontPtr, _2byteWidth * _2byteHeight * numChar / 8);
fp.close();
}
} else if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD && _language == Common::JA_JPN) {
int numChar = 1413;
_2byteWidth = 16;
_2byteHeight = 16;
_useCJKMode = true;
_newLineCharacter = 0x5F;
// charset resources are not inited yet, load charset later
_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)) {
int numChar = 0;
const char *fontFile = NULL;
@ -292,6 +302,18 @@ byte *ScummEngine::get2byteCharPtr(int idx) {
if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) {
idx = SJIStoPCEChunk((idx % 256), (idx / 256));
return _2byteFontPtr + (_2byteWidth * _2byteHeight / 8) * idx;
} else if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD && _language == Common::JA_JPN) {
// init pointer to charset resource
if (_2byteFontPtr[0] == 0xFF) {
int charsetId = 5;
int numChar = 1413;
byte *charsetPtr = getResourceAddress(rtCharset, charsetId);
if (charsetPtr == 0)
error("ScummEngine::get2byteCharPtr: charset %d not found", charsetId);
memcpy(_2byteFontPtr, charsetPtr + 46, _2byteWidth * _2byteHeight * numChar / 8);
}
idx = ((idx & 0x7F) << 8) | ((idx >> 8) & 0xFF) - 1;
} else {
idx = SJIStoFMTChunk((idx % 256), (idx / 256));
}