diff options
author | Nicola Mettifogo | 2008-07-28 08:56:37 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-07-28 08:56:37 +0000 |
commit | c6cbf1f144110ab2d754e42032036018768ef9ff (patch) | |
tree | 7bacb7bda4bc13b9919f72c33eb4b9cd4c877737 | |
parent | 16fe053ab4535865b7f52a274cc886a682caf7d4 (diff) | |
download | scummvm-rg350-c6cbf1f144110ab2d754e42032036018768ef9ff.tar.gz scummvm-rg350-c6cbf1f144110ab2d754e42032036018768ef9ff.tar.bz2 scummvm-rg350-c6cbf1f144110ab2d754e42032036018768ef9ff.zip |
Added a post processing step to runScripts, so that Animation can be validated after buggy scripts have been executed.
svn-id: r33363
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 33 | ||||
-rw-r--r-- | engines/parallaction/objects.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/objects.h | 2 |
3 files changed, 25 insertions, 16 deletions
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index fee215289b..11ee829662 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -331,35 +331,34 @@ void Parallaction_ns::drawAnimations() { 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 @@ void ProgramExec::runScripts(ProgramList::iterator first, ProgramList::iterator label1: if (a->_flags & kFlagsCharacter) a->_z = a->_top + a->height(); + + a->validateScriptVars(); } _modCounter++; diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index e04a7d5342..c387484de7 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -81,6 +81,12 @@ byte* Animation::getFrameData(uint32 index) const { 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]; diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index fd855f9dca..813f83d183 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -448,6 +448,8 @@ struct Animation : public Zone { virtual uint16 height() const; uint16 getFrameNum() const; byte* getFrameData(uint32 index) const; + + void validateScriptVars(); }; class Table { |