[Scummvm-cvs-logs] scummvm master -> 4ae6d57a03a013f3072a548548b3ca24743055f7

dreammaster dreammaster at scummvm.org
Sun Feb 9 16:45:55 CET 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:
4ae6d57a03 TSAGE: Fix smoke transparency effect in the R2R drive room


Commit: 4ae6d57a03a013f3072a548548b3ca24743055f7
    https://github.com/scummvm/scummvm/commit/4ae6d57a03a013f3072a548548b3ca24743055f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-02-09T07:45:21-08:00

Commit Message:
TSAGE: Fix smoke transparency effect in the R2R drive room

Changed paths:
    engines/tsage/ringworld2/ringworld2_scenes0.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.h



diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index 9e02fb8..fc7e34b 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -5765,24 +5765,47 @@ bool Scene600::Smoke::startAction(CursorType action, Event &event) {
 	return false;
 }
 
-GfxSurface Scene600::Smoke::getFrame() {
-	GfxSurface frame = SceneActor::getFrame();
+void Scene600::Smoke::draw() {
+	// Effect should always be active on smoke, but since the original had this
+	// check, include it here too
+	if (_effect == EFFECT_NONE) {
+		SceneActor::draw();
+		return;
+	}
 
-	if (_effect != EFFECT_NONE) {
-		// Translate the frame using the scene's pixel map
-		byte *pixelMap = static_cast<Scene600 *>(R2_GLOBALS._sceneManager._scene)->_pixelMap;
-		Graphics::Surface surface = frame.lockSurface();
-		byte *srcP = (byte *)surface.getPixels();
+	// Determine the area of the screen to be updated
+	Rect destRect = _bounds;
+	destRect.translate(-g_globals->_sceneManager._scene->_sceneBounds.left,
+		-g_globals->_sceneManager._scene->_sceneBounds.top);
 
-		while (srcP < ((byte *)surface.getBasePtr(0, surface.h))) {
-			*srcP = pixelMap[*srcP];
-			srcP++;
-		}
+	// Get the smoke frame, screen reference, and pixel palette translation map
+	GfxSurface frame = getFrame();
+	Graphics::Surface s = frame.lockSurface();
+	Graphics::Surface screen = g_globals->gfxManager().getSurface().lockSurface();
+	byte *pixelMap = static_cast<Scene600 *>(R2_GLOBALS._sceneManager._scene)->_pixelMap;
 
-		frame.unlockSurface();
+	// Loop through every pixel of the frame. Any pixel of the frame that's not a 
+	// tranparency, get the same pixel from the screen background, and shade it using
+	// the scene's pixel translation map
+	for (int yp = 0; yp < s.h; ++yp) {
+		byte *frameSrcP = (byte *)s.getBasePtr(0, yp);
+		byte *screenP = (byte *)screen.getBasePtr(destRect.left, destRect.top + yp);
+
+		for (int xp = 0; xp < s.w; ++xp, ++frameSrcP, ++screenP) {
+			if (*frameSrcP != frame._transColor) {
+				*frameSrcP = pixelMap[*screenP];
+			}
+		}
 	}
 
-	return frame;
+	// Finished updating the frame
+	frame.unlockSurface();
+	g_globals->gfxManager().getSurface().unlockSurface();
+
+	// Draw the processed frame
+	Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(_priority);
+	g_globals->gfxManager().copyFrom(frame, destRect, priorityRegion);
+
 }
 
 bool Scene600::Doorway::startAction(CursorType action, Event &event) {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index 216039a..ba93dda 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -661,7 +661,7 @@ class Scene600 : public SceneExt {
 	public:
 		virtual void signal();
 		virtual bool startAction(CursorType action, Event &event);
-		virtual GfxSurface getFrame();
+		virtual void draw();
 	};
 	class Doorway : public SceneActor {
 	public:






More information about the Scummvm-git-logs mailing list