mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 15:09:47 +00:00
DIRECTOR: Initial code for Lingo keyboard handling
This commit is contained in:
parent
82e0ad732e
commit
18af5ea5da
@ -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() {
|
||||
|
@ -98,6 +98,7 @@ public:
|
||||
|
||||
public:
|
||||
int _colorDepth;
|
||||
int _keyCode;
|
||||
|
||||
protected:
|
||||
virtual Common::Error run();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user