Cleanup, remove hacks.

svn-id: r19425
This commit is contained in:
Travis Howell 2005-11-04 13:09:57 +00:00
parent eaf2f611f7
commit 549a052967
2 changed files with 83 additions and 98 deletions

View File

@ -298,50 +298,49 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
int code = (_vm->_heversion >= 80) ? 127 : 64;
while ((chr = text[pos++]) != 0) {
if (_vm->_heversion >= 72 && chr == code) {
chr = text[pos++];
if (chr == 84) { // Strings of speech offset/size
while (chr != code)
chr = text[pos++];
continue;
}
if (chr == 119) // 'Wait'
break;
if (chr == 104|| chr == 110) // 'Newline'
break;
} else if (chr == '@')
continue;
if (chr == '\n' || chr == '\r')
break;
if (chr == 254 || chr == 255) {
//process in LE
if (chr == 254 && checkKSCode(text[pos], chr) && _vm->_useCJKMode) {
goto loc_avoid_ks_fe;
}
chr = text[pos++];
if (chr == 3) // 'WAIT'
break;
if (chr == 8) { // 'Verb on next line'
if (arg == 1)
if (_vm->_heversion >= 72) {
if (chr == code) {
chr = text[pos++];
if (chr == 84) { // Strings of speech offset/size
while (chr != code)
chr = text[pos++];
continue;
}
if (chr == 119) // 'Wait'
break;
if (chr == 104|| chr == 110) // 'Newline'
break;
while (text[pos++] == ' ')
;
continue;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
pos += 2;
} else {
if (chr == '@')
continue;
}
if (chr == 9 || chr == 1 || chr == 2) // 'Newline'
if (chr == '\n' || chr == '\r')
break;
if (chr == 14) {
int set = text[pos] | (text[pos + 1] << 8);
pos += 2;
setCurID(set);
continue;
if (chr == 255 || (_vm->_version <= 6 && chr == 254)) {
chr = text[pos++];
if (chr == 3) // 'WAIT'
break;
if (chr == 8) { // 'Verb on next line'
if (arg == 1)
break;
while (text[pos++] == ' ')
;
continue;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
pos += 2;
continue;
}
if (chr == 9 || chr == 1 || chr == 2) // 'Newline'
break;
if (chr == 14) {
int set = text[pos] | (text[pos + 1] << 8);
pos += 2;
setCurID(set);
continue;
}
}
}
loc_avoid_ks_fe:
if ((chr & 0x80) && _vm->_useCJKMode) {
pos++;
width += _vm->_2byteWidth;
@ -363,62 +362,60 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
int code = (_vm->_heversion >= 80) ? 127 : 64;
while ((chr = str[pos++]) != 0) {
if (_vm->_heversion >= 72 && chr == code) {
chr = str[pos++];
if (chr == 84) { // Strings of speech offset/size
while (chr != code)
chr = str[pos++];
continue;
}
if (chr == 119) // 'Wait'
break;
if (chr == 110) { // 'Newline'
curw = 1;
continue;
}
if (chr == 104) // 'Don't terminate with \n'
break;
} else if (chr == '@')
continue;
if (chr == 254 || chr == 255) {
//process in LE
if (chr == 254 && checkKSCode(str[pos], chr) && _vm->_useCJKMode) {
goto loc_avoid_ks_fe;
}
chr = str[pos++];
if (chr == 3) // 'Wait'
break;
if (chr == 8) { // 'Verb on next line'
if (a == 1) {
curw = 1;
} else {
while (str[pos] == ' ')
str[pos++] = '@';
if (_vm->_heversion >= 72) {
if (chr == code) {
chr = str[pos++];
if (chr == 84) { // Strings of speech offset/size
while (chr != code)
chr = str[pos++];
continue;
}
continue;
if (chr == 119) // 'Wait'
break;
if (chr == 110) { // 'Newline'
curw = 1;
continue;
}
if (chr == 104) // 'Don't terminate with \n'
break;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
pos += 2;
continue;
}
if (chr == 1) { // 'Newline'
curw = 1;
continue;
}
if (chr == 2) // 'Don't terminate with \n'
break;
if (chr == 14) {
int set = str[pos] | (str[pos + 1] << 8);
pos += 2;
setCurID(set);
} else {
if (chr == '@')
continue;
if (chr == 255 || (_vm->_version <= 6 && chr == 254)) {
chr = str[pos++];
if (chr == 3) // 'Wait'
break;
if (chr == 8) { // 'Verb on next line'
if (a == 1) {
curw = 1;
} else {
while (str[pos] == ' ')
str[pos++] = '@';
}
continue;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
pos += 2;
continue;
}
if (chr == 1) { // 'Newline'
curw = 1;
continue;
}
if (chr == 2) // 'Don't terminate with \n'
break;
if (chr == 14) {
int set = str[pos] | (str[pos + 1] << 8);
pos += 2;
setCurID(set);
continue;
}
}
}
if (chr == ' ')
lastspace = pos - 1;
loc_avoid_ks_fe:
if ((chr & 0x80) && _vm->_useCJKMode) {
pos++;
curw += _vm->_2byteWidth;

View File

@ -31,18 +31,6 @@ class ScummEngine;
class NutRenderer;
struct VirtScreen;
static inline bool checkKSCode(byte hi, byte lo) {
//hi : xx
//lo : yy
if ((0xA1 > lo) || (0xFE < lo)) {
return false;
}
if ((hi >= 0xB0) && (hi <= 0xC8)) {
return true;
}
return false;
}
static inline bool checkSJISCode(byte c) {
if ((c > 0x84 && c < 0x88) || (c > 0x9f && c < 0xe0) || (c > 0xea /* && c <= 0xff */))
return false;