[Scummvm-cvs-logs] scummvm master -> 06387c25d8e908f174d081769b94dd0625e00b58

dreammaster dreammaster at scummvm.org
Fri May 30 03:39:59 CEST 2014


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:
06387c25d8 MADS: Fix positioning of teleporter window backgrounds


Commit: 06387c25d8e908f174d081769b94dd0625e00b58
    https://github.com/scummvm/scummvm/commit/06387c25d8e908f174d081769b94dd0625e00b58
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-05-29T21:35:59-04:00

Commit Message:
MADS: Fix positioning of teleporter window backgrounds

Changed paths:
    engines/mads/msurface.cpp
    engines/mads/msurface.h
    engines/mads/scene_data.cpp



diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index 39c7808..839882a 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -419,6 +419,27 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth,
 	}
 }
 
+void MSurface::copyFromScaled(MSurface *src, const Common::Point &destPos, int depth,
+		DepthSurface *depthSurface, int scale, int transparentColor) {
+	int distXCount = 0, distYCount = 0;
+	int highestDim = MAX(src->w, src->h);
+	int accum = 0;
+
+	for (int idx = 0; idx < highestDim; ++idx) {
+		accum += scale;
+		if (accum >= 100) {
+			accum -= 100;
+			if (idx < src->w)
+				++distXCount;
+			if (idx < src->h)
+				++distYCount;
+		}
+	}
+
+	Common::Point newPos(destPos.x - distXCount / 2, destPos.y - distYCount);
+	copyFrom(src, src->getBounds(), newPos, transparentColor);
+}
+
 void MSurface::scrollX(int xAmount) {
 	if (xAmount == 0)
 		return;
diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h
index 8ad0b1c..985a097 100644
--- a/engines/mads/msurface.h
+++ b/engines/mads/msurface.h
@@ -161,12 +161,27 @@ public:
 	* @param destPos		Destination position to draw in current surface
 	* @param depth			Depth of sprite
 	* @param depthSurface	Depth surface to use with sprite depth
+	* @param scale			Scale for image
 	* @param transparentColor	Transparency palette index
 	*/
 	void copyFrom(MSurface *src, const Common::Point &destPos, int depth, DepthSurface *depthSurface,
 		int scale, int transparentColor = -1);
 
 	/**
+	* Copys a sub-section of another surface into the current one, taking into
+	* account variation in the destination copy position based on item size
+	* and scaling.
+	* @param src			Source surface
+	* @param destPos		Destination position to draw in current surface
+	* @param depth			Depth of sprite
+	* @param depthSurface	Depth surface to use with sprite depth
+	* @param scale			Scale for image
+	* @param transparentColor	Transparency palette index
+	*/
+	void copyFromScaled(MSurface *src, const Common::Point &destPos, int depth, DepthSurface *depthSurface,
+		int scale, int transparentColor = -1);
+
+	/**
 	 * Copies the surface to a given destination surface
 	 */
 	void copyTo(MSurface *dest, int transparentColor = -1) {
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index de75b04..d53a668 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -265,13 +265,13 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
 		assert(asset && _depthStyle != 2);
 
 		MSprite *spr = asset->getFrame(asset->getCount() - 1);
-		bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, si._scale,
-			spr->getTransparencyIndex());
+		bgSurface.copyFromScaled(spr, si._position, si._depth, &depthSurface, 
+			si._scale, spr->getTransparencyIndex());
 	}
 
 	// Free the sprite sets
 	for (int i = (int)spriteSets.size() - 1; i >= 0; --i) {
-		warning("TODO: sub_201C8 SPRITE_SET.field_6");
+		_vm->_palette->_paletteUsage.resetPalFlags(spriteSets[i]->_usageIndex);
 		delete spriteSets[i];
 	}
 }






More information about the Scummvm-git-logs mailing list