WINTERMUTE: Don't scroll as fast as the scripts actually ask for.

This commit is contained in:
Einar Johan Trøan Sømåen 2013-01-24 16:12:35 +01:00
parent e829a57762
commit a1a6354687

View File

@ -933,6 +933,10 @@ bool AdScene::traverseNodes(bool doUpdate) {
// adjust horizontal scroll
if (_gameRef->_timer - _lastTimeH >= _scrollTimeH) {
int timesMissed = (_gameRef->_timer - _lastTimeH) / _scrollTimeH;
// Cap the amount of catch-up to avoid jittery characters.
if (timesMissed > 2) {
timesMissed = 2;
}
_lastTimeH = _gameRef->_timer;
if (_offsetLeft < _targetOffsetLeft) {
_offsetLeft += _scrollPixelsH * timesMissed;
@ -946,6 +950,10 @@ bool AdScene::traverseNodes(bool doUpdate) {
// adjust vertical scroll
if (_gameRef->_timer - _lastTimeV >= _scrollTimeV) {
int timesMissed = (_gameRef->_timer - _lastTimeV) / _scrollTimeV;
// Cap the amount of catch-up to avoid jittery characters.
if (timesMissed > 2) {
timesMissed = 2;
}
_lastTimeV = _gameRef->_timer;
if (_offsetTop < _targetOffsetTop) {
_offsetTop += _scrollPixelsV * timesMissed;