diff options
author | Martin Kiewitz | 2010-01-07 14:46:29 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-07 14:46:29 +0000 |
commit | 519e80ca8b57bb7b68a13cea6e83c0404fe0a414 (patch) | |
tree | eb19c6176dfa1b3c26cd9311cf50f8422058760d /engines/sci/graphics | |
parent | 5b063e2d939208415d6940eecfa56720108d4a27 (diff) | |
download | scummvm-rg350-519e80ca8b57bb7b68a13cea6e83c0404fe0a414.tar.gz scummvm-rg350-519e80ca8b57bb7b68a13cea6e83c0404fe0a414.tar.bz2 scummvm-rg350-519e80ca8b57bb7b68a13cea6e83c0404fe0a414.zip |
SCI: implemented additional drawCel for hires views, fixes menu bar of kq6 - still need to fix coordinates and implement save/restoreBits for hires
svn-id: r47116
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/animate.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/gfx.cpp | 60 | ||||
-rw-r--r-- | engines/sci/graphics/gfx.h | 7 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/view.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 2 |
6 files changed, 59 insertions, 22 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index 8c52d003d4..f4668540f0 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -368,7 +368,7 @@ void SciGuiAnimate::drawCels() { } // draw corresponding cel - _gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, -1, scaleX, scaleY); + _gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, scaleX, scaleY); listEntry->showBitsFlag = true; if (signal & kSignalRemoveView) { diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index 01e69926a5..a6aed9ec5c 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -329,35 +329,36 @@ void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredF } // This one is the only one that updates screen! -void Gfx::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) { +void Gfx::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) { View *view = getView(viewId); - Common::Rect rect; + Common::Rect celRect; if (view) { - rect.left = leftPos; - rect.top = topPos; - rect.right = rect.left + view->getWidth(loopNo, celNo); - rect.bottom = rect.top + view->getHeight(loopNo, celNo); + 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, rect, priority, paletteNo, origHeight, scaleX, scaleY); + drawCel(view, loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY); if (getSciVersion() >= SCI_VERSION_1_1) { - if (!_screen->_picNotValidSci11) - BitsShow(rect); + if (!_screen->_picNotValidSci11) { + BitsShow(celRect); + } } else { if (!_screen->_picNotValid) - BitsShow(rect); + BitsShow(celRect); } } } // This version of drawCel is not supposed to call BitsShow()! -void Gfx::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) { - drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo, origHeight, scaleX, scaleY); +void Gfx::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) { + drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY); } // This version of drawCel is not supposed to call BitsShow()! -void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) { +void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) { Common::Rect clipRect = celRect; clipRect.clip(_curPort->rect); if (clipRect.isEmpty()) // nothing to draw @@ -365,7 +366,38 @@ void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, b Common::Rect clipRectTranslated = clipRect; OffsetRect(clipRectTranslated); - view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, origHeight, scaleX, scaleY); + view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false, scaleX, scaleY); +} + +// This is used as replacement for drawCelAndShow() when hires-cels are drawn to screen +// Hires-cels are available only SCI 1.1+ +void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) { + View *view = getView(viewId); + Common::Rect celRect, curPortRect, clipRect, clipRectTranslated; + + if (view) { + 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 = _curPort->rect; + curPortRect.top *= 2; curPortRect.bottom *= 2; + curPortRect.left *= 2; curPortRect.right *= 2; + clipRect.clip(curPortRect); + if (clipRect.isEmpty()) // nothing to draw + return; + + clipRectTranslated = clipRect; + clipRectTranslated.top += curPortRect.top; clipRectTranslated.bottom += curPortRect.top; + clipRectTranslated.left += curPortRect.left; clipRectTranslated.right += curPortRect.left; + + view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true, scaleX, scaleY); + if (!_screen->_picNotValidSci11) { + _screen->copyDisplayRectToScreen(clipRectTranslated); + } + } } uint16 Gfx::onControl(uint16 screenMask, Common::Rect rect) { diff --git a/engines/sci/graphics/gfx.h b/engines/sci/graphics/gfx.h index b521c7e988..1c47d6af2a 100644 --- a/engines/sci/graphics/gfx.h +++ b/engines/sci/graphics/gfx.h @@ -84,9 +84,10 @@ public: void BitsFree(reg_t memoryHandle); void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId); - void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); - void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); - void drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); + void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128); + void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128); + void drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128); + void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128); uint16 onControl(uint16 screenMask, Common::Rect rect); diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index 9a85f2cb1b..6e65c0e91f 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -368,7 +368,10 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animat } void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) { - _gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, origHeight); + if (origHeight == -1) + _gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo); + else + _gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo); _palette->setOnScreen(); } diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 5c78c2a39c..b93258489d 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -460,7 +460,7 @@ void View::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clear } } -void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, int16 origHeight, uint16 scaleX, uint16 scaleY) { +void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX, uint16 scaleY) { Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; CelInfo *celInfo = getCelInfo(loopNo, celNo); byte *bitmap = getBitmap(loopNo, celNo); @@ -487,7 +487,8 @@ void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectT for (x = 0; x < width; x++) { color = bitmap[x]; if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, clipRectTranslated.top + y)) { - if (origHeight == -1) // HACK: this parameter is passed for already scaled views, but we're not actually using it + // UpscaledHires means view is hires and is supposed to get drawn onto lowres screen + if (!upscaledHires) _screen->putPixel(clipRectTranslated.left + x, clipRectTranslated.top + y, drawMask, palette->mapping[color], priority, 0); else _screen->putPixelOnDisplay(clipRectTranslated.left + x, clipRectTranslated.top + y, palette->mapping[color]); diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index 0b199f514b..5a0791a2a4 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -60,7 +60,7 @@ public: LoopInfo *getLoopInfo(int16 loopNo); void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect); byte *getBitmap(int16 loopNo, int16 celNo); - void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); + void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX = 128, uint16 scaleY = 128); uint16 getLoopCount() const { return _loopCount; } uint16 getCelCount(int16 loopNo) { return _loop[loopNo].celCount; } Palette *getPalette(); |