aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/livingbooks.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-11-27 21:01:46 +0100
committerAlyssa Milburn2011-11-27 21:02:13 +0100
commit1e9ea0849516c545ce9f6f943f154c31597be8ef (patch)
treeda9416de903cf98dce1073baae1a043b7bd76a66 /engines/mohawk/livingbooks.cpp
parent3f30105fff58849dc24dadbf04d945bfb75916a4 (diff)
downloadscummvm-rg350-1e9ea0849516c545ce9f6f943f154c31597be8ef.tar.gz
scummvm-rg350-1e9ea0849516c545ce9f6f943f154c31597be8ef.tar.bz2
scummvm-rg350-1e9ea0849516c545ce9f6f943f154c31597be8ef.zip
MOHAWK: Fix LBCode seek/seekToFrame.
Diffstat (limited to 'engines/mohawk/livingbooks.cpp')
-rw-r--r--engines/mohawk/livingbooks.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index d0c8bf3515..486ecb52eb 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -1859,6 +1859,35 @@ void LBAnimation::seek(uint16 pos) {
}
}
+void LBAnimation::seekToTime(uint32 time) {
+ _lastTime = 0;
+ _currentFrame = 0;
+
+ if (_currentSound != 0xffff) {
+ _vm->_sound->stopSound(_currentSound);
+ _currentSound = 0xffff;
+ }
+
+ for (uint32 i = 0; i < _nodes.size(); i++)
+ _nodes[i]->reset();
+
+ uint32 elapsed = 0;
+ while (elapsed <= time) {
+ bool ranSomething = false;
+ // nodes don't wait while seeking
+ for (uint32 i = 0; i < _nodes.size(); i++)
+ ranSomething |= (_nodes[i]->update(true) != kLBNodeDone);
+
+ elapsed += _tempo;
+ _currentFrame++;
+
+ if (!ranSomething) {
+ _running = false;
+ break;
+ }
+ }
+}
+
void LBAnimation::stop() {
_running = false;
if (_currentSound != 0xffff) {
@@ -3612,6 +3641,10 @@ void LBAnimationItem::seek(uint16 pos) {
_anim->seek(pos);
}
+void LBAnimationItem::seekToTime(uint32 time) {
+ _anim->seekToTime(time);
+}
+
void LBAnimationItem::startPhase(uint phase) {
if (phase == _phase)
seek(1);