aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Milburn2011-01-25 17:35:53 +0000
committerAlyssa Milburn2011-01-25 17:35:53 +0000
commitb79743b2215a7a1b018e2969b3da78bffd488fdf (patch)
tree1ccc9adea6e56cb1ba40fbad2775def0f478ab6d
parenta3baa1874a90093c3cbaa5abdbe3a82c131c6324 (diff)
downloadscummvm-rg350-b79743b2215a7a1b018e2969b3da78bffd488fdf.tar.gz
scummvm-rg350-b79743b2215a7a1b018e2969b3da78bffd488fdf.tar.bz2
scummvm-rg350-b79743b2215a7a1b018e2969b3da78bffd488fdf.zip
MOHAWK: Read kLBEventNotified data after commands.
This fixes some pages in Maggie's Farmyard Adventure, at least. Thanks to clone2727 for testing this. svn-id: r55538
-rw-r--r--engines/mohawk/livingbooks.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index d2c539cc06..b7e8a7b71a 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -1779,15 +1779,6 @@ LBScriptEntry *LBItem::parseScriptEntry(uint16 type, uint16 &size, Common::Seeka
entry->newUnknown, entry->newMode, entry->newPage, entry->newSubpage);
size -= 8;
}
- if (entry->event == kLBEventNotified) {
- if (size < 4)
- error("not enough bytes (%d) in kLBEventNotified, opcode 0x%04x", size, entry->opcode);
- entry->matchFrom = stream->readUint16();
- entry->matchNotify = stream->readUint16();
- debug(4, "kLBEventNotified: unknowns %04x, %04x",
- entry->matchFrom, entry->matchNotify);
- size -= 4;
- }
if (entry->opcode == kLBOpSendExpression) {
if (size < 4)
error("not enough bytes (%d) in kLBOpSendExpression, event 0x%04x", size, entry->event);
@@ -1814,7 +1805,7 @@ LBScriptEntry *LBItem::parseScriptEntry(uint16 type, uint16 &size, Common::Seeka
if (msgId != kLBCommand)
error("expected a command in script entry, got 0x%04x", msgId);
- if (msgLen != size && !conditionTag)
+ if (msgLen != size - (entry->event == kLBEventNotified ? 4 : 0) && !conditionTag)
error("script entry msgLen %d is not equal to size %d", msgLen, size);
Common::String command = _vm->readString(stream);
@@ -1827,6 +1818,15 @@ LBScriptEntry *LBItem::parseScriptEntry(uint16 type, uint16 &size, Common::Seeka
entry->command = command;
debug(4, "script entry command '%s'", command.c_str());
}
+ if (entry->event == kLBEventNotified) {
+ if (size < 4)
+ error("not enough bytes (%d) in kLBEventNotified, opcode 0x%04x", size, entry->opcode);
+ entry->matchFrom = stream->readUint16();
+ entry->matchNotify = stream->readUint16();
+ debug(4, "kLBEventNotified: unknowns %04x, %04x",
+ entry->matchFrom, entry->matchNotify);
+ size -= 4;
+ }
if (isSubentry) {
// TODO: subentries may be aligned, so this check is a bit too relaxed