Skip to content

Commit

Permalink
PEGASUS: Update timer code a bit to make it friendlier for movies
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Sep 20, 2011
1 parent 6ed2679 commit d29e505
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions engines/pegasus/timers.cpp
Expand Up @@ -223,28 +223,30 @@ void TimeBase::checkCallBacks() {

// TODO: Update the slaves?

Common::Rational time = getTime();

// Check if we've triggered any callbacks
for (TimeBaseCallBack *runner = _callBackList; runner != 0; runner = runner->_nextCallBack) {
if (runner->_type == kCallBackAtTime && runner->_trigger == kTriggerTimeFwd) {
if (_time >= (runner->_param2 * _preferredScale / runner->_param3) && getRate() > 0)
if (time >= (runner->_param2 * _preferredScale / runner->_param3) && getRate() > 0)
runner->callBack();
} else if (runner->_type == kCallBackAtExtremes) {
if (runner->_trigger == kTriggerAtStop) {
if (_time == stopTime)
if (time == stopTime)
runner->callBack();
} else if (runner->_trigger == kTriggerAtStart) {
if (_time == startTime)
if (time == startTime)
runner->callBack();
}
}
}

// Loop if necessary
if (getFlags() & kLoopTimeBase) {
if (_time == startTime)
_time = stopTime;
else if (_time == stopTime)
_time = startTime;
if (time == startTime)
setTime(_stopTime, _stopScale);
else if (time == stopTime)
setTime(_startTime, _startScale);
}
}

Expand Down
2 changes: 1 addition & 1 deletion engines/pegasus/timers.h
Expand Up @@ -102,7 +102,7 @@ friend class TimeBaseCallBack;
void disposeAllCallBacks();

// ScummVM's API additions (to replace the need for actual timers)
void checkCallBacks();
virtual void checkCallBacks();

protected:
void addCallBack(TimeBaseCallBack *);
Expand Down

0 comments on commit d29e505

Please sign in to comment.