diff options
author | Martin Kiewitz | 2010-08-02 13:41:58 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-08-02 13:41:58 +0000 |
commit | 50b8073bab18e1a5f8c620468bc97bb1e9369148 (patch) | |
tree | 4fc3c9f3385d381da35f165b9a4c88924342ec9f | |
parent | b914ad3e843b208fa897b1916ae187559b1b3f71 (diff) | |
download | scummvm-rg350-50b8073bab18e1a5f8c620468bc97bb1e9369148.tar.gz scummvm-rg350-50b8073bab18e1a5f8c620468bc97bb1e9369148.tar.bz2 scummvm-rg350-50b8073bab18e1a5f8c620468bc97bb1e9369148.zip |
SCI: clipping plane rects for sci32
fixes crash in hires gk1 on cemetary
svn-id: r51615
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index b8d50e77ce..21e3c59628 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -109,10 +109,12 @@ void GfxFrameout::kernelDeletePlane(reg_t object) { planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom)) + 1; planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right)) + 1; - planeRect.top = (planeRect.top * _screen->getHeight()) / scriptsRunningHeight; - planeRect.left = (planeRect.left * _screen->getWidth()) / scriptsRunningWidth; - planeRect.bottom = (planeRect.bottom * _screen->getHeight()) / scriptsRunningHeight; - planeRect.right = (planeRect.right * _screen->getWidth()) / scriptsRunningWidth; + Common::Rect screenRect(_screen->getWidth(), _screen->getHeight()); + planeRect.top = (planeRect.top * screenRect.height()) / scriptsRunningHeight; + planeRect.left = (planeRect.left * screenRect.width()) / scriptsRunningWidth; + planeRect.bottom = (planeRect.bottom * screenRect.height()) / scriptsRunningHeight; + planeRect.right = (planeRect.right * screenRect.width()) / scriptsRunningWidth; + planeRect.clip(screenRect); // we need to do this, at least in gk1 on cemetary we get bottom right -> 201, 321 // Blackout removed plane rect _paint32->fillRect(planeRect, 0); return; @@ -220,10 +222,12 @@ void GfxFrameout::kernelFrameout() { // Update priority here, sq6 sets it w/o UpdatePlane uint16 planePriority = it->priority = readSelectorValue(_segMan, planeObject, SELECTOR(priority)); - planeRect.top = (planeRect.top * _screen->getHeight()) / scriptsRunningHeight; - planeRect.left = (planeRect.left * _screen->getWidth()) / scriptsRunningWidth; - planeRect.bottom = (planeRect.bottom * _screen->getHeight()) / scriptsRunningHeight; - planeRect.right = (planeRect.right * _screen->getWidth()) / scriptsRunningWidth; + Common::Rect screenRect(_screen->getWidth(), _screen->getHeight()); + planeRect.top = (planeRect.top * screenRect.height()) / scriptsRunningHeight; + planeRect.left = (planeRect.left * screenRect.width()) / scriptsRunningWidth; + planeRect.bottom = (planeRect.bottom * screenRect.height()) / scriptsRunningHeight; + planeRect.right = (planeRect.right * screenRect.width()) / scriptsRunningWidth; + planeRect.clip(screenRect); // we need to do this, at least in gk1 on cemetary we get bottom right -> 201, 321 int16 planeOffsetX = 0; |