[Scummvm-cvs-logs] SF.net SVN: scummvm:[48777] scummvm/trunk/engines/sci/graphics/text16.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Fri Apr 23 15:52:00 CEST 2010
Revision: 48777
http://scummvm.svn.sourceforge.net/scummvm/?rev=48777&view=rev
Author: m_kiewitz
Date: 2010-04-23 13:51:59 +0000 (Fri, 23 Apr 2010)
Log Message:
-----------
SCI: pc98 sierra interpreter had special code, that circumvents having a japanese punctuation char as first char on new lines - we do so now as well
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/text16.cpp
Modified: scummvm/trunk/engines/sci/graphics/text16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text16.cpp 2010-04-23 10:28:30 UTC (rev 48776)
+++ scummvm/trunk/engines/sci/graphics/text16.cpp 2010-04-23 13:51:59 UTC (rev 48777)
@@ -152,6 +152,11 @@
return textCodeSize;
}
+static const uint16 text16_punctuationSjis[] = {
+ 0x9F82, 0xA182, 0xA382, 0xA582, 0xA782, 0xC182, 0xA782, 0xC182, 0xE182, 0xE382, 0xE582, 0xEC82,
+ 0x4083, 0x4283, 0x4483, 0x4683, 0x4883, 0x6283, 0x8383, 0x8583, 0x8783, 0x8E83, 0x9583, 0x9683,
+ 0x5B81, 0x4181, 0x4281, 0x7681, 0x7881, 0x4981, 0x4881, 0 };
+
// return max # of chars to fit maxwidth with full words
int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) {
uint16 curChar;
@@ -210,6 +215,24 @@
// Text w/o space, supposingly kanji - we don't adjust back to last char here strangely. If we do, we don't
// get the same text cutting like in sierra sci
maxChars = curCharCount;
+
+ // sierra checked the following character against a punctuation kanji table
+ uint16 nextChar = (*(const byte *)text++);
+ if (_font->isDoubleByte(nextChar)) {
+ nextChar |= (*(const byte *)text++) << 8;
+
+ // if the character is punctuation, we go back one character
+ uint nonBreakingNr = 0;
+ while (text16_punctuationSjis[nonBreakingNr]) {
+ if (text16_punctuationSjis[nonBreakingNr] == nextChar) {
+ maxChars--;
+ if (curChar > 0xFF)
+ maxChars--; // go back 2 chars, when last char was double byte
+ break;
+ }
+ nonBreakingNr++;
+ }
+ }
}
SetFont(oldFontId);
_ports->penColor(oldPenColor);
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