[Scummvm-git-logs] scummvm master -> f468db1c6373e1097349a1d5256c4693e62dde6c

wonst719 wonst719 at gmail.com
Sun Nov 8 04:37:27 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4246929148 SCUMM: Move CharsetRenderer::isScummvmKorTarget() to ScummEngine
f468db1c63 SCUMM: Guard Korean postposition code against existing code


Commit: 4246929148772ba674f653c1d392191e4865e153
    https://github.com/scummvm/scummvm/commit/4246929148772ba674f653c1d392191e4865e153
Author: wonst719 (wonst719 at gmail.com)
Date: 2020-11-08T13:34:44+09:00

Commit Message:
SCUMM: Move CharsetRenderer::isScummvmKorTarget() to ScummEngine

Changed paths:
    engines/scumm/charset.cpp
    engines/scumm/charset.h
    engines/scumm/scumm.h


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index e66d867f23..365ae6f2d8 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -42,8 +42,8 @@ The advantage will be cleaner coder (easier to debug, in particular), and a
 better separation of the various modules.
 */
 
-bool CharsetRenderer::isScummvmKorTarget() {
-	if (_vm->_language == Common::KO_KOR && (_vm->_game.version < 7 || _vm->_game.id == GID_FT)) {
+bool ScummEngine::isScummvmKorTarget() {
+	if (_language == Common::KO_KOR && (_game.version < 7 || _game.id == GID_FT)) {
 		return true;
 	}
 	return false;
@@ -57,7 +57,7 @@ void ScummEngine::loadCJKFont() {
 	_useMultiFont = 0;	// Korean Multi-Font
 
 	// Special case for Korean
-	if (_language == Common::KO_KOR && (_game.version < 7 || _game.id == GID_FT)) {
+	if (isScummvmKorTarget()) {
 		loadKorFont();
 
 		return;
@@ -618,7 +618,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
 		if (chr == _vm->_newLineCharacter)
 			lastspace = pos - 1;
 
-		if (_vm->_useCJKMode && isScummvmKorTarget()) {
+		if (_vm->_useCJKMode && _vm->isScummvmKorTarget()) {
 			if (_center == false && chr == '(' && pos - 3 >= origPos && checkKSCode(str[pos -3], str[pos -2]))
 				lastKoreanLineBreak = pos - 1;
 		}
@@ -633,7 +633,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
 			} else if (chr & 0x80) {
 				pos++;
 				curw += _vm->_2byteWidth;
-				if (isScummvmKorTarget() && checkKSCode(chr, str[pos])) {
+				if (_vm->isScummvmKorTarget() && checkKSCode(chr, str[pos])) {
 					if (_center == false
 						&& !(pos - 4 >= origPos && str[pos - 3] == '`' && str[pos - 4] == ' ')	// prevents hanging quotation mark at the end of line
 						&& !(pos - 4 >= origPos && str[pos - 3] == '\'' && str[pos - 4] == ' ')	// prevents hanging single quotation mark at the end of line
@@ -651,12 +651,12 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
 			curw += getCharWidth(chr);
 		}
 		if (lastspace == -1) {
-			if (!isScummvmKorTarget() || lastKoreanLineBreak == -1) {
+			if (!_vm->isScummvmKorTarget() || lastKoreanLineBreak == -1) {
 				continue;
 			}
 		}
 		if (curw > maxwidth) {
-			if (!isScummvmKorTarget()) {
+			if (!_vm->isScummvmKorTarget()) {
 				str[lastspace] = 0xD;
 				curw = 1;
 				pos = lastspace + 1;
@@ -705,7 +705,7 @@ void CharsetRendererPC::enableShadow(bool enable) {
 }
 
 void CharsetRendererPC::drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height) {
-	if (_vm->_useCJKMode && isScummvmKorTarget()) {
+	if (_vm->_useCJKMode && _vm->isScummvmKorTarget()) {
 		drawBits1Kor(dest, x, y, src, drawTop, width, height);
 		return;
 	}
@@ -862,7 +862,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
 	if (chr == '@')
 		return;
 
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		if (is2byte) {
 			charPtr = _vm->get2byteCharPtr(chr);
 			width = _vm->_2byteWidth;
@@ -943,7 +943,7 @@ void CharsetRendererV3::drawChar(int chr, Graphics::Surface &s, int x, int y) {
 	int height;
 	int is2byte = (chr > 0xff && _vm->_useCJKMode) ? 1 : 0;
 
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		if (is2byte) {
 			charPtr = _vm->get2byteCharPtr(chr);
 			width = _vm->_2byteWidth;
@@ -1003,7 +1003,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
 	translateColor();
 
 	_vm->_charsetColorMap[1] = _color;
-	if (isScummvmKorTarget() && is2byte) {
+	if (_vm->isScummvmKorTarget() && is2byte) {
 		enableShadow(true);
 		_charPtr = _vm->get2byteCharPtr(chr);
 		_width = _vm->_2byteWidth;
@@ -1014,7 +1014,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
 			return;
 	}
 
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		_origWidth = _width;
 		_origHeight = _height;
 	}
@@ -1289,7 +1289,7 @@ CharsetRendererTownsV3::CharsetRendererTownsV3(ScummEngine *vm) : CharsetRendere
 }
 
 int CharsetRendererTownsV3::getCharWidth(uint16 chr) {
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		return CharsetRendererV3::getCharWidth(chr);
 	}
 
@@ -1309,7 +1309,7 @@ int CharsetRendererTownsV3::getCharWidth(uint16 chr) {
 }
 
 int CharsetRendererTownsV3::getFontHeight() {
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		return CharsetRendererV3::getFontHeight();
 	}
 
@@ -1317,7 +1317,7 @@ int CharsetRendererTownsV3::getFontHeight() {
 }
 
 void CharsetRendererTownsV3::enableShadow(bool enable) {
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		CharsetRendererV3::enableShadow(enable);
 		return;
 	}
@@ -1335,7 +1335,7 @@ void CharsetRendererTownsV3::enableShadow(bool enable) {
 }
 
 void CharsetRendererTownsV3::drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height) {
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		CharsetRendererV3::drawBits1(dest, x, y, src, drawTop, width, height);
 		return;
 	}
@@ -1420,7 +1420,7 @@ void CharsetRendererTownsV3::drawBits1(Graphics::Surface &dest, int x, int y, co
 }
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
 int CharsetRendererTownsV3::getDrawWidthIntern(uint16 chr) {
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		return CharsetRendererV3::getDrawWidthIntern(chr);
 	}
 
@@ -1434,7 +1434,7 @@ int CharsetRendererTownsV3::getDrawWidthIntern(uint16 chr) {
 }
 
 int CharsetRendererTownsV3::getDrawHeightIntern(uint16 chr) {
-	if (isScummvmKorTarget()) {
+	if (_vm->isScummvmKorTarget()) {
 		return CharsetRendererV3::getDrawHeightIntern(chr);
 	}
 
diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h
index 606bdec306..977e2f61d1 100644
--- a/engines/scumm/charset.h
+++ b/engines/scumm/charset.h
@@ -109,8 +109,6 @@ public:
 
 	virtual void setColor(byte color) { _color = color; translateColor(); }
 
-	bool isScummvmKorTarget();
-
 	void saveLoadWithSerializer(Common::Serializer &ser);
 };
 
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 98f3580880..d060a6badd 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1149,6 +1149,8 @@ public:
 	byte _newLineCharacter;
 	byte *get2byteCharPtr(int idx);
 
+	bool isScummvmKorTarget();
+
 //protected:
 	byte *_2byteFontPtr;
 	byte *_2byteMultiFontPtr[20];


Commit: f468db1c6373e1097349a1d5256c4693e62dde6c
    https://github.com/scummvm/scummvm/commit/f468db1c6373e1097349a1d5256c4693e62dde6c
Author: wonst719 (wonst719 at gmail.com)
Date: 2020-11-08T13:34:44+09:00

Commit Message:
SCUMM: Guard Korean postposition code against existing code

Changed paths:
    engines/scumm/string.cpp


diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index ec15902fee..5b722317a5 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1402,7 +1402,7 @@ int ScummEngine::convertVerbMessage(byte *dst, int dstSize, int var) {
 
 	bool isKorVerbGlue = false;
 
-	if (_language == Common::KO_KOR && _useCJKMode && var & (1 << 15)) {
+	if (isScummvmKorTarget() && _useCJKMode && var & (1 << 15)) {
 		isKorVerbGlue = true;
 		var &= ~(1 << 15);
 	}
@@ -1484,7 +1484,7 @@ int ScummEngine::convertNameMessage(byte *dst, int dstSize, int var) {
 		const byte *ptr = getObjOrActorName(num);
 		if (ptr) {
 			int increment = convertMessageToString(ptr, dst, dstSize);
-			if (_language == Common::KO_KOR && _useCJKMode) {
+			if (isScummvmKorTarget() && _useCJKMode) {
 				_krStrPost = 0;
 				int len = resStrLen(ptr);
 				if (len >= 2) {
@@ -1527,7 +1527,7 @@ int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) {
 	if (_game.version == 3 || (_game.version >= 6 && _game.heversion < 72))
 		var = readVar(var);
 
-	if (_language == Common::KO_KOR && _useCJKMode && (var & (1 << 15))) {
+	if (isScummvmKorTarget() && _useCJKMode && (var & (1 << 15))) {
 		int idx;
 		static const byte codeIdx[] = {0x00, 0x00, 0xC0, 0xB8, 0x00, 0x00, 0xC0, 0xCC, 0xB0, 0xA1, 0xC0, 0xCC, 0xB8, 0xA6, 0xC0, 0xBB, 0xBF, 0xCD, 0xB0, 0xFA, 0xB4, 0xC2, 0xC0, 0xBA};
 
@@ -1547,7 +1547,7 @@ int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) {
 		ptr = getStringAddress(var);
 		if (ptr) {
 			int increment = convertMessageToString(ptr, dst, dstSize);
-			if (_language == Common::KO_KOR && _useCJKMode) {
+			if (isScummvmKorTarget() && _useCJKMode) {
 				_krStrPost = 0;
 				for (int i = resStrLen(ptr); i > 1; i--) {
 					byte k1 = ptr[i - 2];




More information about the Scummvm-git-logs mailing list