[Scummvm-git-logs] scummvm branch-2-5 -> 183bbe5d127671fb4cc8b772c8d78202a3f06cd4
athrxx
athrxx at scummvm.org
Sun Oct 24 17:25:17 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:
183bbe5d12 KYRA: (MR/Simplified Chinese) - fix preprocessing of long actor strings
Commit: 183bbe5d127671fb4cc8b772c8d78202a3f06cd4
https://github.com/scummvm/scummvm/commit/183bbe5d127671fb4cc8b772c8d78202a3f06cd4
Author: athrxx (athrxx at scummvm.org)
Date: 2021-10-24T19:24:13+02:00
Commit Message:
KYRA: (MR/Simplified Chinese) - fix preprocessing of long actor strings
Changed paths:
engines/kyra/graphics/screen.h
engines/kyra/graphics/screen_mr.cpp
engines/kyra/text/text_mr.cpp
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index 0082fadd7c..fc0ea505bb 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -273,6 +273,7 @@ public:
private:
const uint8 *_oneByteData;
const uint8 *_twoByteData;
+ uint32 _twoByteNumChar;
uint32 _twoByteDataSize;
const uint8 *_colorMap;
uint16 _textColor[2];
diff --git a/engines/kyra/graphics/screen_mr.cpp b/engines/kyra/graphics/screen_mr.cpp
index fb9f8c3a9f..e9523579ad 100644
--- a/engines/kyra/graphics/screen_mr.cpp
+++ b/engines/kyra/graphics/screen_mr.cpp
@@ -131,7 +131,7 @@ void Screen_MR::drawFilledBox(int x1, int y1, int x2, int y2, uint8 c1, uint8 c2
drawClippedLine(x1, y2-1, x2-1, y2-1, c3);
}
-Big5Font::Big5Font(const uint8 *oneByteData, int pitch) : Font(), _oneByteData(oneByteData), _twoByteData(0), _twoByteDataSize(0), _pitch(pitch), _border(false) {
+Big5Font::Big5Font(const uint8 *oneByteData, int pitch) : Font(), _oneByteData(oneByteData), _twoByteData(0), _twoByteDataSize(0), _twoByteNumChar(0), _pitch(pitch), _border(false) {
assert(_oneByteData);
_textColor[0] = _textColor[1] = 0;
}
@@ -143,6 +143,7 @@ Big5Font::~Big5Font() {
bool Big5Font::load(Common::SeekableReadStream &data) {
delete[] _twoByteData;
_twoByteData = 0;
+ _twoByteNumChar = _twoByteDataSize = 0;
if (!data.size())
return false;
@@ -154,6 +155,7 @@ bool Big5Font::load(Common::SeekableReadStream &data) {
data.read(dst, _twoByteDataSize);
_twoByteData = dst;
+ _twoByteNumChar = _twoByteDataSize / 28;
return true;
}
@@ -184,7 +186,7 @@ void Big5Font::drawChar(uint16 c, byte *dst, int pitch, int) const {
glyphData = &_oneByteData[128];
} else if (c & 0x80) {
c = ((c & 0x7F00) >> 2) | (c & 0x3F);
- assert(c * 28 < _twoByteDataSize);
+ assert(c < _twoByteNumChar);
glyphData = &_twoByteData[c * 28];
w = 15;
}
diff --git a/engines/kyra/text/text_mr.cpp b/engines/kyra/text/text_mr.cpp
index 9356504851..f3c5808f8a 100644
--- a/engines/kyra/text/text_mr.cpp
+++ b/engines/kyra/text/text_mr.cpp
@@ -48,19 +48,18 @@ char *TextDisplayer_MR::preprocessString(const char *str) {
if (_vm->_lang == 3) {
Screen::FontId curFont = _screen->setFont(Screen::FID_CHINESE_FNT);
int textLen = Common::strnlen(p, sizeof(_talkBuffer));
- int maxTextWidth;
if (textLen > 68) {
- maxTextWidth = ((textLen + 3) / 3) & ~1;
+ int maxTextWidth = ((textLen + 3) / 3) & ~1;
for (int i = textLen + 1; i >= maxTextWidth; --i)
p[i + 1] = p[i];
p[maxTextWidth] = '\r';
- ++p;
+ p += (maxTextWidth + 1);
textLen -= maxTextWidth;
}
if (textLen > 34) {
- maxTextWidth = ((textLen + 2) / 2) & ~1;
+ int maxTextWidth = ((textLen + 2) / 2) & ~1;
for (int i = textLen + 1; i >= maxTextWidth; --i)
p[i + 1] = p[i];
p[maxTextWidth] = '\r';
More information about the Scummvm-git-logs
mailing list