From bcfe38c24f032715e732422069f25ae5ef1f2a81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jul 2015 21:51:18 -0400 Subject: SHERLOCK: RT: Move Journal record method back to Journal class --- engines/sherlock/journal.cpp | 31 +++++++++++++++++++++++ engines/sherlock/journal.h | 12 ++++----- engines/sherlock/scalpel/scalpel_journal.cpp | 37 ---------------------------- engines/sherlock/scalpel/scalpel_journal.h | 6 ----- engines/sherlock/tattoo/widget_files.cpp | 1 - 5 files changed, 37 insertions(+), 50 deletions(-) diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp index 9441d6682a..44b24066d3 100644 --- a/engines/sherlock/journal.cpp +++ b/engines/sherlock/journal.cpp @@ -683,6 +683,37 @@ void Journal::loadJournalFile(bool alreadyLoaded) { } } +void Journal::record(int converseNum, int statementNum, bool replyOnly) { + int saveIndex = _index; + int saveSub = _sub; + + if (IS_3DO) { + // there seems to be no journal in the 3DO version + return; + } + + // Record the entry into the list + _journal.push_back(JournalEntry(converseNum, statementNum, replyOnly)); + _index = _journal.size() - 1; + + // Load the text for the new entry to get the number of lines it will have + loadJournalFile(true); + + // Restore old state + _index = saveIndex; + _sub = saveSub; + + // If new lines were added to the ournal, update the total number of lines + // the journal continues + if (!_lines.empty()) { + _maxPage += _lines.size(); + } else { + // No lines in entry, so remove the new entry from the journal + _journal.remove_at(_journal.size() - 1); + } +} + + void Journal::synchronize(Serializer &s) { s.syncAsSint16LE(_index); s.syncAsSint16LE(_sub); diff --git a/engines/sherlock/journal.h b/engines/sherlock/journal.h index d2baae11a9..ac23fc50f5 100644 --- a/engines/sherlock/journal.h +++ b/engines/sherlock/journal.h @@ -78,6 +78,12 @@ public: */ bool drawJournal(int direction, int howFar); + /** + * Records statements that are said, in the order which they are said. The player + * can then read the journal to review them + */ + void record(int converseNum, int statementNum, bool replyOnly = false); + /** * Synchronize the data for a savegame */ @@ -88,12 +94,6 @@ public: */ virtual void drawFrame() = 0; - /** - * Records statements that are said, in the order which they are said. The player - * can then read the journal to review them - */ - virtual void record(int converseNum, int statementNum, bool replyOnly = false) {} - /** * Reset viewing position to the start of the journal */ diff --git a/engines/sherlock/scalpel/scalpel_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp index 8e356c0f65..e54f1bc490 100644 --- a/engines/sherlock/scalpel/scalpel_journal.cpp +++ b/engines/sherlock/scalpel/scalpel_journal.cpp @@ -60,49 +60,12 @@ static const int SEARCH_POINTS[3][3] = { /*----------------------------------------------------------------*/ ScalpelJournal::ScalpelJournal(SherlockEngine *vm) : Journal(vm) { - // Initialize fields - _maxPage = 0; - _index = 0; - _sub = 0; - _up = _down = false; - _page = 1; - if (_vm->_interactiveFl) { // Load the journal directory and location names loadLocations(); } } -void ScalpelJournal::record(int converseNum, int statementNum, bool replyOnly) { - int saveIndex = _index; - int saveSub = _sub; - - if (IS_3DO) { - // there seems to be no journal in the 3DO version - return; - } - - // Record the entry into the list - _journal.push_back(JournalEntry(converseNum, statementNum, replyOnly)); - _index = _journal.size() - 1; - - // Load the text for the new entry to get the number of lines it will have - loadJournalFile(true); - - // Restore old state - _index = saveIndex; - _sub = saveSub; - - // If new lines were added to the ournal, update the total number of lines - // the journal continues - if (!_lines.empty()) { - _maxPage += _lines.size(); - } else { - // No lines in entry, so remove the new entry from the journal - _journal.remove_at(_journal.size() - 1); - } -} - void ScalpelJournal::loadLocations() { Resources &res = *_vm->_res; diff --git a/engines/sherlock/scalpel/scalpel_journal.h b/engines/sherlock/scalpel/scalpel_journal.h index 6bc0aa012c..0cfed0daa6 100644 --- a/engines/sherlock/scalpel/scalpel_journal.h +++ b/engines/sherlock/scalpel/scalpel_journal.h @@ -83,12 +83,6 @@ public: */ virtual void drawFrame(); - /** - * Records statements that are said, in the order which they are said. The player - * can then read the journal to review them - */ - virtual void record(int converseNum, int statementNum, bool replyOnly = false); - /** * Reset viewing position to the start of the journal */ diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp index 1743bcd09e..c6edfa30dc 100644 --- a/engines/sherlock/tattoo/widget_files.cpp +++ b/engines/sherlock/tattoo/widget_files.cpp @@ -167,7 +167,6 @@ void WidgetFiles::render(FilesRenderMode mode) { void WidgetFiles::handleEvents() { Events &events = *_vm->_events; - TattooScene &scene = *(TattooScene *)_vm->_scene; TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; Common::Point mousePos = events.mousePos(); Common::KeyState keyState = ui._keyState; -- cgit v1.2.3