diff options
author | Walter van Niftrik | 2009-05-10 22:25:43 +0000 |
---|---|---|
committer | Walter van Niftrik | 2009-05-10 22:25:43 +0000 |
commit | 4d55f8b8d7013095edc17b5d0771a37216dfca65 (patch) | |
tree | 601134b874c6599da96020ebd4e8562687ef20d5 /engines/sci/engine/message.cpp | |
parent | 6d56924bb1854ee9592c4223a4746a32038ade6d (diff) | |
download | scummvm-rg350-4d55f8b8d7013095edc17b5d0771a37216dfca65.tar.gz scummvm-rg350-4d55f8b8d7013095edc17b5d0771a37216dfca65.tar.bz2 scummvm-rg350-4d55f8b8d7013095edc17b5d0771a37216dfca65.zip |
SCI: Minor changes to Message(). Some of the text in KQ6 floppy should now be visible.
svn-id: r40441
Diffstat (limited to 'engines/sci/engine/message.cpp')
-rw-r--r-- | engines/sci/engine/message.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index e6d2a560cc..fd924891a4 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -31,7 +31,8 @@ namespace Sci { void MessageState::initIndexRecordCursor() { _engineCursor.resource_beginning = _currentResource->data; _engineCursor.index_record = _indexRecords; - _engineCursor.index = 1; + _engineCursor.index = 0; + _lastMessage.seq = 0; } void MessageState::parse(IndexRecordCursor *cursor, MessageTuple *t) { @@ -48,30 +49,37 @@ void MessageState::parse(IndexRecordCursor *cursor, MessageTuple *t) { int MessageState::getMessage(MessageTuple *t) { MessageTuple looking_at; - int found = 0; initIndexRecordCursor(); - do { + while (_engineCursor.index != _recordCount) { parse(&_engineCursor, &looking_at); if (t->noun == looking_at.noun && t->verb == looking_at.verb && t->cond == looking_at.cond && t->seq == looking_at.seq) - found = 1; - } while (!found && getNext()); + return 1; + + _engineCursor.index_record += ((_version == 2101) ? 4 : 11); + _engineCursor.index++; + } // FIXME: Recursion not handled yet - return found; + return 0; } int MessageState::getNext() { if (_engineCursor.index == _recordCount) return 0; - _engineCursor.index_record += ((_version == 2101) ? 4 : 11); - _engineCursor.index ++; - return 1; + + MessageTuple mesg; + parse(&_engineCursor, &mesg); + + if (_lastMessage.seq == mesg.seq - 1) + return 1; + + return 0; } int MessageState::getTalker() { @@ -81,7 +89,10 @@ int MessageState::getTalker() { void MessageState::getText(char *buffer) { int offset = READ_LE_UINT16(_engineCursor.index_record + ((_version == 2101) ? 2 : 5)); char *stringptr = (char *)_engineCursor.resource_beginning + offset; + parse(&_engineCursor, &_lastMessage); strcpy(buffer, stringptr); + _engineCursor.index_record += ((_version == 2101) ? 4 : 11); + _engineCursor.index++; } int MessageState::getLength() { |