[Scummvm-cvs-logs] SF.net SVN: scummvm:[33363] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jul 28 10:56:38 CEST 2008


Revision: 33363
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33363&view=rev
Author:   peres001
Date:     2008-07-28 08:56:37 +0000 (Mon, 28 Jul 2008)

Log Message:
-----------
Added a post processing step to runScripts, so that Animation can be validated after buggy scripts have been executed.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/objects.cpp
    scummvm/trunk/engines/parallaction/objects.h

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-28 08:44:49 UTC (rev 33362)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-28 08:56:37 UTC (rev 33363)
@@ -331,35 +331,34 @@
 
 	for (AnimationList::iterator it = _location._animations.begin(); it != _location._animations.end(); it++) {
 
-		AnimationPtr v18 = *it;
-		GfxObj *obj = v18->gfxobj;
+		AnimationPtr anim = *it;
+		GfxObj *obj = anim->gfxobj;
 
-		if ((v18->_flags & kFlagsActive) && ((v18->_flags & kFlagsRemove) == 0))   {
+		if ((anim->_flags & kFlagsActive) && ((anim->_flags & kFlagsRemove) == 0))   {
 
-			int16 frame = CLIP((int)v18->_frame, 0, v18->getFrameNum()-1);
-			if (v18->_flags & kFlagsNoMasked)
+			if (anim->_flags & kFlagsNoMasked)
 				layer = 3;
 			else
-				layer = _gfx->_backgroundInfo.getLayer(v18->_top + v18->height());
+				layer = _gfx->_backgroundInfo.getLayer(anim->_top + anim->height());
 
 			if (obj) {
 				_gfx->showGfxObj(obj, true);
-				obj->frame = frame;
-				obj->x = v18->_left;
-				obj->y = v18->_top;
-				obj->z = v18->_z;
+				obj->frame =  anim->_frame;
+				obj->x = anim->_left;
+				obj->y = anim->_top;
+				obj->z = anim->_z;
 				obj->layer = layer;
 			}
 		}
 
-		if (((v18->_flags & kFlagsActive) == 0) && (v18->_flags & kFlagsRemove))   {
-			v18->_flags &= ~kFlagsRemove;
-			v18->_oldPos.x = -1000;
+		if (((anim->_flags & kFlagsActive) == 0) && (anim->_flags & kFlagsRemove))   {
+			anim->_flags &= ~kFlagsRemove;
+			anim->_oldPos.x = -1000;
 		}
 
-		if ((v18->_flags & kFlagsActive) && (v18->_flags & kFlagsRemove))	{
-			v18->_flags &= ~kFlagsActive;
-			v18->_flags |= kFlagsRemove;
+		if ((anim->_flags & kFlagsActive) && (anim->_flags & kFlagsRemove))	{
+			anim->_flags &= ~kFlagsActive;
+			anim->_flags |= kFlagsRemove;
 			if (obj) {
 				_gfx->showGfxObj(obj, false);
 			}
@@ -416,6 +415,8 @@
 label1:
 		if (a->_flags & kFlagsCharacter)
 			a->_z = a->_top + a->height();
+
+		a->validateScriptVars();
 	}
 
 	_modCounter++;

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2008-07-28 08:44:49 UTC (rev 33362)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2008-07-28 08:56:37 UTC (rev 33363)
@@ -81,7 +81,13 @@
 	return gfxobj->getData(index);
 }
 
+void Animation::validateScriptVars() {
+	// this is used to clip values of _frame, _left and _top
+	// which can be screwed up by buggy scripts.
 
+	_frame = CLIP(_frame, (int16)0, (int16)(getFrameNum() - 1));
+}
+
 #define NUM_LOCALS	10
 char	_localNames[NUM_LOCALS][10];
 

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2008-07-28 08:44:49 UTC (rev 33362)
+++ scummvm/trunk/engines/parallaction/objects.h	2008-07-28 08:56:37 UTC (rev 33363)
@@ -448,6 +448,8 @@
 	virtual uint16 height() const;
 	uint16 getFrameNum() const;
 	byte* getFrameData(uint32 index) const;
+
+	void validateScriptVars();
 };
 
 class Table {


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