aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/ad
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2013-04-18 12:10:40 +0200
committerEinar Johan Trøan Sømåen2013-04-18 12:10:40 +0200
commit8f25b651e8fc05dc29e6ea5fff5eba1c8df78697 (patch)
tree14bd6bbe7177e586f55c2f83dc458d6508d9e6cc /engines/wintermute/ad
parent7ee757366b9aee0e6a59669d263e29b5fe20278e (diff)
downloadscummvm-rg350-8f25b651e8fc05dc29e6ea5fff5eba1c8df78697.tar.gz
scummvm-rg350-8f25b651e8fc05dc29e6ea5fff5eba1c8df78697.tar.bz2
scummvm-rg350-8f25b651e8fc05dc29e6ea5fff5eba1c8df78697.zip
WINTERMUTE: Split the timers from BaseGame into a separate class.
Diffstat (limited to 'engines/wintermute/ad')
-rw-r--r--engines/wintermute/ad/ad_actor.cpp2
-rw-r--r--engines/wintermute/ad/ad_entity.cpp2
-rw-r--r--engines/wintermute/ad/ad_item.cpp2
-rw-r--r--engines/wintermute/ad/ad_object.cpp2
-rw-r--r--engines/wintermute/ad/ad_scene.cpp12
-rw-r--r--engines/wintermute/ad/ad_sentence.cpp6
6 files changed, 13 insertions, 13 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
index d0d04764df..9879cc9f40 100644
--- a/engines/wintermute/ad/ad_actor.cpp
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -752,7 +752,7 @@ bool AdActor::update() {
_tempSprite2 = _sentence->_currentSprite;
}
- bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
+ bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp
index 259b68f291..6e47d0f072 100644
--- a/engines/wintermute/ad/ad_entity.cpp
+++ b/engines/wintermute/ad/ad_entity.cpp
@@ -627,7 +627,7 @@ bool AdEntity::update() {
_tempSprite2 = _sentence->_currentSprite;
}
- bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
+ bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp
index 8534956120..578105105c 100644
--- a/engines/wintermute/ad/ad_item.cpp
+++ b/engines/wintermute/ad/ad_item.cpp
@@ -378,7 +378,7 @@ bool AdItem::update() {
_tempSprite2 = _sentence->_currentSprite;
}
- bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
+ bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp
index 5a61184179..9026b2849c 100644
--- a/engines/wintermute/ad/ad_object.cpp
+++ b/engines/wintermute/ad/ad_object.cpp
@@ -904,7 +904,7 @@ void AdObject::talk(const char *text, const char *sound, uint32 duration, const
_sentence->setStances(stances);
_sentence->_duration = duration;
_sentence->_align = Align;
- _sentence->_startTime = _gameRef->_timer;
+ _sentence->_startTime = _gameRef->getTimer()->getTime();
_sentence->_currentStance = -1;
_sentence->_font = _font == nullptr ? _gameRef->getSystemFont() : _font;
_sentence->_freezable = _freezable;
diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp
index f7a6fdc7f4..699ef0685d 100644
--- a/engines/wintermute/ad/ad_scene.cpp
+++ b/engines/wintermute/ad/ad_scene.cpp
@@ -931,13 +931,13 @@ bool AdScene::traverseNodes(bool doUpdate) {
if (_autoScroll) {
// adjust horizontal scroll
- if (_gameRef->_timer - _lastTimeH >= _scrollTimeH) {
- int timesMissed = (_gameRef->_timer - _lastTimeH) / _scrollTimeH;
+ if (_gameRef->getTimer()->getTime() - _lastTimeH >= _scrollTimeH) {
+ int timesMissed = (_gameRef->getTimer()->getTime() - _lastTimeH) / _scrollTimeH;
// Cap the amount of catch-up to avoid jittery characters.
if (timesMissed > 2) {
timesMissed = 2;
}
- _lastTimeH = _gameRef->_timer;
+ _lastTimeH = _gameRef->getTimer()->getTime();
if (_offsetLeft < _targetOffsetLeft) {
_offsetLeft += _scrollPixelsH * timesMissed;
_offsetLeft = MIN(_offsetLeft, _targetOffsetLeft);
@@ -948,13 +948,13 @@ bool AdScene::traverseNodes(bool doUpdate) {
}
// adjust vertical scroll
- if (_gameRef->_timer - _lastTimeV >= _scrollTimeV) {
- int timesMissed = (_gameRef->_timer - _lastTimeV) / _scrollTimeV;
+ if (_gameRef->getTimer()->getTime() - _lastTimeV >= _scrollTimeV) {
+ int timesMissed = (_gameRef->getTimer()->getTime() - _lastTimeV) / _scrollTimeV;
// Cap the amount of catch-up to avoid jittery characters.
if (timesMissed > 2) {
timesMissed = 2;
}
- _lastTimeV = _gameRef->_timer;
+ _lastTimeV = _gameRef->getTimer()->getTime();
if (_offsetTop < _targetOffsetTop) {
_offsetTop += _scrollPixelsV * timesMissed;
_offsetTop = MIN(_offsetTop, _targetOffsetTop);
diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp
index 69101fef7a..9192b74c4e 100644
--- a/engines/wintermute/ad/ad_sentence.cpp
+++ b/engines/wintermute/ad/ad_sentence.cpp
@@ -314,9 +314,9 @@ bool AdSentence::update(TDirection dir) {
/*
if (_sound) CurrentTime = _sound->GetPositionTime();
- else CurrentTime = _gameRef->_timer - _startTime;
+ else CurrentTime = _gameRef->getTimer()->getTime() - _startTime;
*/
- currentTime = _gameRef->_timer - _startTime;
+ currentTime = _gameRef->getTimer()->getTime() - _startTime;
bool talkNodeFound = false;
for (uint32 i = 0; i < _talkDef->_nodes.size(); i++) {
@@ -355,7 +355,7 @@ bool AdSentence::update(TDirection dir) {
//////////////////////////////////////////////////////////////////////////
bool AdSentence::canSkip() {
// prevent accidental sentence skipping (TODO make configurable)
- return (_gameRef->_timer - _startTime) > 300;
+ return (_gameRef->getTimer()->getTime() - _startTime) > 300;
}
} // end of namespace Wintermute