Add safety check for charset codes in HE72+ games.
Since charset codes and characters share some values. svn-id: r19406
This commit is contained in:
parent
4d8e8b5487
commit
3532271973
1 changed files with 6 additions and 5 deletions
|
@ -222,7 +222,8 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
|
||||||
uint32 talk_sound_b = 0;
|
uint32 talk_sound_b = 0;
|
||||||
int i, c;
|
int i, c;
|
||||||
char value[32];
|
char value[32];
|
||||||
bool endLoop = false;
|
bool endLoop = false, ;
|
||||||
|
bool endText = false;
|
||||||
byte *buffer = _charsetBuffer + _charsetBufPos;
|
byte *buffer = _charsetBuffer + _charsetBufPos;
|
||||||
while (!endLoop) {
|
while (!endLoop) {
|
||||||
c = *buffer++;
|
c = *buffer++;
|
||||||
|
@ -257,7 +258,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
|
||||||
case 104:
|
case 104:
|
||||||
_haveMsg = 0;
|
_haveMsg = 0;
|
||||||
_keepText = true;
|
_keepText = true;
|
||||||
endLoop = true;
|
endLoop = endText = true;
|
||||||
break;
|
break;
|
||||||
case 110:
|
case 110:
|
||||||
c = 13; // new line
|
c = 13; // new line
|
||||||
|
@ -280,7 +281,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
|
||||||
case 119:
|
case 119:
|
||||||
_haveMsg = 0xFF;
|
_haveMsg = 0xFF;
|
||||||
_keepText = false;
|
_keepText = false;
|
||||||
endLoop = true;
|
endLoop = endText = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("handleNextCharsetCode: invalid code %d", c);
|
error("handleNextCharsetCode: invalid code %d", c);
|
||||||
|
@ -288,7 +289,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
|
||||||
}
|
}
|
||||||
_charsetBufPos = buffer - _charsetBuffer;
|
_charsetBufPos = buffer - _charsetBuffer;
|
||||||
*code = c;
|
*code = c;
|
||||||
return (c != 104 && c != 119);
|
return (endText == 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -465,7 +466,7 @@ void ScummEngine::CHARSET_1() {
|
||||||
*subtitleLine++ = c;
|
*subtitleLine++ = c;
|
||||||
*subtitleLine = '\0';
|
*subtitleLine = '\0';
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (_version <= 3) {
|
if (_version <= 3) {
|
||||||
_charset->printChar(c);
|
_charset->printChar(c);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue