DIRECTOR: Start executing frame scripts

This commit is contained in:
Eugene Sandulenko 2016-08-25 17:45:44 +02:00
parent b3e24c2518
commit 7e0899f5d4
3 changed files with 24 additions and 1 deletions

View File

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

View File

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

View File

@ -58,6 +58,7 @@ enum ScriptType {
kMovieScript = 0,
kSpriteScript = 1,
kFrameScript = 2,
kNoneScript = -1,
kMaxScriptType = 2
};