SHERLOCK: SS: Fix German accents not showing in journal

This commit is contained in:
Paul Gilbert 2016-01-27 21:47:24 -05:00
parent 2eecbe68fa
commit 314379e929
2 changed files with 26 additions and 2 deletions

View File

@ -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;

View File

@ -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() {}