// This is "hacked" together, because its only used by debug command void GfxPaint32::kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle) { GfxView *view = _cache->getView(viewId); Common::Rect celRect(50, 50, 50, 50); Common::Rect translatedRect; celRect.bottom += view->getHeight(loopNo, celNo); celRect.right += view->getWidth(loopNo, celNo); view->draw(celRect, celRect, celRect, loopNo, celNo, 255, 0, false); _screen->copyRectToScreen(celRect); }
// This is used as replacement for drawCelAndShow() when hires-cels are drawn to // screen. Hires-cels are available only SCI 1.1+. void GfxPaint16::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, uint16 scaleX, uint16 scaleY) { GfxView *view = _cache->getView(viewId); Common::Rect celRect, curPortRect, clipRect, clipRectTranslated; Common::Point curPortPos; bool upscaledHiresHack = false; if (view) { 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 = _segMan->getHunkPointer(upscaledHiresHandle); if (memoryPtr) { Common::Rect upscaledHiresRect; _screen->bitsGetRect(memoryPtr, &upscaledHiresRect); leftPos = upscaledHiresRect.left; topPos = upscaledHiresRect.top; upscaledHiresHack = true; } } celRect.left = leftPos; celRect.top = topPos; celRect.right = celRect.left + view->getWidth(loopNo, celNo); celRect.bottom = celRect.top + view->getHeight(loopNo, celNo); // adjust curPort to upscaled hires clipRect = celRect; curPortRect = _ports->_curPort->rect; _screen->adjustToUpscaledCoordinates(curPortRect.top, curPortRect.left); _screen->adjustToUpscaledCoordinates(curPortRect.bottom, curPortRect.right); curPortRect.bottom++; curPortRect.right++; clipRect.clip(curPortRect); if (clipRect.isEmpty()) // nothing to draw return; clipRectTranslated = clipRect; if (!upscaledHiresHack) { curPortPos.x = _ports->_curPort->left; curPortPos.y = _ports->_curPort->top; _screen->adjustToUpscaledCoordinates(curPortPos.y, curPortPos.x); clipRectTranslated.top += curPortPos.y; clipRectTranslated.bottom += curPortPos.y; clipRectTranslated.left += curPortPos.x; clipRectTranslated.right += curPortPos.x; } view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true); if (!_screen->_picNotValidSci11) { _screen->copyDisplayRectToScreen(clipRectTranslated); } } }
// This one is the only one that updates screen! void GfxPaint16::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) { GfxView *view = _cache->getView(viewId); Common::Rect celRect; if (view) { celRect.left = leftPos; celRect.top = topPos; celRect.right = celRect.left + view->getWidth(loopNo, celNo); celRect.bottom = celRect.top + view->getHeight(loopNo, celNo); drawCel(view, loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY); if (getSciVersion() >= SCI_VERSION_1_1) { if (!_screen->_picNotValidSci11) { bitsShow(celRect); } } else { if (!_screen->_picNotValid) bitsShow(celRect); } } }