aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/tattoo/tattoo_journal.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-21 12:30:43 -0400
committerPaul Gilbert2015-06-21 12:30:43 -0400
commit6b01a11a398b6366cdf810a31648e371ea6146ca (patch)
treefd43baefea0645280fbd00e06adb67b398f315e6 /engines/sherlock/tattoo/tattoo_journal.cpp
parent3910ff481ed1baeb9d46b776f58ad24989d48e13 (diff)
downloadscummvm-rg350-6b01a11a398b6366cdf810a31648e371ea6146ca.tar.gz
scummvm-rg350-6b01a11a398b6366cdf810a31648e371ea6146ca.tar.bz2
scummvm-rg350-6b01a11a398b6366cdf810a31648e371ea6146ca.zip
SHERLOCK: RT: Move journal code used by both games back to Journal
Diffstat (limited to 'engines/sherlock/tattoo/tattoo_journal.cpp')
-rw-r--r--engines/sherlock/tattoo/tattoo_journal.cpp100
1 files changed, 97 insertions, 3 deletions
diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp
index 380f6efc54..104e2a8bfe 100644
--- a/engines/sherlock/tattoo/tattoo_journal.cpp
+++ b/engines/sherlock/tattoo/tattoo_journal.cpp
@@ -29,32 +29,126 @@ namespace Sherlock {
namespace Tattoo {
+#define JOURNAL_BAR_WIDTH 450
+
TattooJournal::TattooJournal(SherlockEngine *vm) : Journal(vm) {
_journalImages = nullptr;
+
+ loadJournalLocations();
}
void TattooJournal::show() {
Resources &res = *_vm->_res;
Screen &screen = *_vm->_screen;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+ byte palette[PALETTE_SIZE];
// Load journal images
_journalImages = new ImageFile("journal.vgs");
// Load palette
Common::SeekableReadStream *stream = res.load("journal.pal");
- stream->read(screen._tMap, PALETTE_SIZE);
- screen.translatePalette(screen._tMap);
- ui.setupBGArea(screen._tMap);
+ stream->read(palette, PALETTE_SIZE);
+ screen.translatePalette(palette);
+ ui.setupBGArea(palette);
+
+ // Set screen to black, and set background
+ screen._backBuffer1.blitFrom((*_journalImages)[0], Common::Point(0, 0));
+ screen.empty();
+ screen.setPalette(palette);
+
+ if (_journal.empty()) {
+ _up = _down = false;
+ } else {
+ drawJournal(0, 0);
+ }
+ // TODO
+ // Free the images
delete _journalImages;
}
+void TattooJournal::loadJournalLocations() {
+ Resources &res = *_vm->_res;
+
+ _directory.clear();
+ _locations.clear();
+
+ Common::SeekableReadStream *dir = res.load("talk.lib");
+ dir->skip(4); // Skip header
+
+ // Get the numer of entries
+ _directory.resize(dir->readUint16LE());
+ dir->seek((_directory.size() + 1) * 8, SEEK_CUR);
+
+ // Read in each entry
+ char buffer[17];
+ for (uint idx = 0; idx < _directory.size(); ++idx) {
+ dir->read(buffer, 17);
+ buffer[16] = '\0';
+
+ _directory[idx] = Common::String(buffer);
+ }
+
+ delete dir;
+
+ // Load in the locations stored in journal.txt
+ Common::SeekableReadStream *loc = res.load("journal.txt");
+
+ // Initialize locations
+ _locations.resize(100);
+ for (int idx = 0; idx < 100; ++idx)
+ _locations[idx] = "No Description";
+
+ while (loc->pos() < loc->size()) {
+ // In Rose Tattoo, each location line starts with the location
+ // number, followed by a dot, some spaces and its description
+ // in quotes
+ Common::String line = loc->readLine();
+ Common::String locNumStr;
+ int locNum = 0;
+ int i = 0;
+ Common::String locDesc;
+
+ // Get the location
+ while (Common::isDigit(line[i])) {
+ locNumStr += line[i];
+ i++;
+ }
+ locNum = atoi(locNumStr.c_str());
+
+ // Skip the dot, spaces and initial quotation mark
+ while (line[i] == ' ' || line[i] == '.' || line[i] == '\"')
+ i++;
+
+ do {
+ locDesc += line[i];
+ i++;
+ } while (line[i] != '\"');
+
+ _locations[locNum] = locDesc;
+ }
+
+ delete loc;
+}
+
+void TattooJournal::drawJournalFrame() {
+ Screen &screen = *_vm->_screen;
+
+ screen._backBuffer1.blitFrom((*_journalImages)[0], Common::Point(0, 0));
+ drawJournalControls(0);
+
+}
+
void TattooJournal::synchronize(Serializer &s) {
// TODO
}
+void TattooJournal::drawJournalControls(int mode) {
+ // TODO
+}
+
} // End of namespace Tattoo
} // End of namespace Sherlock