RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.119
diff -u -r2.119 charset.cpp
|
|
|
23 | 23 | #include "scumm/scumm.h" |
24 | 24 | #include "scumm/nut_renderer.h" |
25 | 25 | |
| 26 | #include "scumm/cjkcode.h" |
| 27 | |
26 | 28 | namespace Scumm { |
27 | 29 | |
28 | 30 | void ScummEngine::loadCJKFont() { |
29 | 31 | _useCJKMode = false; |
30 | | if ((_gameId == GID_DIG || _gameId == GID_CMI) && (_language == Common::KO_KOR || _language == Common::JA_JPN || _language == Common::ZH_TWN)) { |
| 32 | if (_language == Common::JA_JPN && _version <= 5) { // FM-TOWNS v3 / v5 Kanji |
31 | 33 | File fp; |
| 34 | int numChar = 256 * 32; |
| 35 | _2byteWidth = 16; |
| 36 | _2byteHeight = 16; |
| 37 | // use FM-TOWNS font rom, since game files don't have kanji font resources |
| 38 | if (fp.open("fmt_fnt.rom", File::kFileReadMode, getGameDataPath()) |
| 39 | || fp.open("fmt_fnt.rom", File::kFileReadMode, "./")) { |
| 40 | _useCJKMode = true; |
| 41 | debug(2, "Loading FM-TOWNS Kanji rom"); |
| 42 | _2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar]; |
| 43 | fp.read(_2byteFontPtr, ((_2byteWidth + 7) / 8) * _2byteHeight * numChar); |
| 44 | fp.close(); |
| 45 | } |
| 46 | } else if (_language == Common::KO_KOR || _language == Common::JA_JPN || _language == Common::ZH_TWN) { |
| 47 | File fp; |
| 48 | int numChar = 0; |
32 | 49 | const char *fontFile = NULL; |
| 50 | |
33 | 51 | switch(_language) { |
34 | 52 | case Common::KO_KOR: |
35 | 53 | fontFile = "korean.fnt"; |
| 54 | numChar = 2350; |
36 | 55 | break; |
37 | 56 | case Common::JA_JPN: |
38 | 57 | fontFile = (_gameId == GID_DIG) ? "kanji16.fnt" : "japanese.fnt"; |
| 58 | numChar = 1024; //FIXME |
39 | 59 | break; |
40 | 60 | case Common::ZH_TWN: |
41 | 61 | if (_gameId == GID_CMI) { |
42 | 62 | fontFile = "chinese.fnt"; |
| 63 | numChar = 1; //FIXME |
43 | 64 | } |
44 | 65 | break; |
45 | 66 | default: |
46 | 67 | break; |
47 | 68 | } |
48 | | if (fontFile && fp.open(fontFile)) { |
| 69 | |
| 70 | char pathS[1024]; |
| 71 | char pathV[1024]; |
| 72 | sprintf(pathS, "%sresource/", getGameDataPath()); |
| 73 | sprintf(pathV, "%svideo/", getGameDataPath()); |
| 74 | if (fontFile && (fp.open(fontFile, File::kFileReadMode, getGameDataPath()) |
| 75 | || fp.open(fontFile, File::kFileReadMode, pathS) |
| 76 | || fp.open(fontFile, File::kFileReadMode, pathV))) { |
49 | 77 | debug(2, "Loading CJK Font"); |
50 | 78 | _useCJKMode = true; |
51 | 79 | fp.seek(2, SEEK_CUR); |
52 | 80 | _2byteWidth = fp.readByte(); |
53 | 81 | _2byteHeight = fp.readByte(); |
54 | 82 | |
55 | | int numChar = 0; |
56 | | switch(_language) { |
57 | | case Common::KO_KOR: |
58 | | numChar = 2350; |
59 | | break; |
60 | | case Common::JA_JPN: |
61 | | numChar = (_gameId == GID_DIG) ? 1024 : 2048; //FIXME |
62 | | break; |
63 | | case Common::ZH_TWN: |
64 | | numChar = 1; //FIXME |
65 | | break; |
66 | | default: |
67 | | break; |
68 | | } |
69 | | _2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar]; |
70 | | fp.read(_2byteFontPtr, ((_2byteWidth + 7) / 8) * _2byteHeight * numChar); |
71 | | fp.close(); |
72 | | } |
73 | | } else if (_language == Common::JA_JPN && _version == 5) { // FM-TOWNS Kanji |
74 | | File fp; |
75 | | int numChar = 256 * 32; |
76 | | _2byteWidth = 16; |
77 | | _2byteHeight = 16; |
78 | | // use FM-TOWNS font rom, since game files don't have kanji font resources |
79 | | if (fp.open("fmt_fnt.rom")) { |
80 | | _useCJKMode = true; |
81 | | debug(2, "Loading FM-TOWNS Kanji rom"); |
82 | 83 | _2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar]; |
83 | 84 | fp.read(_2byteFontPtr, ((_2byteWidth + 7) / 8) * _2byteHeight * numChar); |
84 | 85 | fp.close(); |
| 86 | } else { |
| 87 | warning("Couldn't load any font"); |
85 | 88 | } |
86 | 89 | } |
87 | 90 | } |
88 | 91 | |
89 | | static int SJIStoFMTChunk(int f, int s) //convert sjis code to fmt font offset |
| 92 | static int SJIStoFMTChunk(int f, int s) //converts sjis code to fmt font offset |
90 | 93 | { |
91 | 94 | enum { |
92 | 95 | KANA = 0, |
93 | 96 | KANJI = 1, |
94 | 97 | EKANJI = 2 |
95 | 98 | }; |
96 | | int base = s - (s % 32) - 1; |
97 | | int c = 0, p = 0, chunk_f = 0, chunk = 0, cr, kanjiType = KANA; |
| 99 | int base = s - ((s + 1) % 32); |
| 100 | int c = 0, p = 0, chunk_f = 0, chunk = 0, cr = 0, kanjiType = KANA; |
98 | 101 | |
99 | 102 | if (f >= 0x81 && f <= 0x84) kanjiType = KANA; |
100 | 103 | if (f >= 0x88 && f <= 0x9f) kanjiType = KANJI; |
… |
… |
|
115 | 118 | chunk_f = c + 2 * p; |
116 | 119 | } |
117 | 120 | |
| 121 | // Base corrections |
118 | 122 | if (base == 0x7f && s == 0x7f) |
119 | | base -= 0x20; //correction |
120 | | if ((base == 0x7f && s == 0x9e) || (base == 0x9f && s == 0xbe) || (base == 0xbf && s == 0xde)) |
121 | | base += 0x20; //correction |
| 123 | base -= 0x20; |
| 124 | if (base == 0x9f && s == 0xbe) |
| 125 | base += 0x20; |
| 126 | if (base == 0xbf && s == 0xde) |
| 127 | base += 0x20; |
| 128 | //if (base == 0x7f && s == 0x9e) |
| 129 | // base += 0x20; |
122 | 130 | |
123 | 131 | switch(base) { |
124 | 132 | case 0x3f: |
… |
… |
|
158 | 166 | else if (kanjiType == EKANJI) chunk = 144; |
159 | 167 | break; |
160 | 168 | default: |
| 169 | warning("Invaild Char! f %x s %x base %x c %d p %d", f, s, base, c, p); |
161 | 170 | return 0; |
162 | 171 | } |
163 | 172 | |
| 173 | debug(6, "Kanji: %c%c f 0x%x s 0x%x base 0x%x c %d p %d chunk %d cr %d index %d", f, s, f, s, base, c, p, chunk, cr, ((chunk_f + chunk) * 32 + (s - base)) + cr); |
164 | 174 | return ((chunk_f + chunk) * 32 + (s - base)) + cr; |
165 | 175 | } |
166 | 176 | |
… |
… |
|
238 | 248 | _fontPtr += _numChars; |
239 | 249 | } |
240 | 250 | |
| 251 | int CharsetRendererCommon::getFontHeight() { |
| 252 | if(_vm->_useCJKMode) |
| 253 | return MAX(_vm->_2byteHeight + 1, (int)_fontPtr[1]); |
| 254 | else |
| 255 | return _fontPtr[1]; |
| 256 | } |
| 257 | |
| 258 | int CharsetRendererV3::getFontHeight() { |
| 259 | if(_vm->_useCJKMode) |
| 260 | return MAX(_vm->_2byteHeight + 1, 8); |
| 261 | else |
| 262 | return 8; |
| 263 | } |
| 264 | |
241 | 265 | // do spacing for variable width old-style font |
242 | 266 | int CharsetRendererClassic::getCharWidth(byte chr) { |
243 | | if (chr >= 0x80 && _vm->_useCJKMode) |
244 | | return 6; |
| 267 | if (chr >= 0x80 && _vm->_useCJKMode) |
| 268 | return _vm->_2byteWidth / 2; |
245 | 269 | int spacing = 0; |
246 | 270 | |
247 | 271 | int offs = READ_LE_UINT32(_fontPtr + chr * 4 + 4); |
… |
… |
|
276 | 300 | if (chr == 0xD) |
277 | 301 | break; |
278 | 302 | if (chr == 254 || chr == 255) { |
| 303 | //process in LE |
| 304 | if(chr == 254 && checkKSCode(text[pos], chr) && _vm->_useCJKMode) { |
| 305 | goto loc_avoid_ks_fe; |
| 306 | } |
279 | 307 | chr = text[pos++]; |
280 | 308 | if (chr == 3) // 'WAIT' |
281 | 309 | break; |
… |
… |
|
299 | 327 | continue; |
300 | 328 | } |
301 | 329 | } |
302 | | width += getCharWidth(chr); |
| 330 | loc_avoid_ks_fe: |
| 331 | if ((chr & 0x80) && _vm->_useCJKMode) { |
| 332 | pos++; |
| 333 | width += _vm->_2byteWidth; |
| 334 | } else { |
| 335 | width += getCharWidth(chr); |
| 336 | } |
303 | 337 | } |
304 | 338 | |
305 | 339 | setCurID(oldID); |
… |
… |
|
333 | 367 | } else if (chr == '@') |
334 | 368 | continue; |
335 | 369 | if (chr == 254 || chr == 255) { |
| 370 | //process in LE |
| 371 | if(chr == 254 && checkKSCode(str[pos], chr) && _vm->_useCJKMode) { |
| 372 | goto loc_avoid_ks_fe; |
| 373 | } |
336 | 374 | chr = str[pos++]; |
337 | 375 | if (chr == 3) // 'Wait' |
338 | 376 | break; |
… |
… |
|
366 | 404 | if (chr == ' ') |
367 | 405 | lastspace = pos - 1; |
368 | 406 | |
369 | | curw += getCharWidth(chr); |
| 407 | loc_avoid_ks_fe: |
| 408 | if ((chr & 0x80) && _vm->_useCJKMode) { |
| 409 | pos++; |
| 410 | curw += _vm->_2byteWidth; |
| 411 | } else { |
| 412 | curw += getCharWidth(chr); |
| 413 | } |
370 | 414 | if (lastspace == -1) |
371 | 415 | continue; |
372 | 416 | if (curw > maxwidth) { |
… |
… |
|
1105 | 1149 | } |
1106 | 1150 | |
1107 | 1151 | int CharsetRendererV3::getCharWidth(byte chr) { |
| 1152 | if (chr & 0x80 && _vm->_useCJKMode) |
| 1153 | return _vm->_2byteWidth / 2; |
1108 | 1154 | int spacing = 0; |
1109 | 1155 | |
1110 | 1156 | spacing = *(_widthTable + chr); |
… |
… |
|
1129 | 1175 | |
1130 | 1176 | void CharsetRendererV3::printChar(int chr) { |
1131 | 1177 | // Indy3 / Zak256 / Loom |
| 1178 | int width, height, origWidth, origHeight; |
1132 | 1179 | VirtScreen *vs; |
1133 | | byte *char_ptr, *dest_ptr; |
1134 | | int width, height; |
1135 | | int drawTop; |
| 1180 | byte *charPtr, *dst; |
| 1181 | int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; |
1136 | 1182 | |
1137 | 1183 | checkRange(_vm->_numCharsets - 1, 0, _curId, "Printing with bad charset %d"); |
1138 | 1184 | |
… |
… |
|
1142 | 1188 | if (chr == '@') |
1143 | 1189 | return; |
1144 | 1190 | |
| 1191 | if (is2byte) { |
| 1192 | charPtr = _vm->get2byteCharPtr(chr); |
| 1193 | width = _vm->_2byteWidth; |
| 1194 | height = _vm->_2byteHeight; |
| 1195 | } else { |
| 1196 | charPtr = _fontPtr + chr * 8; |
| 1197 | // width = height = 8; |
| 1198 | width = getCharWidth(chr); |
| 1199 | height = 8; |
| 1200 | } |
| 1201 | |
| 1202 | origWidth = width; |
| 1203 | origHeight = height; |
| 1204 | |
| 1205 | if (_dropShadow) { |
| 1206 | width++; |
| 1207 | height++; |
| 1208 | } |
| 1209 | |
1145 | 1210 | if (_firstChar) { |
1146 | 1211 | _str.left = _left; |
1147 | 1212 | _str.top = _top; |
… |
… |
|
1150 | 1215 | _firstChar = false; |
1151 | 1216 | } |
1152 | 1217 | |
1153 | | width = height = 8; |
1154 | | if (_dropShadow) { |
1155 | | width++; |
1156 | | height++; |
1157 | | } |
1158 | | |
1159 | | drawTop = _top - vs->topline; |
1160 | | char_ptr = _fontPtr + chr * 8; |
| 1218 | int drawTop = _top - vs->topline; |
1161 | 1219 | |
1162 | 1220 | _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height); |
1163 | 1221 | |
… |
… |
|
1166 | 1224 | _textScreenID = vs->number; |
1167 | 1225 | } |
1168 | 1226 | if (_ignoreCharsetMask || !vs->hasTwoBuffers) { |
1169 | | dest_ptr = vs->getPixels(_left, drawTop); |
1170 | | drawBits1(*vs, dest_ptr, char_ptr, drawTop, 8, 8); |
| 1227 | dst = vs->getPixels(_left, drawTop); |
| 1228 | drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight); |
1171 | 1229 | } else { |
1172 | | dest_ptr = (byte *)_vm->gdi._textSurface.pixels + _top * _vm->gdi._textSurface.pitch + _left; |
1173 | | drawBits1(_vm->gdi._textSurface, dest_ptr, char_ptr, drawTop, 8, 8); |
| 1230 | dst = (byte *)_vm->gdi._textSurface.pixels + _top * _vm->gdi._textSurface.pitch + _left; |
| 1231 | drawBits1(_vm->gdi._textSurface, dst, charPtr, drawTop, origWidth, origHeight); |
1174 | 1232 | } |
1175 | 1233 | |
1176 | 1234 | if (_str.left > _left) |
1177 | 1235 | _str.left = _left; |
1178 | 1236 | |
1179 | | _left += getCharWidth(chr); |
| 1237 | _left += origWidth; |
1180 | 1238 | |
1181 | 1239 | if (_str.right < _left) { |
1182 | 1240 | _str.right = _left; |
… |
… |
|
1189 | 1247 | } |
1190 | 1248 | |
1191 | 1249 | void CharsetRendererV3::drawChar(int chr, const Graphics::Surface &s, int x, int y) { |
1192 | | byte *char_ptr, *dest_ptr; |
1193 | | char_ptr = _fontPtr + chr * 8; |
1194 | | dest_ptr = (byte *)s.pixels + y * s.pitch + x; |
1195 | | drawBits1(s, dest_ptr, char_ptr, y, 8, 8); |
| 1250 | byte *charPtr, *dst; |
| 1251 | int width, height; |
| 1252 | int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; |
| 1253 | if (is2byte) { |
| 1254 | charPtr = _vm->get2byteCharPtr(chr); |
| 1255 | width = _vm->_2byteWidth; |
| 1256 | height = _vm->_2byteHeight; |
| 1257 | } else { |
| 1258 | charPtr = _fontPtr + chr * 8; |
| 1259 | // width = height = 8; |
| 1260 | width = getCharWidth(chr); |
| 1261 | height = 8; |
| 1262 | } |
| 1263 | dst = (byte *)s.pixels + y * s.pitch + x; |
| 1264 | drawBits1(s, dst, charPtr, y, width, height); |
1196 | 1265 | } |
1197 | 1266 | |
1198 | 1267 | |
… |
… |
|
1216 | 1285 | int type = *_fontPtr; |
1217 | 1286 | if (is2byte) { |
1218 | 1287 | _dropShadow = true; |
| 1288 | _shadowColor = (_vm->_features & GF_FMTOWNS) ? 8 : 0; |
1219 | 1289 | charPtr = _vm->get2byteCharPtr(chr); |
1220 | 1290 | width = _vm->_2byteWidth; |
1221 | 1291 | height = _vm->_2byteHeight; |
… |
… |
|
1404 | 1474 | void CharsetRendererClassic::drawChar(int chr, const Graphics::Surface &s, int x, int y) { |
1405 | 1475 | const byte *charPtr; |
1406 | 1476 | byte *dst; |
| 1477 | int width, height; |
| 1478 | int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; |
1407 | 1479 | |
1408 | | uint32 charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4); |
1409 | | assert(charOffs < 0x10000); |
1410 | | if (!charOffs) |
1411 | | return; |
1412 | | charPtr = _fontPtr + charOffs; |
1413 | | |
1414 | | int width = charPtr[0]; |
1415 | | int height = charPtr[1]; |
| 1480 | if (is2byte) { |
| 1481 | _dropShadow = true; |
| 1482 | _shadowColor = (_vm->_features & GF_FMTOWNS) ? 8 : 0; |
| 1483 | charPtr = _vm->get2byteCharPtr(chr); |
| 1484 | width = _vm->_2byteWidth; |
| 1485 | height = _vm->_2byteHeight; |
| 1486 | } else { |
| 1487 | uint32 charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4); |
| 1488 | assert(charOffs < 0x10000); |
| 1489 | if (!charOffs) |
| 1490 | return; |
| 1491 | charPtr = _fontPtr + charOffs; |
| 1492 | |
| 1493 | width = charPtr[0]; |
| 1494 | height = charPtr[1]; |
1416 | 1495 | |
1417 | | charPtr += 4; // Skip over char header |
| 1496 | charPtr += 4; // Skip over char header |
| 1497 | } |
1418 | 1498 | |
1419 | 1499 | dst = (byte *)s.pixels + y * s.pitch + x; |
1420 | | drawBitsN(s, dst, charPtr, *_fontPtr, y, width, height); |
| 1500 | |
| 1501 | if (is2byte) { |
| 1502 | drawBits1(s, dst, charPtr, y, width, height); |
| 1503 | } else { |
| 1504 | drawBitsN(s, dst, charPtr, *_fontPtr, y, width, height); |
| 1505 | } |
1421 | 1506 | } |
1422 | 1507 | |
1423 | 1508 | void CharsetRendererClassic::drawBitsN(const Graphics::Surface &s, byte *dst, const byte *src, byte bpp, int drawTop, int width, int height) { |
… |
… |
|
1540 | 1625 | int height = _current->getCharHeight(chr); |
1541 | 1626 | |
1542 | 1627 | if (chr >= 256 && _vm->_useCJKMode) |
1543 | | width = 16; |
| 1628 | width = _vm->_2byteWidth; |
1544 | 1629 | |
1545 | 1630 | shadow.right = _left + width + 2; |
1546 | 1631 | shadow.bottom = _top + height + 2; |
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.31
diff -u -r2.31 charset.h
|
|
|
94 | 94 | |
95 | 95 | void setCurID(byte id); |
96 | 96 | |
97 | | int getFontHeight() { return _fontPtr[1]; } |
| 97 | int getFontHeight(); |
98 | 98 | }; |
99 | 99 | |
100 | 100 | class CharsetRendererClassic : public CharsetRendererCommon { |
… |
… |
|
122 | 122 | void drawChar(int chr, const Graphics::Surface &s, int x, int y); |
123 | 123 | void setCurID(byte id); |
124 | 124 | void setColor(byte color); |
125 | | int getFontHeight() { return 8; } |
| 125 | int getFontHeight(); |
126 | 126 | int getCharWidth(byte chr); |
127 | 127 | }; |
128 | 128 | |
RCS file: /cvsroot/scummvm/scummvm/scumm/nut_renderer.cpp,v
retrieving revision 1.52
diff -u -r1.52 nut_renderer.cpp
|
|
|
204 | 204 | return 0; |
205 | 205 | } |
206 | 206 | |
207 | | if (c >= 0x80 && _vm->_useCJKMode) { |
208 | | if (_vm->_gameId == GID_CMI) |
209 | | return 8; |
210 | | if (_vm->_gameId == GID_DIG) |
211 | | return 6; |
212 | | return 0; |
213 | | } |
| 207 | if (c >= 0x80 && _vm->_useCJKMode) |
| 208 | return _vm->_2byteWidth / 2; |
214 | 209 | |
215 | 210 | if (c >= _numChars) |
216 | 211 | error("invalid character in NutRenderer::getCharWidth : %d (%d)", c, _numChars); |
… |
… |
|
225 | 220 | return 0; |
226 | 221 | } |
227 | 222 | |
228 | | if (c >= 0x80 && _vm->_useCJKMode) { |
229 | | if (_vm->_gameId == GID_CMI) |
230 | | return 16; |
231 | | if (_vm->_gameId == GID_DIG) |
232 | | return 10; |
233 | | return 0; |
234 | | } |
| 223 | if (c >= 0x80 && _vm->_useCJKMode) |
| 224 | return _vm->_2byteHeight; |
235 | 225 | |
236 | 226 | if (c >= _numChars) |
237 | 227 | error("invalid character in NutRenderer::getCharHeight : %d (%d)", c, _numChars); |
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.258
diff -u -r1.258 string.cpp
|
|
|
32 | 32 | #include "scumm/verbs.h" |
33 | 33 | #include "scumm/sound.h" |
34 | 34 | |
| 35 | #include "scumm/cjkcode.h" |
| 36 | |
35 | 37 | namespace Scumm { |
36 | 38 | |
37 | 39 | void ScummEngine::printString(int m, const byte *msg) { |
… |
… |
|
103 | 105 | int code = (_heversion >= 80) ? 127 : 64; |
104 | 106 | char value[32]; |
105 | 107 | |
| 108 | bool cmi_pos_hack = false; |
| 109 | |
106 | 110 | if (!_haveMsg) |
107 | 111 | return; |
108 | 112 | |
… |
… |
|
283 | 287 | warning("CHARSET_1: invalid code %d", c); |
284 | 288 | } |
285 | 289 | } else if (c == 0xFE || c == 0xFF) { |
| 290 | //WORKAROUND |
| 291 | //to avoid korean code 0xfe treated as charset message code. |
| 292 | if(c == 0xFE && checkKSCode(*(buffer + 1), c) && _useCJKMode) { |
| 293 | goto loc_avoid_ks_fe; |
| 294 | } |
286 | 295 | c = *buffer++; |
287 | 296 | switch(c) { |
288 | 297 | case 1: |
… |
… |
|
343 | 352 | warning("CHARSET_1: invalid code %d", c); |
344 | 353 | } |
345 | 354 | } else { |
| 355 | loc_avoid_ks_fe: |
346 | 356 | _charset->_left = _charset->_nextLeft; |
347 | 357 | _charset->_top = _charset->_nextTop; |
348 | 358 | if (c & 0x80 && _useCJKMode) |
349 | | if (_language == 6 && ((c > 0x84 && c < 0x88) || (c > 0x9f && c < 0xe0) || (c > 0xea && c <= 0xff))) |
| 359 | if (_language == Common::JA_JPN && !checkSJISCode(c)) { |
350 | 360 | c = 0x20; //not in S-JIS |
351 | | else |
352 | | c += *buffer++ * 256; |
| 361 | } else { |
| 362 | c += *buffer++ * 256; //LE |
| 363 | if(_gameId == GID_CMI) { //HACK: This fixes korean text position in COMI (off by 6 pixel) |
| 364 | cmi_pos_hack = true; |
| 365 | _charset->_top += 6; |
| 366 | } |
| 367 | } |
353 | 368 | if (_version <= 3) { |
354 | 369 | _charset->printChar(c); |
355 | 370 | } else { |
… |
… |
|
363 | 378 | } else |
364 | 379 | _charset->printChar(c); |
365 | 380 | } |
| 381 | if(cmi_pos_hack) { |
| 382 | cmi_pos_hack = false; |
| 383 | _charset->_top -= 6; |
| 384 | } |
366 | 385 | |
367 | 386 | _charset->_nextLeft = _charset->_left; |
368 | 387 | _charset->_nextTop = _charset->_top; |
… |
… |
|
389 | 408 | uint color; |
390 | 409 | int code = (_heversion >= 80) ? 127 : 64; |
391 | 410 | |
| 411 | bool cmi_pos_hack = false; |
| 412 | |
392 | 413 | addMessageToStack(msg, buf, sizeof(buf)); |
393 | 414 | |
394 | 415 | _charset->_top = _string[a].ypos + _screenTop; |
… |
… |
|
491 | 512 | _charset->_blitAlso = true; |
492 | 513 | } |
493 | 514 | } |
494 | | if (c >= 0x80 && _useCJKMode) |
495 | | c += buf[i++] * 256; |
| 515 | if (c & 0x80 && _useCJKMode) { |
| 516 | if (_language == Common::JA_JPN && !checkSJISCode(c)) { |
| 517 | c = 0x20; //not in S-JIS |
| 518 | } else { |
| 519 | c += buf[i++] * 256; |
| 520 | if(_gameId == GID_CMI) { |
| 521 | cmi_pos_hack = true; |
| 522 | _charset->_top += 6; |
| 523 | } |
| 524 | } |
| 525 | } |
496 | 526 | _charset->printChar(c); |
497 | 527 | _charset->_blitAlso = false; |
| 528 | |
| 529 | if(cmi_pos_hack) { |
| 530 | cmi_pos_hack = false; |
| 531 | _charset->_top -= 6; |
| 532 | } |
498 | 533 | } |
499 | 534 | } |
500 | 535 | |
… |
… |
|
729 | 764 | do { |
730 | 765 | c = *buf++; |
731 | 766 | if (c != 0 && c != 0xFF) { |
732 | | if (c >= 0x80 && _useCJKMode) |
733 | | c += *buf++ * 256; |
| 767 | if (c & 0x80 && _useCJKMode) { |
| 768 | if (_language == Common::JA_JPN && !checkSJISCode(c)) { |
| 769 | c = 0x20; //not in S-JIS |
| 770 | } else { |
| 771 | c += *buf++ * 256; |
| 772 | } |
| 773 | } |
734 | 774 | _charset->printChar(c); |
735 | 775 | } |
736 | 776 | } while (c); |
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_font.cpp,v
retrieving revision 1.23
diff -u -r1.23 smush_font.cpp
|
|
|
43 | 43 | |
44 | 44 | int width = 0; |
45 | 45 | while (*str) { |
46 | | width += getCharWidth(*str++); |
| 46 | if(*str & 0x80 && g_scumm->_useCJKMode) { |
| 47 | width += g_scumm->_2byteWidth + 1; |
| 48 | str += 2; |
| 49 | } else |
| 50 | width += getCharWidth(*str++); |
47 | 51 | } |
48 | 52 | return width; |
49 | 53 | } |
… |
… |
|
118 | 122 | int h = _vm->_2byteHeight; |
119 | 123 | |
120 | 124 | byte *src = _vm->get2byteCharPtr(idx); |
121 | | byte *dst = buffer + dst_width * (y + (_vm->_gameId == GID_CMI ? 7 : 2)) + x; |
| 125 | byte *dst = buffer + dst_width * (y + (_vm->_gameId == GID_CMI ? 7 : (_vm->_gameId == GID_DIG ? 2 : 0))) + x; |
122 | 126 | byte bits = 0; |
123 | 127 | |
124 | 128 | char color = (_color != -1) ? _color : 1; |
| 129 | |
125 | 130 | if (_new_colors) |
126 | | color = (char)0xff; //FIXME; |
| 131 | color = (char)0xff; |
| 132 | |
| 133 | if (g_scumm->_gameId == GID_FT) |
| 134 | color = 1; |
| 135 | |
127 | 136 | for (int j = 0; j < h; j++) { |
128 | 137 | for (int i = 0; i < w; i++) { |
129 | 138 | if ((i % 8) == 0) |
130 | 139 | bits = *src++; |
131 | 140 | if (bits & revBitMask[i % 8]) { |
132 | 141 | dst[i + 1] = 0; |
| 142 | dst[dst_width + i] = 0; |
| 143 | dst[dst_width + i + 1] = 0; |
133 | 144 | dst[i] = color; |
134 | 145 | } |
135 | 146 | } |