From ba50f88a3c60e5ad90aa830739a271ee2ba844f0 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 12 Jan 2017 13:10:08 -0600 Subject: SCI32: Fix crash trying to clip invalid rects generated by transitions In PQ4CD, when leaving the shooting range through the front door, some transition screen items will be generated that have invalid dimensions. SSCI simply clips these rectangles to zero. --- engines/sci/graphics/screen_item32.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/sci/graphics/screen_item32.cpp') diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp index f7239c33bb..4757770dc0 100644 --- a/engines/sci/graphics/screen_item32.cpp +++ b/engines/sci/graphics/screen_item32.cpp @@ -455,7 +455,11 @@ void ScreenItem::calcRects(const Plane &plane) { _screenRect = _screenItemRect; - if (_screenRect.intersects(plane._screenRect)) { + // PQ4CD creates screen items with invalid rects; SSCI does not care + // about this, but `Common::Rect::clip` does, so we need to check + // whether or not the rect is actually valid before clipping and only + // clip valid rects + if (_screenRect.intersects(plane._screenRect) && _screenRect.isValidRect()) { _screenRect.clip(plane._screenRect); } else { _screenRect.right = 0; -- cgit v1.2.3