mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 20:01:25 +00:00
DIRECTOR: implement handling timeOut related values.
This commit is contained in:
parent
5466511dce
commit
e24d00a81b
@ -44,13 +44,22 @@ bool DirectorEngine::processEvents(bool captureClick) {
|
||||
debugC(3, kDebugEvents, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
|
||||
|
||||
// update and register timeOut event
|
||||
if (g_director->getMacTicks() - g_director->getCurrentMovie()->_lastTimeOut >= g_director->getCurrentMovie()->_timeOutLength) {
|
||||
if (getMacTicks() - g_director->getCurrentMovie()->_lastTimeOut >= g_director->getCurrentMovie()->_timeOutLength) {
|
||||
g_director->getCurrentMovie()->registerEvent(kEventTimeout);
|
||||
g_director->getCurrentMovie()->_lastTimeOut = g_director->getMacTicks();
|
||||
g_director->getCurrentMovie()->_lastTimeOut = getMacTicks();
|
||||
}
|
||||
|
||||
if (g_director->getCurrentMovie()->_timeOutPlay && g_director->_playbackPaused)
|
||||
g_director->getCurrentMovie()->_lastTimeOut = getMacTicks();
|
||||
|
||||
Common::Event event;
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
// update timeOut related values
|
||||
if (event.type == Common::EVENT_LBUTTONDOWN && g_director->getCurrentMovie()->_timeOutMouse)
|
||||
g_director->getCurrentMovie()->_lastTimeOut = getMacTicks();
|
||||
if (event.type == Common::EVENT_KEYDOWN && g_director->getCurrentMovie()->_timeOutKeyDown)
|
||||
g_director->getCurrentMovie()->_lastTimeOut = getMacTicks();
|
||||
|
||||
if (!_wm->processEvent(event)) {
|
||||
// We only want to handle these events if the event
|
||||
// wasn't handled by the window manager.
|
||||
|
@ -841,7 +841,8 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
|
||||
d = getTheTime(field);
|
||||
break;
|
||||
case kTheTimeoutKeyDown:
|
||||
getTheEntitySTUB(kTheTimeoutKeyDown);
|
||||
d.type = INT;
|
||||
d.u.i = g_director->getCurrentMovie()->_timeOutKeyDown;
|
||||
break;
|
||||
case kTheTimeoutLapsed:
|
||||
d.type = INT;
|
||||
@ -852,10 +853,12 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
|
||||
d.u.i = g_director->getCurrentMovie()->_timeOutLength;
|
||||
break;
|
||||
case kTheTimeoutMouse:
|
||||
getTheEntitySTUB(kTheTimeoutMouse);
|
||||
d.type = INT;
|
||||
d.u.i = g_director->getCurrentMovie()->_timeOutMouse;
|
||||
break;
|
||||
case kTheTimeoutPlay:
|
||||
getTheEntitySTUB(kTheTimeoutPlay);
|
||||
d.type = INT;
|
||||
d.u.i = g_director->getCurrentMovie()->_timeOutPlay;
|
||||
break;
|
||||
case kTheTimeoutScript:
|
||||
d.type = STRING;
|
||||
@ -1078,7 +1081,7 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
|
||||
setTheEntitySTUB(kTheSwitchColorDepth);
|
||||
break;
|
||||
case kTheTimeoutKeyDown:
|
||||
setTheEntitySTUB(kTheTimeoutKeyDown);
|
||||
g_director->getCurrentMovie()->_timeOutKeyDown = d.asInt();
|
||||
break;
|
||||
case kTheTimeoutLapsed:
|
||||
// timeOutLapsed can be set in D4, but can't in D3. see D3.1 interactivity manual p312 and D4 dictionary p296.
|
||||
@ -1088,10 +1091,10 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
|
||||
g_director->getCurrentMovie()->_timeOutLength = d.asInt();
|
||||
break;
|
||||
case kTheTimeoutMouse:
|
||||
setTheEntitySTUB(kTheTimeoutMouse);
|
||||
g_director->getCurrentMovie()->_timeOutMouse = d.asInt();
|
||||
break;
|
||||
case kTheTimeoutPlay:
|
||||
setTheEntitySTUB(kTheTimeoutPlay);
|
||||
g_director->getCurrentMovie()->_timeOutPlay = d.asInt();
|
||||
break;
|
||||
case kTheTimeoutScript:
|
||||
movie->setPrimaryEventHandler(kEventTimeout, d.asString());
|
||||
|
@ -83,6 +83,10 @@ Movie::Movie(Window *window) {
|
||||
|
||||
_lastTimeOut = _lastEventTime;
|
||||
_timeOutLength = 10800; // D4 dictionary p297, default value is 3minutes
|
||||
// default value of keydown and mouse is true, for timeOutPlay is false. check D4 dictionary p297
|
||||
_timeOutKeyDown = true;
|
||||
_timeOutMouse = true;
|
||||
_timeOutPlay = false;
|
||||
}
|
||||
|
||||
Movie::~Movie() {
|
||||
|
@ -164,6 +164,9 @@ public:
|
||||
|
||||
uint _lastTimeOut;
|
||||
uint _timeOutLength;
|
||||
bool _timeOutKeyDown;
|
||||
bool _timeOutMouse;
|
||||
bool _timeOutPlay;
|
||||
|
||||
private:
|
||||
Window *_window;
|
||||
|
Loading…
Reference in New Issue
Block a user