From 366e9a314754ebc69ea7a4d1b52763b1e660a15c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 3 May 2020 19:27:18 +0200 Subject: [PATCH] DIRECTOR: LINGO: Passing channels Id for immediate scripts --- engines/director/lingo/lingo-events.cpp | 3 ++- engines/director/lingo/lingo.cpp | 5 +++-- engines/director/lingo/lingo.h | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index c3f7840742a..01068a43590 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -303,7 +303,7 @@ void Lingo::processEvent(LEvent event) { _dontPassEvent = false; } -void Lingo::processEvent(LEvent event, ScriptType st, int entityId) { +void Lingo::processEvent(LEvent event, ScriptType st, int entityId, int channelId) { if (entityId < 0) return; @@ -313,6 +313,7 @@ void Lingo::processEvent(LEvent event, ScriptType st, int entityId) { debugC(9, kDebugEvents, "Lingo::processEvent(%s, %s, %d)", _eventHandlerTypes[event], scriptType2str(st), entityId); _currentEntityId = entityId; + _currentChannelId = channelId; if (!_eventHandlerTypes.contains(event)) error("processEvent: Unknown event %d for entity %d", event, entityId); diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 477589810c0..1372bd40c02 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -74,6 +74,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { _currentScriptFunction = 0; _currentEntityId = 0; + _currentChannelId = -1; _pc = 0; _returning = false; _nextRepeat = false; @@ -694,9 +695,9 @@ void Lingo::executeImmediateScripts(Frame *frame) { // From D5 only explicit event handlers are processed // Before that you could specify commands which will be executed on mouse up if (_vm->getVersion() < 5) - g_lingo->processEvent(kEventNone, kFrameScript, frame->_sprites[i]->_scriptId); + g_lingo->processEvent(kEventNone, kFrameScript, frame->_sprites[i]->_scriptId, i); else - g_lingo->processEvent(kEventMouseUp, kFrameScript, frame->_sprites[i]->_scriptId); + g_lingo->processEvent(kEventMouseUp, kFrameScript, frame->_sprites[i]->_scriptId, i); } } } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 44cccd75d74..74bf83d7cdb 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -202,7 +202,7 @@ private: void processGenericEvent(LEvent event); void runMovieScript(LEvent event); void processSpriteEvent(LEvent event); - void processEvent(LEvent event, ScriptType st, int entityId); + void processEvent(LEvent event, ScriptType st, int entityId, int channelId = -1); public: ScriptContext *getScriptContext(ScriptType type, uint16 id); @@ -311,6 +311,7 @@ public: public: ScriptType _currentScriptType; uint16 _currentEntityId; + int _currentChannelId; ScriptContext *_currentScriptContext; uint16 _currentScriptFunction; ScriptData *_currentScript;