[Scummvm-cvs-logs] SF.net SVN: scummvm:[46281] scummvm/trunk/engines/m4

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Dec 7 19:23:28 CET 2009


Revision: 46281
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46281&view=rev
Author:   fingolfin
Date:     2009-12-07 18:23:28 +0000 (Mon, 07 Dec 2009)

Log Message:
-----------
M4: Move 'determine transparent color' hack into a new M4Sprite method

Modified Paths:
--------------
    scummvm/trunk/engines/m4/animation.cpp
    scummvm/trunk/engines/m4/console.cpp
    scummvm/trunk/engines/m4/mads_menus.cpp
    scummvm/trunk/engines/m4/sprite.cpp
    scummvm/trunk/engines/m4/sprite.h

Modified: scummvm/trunk/engines/m4/animation.cpp
===================================================================
--- scummvm/trunk/engines/m4/animation.cpp	2009-12-07 18:22:18 UTC (rev 46280)
+++ scummvm/trunk/engines/m4/animation.cpp	2009-12-07 18:23:28 UTC (rev 46281)
@@ -175,11 +175,8 @@
 		// Write the sprite onto the screen
 		M4Sprite *spr = _spriteSeries->getFrame(seriesFrameIndex);
 
-		// FIXME: We assume that the transparent color is the color of the top left pixel
-		byte *transparentColor = spr->getBasePtr(0, 0);
-
 		// FIXME: correct x, y
-		spr->copyTo(bg, frame->x, frame->y, (int)*transparentColor);
+		spr->copyTo(bg, frame->x, frame->y, (int)spr->getTransparentColor());
 
 		// HACK: wait a bit
 		g_system->delayMillis(100);

Modified: scummvm/trunk/engines/m4/console.cpp
===================================================================
--- scummvm/trunk/engines/m4/console.cpp	2009-12-07 18:22:18 UTC (rev 46280)
+++ scummvm/trunk/engines/m4/console.cpp	2009-12-07 18:23:28 UTC (rev 46281)
@@ -223,11 +223,8 @@
 			if (y >= bg->height())
 				break;
 
-			// FIXME: We assume that the transparent color is the color of the top left pixel
-			byte *transparentColor = spr->getBasePtr(0, 0);
+			spr->copyTo(bg, x, y, (int)spr->getTransparentColor());
 
-			spr->copyTo(bg, x, y, (int)*transparentColor);
-
 			x += spr->width();
 			yMax = MAX(yMax, spr->height());
 		}

Modified: scummvm/trunk/engines/m4/mads_menus.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_menus.cpp	2009-12-07 18:22:18 UTC (rev 46280)
+++ scummvm/trunk/engines/m4/mads_menus.cpp	2009-12-07 18:23:28 UTC (rev 46281)
@@ -528,9 +528,7 @@
 	_itemPalData.push_back(palData);
 
 	spr = _menuItem->getFrame(1);
-	// FIXME: We assume that the transparent color is the color of the top left pixel
-	byte *transparentColor = spr->getBasePtr(0, 0);
-	spr->copyTo(this, spr->xOffset - 140, spr->yOffset - spr->height(), (int)*transparentColor);
+	spr->copyTo(this, spr->xOffset - 140, spr->yOffset - spr->height(), (int)spr->getTransparentColor());
 
 	_vm->_mouse->cursorOn();
 }

Modified: scummvm/trunk/engines/m4/sprite.cpp
===================================================================
--- scummvm/trunk/engines/m4/sprite.cpp	2009-12-07 18:22:18 UTC (rev 46280)
+++ scummvm/trunk/engines/m4/sprite.cpp	2009-12-07 18:23:28 UTC (rev 46281)
@@ -171,4 +171,10 @@
 	}
 }
 
+byte M4Sprite::getTransparentColor() const {
+	// FIXME: We assume that the transparent color is the color of the
+	// top left pixel.
+	return *getBasePtr(0, 0);
+}
+
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/sprite.h
===================================================================
--- scummvm/trunk/engines/m4/sprite.h	2009-12-07 18:22:18 UTC (rev 46280)
+++ scummvm/trunk/engines/m4/sprite.h	2009-12-07 18:23:28 UTC (rev 46281)
@@ -114,6 +114,8 @@
 	void loadRle(Common::SeekableReadStream* rleData);
 	void loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY);
 	void loadMadsSprite(Common::SeekableReadStream* source);
+
+	byte getTransparentColor() const;
 protected:
 };
 


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