diff options
-rw-r--r-- | engines/director/events.cpp | 20 | ||||
-rw-r--r-- | engines/director/lingo/lingo-events.cpp | 23 |
2 files changed, 25 insertions, 18 deletions
diff --git a/engines/director/events.cpp b/engines/director/events.cpp index f55a7c8991..81c80dcc1e 100644 --- a/engines/director/events.cpp +++ b/engines/director/events.cpp @@ -71,12 +71,7 @@ void DirectorEngine::processEvents() { sc->_currentMouseDownSpriteId = spriteId; debugC(3, kDebugEvents, "event: Button Down @(%d, %d), sprite id: %d", pos.x, pos.y, spriteId); - - if (getVersion() > 3) { - // TODO: check that this is the order of script execution! - _lingo->processEvent(kEventMouseDown, kCastScript, currentFrame->_sprites[spriteId]->_castId); - _lingo->processEvent(kEventMouseDown, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); - } + _lingo->processEvent(kEventMouseDown); if (currentFrame->_sprites[spriteId]->_moveable) { warning("Moveable"); @@ -90,18 +85,7 @@ void DirectorEngine::processEvents() { debugC(3, kDebugEvents, "event: Button Up @(%d, %d), sprite id: %d", pos.x, pos.y, spriteId); - if (getVersion() > 3) { - // TODO: check that this is the order of script execution! - _lingo->processEvent(kEventMouseUp, kCastScript, currentFrame->_sprites[spriteId]->_castId); - _lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); - } else { - // Frame script overrides sprite script - if (!currentFrame->_sprites[spriteId]->_scriptId) - _lingo->processEvent(kEventNone, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + 1024); - else - _lingo->processEvent(kEventNone, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId); - } - + _lingo->processEvent(kEventMouseUp); sc->_currentMouseDownSpriteId = 0; break; diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index 9e7f719e7f..573ee521d1 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -145,6 +145,29 @@ void Lingo::processInputEvent(LEvent event) { // Script of Cast Member // Score Script // Movie Script + Score *score = _vm->getCurrentScore(); + Frame *currentFrame = score->_frames[score->getCurrentFrame()]; + assert(currentFrame != nullptr); + uint16 spriteId = score->_currentMouseDownSpriteId; + if (event == kEventMouseDown) { + if (_vm->getVersion() > 3) { + g_lingo->processEvent(kEventMouseDown, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); + g_lingo->processEvent(kEventMouseDown, kCastScript, currentFrame->_sprites[spriteId]->_castId); + } + // TODO: Unhandled in D<3? + } else if (event == kEventMouseUp) { + if (_vm->getVersion() > 3) { + // TODO: check that this is the order of script execution! + g_lingo->processEvent(kEventMouseUp, kCastScript, currentFrame->_sprites[spriteId]->_castId); + g_lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId); + } else { + // Frame script overrides sprite script + if (!currentFrame->_sprites[spriteId]->_scriptId) + g_lingo->processEvent(kEventNone, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + 1024); + else + g_lingo->processEvent(kEventNone, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId); + } + } } void Lingo::runMovieScript(LEvent event) { |