diff options
author | Eugene Sandulenko | 2016-09-02 09:30:37 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-02 09:51:12 +0200 |
commit | 18af5ea5da5b37375dec1efa51e42e81115dc99a (patch) | |
tree | 64b7bcb3e441449055c7093333d071662233b675 /engines/director | |
parent | 82e0ad732e981d684024e9c16aa8f525412a0d1d (diff) | |
download | scummvm-rg350-18af5ea5da5b37375dec1efa51e42e81115dc99a.tar.gz scummvm-rg350-18af5ea5da5b37375dec1efa51e42e81115dc99a.tar.bz2 scummvm-rg350-18af5ea5da5b37375dec1efa51e42e81115dc99a.zip |
DIRECTOR: Initial code for Lingo keyboard handling
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/director.cpp | 1 | ||||
-rw-r--r-- | engines/director/director.h | 1 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 8 | ||||
-rw-r--r-- | engines/director/lingo/lingo-the.cpp | 4 | ||||
-rw-r--r-- | engines/director/lingo/lingo.cpp | 8 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 2 | ||||
-rw-r--r-- | engines/director/score.cpp | 5 |
7 files changed, 22 insertions, 7 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index d921e11d59..c6b51bc452 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -72,6 +72,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam SearchMan.addSubDirectoryMatching(gameDataDir, "install"); _colorDepth = 8; // FIXME. Check if it is 8-bit + _keyCode = 0; } DirectorEngine::~DirectorEngine() { diff --git a/engines/director/director.h b/engines/director/director.h index d319f476df..5a28a9e267 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -98,6 +98,7 @@ public: public: int _colorDepth; + int _keyCode; protected: virtual Common::Error run(); diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index d7b91d2839..91ab21fd6f 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -756,14 +756,14 @@ void Lingo::c_whencode() { Datum d; int start = g_lingo->_pc; int end = READ_UINT32(&(*g_lingo->_currentScript)[start]); - Common::String eventname((char *)&(*g_lingo->_currentScript)[start]); + Common::String eventname((char *)&(*g_lingo->_currentScript)[start + 1]); start += g_lingo->calcStringAlignment(eventname.c_str()); - g_lingo->define(eventname, start, 0, NULL, end); - debugC(3, kDebugLingoExec, "c_whencode([%5d][%5d], %s)", start, end, eventname.c_str()); + g_lingo->define(eventname, start, 0, NULL, end); + g_lingo->_pc = end; } @@ -833,7 +833,7 @@ void Lingo::c_call() { g_lingo->call(name, nargs); } -void Lingo::call(Common::String &name, int nargs) { +void Lingo::call(Common::String name, int nargs) { bool drop = false; Symbol *sym; diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index 7fb055174d..9751d06900 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -365,6 +365,10 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) { d.type = FLOAT; d.u.f = sqrt(id.u.f); break; + case kTheKeyCode: + d.type = INT; + d.u.i = _vm->_keyCode; + break; case kTheColorQD: d.type = INT; d.u.i = 1; diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index dbc022798d..8a084c7498 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -273,10 +273,14 @@ void Lingo::processEvent(LEvent event, int entityId) { ScriptType st = event2script(event); - if (st != kNoneScript) + if (st != kNoneScript) { executeScript(st, entityId + 1); - else + } else if (_handlers.contains(_eventHandlerTypes[event])) { + call(_eventHandlerTypes[event], 0); + } else { + warning("---- Handler %s is not set", _eventHandlerTypes[event]); debugC(8, kDebugLingoExec, "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 464e4eeaa1..05c73f9886 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -275,7 +275,7 @@ public: static void c_le(); static void c_call(); - void call(Common::String &name, int nargs); + void call(Common::String name, int nargs); static void c_procret(); diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 2d3ae798bd..69d974a21c 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -839,6 +839,11 @@ void Score::processEvents() { _lingo->processEvent(kEventMouseUp, _frames[_currentFrame]->getSpriteIDFromPos(pos)); } + + if (event.type == Common::EVENT_KEYDOWN) { + _vm->_keyCode = event.kbd.keycode; + _lingo->processEvent(kEventKeyDown, 0); + } } g_system->updateScreen(); |