aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-26 21:51:18 -0400
committerPaul Gilbert2015-07-26 21:51:18 -0400
commitbcfe38c24f032715e732422069f25ae5ef1f2a81 (patch)
tree3929434d5d5dc121c7224240fe0370c923f171d4
parent6f121be1c26adb406e204c1644cf1f5c8b3960e8 (diff)
downloadscummvm-rg350-bcfe38c24f032715e732422069f25ae5ef1f2a81.tar.gz
scummvm-rg350-bcfe38c24f032715e732422069f25ae5ef1f2a81.tar.bz2
scummvm-rg350-bcfe38c24f032715e732422069f25ae5ef1f2a81.zip
SHERLOCK: RT: Move Journal record method back to Journal class
-rw-r--r--engines/sherlock/journal.cpp31
-rw-r--r--engines/sherlock/journal.h12
-rw-r--r--engines/sherlock/scalpel/scalpel_journal.cpp37
-rw-r--r--engines/sherlock/scalpel/scalpel_journal.h6
-rw-r--r--engines/sherlock/tattoo/widget_files.cpp1
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
@@ -79,6 +79,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
*/
void synchronize(Serializer &s);
@@ -89,12 +95,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
*/
virtual void resetPosition() {}
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
@@ -84,12 +84,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
*/
virtual void resetPosition();
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;