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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Jan 10 10:07:09 CET 2010


Revision: 47218
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47218&view=rev
Author:   m_kiewitz
Date:     2010-01-10 09:07:09 +0000 (Sun, 10 Jan 2010)

Log Message:
-----------
SCI: changed location of hack inside kDrawCel, coordinates of savedhiresbox may not get port adjusted

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

Modified: scummvm/trunk/engines/sci/graphics/gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-10 08:55:19 UTC (rev 47217)
+++ scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-10 09:07:09 UTC (rev 47218)
@@ -383,12 +383,28 @@
 
 // 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) {
+void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, uint16 scaleX, uint16 scaleY) {
 	View *view = 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 = kmem(_segMan, 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);
@@ -403,9 +419,11 @@
 			return;
 
 		clipRectTranslated = clipRect;
-		curPortPos.x = _curPort->left * 2; curPortPos.y = _curPort->top * 2;
-		clipRectTranslated.top += curPortPos.y; clipRectTranslated.bottom += curPortPos.y;
-		clipRectTranslated.left += curPortPos.x; clipRectTranslated.right += curPortPos.x;
+		if (!upscaledHiresHack) {
+			curPortPos.x = _curPort->left * 2; curPortPos.y = _curPort->top * 2;
+			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, scaleX, scaleY);
 		if (!_screen->_picNotValidSci11) {

Modified: scummvm/trunk/engines/sci/graphics/gfx.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-10 08:55:19 UTC (rev 47217)
+++ scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-10 09:07:09 UTC (rev 47218)
@@ -89,7 +89,7 @@
 	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);
+	void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, 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-10 08:55:19 UTC (rev 47217)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-10 09:07:09 UTC (rev 47218)
@@ -372,20 +372,7 @@
 	if (!hiresMode) {
 		_gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
 	} else {
-		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 = kmem(_s->_segMan, upscaledHiresHandle);
-			if (memoryPtr) {
-				Common::Rect upscaledHiresRect;
-				_screen->bitsGetRect(memoryPtr, &upscaledHiresRect);
-				leftPos = upscaledHiresRect.left;
-				topPos = upscaledHiresRect.top;
-			}
-		}
-		_gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
+		_gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, upscaledHiresHandle);
 	}
 	_palette->setOnScreen();
 }


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