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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jul 24 17:15:39 CEST 2010


Revision: 51245
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51245&view=rev
Author:   m_kiewitz
Date:     2010-07-24 15:15:38 +0000 (Sat, 24 Jul 2010)

Log Message:
-----------
SCI: kCelWide/kCelHigh now adjust on hires views

somewhat fixes gk1 hires inventory issue

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/graphics/cache.cpp
    scummvm/trunk/engines/sci/graphics/view.cpp
    scummvm/trunk/engines/sci/graphics/view.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-07-24 12:03:30 UTC (rev 51244)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-07-24 15:15:38 UTC (rev 51245)
@@ -436,15 +436,6 @@
 
 	celWidth = g_sci->_gfxCache->kernelViewGetCelWidth(viewId, loopNo, celNo);
 
-#ifdef ENABLE_SCI32
-	if (getSciVersion() == SCI_VERSION_2_1) {
-		if (g_sci->_gfxScreen->getWidth() > 320)
-			celWidth = celWidth / 2; // half the width returned here, fixes lsl6 action icon placements
-	}
-	// the scripts work low-res and add the returned value from here to the coordinate
-	// TODO: check, if this is actually right. I'm slightly confused by this, but even GK1CD has some idivs in this
-	//  code, so it seems plausible.
-#endif
 	return make_reg(0, celWidth);
 }
 
@@ -1159,6 +1150,8 @@
 reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) {
 	reg_t planeObj = argv[0];
 
+	warning("AddPlane %s", s->_segMan->getObjectName(argv[0]));
+
 	g_sci->_gfxFrameout->kernelAddPlane(planeObj);
 	return NULL_REG;
 }

Modified: scummvm/trunk/engines/sci/graphics/cache.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cache.cpp	2010-07-24 12:03:30 UTC (rev 51244)
+++ scummvm/trunk/engines/sci/graphics/cache.cpp	2010-07-24 15:15:38 UTC (rev 51245)
@@ -90,11 +90,11 @@
 }
 
 int16 GfxCache::kernelViewGetCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) {
-	return getView(viewId)->getCelInfo(loopNo, celNo)->width;
+	return getView(viewId)->getCelInfo(loopNo, celNo)->scriptWidth;
 }
 
 int16 GfxCache::kernelViewGetCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo) {
-	return getView(viewId)->getCelInfo(loopNo, celNo)->height;
+	return getView(viewId)->getCelInfo(loopNo, celNo)->scriptHeight;
 }
 
 int16 GfxCache::kernelViewGetLoopCount(GuiResourceId viewId) {

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2010-07-24 12:03:30 UTC (rev 51244)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2010-07-24 15:15:38 UTC (rev 51245)
@@ -160,8 +160,8 @@
 				// For EGA
 				// Width:WORD Height:WORD DisplaceX:BYTE DisplaceY:BYTE ClearKey:BYTE EGAData starts now directly
 				cel = &_loop[loopNo].cel[celNo];
-				cel->width = READ_LE_UINT16(celData);
-				cel->height = READ_LE_UINT16(celData + 2);
+				cel->scriptWidth = cel->width = READ_LE_UINT16(celData);
+				cel->scriptHeight = cel->height = READ_LE_UINT16(celData + 2);
 				cel->displaceX = (signed char)celData[4];
 				cel->displaceY = celData[5];
 				cel->clearKey = celData[6];
@@ -231,8 +231,8 @@
 			_loop[loopNo].cel = new CelInfo[celCount];
 			for (celNo = 0; celNo < celCount; celNo++) {
 				cel = &_loop[loopNo].cel[celNo];
-				cel->width = READ_SCI11ENDIAN_UINT16(celData);
-				cel->height = READ_SCI11ENDIAN_UINT16(celData + 2);
+				cel->scriptWidth = cel->width = READ_SCI11ENDIAN_UINT16(celData);
+				cel->scriptHeight = cel->height = READ_SCI11ENDIAN_UINT16(celData + 2);
 				cel->displaceX = READ_SCI11ENDIAN_UINT16(celData + 4);
 				cel->displaceY = READ_SCI11ENDIAN_UINT16(celData + 6);
 
@@ -253,6 +253,36 @@
 				celData += celSize;
 			}
 		}
+#ifdef ENABLE_SCI32
+		// adjust width/height returned to scripts
+		switch (getSciVersion()) {
+		case SCI_VERSION_2:
+			if (_isSci2Hires) {
+				for (loopNo = 0; loopNo < _loopCount; loopNo++) {
+					for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) {
+						_screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight);
+					}
+				}
+			}
+			break;
+
+		case SCI_VERSION_2_1:
+			// half the width returned here, fixes lsl6 action icon placements
+			// the scripts work low-res and add the returned value from here to the coordinate
+			// TODO: check, if this is actually right. I'm slightly confused by this, but even GK1CD has some idivs in this
+			//  code, so it seems plausible.
+			if (_screen->getDisplayWidth() > 320) {
+				for (loopNo = 0; loopNo < _loopCount; loopNo++) {
+					for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) {
+						_loop[loopNo].cel[celNo].scriptWidth /= 2;
+						_loop[loopNo].cel[celNo].scriptHeight /= 2;
+					}
+				}
+			}
+		default:
+			break;
+		}
+#endif
 		break;
 
 	default:

Modified: scummvm/trunk/engines/sci/graphics/view.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.h	2010-07-24 12:03:30 UTC (rev 51244)
+++ scummvm/trunk/engines/sci/graphics/view.h	2010-07-24 15:15:38 UTC (rev 51245)
@@ -30,6 +30,7 @@
 
 struct CelInfo {
 	int16 width, height;
+	int16 scriptWidth, scriptHeight;
 	int16 displaceX;
 	int16 displaceY;
 	byte clearKey;


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