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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Feb 2 14:57:29 CET 2008


Revision: 30740
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30740&view=rev
Author:   peres001
Date:     2008-02-02 05:57:29 -0800 (Sat, 02 Feb 2008)

Log Message:
-----------
BRA now loads and displays location backgrounds (at least in the intro).

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk_br.cpp
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parser_br.cpp

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2008-02-02 12:36:06 UTC (rev 30739)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2008-02-02 13:57:29 UTC (rev 30740)
@@ -318,6 +318,7 @@
 
 		info.bg.create(info.width, info.height, 1);
 		stream.read(info.bg.pixels, info.width * info.height);
+		stream.close();
 	}
 
 	if (mask) {
@@ -329,6 +330,7 @@
 		// have already been loaded
 		info.mask.create(info.width, info.height);
 		stream.read(info.mask.data, info.width * info.height);
+		stream.close();
 	}
 
 	if (path) {
@@ -340,6 +342,7 @@
 		// have already been loaded
 		info.path.create(info.width, info.height);
 		stream.read(info.path.data, info.width * info.height);
+		stream.close();
 	}
 
 	return;

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-02-02 12:36:06 UTC (rev 30739)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-02-02 13:57:29 UTC (rev 30740)
@@ -335,13 +335,14 @@
 			else
 				layer = _gfx->_backgroundInfo.getLayer(v18->_top + v18->height());
 
-
-			_gfx->showGfxObj(obj, true);
-			obj->frame = frame;
-			obj->x = v18->_left;
-			obj->y = v18->_top;
-			obj->z = v18->_z;
-			obj->layer = layer;
+			if (obj) {
+				_gfx->showGfxObj(obj, true);
+				obj->frame = frame;
+				obj->x = v18->_left;
+				obj->y = v18->_top;
+				obj->z = v18->_z;
+				obj->layer = layer;
+			}
 		}
 
 		if (((v18->_flags & kFlagsActive) == 0) && (v18->_flags & kFlagsRemove))   {
@@ -352,7 +353,9 @@
 		if ((v18->_flags & kFlagsActive) && (v18->_flags & kFlagsRemove))	{
 			v18->_flags &= ~kFlagsActive;
 			v18->_flags |= kFlagsRemove;
-			_gfx->showGfxObj(obj, false);
+			if (obj) {
+				_gfx->showGfxObj(obj, false);
+			}
 		}
 	}
 
@@ -407,7 +410,9 @@
 	}
 
 	_char._ani._z = _char._ani.height() + _char._ani._top;
-	_char._ani.gfxobj->z = _char._ani._z;
+	if (_char._ani.gfxobj) {
+		_char._ani.gfxobj->z = _char._ani._z;
+	}
 	modCounter++;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-02-02 12:36:06 UTC (rev 30739)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-02-02 13:57:29 UTC (rev 30740)
@@ -680,6 +680,9 @@
 
 		// BRA specific
 		int numZones;
+		char *bgName;
+		char *maskName;
+		char *pathName;
 	} _locParseCtxt;
 
 	void warning_unexpected();

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-02-02 12:36:06 UTC (rev 30739)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-02-02 13:57:29 UTC (rev 30740)
@@ -115,6 +115,7 @@
 	debugC(7, kDebugParser, "LOCATION_PARSER(location) ");
 
 	strcpy(_location._name, _tokens[1]);
+	_locParseCtxt.bgName = strdup(_tokens[1]);
 
 	bool flip = false;
 	int nextToken;
@@ -125,18 +126,9 @@
 	} else {
 		nextToken = 2;
 	}
-#if 0
-	_disk->loadScenery(*_backgroundInfo, _location._name, NULL, NULL);
 
-//	if (flip) {
-//		flip();
-//	}
+	// TODO: handle background horizontal flip (via a context parameter)
 
-	_gfx->setBackground(&_backgroundInfo.bg);
-	_gfx->_palette.clone(_backgroundInfo.palette);
-	_gfx->setPalette(_backgroundInfo.palette);
-#endif
-
 	if (_tokens[nextToken][0] != '\0') {
 		_char._ani._left = atoi(_tokens[nextToken]);
 		nextToken++;
@@ -271,23 +263,18 @@
 
 DECLARE_LOCATION_PARSER(mask)  {
 	debugC(7, kDebugParser, "LOCATION_PARSER(mask) ");
-#if 0
-	_disk->loadScenery(*_backgroundInfo, NULL, _tokens[1], NULL);
-	_gfx->setMask(&_backgroundInfo.mask);
 
-	_gfx->_bgLayers[0] = atoi(_tokens[2]);
-	_gfx->_bgLayers[1] = atoi(_tokens[3]);
-	_gfx->_bgLayers[2] = atoi(_tokens[4]);
-#endif
+	_locParseCtxt.maskName = strdup(_tokens[1]);
+	_gfx->_backgroundInfo.layers[0] = atoi(_tokens[2]);
+	_gfx->_backgroundInfo.layers[1] = atoi(_tokens[3]);
+	_gfx->_backgroundInfo.layers[2] = atoi(_tokens[4]);
 }
 
 
 DECLARE_LOCATION_PARSER(path)  {
 	debugC(7, kDebugParser, "LOCATION_PARSER(path) ");
-#if 0
-	_disk->loadScenery(*_backgroundInfo, NULL, NULL, _tokens[1]);
-	_pathBuffer = &_backgroundInfo.path;
-#endif
+
+	_locParseCtxt.pathName = strdup(_tokens[1]);
 }
 
 
@@ -947,9 +934,19 @@
 void Parallaction_br::parseLocation(const char* filename) {
 
 	_locParseCtxt.numZones = 0;
+	_locParseCtxt.bgName = 0;
+	_locParseCtxt.maskName = 0;
+	_locParseCtxt.pathName = 0;
 
 	Super::parseLocation(filename);
 
+	_gfx->setBackground(kBackgroundLocation, _locParseCtxt.bgName, _locParseCtxt.maskName, _locParseCtxt.pathName);
+	_pathBuffer = &_gfx->_backgroundInfo.path;
+
+	free(_locParseCtxt.bgName);
+	free(_locParseCtxt.maskName);
+	free(_locParseCtxt.pathName);
+
 //	drawZones();
 
 	return;


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