[Scummvm-cvs-logs] SF.net SVN: scummvm:[50493] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Tue Jun 29 13:51:05 CEST 2010


Revision: 50493
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50493&view=rev
Author:   dreammaster
Date:     2010-06-29 11:51:05 +0000 (Tue, 29 Jun 2010)

Log Message:
-----------
Added code to properly detect when an animation sequence is complete

Modified Paths:
--------------
    scummvm/trunk/engines/m4/mads_anim.cpp
    scummvm/trunk/engines/m4/mads_anim.h

Modified: scummvm/trunk/engines/m4/mads_anim.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.cpp	2010-06-29 11:26:48 UTC (rev 50492)
+++ scummvm/trunk/engines/m4/mads_anim.cpp	2010-06-29 11:51:05 UTC (rev 50493)
@@ -460,6 +460,7 @@
 	_activeAnimation = NULL;
 	_bgLoadFlag = true;
 	_startFrame = -1;
+	_scriptDone = false;
 
 	reset();
 
@@ -519,7 +520,7 @@
 void AnimviewView::updateState() {
 	MadsView::update();
 
-	if (!_script)
+	if (!_script || _scriptDone)
 		return;
 
 	if (!_activeAnimation) {
@@ -537,16 +538,16 @@
 		_backgroundSurface.reset();
 		clearLists();
 		
+		// Reset flags
+		_startFrame = -1;
+
+		readNextCommand();
+
 		// Check if script is finished
-		if (_script->eos() ||  _script->err()) {
+		if (_scriptDone) {
 			scriptDone();
 			return;
 		}
-
-		// Reset flags
-		_startFrame = -1;
-
-		readNextCommand();
 	}
 
 	refresh();
@@ -589,6 +590,12 @@
 			break;
 	}
 
+	if (!_currentLine[0]) {
+		// A blank line at this point means that the end of the animation has been reached
+		_scriptDone = true;
+		return;
+	}
+
 	if (strchr(_currentLine, '.') == NULL)
 		strcat(_currentLine, ".aa");
 

Modified: scummvm/trunk/engines/m4/mads_anim.h
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.h	2010-06-29 11:26:48 UTC (rev 50492)
+++ scummvm/trunk/engines/m4/mads_anim.h	2010-06-29 11:51:05 UTC (rev 50493)
@@ -81,6 +81,7 @@
 private:
 	char _resourceName[80];
 	Common::SeekableReadStream *_script;
+	bool _scriptDone;
 	uint32 _previousUpdate;
 	char _currentLine[80];
 	M4Surface _backgroundSurface;


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