[Scummvm-cvs-logs] scummvm master -> 2a2c7f5bef6b7ddcc6df3aca62683501cc740030

clone2727 clone2727 at gmail.com
Wed Mar 30 22:02:50 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2a2c7f5bef SCI: Minor cleanup


Commit: 2a2c7f5bef6b7ddcc6df3aca62683501cc740030
    https://github.com/scummvm/scummvm/commit/2a2c7f5bef6b7ddcc6df3aca62683501cc740030
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-30T13:00:46-07:00

Commit Message:
SCI: Minor cleanup

Changed paths:
    engines/sci/graphics/screen.cpp
    engines/sci/graphics/view.cpp



diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 1838ba7..32f54c7 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -696,41 +696,35 @@ void GfxScreen::scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHei
 	}
 }
 
-typedef struct {
+struct UpScaledAdjust {
 	GfxScreenUpscaledMode gameHiresMode;
 	Sci32ViewNativeResolution viewNativeRes;
 	int numerator;
 	int denominator;
-} UpScaledAdjust;
-
-UpScaledAdjust upscaledAdjustTable[] = {
-	{GFX_SCREEN_UPSCALED_640x480, SCI_VIEW_NATIVERES_640x400, 5, 6},
 };
 
-int upscaledAdjustTableSize = ARRAYSIZE(upscaledAdjustTable);
+static const UpScaledAdjust s_upscaledAdjustTable[] = {
+	{ GFX_SCREEN_UPSCALED_640x480, SCI_VIEW_NATIVERES_640x400, 5, 6 }
+};
 
 void GfxScreen::adjustToUpscaledCoordinates(int16 &y, int16 &x, Sci32ViewNativeResolution viewNativeRes) {
 	x *= 2;
 	y = _upscaledMapping[y];
 
-	for (int i = 0; i < upscaledAdjustTableSize; i++)
-	{
-		if (upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
-		    upscaledAdjustTable[i].viewNativeRes == viewNativeRes)
-		{
-			y = (y * upscaledAdjustTable[i].numerator) / upscaledAdjustTable[i].denominator;
+	for (int i = 0; i < ARRAYSIZE(s_upscaledAdjustTable); i++) {
+		if (s_upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
+				s_upscaledAdjustTable[i].viewNativeRes == viewNativeRes) {
+			y = (y * s_upscaledAdjustTable[i].numerator) / s_upscaledAdjustTable[i].denominator;
 			break;
 		}
 	}
 }
 
 void GfxScreen::adjustBackUpscaledCoordinates(int16 &y, int16 &x, Sci32ViewNativeResolution viewNativeRes) {
-	for (int i = 0; i < upscaledAdjustTableSize; i++)
-	{
-		if (upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
-		    upscaledAdjustTable[i].viewNativeRes == viewNativeRes)
-		{
-			y = (y * upscaledAdjustTable[i].denominator) / upscaledAdjustTable[i].numerator;
+	for (int i = 0; i < ARRAYSIZE(s_upscaledAdjustTable); i++) {
+		if (s_upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
+				s_upscaledAdjustTable[i].viewNativeRes == viewNativeRes) {
+			y = (y * s_upscaledAdjustTable[i].denominator) / s_upscaledAdjustTable[i].numerator;
 			break;
 		}
 	}
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 2623bce..f31cbac 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -204,12 +204,9 @@ void GfxView::initData(GuiResourceId resourceId) {
 		assert(_loopCount);
 		palOffset = READ_SCI11ENDIAN_UINT32(_resourceData + 8);
 
-		// FIXME: _resourceData[5] is sometimes 2 in GK1 also denoting scaled, but somehow modified.
-		// For a good test, jump to room 720 and talk to Wolfgang. Wolfgang's head is scaled when it
-		// shouldn't be, but the positioning of his eyes and mouth is also incorrect.
-		if (getSciVersion() >= SCI_VERSION_2)
-		{ 
-			_sci2ScaleRes = (Sci32ViewNativeResolution) _resourceData[5];
+		// For SCI32, this is a scale flag
+		if (getSciVersion() >= SCI_VERSION_2) { 
+			_sci2ScaleRes = (Sci32ViewNativeResolution)_resourceData[5];
 			if (_screen->getUpscaledHires() == GFX_SCREEN_UPSCALED_DISABLED)
 				_sci2ScaleRes = SCI_VIEW_NATIVERES_NONE;
 		}
@@ -340,7 +337,7 @@ Palette *GfxView::getPalette() {
 }
 
 bool GfxView::isSci2Hires() {
-	return _sci2ScaleRes > 0;
+	return _sci2ScaleRes > SCI_VIEW_NATIVERES_320x200;
 }
 
 bool GfxView::isScaleable() {
@@ -725,6 +722,8 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
 						// get drawn onto lowres screen.
 						// FIXME(?): we can't read priority directly with the
 						// hires coordinates. May not be needed at all in kq6
+						// FIXME: Handle proper aspect ratio. Some GK1 hires images
+						// are in 640x400 instead of 640x480
 						_screen->putPixelOnDisplay(x2, y2, palette->mapping[color]);
 					}
 				}






More information about the Scummvm-git-logs mailing list