[Scummvm-cvs-logs] scummvm master -> 0c4e0673c3a7d17aef7c586251c3990104163bc3

bluegr bluegr at gmail.com
Tue Dec 30 02:09:40 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0c4e0673c3 ZVISION: Further cleanup to the AnimationNode class


Commit: 0c4e0673c3a7d17aef7c586251c3990104163bc3
    https://github.com/scummvm/scummvm/commit/0c4e0673c3a7d17aef7c586251c3990104163bc3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-30T03:08:39+02:00

Commit Message:
ZVISION: Further cleanup to the AnimationNode class

Changed paths:
    engines/zvision/scripting/sidefx/animation_node.cpp
    engines/zvision/scripting/sidefx/animation_node.h



diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp
index 1657a6e..a0870bf 100644
--- a/engines/zvision/scripting/sidefx/animation_node.cpp
+++ b/engines/zvision/scripting/sidefx/animation_node.cpp
@@ -33,14 +33,13 @@
 
 namespace ZVision {
 
-AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool DisposeAfterUse)
+AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool disposeAfterUse)
 	: SideFX(engine, controlKey, SIDEFX_ANIM),
-	  _DisposeAfterUse(DisposeAfterUse),
+	  _disposeAfterUse(disposeAfterUse),
 	  _mask(mask),
 	  _animation(NULL) {
 
 	_animation = engine->loadAnimation(fileName);
-	_animation->start();
 
 	if (frate > 0) {
 		_frmDelayOverride = (int32)(1000.0 / frate);
@@ -89,12 +88,10 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
 	if (it != _playList.end()) {
 		playnode *nod = &(*it);
 
-		if (nod->_curFrame == -1) {
+		if (!_animation->isPlaying()) {
 			// The node is just beginning playback
-			nod->_curFrame = nod->start;
-
+			_animation->start();
 			_animation->seekToFrame(nod->start);
-			_animation->setEndFrame(nod->stop);
 
 			nod->_delay = deltaTimeInMillis; // Force the frame to draw
 			if (nod->slot)
@@ -111,10 +108,9 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
 					delete nod->_scaled;
 				}
 				_playList.erase(it);
-				return _DisposeAfterUse;
+				return _disposeAfterUse;
 			}
 
-			nod->_curFrame = nod->start;
 			_animation->seekToFrame(nod->start);
 		}
 
@@ -190,13 +186,9 @@ void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int st
 	nod.loop = loops;
 	nod.pos = Common::Rect(x, y, x2 + 1, y2 + 1);
 	nod.start = startFrame;
-	nod.stop = endFrame;
-
-	if (nod.stop >= (int)_animation->getFrameCount())
-		nod.stop = _animation->getFrameCount() - 1;
+	_animation->setEndFrame(CLIP<int>(endFrame, 0,_animation->getFrameCount() - 1));
 
 	nod.slot = slot;
-	nod._curFrame = -1;
 	nod._delay = 0;
 	nod._scaled = NULL;
 	_playList.push_back(nod);
diff --git a/engines/zvision/scripting/sidefx/animation_node.h b/engines/zvision/scripting/sidefx/animation_node.h
index 64270eb..1dc0dc7 100644
--- a/engines/zvision/scripting/sidefx/animation_node.h
+++ b/engines/zvision/scripting/sidefx/animation_node.h
@@ -41,16 +41,14 @@ class ZVision;
 
 class AnimationNode : public SideFX {
 public:
-	AnimationNode(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool DisposeAfterUse = true);
+	AnimationNode(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool disposeAfterUse = true);
 	~AnimationNode();
 
 	struct playnode {
 		Common::Rect pos;
 		int32 slot;
 		int32 start;
-		int32 stop;
 		int32 loop;
-		int32 _curFrame;
 		int32 _delay;
 		Graphics::Surface *_scaled;
 	};
@@ -61,7 +59,7 @@ private:
 	PlayNodes _playList;
 
 	int32 _mask;
-	bool _DisposeAfterUse;
+	bool _disposeAfterUse;
 
 	Video::VideoDecoder *_animation;
 	int32 _frmDelayOverride;






More information about the Scummvm-git-logs mailing list