diff options
author | Johannes Schickel | 2006-10-23 23:12:12 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-10-23 23:12:12 +0000 |
commit | 8fb07286cc5a6aaa508bcff5e8c91791e7303704 (patch) | |
tree | d64bc47da208846d29ed31110ef620a55efa2731 /engines/kyra/animator.cpp | |
parent | 67041f96a905c27e2f744cc88dfb57e12f93d6af (diff) | |
download | scummvm-rg350-8fb07286cc5a6aaa508bcff5e8c91791e7303704.tar.gz scummvm-rg350-8fb07286cc5a6aaa508bcff5e8c91791e7303704.tar.bz2 scummvm-rg350-8fb07286cc5a6aaa508bcff5e8c91791e7303704.zip |
Fix for bug #1582726 ("KYRA1: Crash when entering Castle screen").
svn-id: r24475
Diffstat (limited to 'engines/kyra/animator.cpp')
-rw-r--r-- | engines/kyra/animator.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/engines/kyra/animator.cpp b/engines/kyra/animator.cpp index a11e56d65e..8d28bcc934 100644 --- a/engines/kyra/animator.cpp +++ b/engines/kyra/animator.cpp @@ -389,9 +389,8 @@ void ScreenAnimator::prepDrawAllObjects() { void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) { debugC(9, kDebugLevelAnimator, "ScreenAnimator::copyChangedObjectsForward(%d)", refreshFlag); - AnimObject *curObject = _objectQueue; - while (curObject) { + for (AnimObject *curObject = _objectQueue; curObject; curObject = curObject->nextAnimObject) { if (curObject->active) { if (curObject->refreshFlag || refreshFlag) { int xpos = 0, ypos = 0, width = 0, height = 0; @@ -402,14 +401,22 @@ void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) { if (xpos < 1) { xpos = 1; - } else if (xpos + width > 39) { - width = width - (xpos + width - 39); + } else if (xpos > 39) { + continue; + } + + if (xpos + width > 39) { + width = 39 - xpos; } if (ypos < 8) { ypos = 8; - } else if (ypos + height > 135) { - height = height - (ypos + height - 136); + } else if (ypos > 136) { + continue; + } + + if (ypos + height > 136) { + height = 136 - ypos; } _screen->copyRegion(xpos << 3, ypos, xpos << 3, ypos, width << 3, height, 2, 0, Screen::CR_CLIPPED); @@ -417,8 +424,8 @@ void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) { _updateScreen = true; } } - curObject = curObject->nextAnimObject; } + if (_updateScreen) { _screen->updateScreen(); _updateScreen = false; |