diff options
author | Matthew Stewart | 2018-07-05 00:24:47 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | 6486579e6a594e93521d4a359265377989cfc5f2 (patch) | |
tree | 46e5220214d202ca2956c3522575cb2ab58a317b | |
parent | 5863f515f72904ab17f976a55264fc5a342fc90c (diff) | |
download | scummvm-rg350-6486579e6a594e93521d4a359265377989cfc5f2.tar.gz scummvm-rg350-6486579e6a594e93521d4a359265377989cfc5f2.tar.bz2 scummvm-rg350-6486579e6a594e93521d4a359265377989cfc5f2.zip |
STARTREK: Fixes to sprites when off-screen
There was a problem implementing FEATHER6 where a thrown rock goes
off-screen, which breaks an assertion that "rect.height() != 0" when
drawing it.
-rw-r--r-- | engines/startrek/graphics.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp index 9dc484f33a..753605a494 100644 --- a/engines/startrek/graphics.cpp +++ b/engines/startrek/graphics.cpp @@ -517,7 +517,7 @@ void Graphics::drawAllSprites(bool updateScreen) { for (int j = 0; j < numDirtyRects; j++) { Common::Rect rect1 = spr->drawRect.findIntersectingRect(dirtyRects[j]); - if (!rect1.isEmpty()) { + if (rect1.width() != 0 && rect1.height() != 0) { if (mustRedrawSprite) rect2 = getRectEncompassing(rect1, rect2); else @@ -538,6 +538,9 @@ void Graphics::drawAllSprites(bool updateScreen) { // Copy dirty rects to screen for (int j = 0; j < numDirtyRects; j++) { Common::Rect &r = dirtyRects[j]; + if (r.width() == 0 || r.height() == 0) + continue; + int offset = r.left + r.top * SCREEN_WIDTH; _vm->_system->copyRectToScreen((byte *)surface.getPixels() + offset, SCREEN_WIDTH, r.left, r.top, r.width(), r.height()); } |