diff options
author | Vincent Bénony | 2016-01-06 16:19:03 +0100 |
---|---|---|
committer | Vincent Bénony | 2016-01-06 16:19:03 +0100 |
commit | 64f50761ec22243fe9964271a8554c9f3356a6b5 (patch) | |
tree | c4aa7991cad01deaa5f8a7683938d4899ff450d0 /engines/sci/graphics/text16.cpp | |
parent | fae79955e5ce6e215dcf457059c5744a85c76a80 (diff) | |
parent | 3fab9056296fbf491372f66f7fbb23d6312ad2ad (diff) | |
download | scummvm-rg350-64f50761ec22243fe9964271a8554c9f3356a6b5.tar.gz scummvm-rg350-64f50761ec22243fe9964271a8554c9f3356a6b5.tar.bz2 scummvm-rg350-64f50761ec22243fe9964271a8554c9f3356a6b5.zip |
IOS: Merge master
Diffstat (limited to 'engines/sci/graphics/text16.cpp')
-rw-r--r-- | engines/sci/graphics/text16.cpp | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index f463dff4b1..89c9be59f0 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -144,12 +144,41 @@ int16 GfxText16::CodeProcessing(const char *&text, GuiResourceId orgFontId, int1 } // Has actually punctuation and characters in it, that may not be the first in a line +// SCI1 didn't check for exclamation nor question marks, us checking for those too shouldn't be bad static const uint16 text16_shiftJIS_punctuation[] = { + 0x4181, 0x4281, 0x7681, 0x7881, 0x4981, 0x4881, 0 +}; + +// Table from Quest for Glory 1 PC-98 (SCI01) +// has pronunciation and small combining form characters on top (details right after this table) +static const uint16 text16_shiftJIS_punctuation_SCI01[] = { 0x9F82, 0xA182, 0xA382, 0xA582, 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 }; +// Police Quest 2 (SCI0) only checked for: 0x4181, 0x4281, 0x7681, 0x7881, 0x4981, 0x4881 +// Castle of Dr. Brain/King's Quest 5/Space Quest 4 (SCI1) only checked for: 0x4181, 0x4281, 0x7681, 0x7881 + +// SCI0/SCI01/SCI1: +// 0x4181 -> comma, 0x4281 -> period / full stop +// 0x7681 -> ending quotation mark, 0x7881 -> secondary quotation mark + +// SCI0/SCI01: +// 0x4981 -> exclamation mark, 0x4881 -> question mark + +// SCI01 (Quest for Glory only): +// 0x9F82, 0xA182, 0xA382, 0xA582, 0xA782 -> specifies vowel part of prev. hiragana char or pronunciation/extension of vowel +// 0xC182 -> pronunciation +// 0xE182, 0xE382, 0xE582, 0xEC82 -> small combining form of hiragana +// 0x4083, 0x4283, 0x4483, 0x4683, 0x4883 -> small combining form of katagana +// 0x6283 -> glottal stop / sokuon +// 0x8383, 0x8583 0x8783, 0x8E83 -> small combining form of katagana +// 0x9583 -> combining form +// 0x9683 -> abbreviation for the kanji (ka), the counter for months, places or provisions +// 0x5b81 -> low line / underscore (full width) + + // return max # of chars to fit maxwidth with full words, does not include // breaking space // Also adjusts text pointer to the new position for the caller @@ -201,9 +230,10 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId } // it's meant to pass through here case 0xA: - case 0x9781: // this one is used by SQ4/japanese as line break as well + case 0x9781: // this one is used by SQ4/japanese as line break as well (was added for SCI1/PC98) curCharCount++; textPtr++; if (curChar > 0xFF) { + // skip another byte in case char is double-byte (PC-98) curCharCount++; textPtr++; } // and it's also meant to pass through here @@ -261,17 +291,27 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId // But it also checked, if the current character is not inside a punctuation table and it even // went backwards in case it found multiple ones inside that table. + // Note: PQ2 PC-98 only went back 1 character and not multiple ones uint nonBreakingPos = 0; + const uint16 *punctuationTable; + + if (getSciVersion() != SCI_VERSION_01) { + punctuationTable = text16_shiftJIS_punctuation; + } else { + // Quest for Glory 1 PC-98 only + punctuationTable = text16_shiftJIS_punctuation_SCI01; + } + while (1) { // Look up if character shouldn't be the first on a new line nonBreakingPos = 0; - while (text16_shiftJIS_punctuation[nonBreakingPos]) { - if (text16_shiftJIS_punctuation[nonBreakingPos] == curChar) + while (punctuationTable[nonBreakingPos]) { + if (punctuationTable[nonBreakingPos] == curChar) break; nonBreakingPos++; } - if (!text16_shiftJIS_punctuation[nonBreakingPos]) { + if (!punctuationTable[nonBreakingPos]) { // character is fine break; } @@ -285,6 +325,14 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId error("Non double byte while seeking back"); curChar |= (*(const byte *)(textPtr + 1)) << 8; } + + if (curChar == 0x4081) { + // Skip over alphabetic double-byte space + // This was introduced for SCI1 + // Happens in Castle of Dr. Brain PC-98 in room 120, when looking inside the mirror + // (game mentions Mixed Up Fairy Tales and uses English letters for that) + textPtr += 2; + } } // We split the word in that case |