From 9606e7fca72645a05ecdce97cc484351e23c7ead Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 5 Jan 2010 14:19:53 +0000 Subject: Some initial work on SCI1.1 view scaling (not working yet) svn-id: r47027 --- engines/sci/graphics/animate.cpp | 10 ++++++++-- engines/sci/graphics/gfx.cpp | 12 ++++++------ engines/sci/graphics/gfx.h | 6 +++--- engines/sci/graphics/view.cpp | 4 +++- engines/sci/graphics/view.h | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index c82fcbf10e..ea70212975 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -347,7 +347,7 @@ void SciGuiAnimate::drawCels() { reg_t bitsHandle; AnimateList::iterator listIterator; AnimateList::iterator listEnd = _list.end(); - + uint16 scaleX = 128, scaleY = 128; // no scaling _lastCastCount = 0; listIterator = _list.begin(); @@ -361,8 +361,14 @@ void SciGuiAnimate::drawCels() { bitsHandle = _gfx->BitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL); PUT_SEL32(_s->_segMan, curObject, underBits, bitsHandle); + if (getSciVersion() >= SCI_VERSION_1_1) { + // View scaling + scaleX = GET_SEL32V(_s->_segMan, curObject, scaleX); + scaleY = GET_SEL32V(_s->_segMan, curObject, scaleY); + } + // draw corresponding cel - _gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo); + _gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, -1, scaleX, scaleY); listEntry->showBitsFlag = true; if (signal & kSignalRemoveView) { diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index 030d585407..abb002b000 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -329,7 +329,7 @@ void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredF } // This one is the only one that updates screen! -void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight) { +void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) { View *view = getView(viewId); Common::Rect rect; @@ -339,7 +339,7 @@ void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftP rect.right = rect.left + view->getWidth(loopNo, celNo); rect.bottom = rect.top + view->getHeight(loopNo, celNo); - drawCel(view, loopNo, celNo, rect, priority, paletteNo, origHeight); + drawCel(view, loopNo, celNo, rect, priority, paletteNo, origHeight, scaleX, scaleY); if (getSciVersion() >= SCI_VERSION_1_1) { if (!_screen->_picNotValidSci11) @@ -352,12 +352,12 @@ void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftP } // This version of drawCel is not supposed to call BitsShow()! -void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight) { - drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo); +void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo 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); } // This version of drawCel is not supposed to call BitsShow()! -void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight) { +void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) { Common::Rect clipRect = celRect; clipRect.clip(_curPort->rect); if (clipRect.isEmpty()) // nothing to draw @@ -365,7 +365,7 @@ void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, Common::Rect clipRectTranslated = clipRect; OffsetRect(clipRectTranslated); - view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo); + view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, origHeight, scaleX, scaleY); } uint16 Gfx::onControl(uint16 screenMask, Common::Rect rect) { diff --git a/engines/sci/graphics/gfx.h b/engines/sci/graphics/gfx.h index 4d9befd829..764d8f925d 100644 --- a/engines/sci/graphics/gfx.h +++ b/engines/sci/graphics/gfx.h @@ -84,9 +84,9 @@ public: void BitsFree(MemoryHandle memoryHandle); void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId); - void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1); - void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1); - void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1); + void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); + void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); + void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); uint16 onControl(uint16 screenMask, Common::Rect rect); diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 068ff24b02..04ac6e1bed 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -461,7 +461,7 @@ void View::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clear } } -void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight) { +void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight, uint16 scaleX, uint16 scaleY) { Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; CelInfo *celInfo = getCelInfo(loopNo, celNo); byte *bitmap = getBitmap(loopNo, celNo); @@ -482,6 +482,8 @@ void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectT bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left); + // TODO: SCI1.1 view scaling + if (!_EGAmapping) { for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) { for (x = 0; x < width; x++) { diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index 109a37f065..edcda9bd4f 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -60,7 +60,7 @@ public: LoopInfo *getLoopInfo(LoopNo loopNo); void getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect); byte *getBitmap(LoopNo loopNo, CelNo celNo); - void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1); + void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128); uint16 getLoopCount() const { return _loopCount; } uint16 getCelCount(LoopNo loopNo) { return _loop[loopNo].celCount; } Palette *getPalette(); -- cgit v1.2.3