From 5db43d641eeac219e0561cbf54b8bb2f59e6be26 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Wed, 8 Dec 2010 15:45:40 +0000 Subject: MOHAWK: Use named constants for LB opcodes, add warnings when unimplemented svn-id: r54833 --- engines/mohawk/livingbooks.cpp | 92 +++++++++++++++++++++++++++++++++--------- engines/mohawk/livingbooks.h | 34 ++++++++++++++++ 2 files changed, 106 insertions(+), 20 deletions(-) diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index 904f99e3a7..e32e0f4475 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -2129,73 +2129,125 @@ void LBItem::runScript(uint id, uint16 data, uint16 from) { } switch (entry->opcode) { - case 0xffff: - runCommand(entry->command); + case kLBOpNone: + warning("ignoring kLBOpNone (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); break; - case 1: + case kLBOpXShow: // TODO: should be setVisible(true) - not a delayed event - // when we're doing the param 1/2/3 stuff above? // and in modern LB this is perhaps just a direct target->setVisible(true).. _vm->queueDelayedEvent(DelayedEvent(this, kLBDelayedEventSetNotVisible)); break; - case 2: + case kLBOpTogglePlay: target->togglePlaying(false); break; - case 3: + case kLBOpSetNotVisible: target->setVisible(false); break; - case 4: + case kLBOpSetVisible: target->setVisible(true); break; - case 5: + case kLBOpDestroy: target->destroySelf(); break; - case 6: - target->seek(1); + case kLBOpRewind: + target->seek(0); break; - case 7: + case kLBOpStop: target->stop(); break; - case 8: + case kLBOpDisable: target->setEnabled(false); break; - case 9: + case kLBOpEnable: target->setEnabled(true); break; - case 0xb: + case kLBOpGlobalSetNotVisible: target->setGlobalVisible(false); break; - case 0xc: + case kLBOpGlobalSetVisible: target->setGlobalVisible(true); break; - case 0xd: + case kLBOpGlobalDisable: target->setGlobalEnabled(false); break; - case 0xe: + case kLBOpGlobalEnable: target->setGlobalEnabled(true); break; - case 0xf: + case kLBOpSeekToEnd: target->seek(0xFFFF); break; + case kLBOpMute: + case kLBOpUnmute: + // FIXME + warning("ignoring kLBOpMute/Unmute (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpLoad: + case kLBOpPreload: + case kLBOpUnload: + // FIXME + warning("ignoring kLBOpLoad/Preload/Unload (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpSeekToPrev: + case kLBOpSeekToNext: + // FIXME + warning("ignoring kLBOpSeekToPrev/Next (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpDragBegin: + case kLBOpDragEnd: + // FIXME + warning("ignoring kLBOpDragBegin/End (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpScriptDisable: + case kLBOpScriptEnable: + // FIXME + warning("ignoring kLBOpScriptDisable/Enable (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpUnknown1C: + // FIXME + warning("ignoring kLBOpUnknown1C (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpSendExpression: + // FIXME + warning("ignoring kLBOpSendExpression (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + + case kLBOpRunCommand: + runCommand(entry->command); + break; + default: - // TODO - warning("Ignoring script entry (type 0x%04x, event 0x%04x, opcode 0x%04x, param 0x%04x)", - entry->type, entry->event, entry->opcode, entry->param); + error("Unknown script opcode (type 0x%04x, event 0x%04x, opcode 0x%04x, param 0x%04x, target '%s')", + entry->type, entry->event, entry->opcode, entry->param, target->_desc.c_str()); } } } diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 9f33e10054..ead232ddb6 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -145,6 +145,40 @@ enum { kLBUnknown80 = 0x80 // unused? }; +enum { + kLBOpNone = 0x0, + kLBOpXShow = 0x1, + kLBOpTogglePlay = 0x2, + kLBOpSetNotVisible = 0x3, + kLBOpSetVisible = 0x4, + kLBOpDestroy = 0x5, + kLBOpRewind = 0x6, + kLBOpStop = 0x7, + kLBOpDisable = 0x8, + kLBOpEnable = 0x9, + // (no 0xa) + kLBOpGlobalSetNotVisible = 0xb, + kLBOpGlobalSetVisible = 0xc, + kLBOpGlobalDisable = 0xd, + kLBOpGlobalEnable = 0xe, + kLBOpSeekToEnd = 0xf, + // (no 0x10) + kLBOpMute = 0x11, + kLBOpUnmute = 0x12, + kLBOpLoad = 0x13, + kLBOpPreload = 0x14, + kLBOpUnload = 0x15, + kLBOpSeekToNext = 0x16, + kLBOpSeekToPrev = 0x17, + kLBOpDragBegin = 0x18, + kLBOpDragEnd = 0x19, + kLBOpScriptDisable = 0x1a, + kLBOpScriptEnable = 0x1b, + kLBOpUnknown1C = 0x1c, + kLBOpSendExpression = 0x1d, + kLBOpRunCommand = 0xffff +}; + enum { kLBNotifyGUIAction = 1, kLBNotifyGoToControls = 2, -- cgit v1.2.3