diff options
author | Martin Kiewitz | 2010-01-16 16:17:45 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-16 16:17:45 +0000 |
commit | e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005 (patch) | |
tree | 6ed188889bf508987d01f62ed49714597d84dd58 /engines | |
parent | 220c118a8fd4459e8947b3896bef386dc8fe51c7 (diff) | |
download | scummvm-rg350-e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005.tar.gz scummvm-rg350-e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005.tar.bz2 scummvm-rg350-e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005.zip |
SCI: View::drawScaled() created (doesnt do scaling yet), removed scaling variables from View::draw, gfx calls drawScaled() when scaleX/Y != 128, getting scaled rect inside kAnimate()
svn-id: r47322
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/animate.cpp | 6 | ||||
-rw-r--r-- | engines/sci/graphics/gfx.cpp | 8 | ||||
-rw-r--r-- | engines/sci/graphics/view.cpp | 36 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 3 |
4 files changed, 48 insertions, 5 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index 1a31dccefb..80e09800a3 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -217,7 +217,11 @@ void SciGuiAnimate::fill(byte &old_picNotValid) { } // Create rect according to coordinates and given cel - view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect); + if (listEntry->scaleSignal & kScaleSignalDoScaling) { + view->getCelScaledRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, listEntry->scaleX, listEntry->scaleY, &listEntry->celRect); + } else { + view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect); + } PUT_SEL32V(_s->_segMan, curObject, nsLeft, listEntry->celRect.left); PUT_SEL32V(_s->_segMan, curObject, nsTop, listEntry->celRect.top); PUT_SEL32V(_s->_segMan, curObject, nsRight, listEntry->celRect.right); diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index 19d9c957f4..99aed7409a 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -382,7 +382,11 @@ 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, false, scaleX, scaleY); + if (scaleX == 128 && scaleY == 128) { + view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false); + } else { + view->drawScaled(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, scaleX, scaleY); + } } // This is used as replacement for drawCelAndShow() when hires-cels are drawn to screen @@ -429,7 +433,7 @@ void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, u clipRectTranslated.left += curPortPos.x; clipRectTranslated.right += curPortPos.x; } - view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true, scaleX, scaleY); + view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true); if (!_screen->_picNotValidSci11) { _screen->copyDisplayRectToScreen(clipRectTranslated); } diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 5027fc5b95..42f1d42777 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -480,7 +480,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, bool upscaledHires, 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) { Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; CelInfo *celInfo = getCelInfo(loopNo, celNo); byte *bitmap = getBitmap(loopNo, celNo); @@ -527,6 +527,40 @@ void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectT } } +void View::drawScaled(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY) { + Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; + CelInfo *celInfo = getCelInfo(loopNo, celNo); + byte *bitmap = getBitmap(loopNo, celNo); + int16 celHeight = celInfo->height, celWidth = celInfo->width; + int16 width, height; + byte clearKey = celInfo->clearKey; + byte color; + byte drawMask = priority == 255 ? SCI_SCREEN_MASK_VISUAL : SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY; + int x, y; + + if (_embeddedPal) { + // Merge view palette in... + _palette->set(&_viewPalette, 1); + } + + width = MIN(clipRect.width(), celWidth); + height = MIN(clipRect.height(), celHeight); + + // Calculate scale table + // TODO + + bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left); + + for (y = 0; y < height; y++, bitmap += celWidth) { + for (x = 0; x < width; x++) { + color = bitmap[x]; + if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, clipRectTranslated.top + y)) { + _screen->putPixel(clipRectTranslated.left + x, clipRectTranslated.top + y, drawMask, palette->mapping[color], priority, 0); + } + } + } +} + uint16 View::getCelCount(int16 loopNo) { if ((loopNo < 0) || (loopNo >= _loopCount)) return 0; diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index e648a37ca9..efff87b92c 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -61,7 +61,8 @@ public: void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect); void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, 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, bool upscaledHires, 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); + void drawScaled(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY); uint16 getLoopCount() const { return _loopCount; } uint16 getCelCount(int16 loopNo); Palette *getPalette(); |