DIRECTOR: LINGO: Implement kTheLastKey function

This commit is contained in:
Nathanael Gentry 2020-04-12 00:27:49 -04:00 committed by Eugene Sandulenko
parent de24b461b9
commit c5651d67a6
4 changed files with 7 additions and 0 deletions

View File

@ -129,6 +129,7 @@ void DirectorEngine::processEvents() {
debugC(1, kDebugEvents, "processEvents(): keycode: %d", _keyCode);
}
sc->_lastKeyTime = g_director->getMacTicks();
_lingo->processEvent(kEventKeyDown);
break;

View File

@ -429,6 +429,10 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
case kTheLastFrame:
d.type = INT;
d.u.i = _vm->getCurrentScore()->_frames.size() - 1;
break;
case kTheLastKey:
d.type = INT;
d.u.i = _vm->getMacTicks() - _vm->getCurrentScore()->_lastKeyTime;
break;
default:
warning("Lingo::getTheEntity(): Unprocessed getting field \"%s\" of entity %s", field2str(field), entity2str(entity));

View File

@ -76,6 +76,7 @@ Score::Score(DirectorEngine *vm) {
_soundManager = _vm->getSoundManager();
_currentMouseDownSpriteId = 0;
_mouseIsDown = false;
_lastKeyTime = _vm->getMacTicks();
// FIXME: TODO: Check whether the original truely does it
if (_vm->getVersion() <= 3) {

View File

@ -142,6 +142,7 @@ public:
Common::Rect _movieRect;
uint16 _currentMouseDownSpriteId;
bool _mouseIsDown;
uint32 _lastKeyTime;
bool _stopPlay;
uint32 _nextFrameTime;