From 23152571554672ada336cee4311f351e409609dc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 28 Jul 2015 20:12:22 -0400 Subject: SHERLOCK: RT: Fix redundant speaker lines in Journal --- engines/sherlock/journal.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp index cd973858ff..cb3941e138 100644 --- a/engines/sherlock/journal.cpp +++ b/engines/sherlock/journal.cpp @@ -409,6 +409,8 @@ void Journal::loadJournalFile(bool alreadyLoaded) { bool commentJustPrinted = false; const byte *replyP = (const byte *)statement._reply.c_str(); const int inspectorId = (IS_SERRATED_SCALPEL) ? 2 : 18; + int beforeLastSpeakerChange = journalString.size(); + bool justChangedSpeaker = true; while (*replyP) { byte c = *replyP++; @@ -427,15 +429,11 @@ void Journal::loadJournalFile(bool alreadyLoaded) { if (c < opcodes[0]) { // Nope. Set flag for allowing control codes to insert spaces ctrlSpace = true; + justChangedSpeaker = false; assert(c >= ' '); // Check for embedded comments if (c == '{' || c == '}') { - - // TODO: Rose Tattoo checks if no text was added for the last - // comment here. In such a case, the last "XXX said" string is - // removed here. - // Comment characters. If we're starting a comment and there's // already text displayed, add a closing quote if (c == '{' && !startOfReply && !commentJustPrinted) @@ -497,6 +495,15 @@ void Journal::loadJournalFile(bool alreadyLoaded) { commentJustPrinted = false; } } else if (c == opcodes[OP_SWITCH_SPEAKER]) { + if (IS_ROSE_TATTOO) { + // If the speaker has just changed, then no text has just been added + // from the last speaker, so remove the initial "Person said" text + if (justChangedSpeaker) + journalString = Common::String(journalString.c_str(), journalString.c_str() + beforeLastSpeakerChange); + + justChangedSpeaker = true; + } + if (!startOfReply) { if (!commentFlag && !commentJustPrinted) journalString += "\"\n"; @@ -656,6 +663,9 @@ void Journal::loadJournalFile(bool alreadyLoaded) { if (!startOfReply && !commentJustPrinted) journalString += '"'; + if (IS_ROSE_TATTOO && justChangedSpeaker) + journalString = Common::String(journalString.c_str(), journalString.c_str() + beforeLastSpeakerChange); + // Finally finished building the journal text. Need to process the text to // word wrap it to fit on-screen. The resulting lines are stored in the // _lines array -- cgit v1.2.3