[Scummvm-cvs-logs] SF.net SVN: scummvm:[42913] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Thu Jul 30 03:12:08 CEST 2009


Revision: 42913
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42913&view=rev
Author:   dkasak13
Date:     2009-07-30 01:12:07 +0000 (Thu, 30 Jul 2009)

Log Message:
-----------
* Added Animation::setCurrentFrame()
* Moved rewinding the animation to the beginning from Animation::nextFrame() to AnimationManager::stop() (fixes the owl animation)

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/animation.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp	2009-07-29 21:39:34 UTC (rev 42912)
+++ scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp	2009-07-30 01:12:07 UTC (rev 42913)
@@ -98,9 +98,6 @@
 		if ((_currentFrame == getFrameCount() - 1) && !_looping) {
 			// When the animation reaches its end, call the preset callback
 			(this->*_callback)();
-
-			// Reset the frame to 0
-			_currentFrame = 0;
 		} else {
 			// Mark old frame dirty so it gets deleted
 			markDirtyRect(surface);
@@ -258,6 +255,16 @@
 	return _currentFrame;
 }
 
+void Animation::setCurrentFrame(uint frame) {
+
+	// Check whether the value is sane
+	if (frame > _frames.size()) {
+		return;
+	}
+
+	_currentFrame = frame;
+}
+
 void Animation::deleteFrames() {
 	
 	// If there are no frames to delete, return
@@ -331,6 +338,10 @@
 		anim->markDirtyRect(_vm->_screen->getSurface());
 
 		anim->setPlaying(false);
+
+		// Reset the animation to the beginning
+		anim->setCurrentFrame(0);
+
 	
 		debugC(3, kDraciAnimationDebugLevel, "Stopping animation %d...", id);
 	}

Modified: scummvm/branches/gsoc2009-draci/engines/draci/animation.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/animation.h	2009-07-29 21:39:34 UTC (rev 42912)
+++ scummvm/branches/gsoc2009-draci/engines/draci/animation.h	2009-07-30 01:12:07 UTC (rev 42913)
@@ -69,6 +69,7 @@
 
 	void addFrame(Drawable *frame);
 	Drawable *getFrame(int frameNum = kCurrentFrame);
+	void setCurrentFrame(uint frame);
 	uint currentFrameNum();
 	uint getFrameCount();
 	void deleteFrames();


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