aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorAlyssa Milburn2010-11-30 14:41:27 +0000
committerAlyssa Milburn2010-11-30 14:41:27 +0000
commit868e39c29a269034a00c7997e1f491231b10b8ce (patch)
tree23ac97beea2dfcc4ab04c25a33c44a0f7b481249 /engines/mohawk
parent8009a86c29eed96f54a7adc56394717bee2c7e4c (diff)
downloadscummvm-rg350-868e39c29a269034a00c7997e1f491231b10b8ce.tar.gz
scummvm-rg350-868e39c29a269034a00c7997e1f491231b10b8ce.tar.bz2
scummvm-rg350-868e39c29a269034a00c7997e1f491231b10b8ce.zip
MOHAWK: fix LB playback seek behaviour
svn-id: r54675
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/livingbooks.cpp27
-rw-r--r--engines/mohawk/livingbooks.h10
2 files changed, 19 insertions, 18 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 9fbf99a790..d51e06890e 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -1622,7 +1622,7 @@ void LBItem::update() {
if (_nextTime == 0 || _nextTime > (uint32)(_vm->_system->getMillis() / 16))
return;
- if (togglePlaying(_playing)) {
+ if (togglePlaying(_playing, true)) {
_nextTime = 0;
} else if (_loops == 0 && _timingMode == 2) {
debug(9, "Looping in update()");
@@ -1647,15 +1647,14 @@ void LBItem::handleMouseUp(Common::Point pos) {
runScript(kLBActionMouseUp);
}
-bool LBItem::togglePlaying(bool playing) {
+bool LBItem::togglePlaying(bool playing, bool restart) {
if (playing) {
_vm->queueDelayedEvent(DelayedEvent(this, kLBDone));
return true;
}
if (!_neverEnabled && _enabled && !_playing) {
- _playing = togglePlaying(true);
+ _playing = togglePlaying(true, restart);
if (_playing) {
- seek(1); // TODO: this is not good in many situations
_nextTime = 0;
_startTime = _vm->_system->getMillis() / 16;
@@ -1689,7 +1688,7 @@ void LBItem::done(bool onlyNotify) {
// TODO: does drag box need adjusting?
}
- if (_loops && _loops--) {
+ if (_loops && --_loops) {
debug(9, "Real looping (now 0x%04x left)", _loops);
setNextTime(_delayMin, _delayMax, _startTime);
} else
@@ -1876,9 +1875,9 @@ LBSoundItem::~LBSoundItem() {
_vm->_sound->stopSound(_resourceId);
}
-bool LBSoundItem::togglePlaying(bool playing) {
+bool LBSoundItem::togglePlaying(bool playing, bool restart) {
if (!playing)
- return LBItem::togglePlaying(playing);
+ return LBItem::togglePlaying(playing, restart);
_vm->_sound->stopSound(_resourceId);
@@ -1944,11 +1943,11 @@ bool LBGroupItem::contains(Common::Point point) {
return false;
}
-bool LBGroupItem::togglePlaying(bool playing) {
+bool LBGroupItem::togglePlaying(bool playing, bool restart) {
for (uint i = 0; i < _groupEntries.size(); i++) {
LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
if (item)
- item->togglePlaying(playing);
+ item->togglePlaying(playing, restart);
}
return false;
@@ -2176,9 +2175,9 @@ void LBLiveTextItem::handleMouseDown(Common::Point pos) {
return LBItem::handleMouseDown(pos);
}
-bool LBLiveTextItem::togglePlaying(bool playing) {
+bool LBLiveTextItem::togglePlaying(bool playing, bool restart) {
if (!playing)
- return LBItem::togglePlaying(playing);
+ return LBItem::togglePlaying(playing, restart);
if (_neverEnabled || !_enabled)
return _running;
@@ -2308,9 +2307,11 @@ void LBAnimationItem::update() {
LBItem::update();
}
-bool LBAnimationItem::togglePlaying(bool playing) {
+bool LBAnimationItem::togglePlaying(bool playing, bool restart) {
if (playing) {
if (!_neverEnabled && _enabled) {
+ if (restart)
+ seek(1);
_running = true;
_anim->start();
}
@@ -2318,7 +2319,7 @@ bool LBAnimationItem::togglePlaying(bool playing) {
return _running;
}
- return LBItem::togglePlaying(playing);
+ return LBItem::togglePlaying(playing, restart);
}
void LBAnimationItem::done(bool onlyNotify) {
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 5dc0e921bf..288cee9b2b 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -217,7 +217,7 @@ public:
virtual void handleMouseDown(Common::Point pos); // 0xB
virtual void handleMouseMove(Common::Point pos); // 0xC
virtual void handleMouseUp(Common::Point pos); // 0xD
- virtual bool togglePlaying(bool playing); // 0xF
+ virtual bool togglePlaying(bool playing, bool restart = false); // 0xF
virtual void done(bool onlyNotify); // 0x10
virtual void init() { } // 0x11
virtual void seek(uint16 pos) { } // 0x13
@@ -259,7 +259,7 @@ public:
LBSoundItem(MohawkEngine_LivingBooks *_vm, Common::Rect rect);
~LBSoundItem();
- bool togglePlaying(bool playing);
+ bool togglePlaying(bool playing, bool restart);
void stop();
};
@@ -276,7 +276,7 @@ public:
void setEnabled(bool enabled);
bool contains(Common::Point point);
- bool togglePlaying(bool playing);
+ bool togglePlaying(bool playing, bool restart);
// 0x12
void seek(uint16 pos);
void setVisible(bool visible);
@@ -322,7 +322,7 @@ public:
bool contains(Common::Point point);
void update();
void handleMouseDown(Common::Point pos);
- bool togglePlaying(bool playing);
+ bool togglePlaying(bool playing, bool restart);
void stop();
void notify(uint16 data, uint16 from);
@@ -361,7 +361,7 @@ public:
bool contains(Common::Point point);
void update();
void draw();
- bool togglePlaying(bool playing);
+ bool togglePlaying(bool playing, bool restart);
void done(bool onlyNotify);
void init();
void seek(uint16 pos);