aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/m4/mads_anim.cpp21
-rw-r--r--engines/m4/mads_anim.h1
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;