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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Thu Jun 24 10:16:40 CEST 2010


Revision: 50205
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50205&view=rev
Author:   dreammaster
Date:     2010-06-24 08:16:40 +0000 (Thu, 24 Jun 2010)

Log Message:
-----------
Corrected rendering of sprites into a scene background

Modified Paths:
--------------
    scummvm/trunk/engines/m4/mads_views.cpp
    scummvm/trunk/engines/m4/mads_views.h

Modified: scummvm/trunk/engines/m4/mads_views.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_views.cpp	2010-06-24 08:15:31 UTC (rev 50204)
+++ scummvm/trunk/engines/m4/mads_views.cpp	2010-06-24 08:16:40 UTC (rev 50205)
@@ -133,20 +133,22 @@
 
 typedef Common::List<DepthEntry> DepthList;
 
-void MadsSpriteSlots::drawBackground() {
+void MadsSpriteSlots::drawBackground(int yOffset) {
 	// Draw all active sprites onto the background surface
 	for (int i = 0; i < startIndex; ++i) {
-		if (_entries[i].spriteType >= 0) {
+		MadsSpriteSlot &slot = _entries[i];
+
+		if (slot.spriteType >= 0) {
 			_owner._dirtyAreas[i].active = false;
 		} else {
 			_owner._dirtyAreas[i].textActive = true;
-			_owner._dirtyAreas.setSpriteSlot(i, _entries[i]);
+			_owner._dirtyAreas.setSpriteSlot(i, slot);
 
-			if (_entries[i].spriteType == BACKGROUND_SPRITE) {
-				SpriteAsset &spriteSet = getSprite(_entries[i].spriteListIndex);
-				M4Sprite *frame = spriteSet.getFrame((_entries[i].frameNumber & 0x7fff) - 1);
-				int xp = _entries[i].xp;
-				int yp = _entries[i].yp;
+			if (slot.spriteType == BACKGROUND_SPRITE) {
+				SpriteAsset &spriteSet = getSprite(slot.spriteListIndex);
+				M4Sprite *frame = spriteSet.getFrame((slot.frameNumber & 0x7fff) - 1);
+				int xp = slot.xp;
+				int yp = slot.yp;
 
 				if (_entries[i].scale != -1) {
 					// Adjust position based on frame size
@@ -154,12 +156,13 @@
 					yp -= frame->height() / 2;
 				}
 
-				if (_entries[i].depth <= 1) {
-					// No depth, so simply copy the frame onto the background
-					frame->copyTo(_owner._bgSurface, xp, yp, 0);
+				if (slot.depth > 1) {
+					// Draw the frame with depth processing
+					_owner._bgSurface->copyFrom(frame, xp, yp, Common::Point(0, yOffset), slot.depth, 
+						_owner._depthSurface, 100, frame->getTransparencyIndex());
 				} else {
-					// Depth was specified, so draw frame using scene's depth information
-					frame->copyTo(_owner._bgSurface, xp, yp, _entries[i].depth, _owner._depthSurface, 100, 0);
+					// No depth, so simply draw the image
+					frame->copyTo(_owner._bgSurface, xp, yp + yOffset, frame->getTransparencyIndex());
 				}
 			}
 		}
@@ -1201,7 +1204,7 @@
 
 void MadsView::refresh() {
 	// Draw any sprites
-	_spriteSlots.drawBackground();
+	_spriteSlots.drawBackground(_yOffset);
 
 	// Process dirty areas
 	_textDisplay.setDirtyAreas();

Modified: scummvm/trunk/engines/m4/mads_views.h
===================================================================
--- scummvm/trunk/engines/m4/mads_views.h	2010-06-24 08:15:31 UTC (rev 50204)
+++ scummvm/trunk/engines/m4/mads_views.h	2010-06-24 08:16:40 UTC (rev 50205)
@@ -97,7 +97,7 @@
 	void clear();
 	void deleteTimer(int seqIndex);
 
-	void drawBackground();
+	void drawBackground(int yOffset);
 	void drawForeground(View *view, int yOffset);
 	void setDirtyAreas();
 	void fullRefresh();


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