aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek/graphics.cpp
diff options
context:
space:
mode:
authorMatthew Stewart2018-07-05 00:24:47 -0400
committerEugene Sandulenko2018-08-09 08:37:30 +0200
commit6486579e6a594e93521d4a359265377989cfc5f2 (patch)
tree46e5220214d202ca2956c3522575cb2ab58a317b /engines/startrek/graphics.cpp
parent5863f515f72904ab17f976a55264fc5a342fc90c (diff)
downloadscummvm-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.
Diffstat (limited to 'engines/startrek/graphics.cpp')
-rw-r--r--engines/startrek/graphics.cpp5
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());
}