diff options
| author | Nicola Mettifogo | 2008-12-26 05:44:32 +0000 | 
|---|---|---|
| committer | Nicola Mettifogo | 2008-12-26 05:44:32 +0000 | 
| commit | b3b23642bfc1da1deb8362b9dfb8c8f01b430c5b (patch) | |
| tree | a35e050b693a4cccfde29855f5d76c8100a63df7 | |
| parent | 751df013e1fb8e521028f2babb1ff47067723c04 (diff) | |
| download | scummvm-rg350-b3b23642bfc1da1deb8362b9dfb8c8f01b430c5b.tar.gz scummvm-rg350-b3b23642bfc1da1deb8362b9dfb8c8f01b430c5b.tar.bz2 scummvm-rg350-b3b23642bfc1da1deb8362b9dfb8c8f01b430c5b.zip  | |
Fixed selection of invalid frame numbers. This means that most locations can be switched to and don't crash up anymore!
svn-id: r35550
| -rw-r--r-- | engines/parallaction/objects.cpp | 10 | ||||
| -rw-r--r-- | engines/parallaction/objects.h | 4 | ||||
| -rw-r--r-- | engines/parallaction/parallaction.cpp | 6 | 
3 files changed, 6 insertions, 14 deletions
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index 8cbcb293ce..00a09ec62d 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -99,13 +99,13 @@ byte* Animation::getFrameData() const {  	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]; diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index 2611f0ed94..4e586d4d2b 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -504,8 +504,6 @@ public:  	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 @@ public:  	void  setZ(int16 value) { _z = value; }  	int16 getF() 			{ return _frame; } -	void  setF(int16 value) { _frame = value; } +	void  setF(int16 value);  };  class Table { diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index f61947f29c..d8e5a43631 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -430,12 +430,6 @@ void Parallaction::drawAnimations() {  		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) {  | 
