diff options
author | Colin Snover | 2017-01-12 13:10:08 -0600 |
---|---|---|
committer | Colin Snover | 2017-01-12 13:16:53 -0600 |
commit | ba50f88a3c60e5ad90aa830739a271ee2ba844f0 (patch) | |
tree | 8146253602eb6d44203b798b4866f6ec4b0c6ac2 /engines/sci | |
parent | 92f185c83c71c789b1a0c0fb734f85635aa7d8c6 (diff) | |
download | scummvm-rg350-ba50f88a3c60e5ad90aa830739a271ee2ba844f0.tar.gz scummvm-rg350-ba50f88a3c60e5ad90aa830739a271ee2ba844f0.tar.bz2 scummvm-rg350-ba50f88a3c60e5ad90aa830739a271ee2ba844f0.zip |
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.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/screen_item32.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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; |