diff options
author | Paul Gilbert | 2010-06-29 11:51:05 +0000 |
---|---|---|
committer | Paul Gilbert | 2010-06-29 11:51:05 +0000 |
commit | c96d44d928a2cb47e70e428b4e61bcf80ceda42b (patch) | |
tree | 8703648ab511d7757d2f8929081a97cf04d751dc | |
parent | 5f2c184e4ef2e5519645b699b5dafa27148c59f4 (diff) | |
download | scummvm-rg350-c96d44d928a2cb47e70e428b4e61bcf80ceda42b.tar.gz scummvm-rg350-c96d44d928a2cb47e70e428b4e61bcf80ceda42b.tar.bz2 scummvm-rg350-c96d44d928a2cb47e70e428b4e61bcf80ceda42b.zip |
Added code to properly detect when an animation sequence is complete
svn-id: r50493
-rw-r--r-- | engines/m4/mads_anim.cpp | 21 | ||||
-rw-r--r-- | engines/m4/mads_anim.h | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index b7aa8eefb5..ebc684bec4 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -460,6 +460,7 @@ AnimviewView::AnimviewView(MadsM4Engine *vm): _activeAnimation = NULL; _bgLoadFlag = true; _startFrame = -1; + _scriptDone = false; reset(); @@ -519,7 +520,7 @@ bool AnimviewView::onEvent(M4EventType eventType, int32 param, int x, int y, boo void AnimviewView::updateState() { MadsView::update(); - if (!_script) + if (!_script || _scriptDone) return; if (!_activeAnimation) { @@ -537,16 +538,16 @@ void AnimviewView::updateState() { _backgroundSurface.reset(); clearLists(); - // Check if script is finished - if (_script->eos() || _script->err()) { - scriptDone(); - return; - } - // Reset flags _startFrame = -1; readNextCommand(); + + // Check if script is finished + if (_scriptDone) { + scriptDone(); + return; + } } refresh(); @@ -589,6 +590,12 @@ static bool tempFlag = true;//****DEBUG - Temporarily allow me to skip several i break; } + if (!_currentLine[0]) { + // A blank line at this point means that the end of the animation has been reached + _scriptDone = true; + return; + } + if (strchr(_currentLine, '.') == NULL) strcat(_currentLine, ".aa"); diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index 78cc8727f8..b33ea24071 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -81,6 +81,7 @@ class AnimviewView : public View, MadsView { private: char _resourceName[80]; Common::SeekableReadStream *_script; + bool _scriptDone; uint32 _previousUpdate; char _currentLine[80]; M4Surface _backgroundSurface; |