diff options
author | Travis Howell | 2005-11-03 10:06:17 +0000 |
---|---|---|
committer | Travis Howell | 2005-11-03 10:06:17 +0000 |
commit | 3532271973576c30869aa1113ee12d5f132519a9 (patch) | |
tree | abd93a5d5e47225352eca01d0f7a60831b2daa71 | |
parent | 4d8e8b5487b5c4520e46a77afa7fc55616ec2e51 (diff) | |
download | scummvm-rg350-3532271973576c30869aa1113ee12d5f132519a9.tar.gz scummvm-rg350-3532271973576c30869aa1113ee12d5f132519a9.tar.bz2 scummvm-rg350-3532271973576c30869aa1113ee12d5f132519a9.zip |
Add safety check for charset codes in HE72+ games.
Since charset codes and characters share some values.
svn-id: r19406
-rw-r--r-- | scumm/string.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp index f004d5da85..03573418b4 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -222,7 +222,8 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { uint32 talk_sound_b = 0; int i, c; char value[32]; - bool endLoop = false; + bool endLoop = false, ; + bool endText = false; byte *buffer = _charsetBuffer + _charsetBufPos; while (!endLoop) { c = *buffer++; @@ -257,7 +258,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { case 104: _haveMsg = 0; _keepText = true; - endLoop = true; + endLoop = endText = true; break; case 110: c = 13; // new line @@ -280,7 +281,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { case 119: _haveMsg = 0xFF; _keepText = false; - endLoop = true; + endLoop = endText = true; break; default: error("handleNextCharsetCode: invalid code %d", c); @@ -288,7 +289,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { } _charsetBufPos = buffer - _charsetBuffer; *code = c; - return (c != 104 && c != 119); + return (endText == 0); } #endif @@ -465,7 +466,7 @@ void ScummEngine::CHARSET_1() { *subtitleLine++ = c; *subtitleLine = '\0'; #endif - } else { + } else { if (_version <= 3) { _charset->printChar(c); } else { |