[Scummvm-cvs-logs] SF.net SVN: scummvm:[54675] scummvm/trunk/engines/mohawk

fuzzie at users.sourceforge.net fuzzie at users.sourceforge.net
Tue Nov 30 15:41:27 CET 2010


Revision: 54675
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54675&view=rev
Author:   fuzzie
Date:     2010-11-30 14:41:27 +0000 (Tue, 30 Nov 2010)

Log Message:
-----------
MOHAWK: fix LB playback seek behaviour

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/livingbooks.cpp
    scummvm/trunk/engines/mohawk/livingbooks.h

Modified: scummvm/trunk/engines/mohawk/livingbooks.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.cpp	2010-11-30 14:41:09 UTC (rev 54674)
+++ scummvm/trunk/engines/mohawk/livingbooks.cpp	2010-11-30 14:41:27 UTC (rev 54675)
@@ -1622,7 +1622,7 @@
 	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 @@
 	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 @@
 			// 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 @@
 	_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 @@
 	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 @@
 	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 @@
 	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 @@
 		return _running;
 	}
 
-	return LBItem::togglePlaying(playing);
+	return LBItem::togglePlaying(playing, restart);
 }
 
 void LBAnimationItem::done(bool onlyNotify) {

Modified: scummvm/trunk/engines/mohawk/livingbooks.h
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.h	2010-11-30 14:41:09 UTC (rev 54674)
+++ scummvm/trunk/engines/mohawk/livingbooks.h	2010-11-30 14:41:27 UTC (rev 54675)
@@ -217,7 +217,7 @@
 	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 @@
 	LBSoundItem(MohawkEngine_LivingBooks *_vm, Common::Rect rect);
 	~LBSoundItem();
 
-	bool togglePlaying(bool playing);
+	bool togglePlaying(bool playing, bool restart);
 	void stop();
 };
 
@@ -276,7 +276,7 @@
 
 	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 @@
 	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 @@
 	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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list