[Scummvm-cvs-logs] SF.net SVN: scummvm:[48726] scummvm/trunk/engines/sci/graphics

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Apr 19 22:15:31 CEST 2010


Revision: 48726
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48726&view=rev
Author:   m_kiewitz
Date:     2010-04-19 20:15:31 +0000 (Mon, 19 Apr 2010)

Log Message:
-----------
SCI: sierra switched hardcoded inside their pc98 interpreter to font 900, if sjis text got detected

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/text16.cpp
    scummvm/trunk/engines/sci/graphics/text16.h

Modified: scummvm/trunk/engines/sci/graphics/text16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text16.cpp	2010-04-19 17:23:27 UTC (rev 48725)
+++ scummvm/trunk/engines/sci/graphics/text16.cpp	2010-04-19 20:15:31 UTC (rev 48726)
@@ -262,7 +262,7 @@
 	Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor);
 }
 
-int16 GfxText16::Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth) {
+int16 GfxText16::Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth) {
 	GuiResourceId oldFontId = GetFontId();
 	int16 oldPenColor = _ports->_curPort->penClr;
 	int16 charCount;
@@ -271,25 +271,29 @@
 
 	if (fontId != -1)
 		SetFont(fontId);
+
+	if (g_sci->getLanguage() == Common::JA_JPN)
+		SwitchToFont900OnSjis(text);
+
 	rect.top = rect.left = 0;
 
 	if (maxWidth < 0) { // force output as single line
-		StringWidth(str, oldFontId, textWidth, textHeight);
+		StringWidth(text, oldFontId, textWidth, textHeight);
 		rect.bottom = textHeight;
 		rect.right = textWidth;
 	} else {
 		// rect.right=found widest line with RTextWidth and GetLongest
 		// rect.bottom=num. lines * GetPointSize
 		rect.right = (maxWidth ? maxWidth : 192);
-		const char*p = str;
-		while (*p) {
-			charCount = GetLongest(p, rect.right, oldFontId);
+		const char *curPos = text;
+		while (*curPos) {
+			charCount = GetLongest(curPos, rect.right, oldFontId);
 			if (charCount == 0)
 				break;
-			Width(p, 0, charCount, oldFontId, textWidth, textHeight);
+			Width(curPos, 0, charCount, oldFontId, textWidth, textHeight);
 			maxTextWidth = MAX(textWidth, maxTextWidth);
 			totalHeight += textHeight;
-			p += charCount;
+			curPos += charCount;
 		}
 		rect.bottom = totalHeight;
 		rect.right = maxWidth ? maxWidth : MIN(rect.right, maxTextWidth);
@@ -365,6 +369,9 @@
 	if (fontId != -1)
 		SetFont(fontId);
 
+	if (g_sci->getLanguage() == Common::JA_JPN)
+		SwitchToFont900OnSjis(text);
+
 	while (*text) {
 		charCount = GetLongest(text, rect.width(), orgFontId);
 		if (charCount == 0)
@@ -408,4 +415,11 @@
 	_ports->penColor(orgPenColor);
 }
 
+// Sierra did this in their PC98 interpreter only, they identify a text as being sjis and then switch to font 900
+void GfxText16::SwitchToFont900OnSjis(const char *text) {
+	byte firstChar = (*(const byte *)text++);
+	if (((firstChar >= 0x81) && (firstChar <= 0x9F)) || ((firstChar >= 0xE0) && (firstChar <= 0xEF)))
+		SetFont(900);
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/text16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/text16.h	2010-04-19 17:23:27 UTC (rev 48725)
+++ scummvm/trunk/engines/sci/graphics/text16.h	2010-04-19 20:15:31 UTC (rev 48726)
@@ -59,7 +59,7 @@
 	void StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight);
 	void ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor);
 	void DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor);
-	int16 Size(Common::Rect &rect, const char *str, GuiResourceId fontId, int16 maxWidth);
+	int16 Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth);
 	void Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor);
 	void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor);
 	void Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId);
@@ -69,6 +69,7 @@
 
 private:
 	void init();
+	void SwitchToFont900OnSjis(const char *text);
 
 	ResourceManager *_resMan;
 	GfxCache *_cache;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list