From b79743b2215a7a1b018e2969b3da78bffd488fdf Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Tue, 25 Jan 2011 17:35:53 +0000 Subject: 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 --- engines/mohawk/livingbooks.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/mohawk') 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 -- cgit v1.2.3