From 5dac7ba6ba8da1bfea07e8f696d230a8eea593b0 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 31 Jul 2010 00:48:03 +0000 Subject: SCI: fix kAddToPic called with view data and adding workaround for pq2 when showing windows with pictures change to kAddToPic fixes bad coordinates of cels when restoring the game (should also fix lsl2) svn-id: r51526 --- engines/sci/engine/workarounds.cpp | 2 ++ engines/sci/graphics/animate.cpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index e2d63b9d7c..daf41a6c39 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -128,12 +128,14 @@ const SciWorkaroundEntry kAbs_workarounds[] = { // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kCelHigh_workarounds[] = { + { GID_PQ2, -1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when showing picture within windows, called with 2nd/3rd parameters as objects { GID_SQ1, 1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // DEMO: Called with 2nd/3rd parameters as objects when clicking on the menu SCI_WORKAROUNDENTRY_TERMINATOR }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry kCelWide_workarounds[] = { + { GID_PQ2, -1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // when showing picture within windows, called with 2nd/3rd parameters as objects { GID_SQ1, 1, 255, 0, "DIcon", "setSize", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // DEMO: Called with 2nd/3rd parameters as objects when clicking on the menu - bug #3035720 SCI_WORKAROUNDENTRY_TERMINATOR }; diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index a4d07cf4ad..f260ee41be 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -527,13 +527,21 @@ void GfxAnimate::addToPicDrawCels() { } } -void GfxAnimate::addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { +void GfxAnimate::addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y, int16 priority, int16 control) { GfxView *view = _cache->getView(viewId); Common::Rect celRect; + if (priority == -1) + priority = _ports->kernelCoordinateToPriority(y); + // Create rect according to coordinates and given cel - view->getCelRect(loopNo, celNo, leftPos, topPos, priority, celRect); + view->getCelRect(loopNo, celNo, x, y, 0, celRect); _paint16->drawCel(view, loopNo, celNo, celRect, priority, 0); + + if (control != -1) { + celRect.top = CLIP(_ports->kernelPriorityToCoordinate(priority) - 1, celRect.top, celRect.bottom - 1); + _paint16->fillRect(celRect, GFX_SCREEN_MASK_CONTROL, 0, 0, control); + } } @@ -633,9 +641,9 @@ void GfxAnimate::kernelAddToPicList(reg_t listReference, int argc, reg_t *argv) addToPicSetPicNotValid(); } -void GfxAnimate::kernelAddToPicView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) { +void GfxAnimate::kernelAddToPicView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y, int16 priority, int16 control) { _ports->setPort((Port *)_ports->_picWind); - addToPicDrawView(viewId, loopNo, celNo, leftPos, topPos, priority, control); + addToPicDrawView(viewId, loopNo, celNo, x, y, priority, control); addToPicSetPicNotValid(); } -- cgit v1.2.3