[Scummvm-cvs-logs] SF.net SVN: scummvm:[47116] scummvm/trunk/engines/sci/graphics

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Jan 7 15:46:29 CET 2010


Revision: 47116
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47116&view=rev
Author:   m_kiewitz
Date:     2010-01-07 14:46:29 +0000 (Thu, 07 Jan 2010)

Log Message:
-----------
SCI: implemented additional drawCel for hires views, fixes menu bar of kq6 - still need to fix coordinates and implement save/restoreBits for hires

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/animate.cpp
    scummvm/trunk/engines/sci/graphics/gfx.cpp
    scummvm/trunk/engines/sci/graphics/gfx.h
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/view.cpp
    scummvm/trunk/engines/sci/graphics/view.h

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-01-07 14:39:42 UTC (rev 47115)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-01-07 14:46:29 UTC (rev 47116)
@@ -368,7 +368,7 @@
 			}
 
 			// 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) {

Modified: scummvm/trunk/engines/sci/graphics/gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-07 14:39:42 UTC (rev 47115)
+++ scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-07 14:46:29 UTC (rev 47116)
@@ -329,35 +329,36 @@
 }
 
 // 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,9 +366,40 @@
 
 	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) {
 	Common::Rect outRect(rect.left, rect.top, rect.right, rect.bottom);
 	int16 x, y;

Modified: scummvm/trunk/engines/sci/graphics/gfx.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-07 14:39:42 UTC (rev 47115)
+++ scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-07 14:46:29 UTC (rev 47116)
@@ -84,9 +84,10 @@
 	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);
 

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-07 14:39:42 UTC (rev 47115)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-07 14:46:29 UTC (rev 47116)
@@ -368,7 +368,10 @@
 }
 
 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();
 }
 

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2010-01-07 14:39:42 UTC (rev 47115)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2010-01-07 14:46:29 UTC (rev 47116)
@@ -460,7 +460,7 @@
 	}
 }
 
-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 @@
 			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]);

Modified: scummvm/trunk/engines/sci/graphics/view.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.h	2010-01-07 14:39:42 UTC (rev 47115)
+++ scummvm/trunk/engines/sci/graphics/view.h	2010-01-07 14:46:29 UTC (rev 47116)
@@ -60,7 +60,7 @@
 	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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list