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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Dec 26 06:44:32 CET 2008


Revision: 35550
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35550&view=rev
Author:   peres001
Date:     2008-12-26 05:44:32 +0000 (Fri, 26 Dec 2008)

Log Message:
-----------
Fixed selection of invalid frame numbers. This means that most locations can be switched to and don't crash up anymore!

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

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2008-12-26 01:13:08 UTC (rev 35549)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2008-12-26 05:44:32 UTC (rev 35550)
@@ -99,13 +99,13 @@
 	return gfxobj->getData(_frame);
 }
 
-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));
+void Animation::setF(int16 value) {
+	int16 min = MIN(0, getFrameNum() - 1);
+	int16 max = MAX(0, getFrameNum() - 1);
+	_frame = CLIP(value, min, max);
 }
 
+
 #define NUM_LOCALS	10
 char	_localNames[NUM_LOCALS][10];
 

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2008-12-26 01:13:08 UTC (rev 35549)
+++ scummvm/trunk/engines/parallaction/objects.h	2008-12-26 05:44:32 UTC (rev 35550)
@@ -504,8 +504,6 @@
 	uint16 getFrameNum() const;
 	byte* getFrameData() const;
 
-	void validateScriptVars();
-
 	void resetZ();
 	bool hitFrameRect(int x, int y) const;
 	void getFrameRect(Common::Rect &r) const;
@@ -522,7 +520,7 @@
 	void  setZ(int16 value) { _z = value; }
 
 	int16 getF() 			{ return _frame; }
-	void  setF(int16 value) { _frame = value; }
+	void  setF(int16 value);
 };
 
 class Table {

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-12-26 01:13:08 UTC (rev 35549)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-12-26 05:44:32 UTC (rev 35550)
@@ -430,12 +430,6 @@
 		AnimationPtr anim = *it;
 		GfxObj *obj = anim->gfxobj;
 
-		// Validation is performed here, so that every animation is affected, instead that only the ones
-		// who *own* a script. In fact, some scripts can change values in other animations.
-		// The right way to do this would be to enforce validation when any variable is modified from
-		// a script.
-		anim->validateScriptVars();
-
 		if ((anim->_flags & kFlagsActive) && ((anim->_flags & kFlagsRemove) == 0))   {
 
 			if (anim->_flags & kFlagsNoMasked) {


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