From 7e0899f5d4d3876da5aa9a6b724c16e2e08f257b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 25 Aug 2016 17:45:44 +0200 Subject: DIRECTOR: Start executing frame scripts --- engines/director/lingo/lingo.cpp | 22 +++++++++++++++++++++- engines/director/lingo/lingo.h | 2 ++ engines/director/score.h | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 529738043c..3b0456d956 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -248,11 +248,31 @@ void Lingo::executeScript(ScriptType type, uint16 id) { cleanLocalVars(); } +ScriptType Lingo::event2script(LEvent ev) { + if (_vm->getVersion() < 4) { + switch (ev) { + //case kEventStartMovie: // We are precompiling it now + // return kMovieScript; + case kEventEnterFrame: + return kFrameScript; + default: + return kNoneScript; + } + } + + return kNoneScript; +} + void Lingo::processEvent(LEvent event, int entityId) { if (!_eventHandlerTypes.contains(event)) error("processEvent: Unknown event %d for entity %d", event, entityId); - debug(2, "STUB: processEvent(%s) for %d", _eventHandlerTypes[event], entityId); + ScriptType st = event2script(event); + + if (st != kNoneScript) + executeScript(st, entityId + 1); + else + debug(2, "STUB: processEvent(%s) for %d", _eventHandlerTypes[event], entityId); } int Lingo::alignTypes(Datum &d1, Datum &d2) { diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index a921f49e4b..4dd00417b8 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -176,6 +176,8 @@ public: void printStack(const char *s); Common::String decodeInstruction(int pc, int *newPC = NULL); + ScriptType event2script(LEvent ev); + void processEvent(LEvent event, int entityId); void initBuiltIns(); diff --git a/engines/director/score.h b/engines/director/score.h index 11f885d492..8ddbed0bd5 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -58,6 +58,7 @@ enum ScriptType { kMovieScript = 0, kSpriteScript = 1, kFrameScript = 2, + kNoneScript = -1, kMaxScriptType = 2 }; -- cgit v1.2.3