diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/gui.h | 2 |
3 files changed, 20 insertions, 6 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index dc83530762..ec787b464e 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -910,9 +910,9 @@ reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) { uint16 y = argv[4].toUint16(); int16 priority = (argc > 5) ? argv[5].toSint16() : -1; uint16 paletteNo = (argc > 6) ? argv[6].toUint16() : 0; - bool upscaledHires = (argc > 7) ? true : false; // actual parameter is MemoryHandle to saved upscaled hires rect + reg_t upscaledHiresHandle = (argc > 7) ? argv[7] : NULL_REG; - s->_gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo, upscaledHires); + s->_gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo, upscaledHiresHandle); return s->r_acc; } diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index f2e54d5e6b..2fdb47f3db 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -367,11 +367,25 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animat _gfx->SetPort(oldPort); } -void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool upscaledHires) { - if (!upscaledHires) +void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, reg_t upscaledHiresHandle) { + if (upscaledHiresHandle.isNull()) { _gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo); - else + } else { + if ((leftPos == 0) && (topPos == 0)) { + // HACK: in kq6, we get leftPos&topPos == 0 SOMETIMES, that's why we need to get coordinates from upscaledHiresHandle + // I'm not sure if this is what we are supposed to do or if there is some other bug that actually makes + // coordinates to be 0 in the first place + byte *memoryPtr = NULL; + memoryPtr = kmem(_s->_segMan, upscaledHiresHandle); + if (memoryPtr) { + Common::Rect upscaledHiresRect; + _screen->bitsGetRect(memoryPtr, &upscaledHiresRect); + leftPos = upscaledHiresRect.left; + topPos = upscaledHiresRect.top; + } + } _gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo); + } _palette->setOnScreen(); } diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index 0d9b481934..c3c5ca6d85 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -88,7 +88,7 @@ public: virtual reg_t menuSelect(reg_t eventObject); virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); - virtual void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool upscaledHires = false); + virtual void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, reg_t upscaledHiresHandle = NULL_REG); virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite); virtual void drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); |