[Scummvm-git-logs] scummvm master -> 1f66e31f3a97be8a1f10c2f98ce286c6d49dc4c5
AndywinXp
noreply at scummvm.org
Sun Feb 12 23:16:18 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1f66e31f3a SCUMM: MI1 (Sega CD): Implement correct dialog text clipping
Commit: 1f66e31f3a97be8a1f10c2f98ce286c6d49dc4c5
https://github.com/scummvm/scummvm/commit/1f66e31f3a97be8a1f10c2f98ce286c6d49dc4c5
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-02-13T00:16:12+01:00
Commit Message:
SCUMM: MI1 (Sega CD): Implement correct dialog text clipping
The text has to be clipped not only from the left, but also from the right.
Changed paths:
engines/scumm/string.cpp
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 192ff48e2b2..bd216389dd3 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -540,7 +540,9 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
bool ScummEngine::newLine() {
_nextLeft = _string[0].xpos;
if (_charset->_center) {
- _nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
+ int stringWidth = _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos);
+ _nextLeft -= stringWidth / 2;
+
if (_nextLeft < 0)
// The commented out part of the next line was meant as a fix for Kanji text glitches in DIG.
// But these glitches couldn't be reproduced in recent tests. So the underlying issue might
@@ -551,8 +553,15 @@ bool ScummEngine::newLine() {
// The Sega CD version of Monkey Island 1 performs
// additional clipping on the X position of the string
- if (_game.platform == Common::kPlatformSegaCD && _nextLeft < 16)
- _nextLeft = 16;
+ if (_game.platform == Common::kPlatformSegaCD) {
+ // Clip 16 pixels away from the right
+ if (_nextLeft + stringWidth > (_screenWidth - 16))
+ _nextLeft -= (_nextLeft + stringWidth) - (_screenWidth - 16);
+
+ // Clip 16 pixels away from the left
+ if (_nextLeft < 16)
+ _nextLeft = 16;
+ }
} else if (_isRTL) {
if (_game.id == GID_MANIAC || _game.heversion >= 72 || ((_game.id == GID_MONKEY || _game.id == GID_MONKEY2) && _charset->getCurID() == 4)) {
_nextLeft = _screenWidth - _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) - _nextLeft;
@@ -944,16 +953,24 @@ void ScummEngine::CHARSET_1() {
}
if (_charset->_center) {
- _nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
+ int stringWidth = _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos);
+ _nextLeft -= stringWidth / 2;
if (_nextLeft < 0)
_nextLeft = _game.version >= 6 ? _string[0].xpos : 0;
// The Sega CD version of Monkey Island 1 performs
// additional clipping on the X position of the string
- if (_game.platform == Common::kPlatformSegaCD && _nextLeft < 16)
- _nextLeft = 16;
+ if (_game.platform == Common::kPlatformSegaCD) {
+ // Clip 16 pixels away from the right
+ if (_nextLeft + stringWidth > (_screenWidth - 16))
+ _nextLeft -= (_nextLeft + stringWidth) - (_screenWidth - 16);
+
+ // Clip 16 pixels away from the left
+ if (_nextLeft < 16)
+ _nextLeft = 16;
+ }
} else if (_isRTL) {
if (_game.id == GID_MANIAC || _game.heversion >= 72 || ((_game.id == GID_MONKEY || _game.id == GID_MONKEY2) && _charset->getCurID() == 4)) {
_nextLeft = _screenWidth - _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) - _nextLeft;
More information about the Scummvm-git-logs
mailing list