From 314379e9291f5f30fddc1fded6efd330a16da8c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jan 2016 21:47:24 -0500 Subject: SHERLOCK: SS: Fix German accents not showing in journal --- engines/sherlock/journal.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'engines/sherlock/journal.cpp') diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp index c4aaa07a73..3312422b92 100644 --- a/engines/sherlock/journal.cpp +++ b/engines/sherlock/journal.cpp @@ -424,7 +424,7 @@ void Journal::loadJournalFile(bool alreadyLoaded) { } // Is it a control character? - if (c < opcodes[0]) { + if (isPrintable(c)) { // Nope. Set flag for allowing control codes to insert spaces ctrlSpace = true; justChangedSpeaker = false; @@ -486,7 +486,7 @@ void Journal::loadJournalFile(bool alreadyLoaded) { // Copy text from the place until either the reply ends, a comment // {} block is started, or a control character is encountered journalString += c; - while (*replyP && *replyP < opcodes[0] && *replyP != '{' && *replyP != '}') { + while (*replyP && isPrintable(*replyP) && *replyP != '{' && *replyP != '}') { journalString += *replyP++; } @@ -706,6 +706,25 @@ void Journal::loadJournalFile(bool alreadyLoaded) { } } +bool Journal::isPrintable(char ch) const { + Talk &talk = *_vm->_talk; + const byte *opcodes = talk._opcodes; + + // Okay.. there is freaky stuff going among the various different languages + // and across the two games as to which characters are printable, and which + // are opcodes, and which are not opcodes but shouldn't be printed anyway. + // I don't want to end up breaking stuff, so this method acts as a bit of a + // kludge to get German accents working in the Journal + if (ch < opcodes[0]) + return true; + + if (_vm->getGameID() == GType_SerratedScalpel && _vm->getLanguage() == Common::DE_DEU + && ch >= 0xe0) + return true; + + return false; +} + void Journal::record(int converseNum, int statementNum, bool replyOnly) { int saveIndex = _index; int saveSub = _sub; -- cgit v1.2.3