diff options
author | Martin Kiewitz | 2010-05-13 22:04:53 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-05-13 22:04:53 +0000 |
commit | c083ce287900f90b0a90dc461add02891b2d0f48 (patch) | |
tree | d85d2ac3087d5cecbf509bef1cb7b4f16243b342 /engines/sci/graphics | |
parent | 38c661bfacf608840b2ad9170b50366e32bcf3d3 (diff) | |
download | scummvm-rg350-c083ce287900f90b0a90dc461add02891b2d0f48.tar.gz scummvm-rg350-c083ce287900f90b0a90dc461add02891b2d0f48.tar.bz2 scummvm-rg350-c083ce287900f90b0a90dc461add02891b2d0f48.zip |
SCI: fix window, when its too large for screen (fixes sq3 crash at ending, actually caused by script bug)
svn-id: r49028
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/ports.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp index bbe0c4adb0..c849044104 100644 --- a/engines/sci/graphics/ports.cpp +++ b/engines/sci/graphics/ports.cpp @@ -229,8 +229,17 @@ Window *GfxPorts::newWindow(const Common::Rect &dims, const Common::Rect *restor else _windowList.push_back(pwnd); openPort(pwnd); + r = dims; - pwnd->rect = dims; + if (r.width() > _screen->getWidth()) { + // We get invalid dimensions at least at the end of sq3 (script bug!) + warning("fixing too large window, given left&right was %d, %d", dims.left, dims.right); + r.left = 0; + r.right = _screen->getWidth() - 1; + if ((style != _styleUser) && !(style & SCI_WINDOWMGR_STYLE_NOFRAME)) + r.right--; + } + pwnd->rect = r; if (restoreRect) pwnd->restoreRect = *restoreRect; @@ -244,7 +253,7 @@ Window *GfxPorts::newWindow(const Common::Rect &dims, const Common::Rect *restor pwnd->title = title; } - r = dims; + r = pwnd->rect; if ((style != _styleUser) && !(style & SCI_WINDOWMGR_STYLE_NOFRAME)) { r.grow(1); if (style & SCI_WINDOWMGR_STYLE_TITLE) { @@ -253,9 +262,6 @@ Window *GfxPorts::newWindow(const Common::Rect &dims, const Common::Rect *restor } } - // FIXME: it seems as if shadows may result in the window getting moved one upwards - // so that the shadow is visible (lsl5) - pwnd->dims = r; const Common::Rect *wmprect = &_wmgrPort->rect; int16 oldtop = pwnd->dims.top; @@ -314,9 +320,9 @@ void GfxPorts::drawWindow(Window *pWnd) { _paint16->frameRect(r);// draw actual window frame if (wndStyle & SCI_WINDOWMGR_STYLE_TITLE) { - r.bottom = r.top + 10; if (getSciVersion() <= SCI_VERSION_0_LATE) { // draw a black line between titlebar and actual window content for SCI0 + r.bottom = r.top + 10; _paint16->frameRect(r); } r.grow(-1); |