[Scummvm-cvs-logs] SF.net SVN: scummvm: [30814] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Feb 7 13:49:47 CET 2008


Revision: 30814
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30814&view=rev
Author:   peres001
Date:     2008-02-07 04:49:46 -0800 (Thu, 07 Feb 2008)

Log Message:
-----------
Implemented scroll command and added a couple more debug variables.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/gfxbase.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-02-06 19:50:45 UTC (rev 30813)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-02-07 12:49:46 UTC (rev 30814)
@@ -267,6 +267,7 @@
 
 DECLARE_COMMAND_OPCODE(scroll) {
 	warning("Parallaction_br::cmdOp_scroll not yet implemented");
+	_gfx->setVar("scroll_x", _cmdRunCtxt.cmd->u._rvalue );
 }
 
 

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-02-06 19:50:45 UTC (rev 30813)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-02-07 12:49:46 UTC (rev 30814)
@@ -163,7 +163,7 @@
 			GfxObj *obj = *b;
 			if (obj->isVisible()) {
 				obj->getRect(obj->frame, rect);
-				rect.translate(obj->x, obj->y);
+				rect.translate(obj->x - _varScrollX, obj->y);
 				data = obj->getData(obj->frame);
 				if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
 					blt(rect, data, &surf, obj->layer, 0);

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-02-06 19:50:45 UTC (rev 30813)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-02-07 12:49:46 UTC (rev 30814)
@@ -405,8 +405,29 @@
 	}
 
 
+	if (_vm->_screenWidth >= _backgroundInfo.width) {
+		_varScrollX = 0;
+	} else {
+		_varScrollX = getVar("scroll_x");
+	}
+
+	_varAnimRenderMode = getRenderMode("anim_render_mode");
+	_varMiscRenderMode = getRenderMode("misc_render_mode");
 }
 
+int32 Gfx::getRenderMode(const char *type) {
+
+	int32 mode = getVar(type);
+	if (mode < 0 || mode > 2) {
+		warning("new value for '%s' is wrong: resetting default", type);
+		setVar(type, 1);
+		mode = 1;
+	}
+	return mode;
+
+}
+
+
 void Gfx::updateScreen() {
 
 	// background may not cover the whole screen, so adjust bulk update size
@@ -417,17 +438,19 @@
 	uint16 backgroundPitch = 0;
 	switch (_varBackgroundMode) {
 	case 1:
-		backgroundData = (byte*)_backgroundInfo.bg.pixels;
+		backgroundData = (byte*)_backgroundInfo.bg.getBasePtr(_varScrollX, 0);
 		backgroundPitch = _backgroundInfo.bg.pitch;
 		break;
 	case 2:
-		backgroundData = (byte*)_bitmapMask.pixels;
+		backgroundData = (byte*)_bitmapMask.getBasePtr(_varScrollX, 0);
 		backgroundPitch = _bitmapMask.pitch;
 		break;
 	}
 	g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo.x, _backgroundInfo.y, w, h);
 
 
+	_varRenderMode = _varAnimRenderMode;
+
 	// TODO: transform objects coordinates to be drawn with scrolling
 	Graphics::Surface *surf = g_system->lockScreen();
 	drawGfxObjects(*surf);
@@ -455,11 +478,11 @@
 
 	g_system->unlockScreen();
 
+	_varRenderMode = _varMiscRenderMode;
+
 	drawInventory();
-
 	drawItems();
 	drawBalloons();
-
 	drawLabels();
 
 	g_system->updateScreen();
@@ -526,6 +549,7 @@
 	blt(r, _unpackedBitmap, surf, z, transparentColor);
 }
 
+
 void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor) {
 
 	Common::Point dp;
@@ -547,41 +571,66 @@
 	uint sPitch = r.width() - q.width();
 	uint dPitch = surf->w - q.width();
 
-    if (_backgroundInfo.mask.data && (z < LAYER_FOREGROUND)) {
 
-        for (uint16 i = 0; i < q.height(); i++) {
+	if (_varRenderMode == 2) {
 
-            for (uint16 j = 0; j < q.width(); j++) {
-                if (*s != transparentColor) {
-                    byte v = _backgroundInfo.mask.getValue(dp.x + j, dp.y + i);
-                    if (z >= v) *d = *s;
-                }
+		for (uint16 i = 0; i < q.height(); i++) {
 
-                s++;
-                d++;
-            }
+			for (uint16 j = 0; j < q.width(); j++) {
+				if (*s != transparentColor) {
+					if (_backgroundInfo.mask.data && (z < LAYER_FOREGROUND)) {
+						byte v = _backgroundInfo.mask.getValue(dp.x + j, dp.y + i);
+						if (z >= v) *d = 5;
+					} else {
+						*d = 5;
+					}
+				}
 
-            s += sPitch;
-            d += dPitch;
-        }
+				s++;
+				d++;
+			}
 
+			s += sPitch;
+			d += dPitch;
+		}
+
     } else {
+		if (_backgroundInfo.mask.data && (z < LAYER_FOREGROUND)) {
 
-        for (uint16 i = q.top; i < q.bottom; i++) {
-            for (uint16 j = q.left; j < q.right; j++) {
-                if (*s != transparentColor)
-                    *d = *s;
+			for (uint16 i = 0; i < q.height(); i++) {
 
-                s++;
-                d++;
-            }
+				for (uint16 j = 0; j < q.width(); j++) {
+					if (*s != transparentColor) {
+						byte v = _backgroundInfo.mask.getValue(dp.x + j, dp.y + i);
+						if (z >= v) *d = *s;
+					}
 
-            s += sPitch;
-            d += dPitch;
-        }
+					s++;
+					d++;
+				}
 
-    }
+				s += sPitch;
+				d += dPitch;
+			}
 
+		} else {
+
+			for (uint16 i = q.top; i < q.bottom; i++) {
+				for (uint16 j = q.left; j < q.right; j++) {
+					if (*s != transparentColor)
+						*d = *s;
+
+					s++;
+					d++;
+				}
+
+				s += sPitch;
+				d += dPitch;
+			}
+
+		}
+	}
+
 }
 
 
@@ -855,6 +904,12 @@
 	registerVar("background_mode", 1);
 	_varBackgroundMode = 1;
 
+	registerVar("scroll_x", 0);
+	_varScrollX = 0;
+
+	registerVar("anim_render_mode", 1);
+	registerVar("misc_render_mode", 1);
+
 	return;
 }
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-02-06 19:50:45 UTC (rev 30813)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-02-07 12:49:46 UTC (rev 30814)
@@ -538,10 +538,14 @@
 	int				_hbCircleRadius;
 
 	// frame data stored in programmable variables
-	int32				_varBackgroundMode;
+	int32				_varBackgroundMode;	// 1 = normal, 2 = only mask
+	int32				_varScrollX;
+	int32				_varAnimRenderMode;	// 1 = normal, 2 = flat
+	int32				_varMiscRenderMode;	// 1 = normal, 2 = flat
+	int32				_varRenderMode;
 	Graphics::Surface 	_bitmapMask;
+	int32 				getRenderMode(const char *type);
 
-
 protected:
 	static int16 _dialogueBalloonX[5];
 


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