DIRECTOR: LINGO: Passing channels Id for immediate scripts

This commit is contained in:
Eugene Sandulenko 2020-05-03 19:27:18 +02:00
parent f48ab6afb8
commit 366e9a3147
3 changed files with 7 additions and 4 deletions

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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;