[Scummvm-git-logs] scummvm master -> c837fafaa816aa61c8150ceefb959620d606a9ef
athrxx
noreply at scummvm.org
Sun Dec 5 16:03:16 UTC 2021
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:
c837fafaa8 KYRA: (LoK/Mac) - fix line breaks glitch
Commit: c837fafaa816aa61c8150ceefb959620d606a9ef
https://github.com/scummvm/scummvm/commit/c837fafaa816aa61c8150ceefb959620d606a9ef
Author: athrxx (athrxx at scummvm.org)
Date: 2021-12-05T17:03:02+01:00
Commit Message:
KYRA: (LoK/Mac) - fix line breaks glitch
(regression from 6f2df10d)
The dialog text displayer functions really only handle '\n' in the Mac version. But the equivalent function to our Screen::printText() function actually handles both '\r' and '\n'.
Changed paths:
engines/kyra/graphics/screen.cpp
engines/kyra/graphics/screen.h
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 21ee7f829b..963051b35a 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -82,7 +82,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
_customDimTable = nullptr;
_curDim = nullptr;
- _lineBreakChar = (_vm->gameFlags().platform == Common::kPlatformMacintosh) ? '\n' : '\r';
+ _lineBreakChars = (_vm->gameFlags().platform == Common::kPlatformMacintosh) ? "\n\r" : "\r";
_yTransOffs = 0;
_idleUpdateTimer = 0;
@@ -1439,7 +1439,7 @@ int Screen::getTextWidth(const char *str, bool nextWordOnly) {
if (c == 0 || (nextWordOnly && (c == 2 || c == 6 || c == 13 || c == 32 || c == 0x4081))) {
break;
- } else if (c == (uint16)_lineBreakChar) {
+ } else if (c < 128 && _lineBreakChars.contains((char)c)) {
if (curLineLen > maxLineLen)
maxLineLen = curLineLen;
else
@@ -1498,7 +1498,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
if (c == 0) {
break;
- } else if (c == (uint16)_lineBreakChar) {
+ } else if (c < 128 && _lineBreakChars.contains((char)c)) {
x = x_start;
y += (charHeight + _lineSpacing);
} else {
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index d9e4da57ee..f07b390e8e 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -657,7 +657,7 @@ public:
const ScreenDim *_curDim;
- char _lineBreakChar;
+ Common::String _lineBreakChars;
// shape handling
uint8 *encodeShape(int x, int y, int w, int h, int flags);
More information about the Scummvm-git-logs
mailing list