aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/string.cpp
diff options
context:
space:
mode:
authorMax Horn2010-12-02 00:27:26 +0000
committerMax Horn2010-12-02 00:27:26 +0000
commite85d196f33a1974bf1fe6088e6eb41c3c20c221f (patch)
treeac62095941e716e70bb723ea9e76bd5a68981fdd /engines/scumm/string.cpp
parentb36b7ee3493dbf086ffb6aba4a3cb5b5daa4d7d7 (diff)
downloadscummvm-rg350-e85d196f33a1974bf1fe6088e6eb41c3c20c221f.tar.gz
scummvm-rg350-e85d196f33a1974bf1fe6088e6eb41c3c20c221f.tar.bz2
scummvm-rg350-e85d196f33a1974bf1fe6088e6eb41c3c20c221f.zip
SCUMM: Fix bug in V12 games causing chars to be lost when wrapping talk text
svn-id: r54729
Diffstat (limited to 'engines/scumm/string.cpp')
-rw-r--r--engines/scumm/string.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index aa099b1b57..10e2aacc26 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -426,6 +426,33 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
}
#endif
+bool ScummEngine::newLine() {
+ _nextLeft = _string[0].xpos;
+ if (_charset->_center) {
+ _nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
+ if (_nextLeft < 0)
+ _nextLeft = _game.version >= 6 ? _string[0].xpos : 0;
+ }
+
+ if (_game.version == 0) {
+ return false;
+ } else if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) {
+ _nextTop += _string[0].height;
+ } else {
+ bool useCJK = _useCJKMode;
+ // SCUMM5 FM-Towns doesn't use the height of the ROM font here.
+ if (_game.platform == Common::kPlatformFMTowns && _game.version == 5)
+ _useCJKMode = false;
+ _nextTop += _charset->getFontHeight();
+ _useCJKMode = useCJK;
+ }
+ if (_game.version > 3) {
+ // FIXME: is this really needed?
+ _charset->_disableOffsX = true;
+ }
+ return true;
+}
+
void ScummEngine::CHARSET_1() {
Actor *a;
#ifdef ENABLE_SCUMM_7_8
@@ -579,36 +606,14 @@ void ScummEngine::CHARSET_1() {
}
if (c == 13) {
- newLine:;
- _nextLeft = _string[0].xpos;
#ifdef ENABLE_SCUMM_7_8
if (_game.version >= 7 && subtitleLine != subtitleBuffer) {
((ScummEngine_v7 *)this)->addSubtitleToQueue(subtitleBuffer, subtitlePos, _charsetColor, _charset->getCurID());
subtitleLine = subtitleBuffer;
}
#endif
- if (_charset->_center) {
- _nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
- if (_nextLeft < 0)
- _nextLeft = _game.version >= 6 ? _string[0].xpos : 0;
- }
-
- if (_game.version == 0) {
+ if (!newLine())
break;
- } else if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) {
- _nextTop += _string[0].height;
- } else {
- bool useCJK = _useCJKMode;
- // SCUMM5 FM-Towns doesn't use the height of the ROM font here.
- if (_game.platform == Common::kPlatformFMTowns && _game.version == 5)
- _useCJKMode = false;
- _nextTop += _charset->getFontHeight();
- _useCJKMode = useCJK;
- }
- if (_game.version > 3) {
- // FIXME: is this really needed?
- _charset->_disableOffsX = true;
- }
continue;
}
@@ -618,7 +623,8 @@ void ScummEngine::CHARSET_1() {
}
// Handle line breaks for V1-V2
if (_game.version <= 2 && _nextLeft >= _screenWidth) {
- goto newLine;
+ if (!newLine())
+ break; // FIXME: Is this necessary? Only would be relevant for v0 games
}
_charset->_left = _nextLeft;