From 6486579e6a594e93521d4a359265377989cfc5f2 Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Thu, 5 Jul 2018 00:24:47 -0400 Subject: 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. --- engines/startrek/graphics.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines') 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()); } -- cgit v1.2.3