From 252c890bf5c60a451354cae17e6a9f90fe4a7ef6 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 20 Jun 2017 19:02:22 +0200 Subject: DIRECTOR: Add Lingo::PrimaryEventHandler --- engines/director/lingo/lingo-events.cpp | 33 +++++++++++++++++++++++++++++++++ engines/director/lingo/lingo.h | 1 + 2 files changed, 34 insertions(+) diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index 3b49121dee..e8f26c137d 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -105,6 +105,39 @@ Symbol *Lingo::getHandler(Common::String &name) { return _handlers[entityIndex]; } +void Lingo::primaryEventHandler(LEvent event) { + /* When an event occurs the message [...] is first sent to a + * primary event handler: [... if exists it is executed] and the + * event is passed on to other objects unless you explicitly stop + * the message by including the dontPassEventCommand in the script + * [D4 docs page 77] + */ + debugC(3, kDebugLingoExec, "STUB: primary event handler (%s) not implemented", _eventHandlerTypes[event]); + switch (event) { + case kEventMouseDown: + case kEventMouseUp: + case kEventKeyUp: + case kEventKeyDown: + case kEventTimeout: + // TODO + break; + default: + /* N.B.: No primary event handlers for events other than + * keyup, keydown, mouseup, mousedown, timeout + * [see: www.columbia.edu/itc/visualarts/r4110/s2001/handouts + * /03_03_Event_Hierarchy.pdf] + */ + warning("primaryEventHandler() on event other than mouseDown, mouseUp, keyUp, keyDown, timeout"); + } +#ifdef DEBUG_DONTPASSEVENT + // #define DEBUG_DONTPASSEVENT to simulate raising of the dontPassEvent flag + g_lingo->dontPassEvent = true; + debugC(3, kDebugLingoExec, "STUB: primaryEventHandler raising dontPassEvent"); +#else + debugC(3, kDebugLingoExec, "STUB: primaryEventHandler not raising dontPassEvent"); +#endif +} + void Lingo::processInputEvent(LEvent event) { // Primary Event handler // Score Script diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index b0a014db52..acb086ad50 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -193,6 +193,7 @@ private: // lingo-events.cpp private: void initEventHandlerTypes(); + void primaryEventHandler(LEvent event); void processInputEvent(LEvent event); void processFrameEvent(LEvent event); void processGenericEvent(LEvent event); -- cgit v1.2.3