[Scummvm-cvs-logs] scummvm master -> 314379e9291f5f30fddc1fded6efd330a16da8c2

dreammaster dreammaster at scummvm.org
Thu Jan 28 03:51:47 CET 2016


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

Summary:
314379e929 SHERLOCK: SS: Fix German accents not showing in journal


Commit: 314379e9291f5f30fddc1fded6efd330a16da8c2
    https://github.com/scummvm/scummvm/commit/314379e9291f5f30fddc1fded6efd330a16da8c2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-01-27T21:47:24-05:00

Commit Message:
SHERLOCK: SS: Fix German accents not showing in journal

Changed paths:
    engines/sherlock/journal.cpp
    engines/sherlock/journal.h



diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index c4aaa07..3312422 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;
diff --git a/engines/sherlock/journal.h b/engines/sherlock/journal.h
index a8fec10..0bd277a 100644
--- a/engines/sherlock/journal.h
+++ b/engines/sherlock/journal.h
@@ -72,6 +72,11 @@ protected:
 	 *		first time, or being reloaded
 	 */
 	void loadJournalFile(bool alreadyLoaded);
+
+	/**
+	 * Returns true if a given character is printable
+	 */
+	bool isPrintable(char ch) const;
 public:
 	static Journal *init(SherlockEngine *vm);
 	virtual ~Journal() {}






More information about the Scummvm-git-logs mailing list