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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Mar 2 09:36:43 CET 2009


Revision: 39064
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39064&view=rev
Author:   peres001
Date:     2009-03-02 08:36:42 +0000 (Mon, 02 Mar 2009)

Log Message:
-----------
Initialize and save zones flags and follower position when a location switch occurs.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/objects.h
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp
    scummvm/trunk/engines/parallaction/parser.h
    scummvm/trunk/engines/parallaction/parser_br.cpp

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2009-03-02 08:32:38 UTC (rev 39063)
+++ scummvm/trunk/engines/parallaction/objects.h	2009-03-02 08:36:42 UTC (rev 39064)
@@ -233,6 +233,11 @@
 	DoorData() {
 		_location = NULL;
 		_startFrame = 0;
+		_startPos.x = -1000;
+		_startPos.y = -1000;
+		_startFrame2 = 0;
+		_startPos2.x = -1000;
+		_startPos2.y = -1000;
 		gfxobj = NULL;
 	}
 };
@@ -316,6 +321,7 @@
 
 	// BRA specific
 	uint			_index;
+	uint			_locationIndex;
 	char			*_linkedName;
 	AnimationPtr	_linkedAnim;
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2009-03-02 08:32:38 UTC (rev 39063)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2009-03-02 08:36:42 UTC (rev 39064)
@@ -496,6 +496,7 @@
 	void clearSubtitles();
 
 	void testCounterCondition(const Common::String &name, int op, int value);
+	void restoreOrSaveZoneFlags(ZonePtr z, bool restore);
 
 public:
 	bool	counterExists(const Common::String &name);

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-03-02 08:32:38 UTC (rev 39063)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-03-02 08:36:42 UTC (rev 39064)
@@ -87,6 +87,8 @@
 	_subtitle[0] = -1;
 	_subtitle[1] = -1;
 
+	memset(_zoneFlags, 0, sizeof(_zoneFlags));
+
 	_countersNames = 0;
 
 	_saveLoad = new SaveLoad_br(this, _saveFileMan);
@@ -453,4 +455,12 @@
 	}
 }
 
+void Parallaction_br::restoreOrSaveZoneFlags(ZonePtr z, bool restore) {
+	if (restore) {
+		z->_flags = _zoneFlags[z->_locationIndex][z->_index];
+	} else {
+		_zoneFlags[z->_locationIndex][z->_index] = z->_flags;
+	}
+}
+
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2009-03-02 08:32:38 UTC (rev 39063)
+++ scummvm/trunk/engines/parallaction/parser.h	2009-03-02 08:36:42 UTC (rev 39064)
@@ -308,6 +308,7 @@
 	virtual void	parseZoneTypeBlock(ZonePtr z);
 	void			parsePathData(ZonePtr z);
 	void 			parseGetData(ZonePtr z);
+	void 			parseDoorData(ZonePtr z);
 	void 			parseAnswerCounter(Answer *answer);
 	virtual Answer *parseAnswer();
 

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2009-03-02 08:32:38 UTC (rev 39063)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2009-03-02 08:36:42 UTC (rev 39064)
@@ -343,37 +343,35 @@
 	_vm->_disk->loadScenery(*ctxt.info, _tokens[1], 0, 0);
 }
 
-
-
 DECLARE_LOCATION_PARSER(zone)  {
 	debugC(7, kDebugParser, "LOCATION_PARSER(zone) ");
 
+	ctxt.z.reset();
 	parseZone(_vm->_location._zones, _tokens[1]);
+	if (!ctxt.z) {
+		return;
+	}
 
 	ctxt.z->_index = ctxt.numZones++;
+	ctxt.z->_locationIndex = _vm->_currentLocationIndex;
 
-	if (_vm->getLocationFlags() & kFlagsVisited) {
-		ctxt.z->_flags = _vm->_zoneFlags[_vm->_currentLocationIndex][ctxt.z->_index];
-	} else {
-		_vm->_zoneFlags[_vm->_currentLocationIndex][ctxt.z->_index] = ctxt.z->_flags;
-	}
-
+	_vm->restoreOrSaveZoneFlags(ctxt.z, _vm->getLocationFlags() & kFlagsVisited);
 }
 
 
 DECLARE_LOCATION_PARSER(animation)  {
 	debugC(7, kDebugParser, "LOCATION_PARSER(animation) ");
 
+	ctxt.a.reset();
 	parseAnimation(_vm->_location._animations, _tokens[1]);
+	if (!ctxt.a) {
+		return;
+	}
 
 	ctxt.a->_index = ctxt.numZones++;
+	ctxt.a->_locationIndex = _vm->_currentLocationIndex;
 
-	if (_vm->getLocationFlags() & kFlagsVisited) {
-		ctxt.a->_flags = _vm->_zoneFlags[_vm->_currentLocationIndex][ctxt.a->_index];
-	} else {
-		_vm->_zoneFlags[_vm->_currentLocationIndex][ctxt.a->_index] = ctxt.a->_flags;
-	}
-
+	_vm->restoreOrSaveZoneFlags(ctxt.a, _vm->getLocationFlags() & kFlagsVisited);
 }
 
 
@@ -808,6 +806,55 @@
 	z->u.get = data;
 }
 
+void LocationParser_br::parseDoorData(ZonePtr z) {
+
+	DoorData *data = new DoorData;
+
+	do {
+
+		if (!scumm_stricmp(_tokens[0], "slidetext")) {
+			strcpy(_vm->_location._slideText[0], _tokens[1]);
+//				printf("%s\t", _slideText[0]);
+			strcpy(_vm->_location._slideText[1], _tokens[2]);
+		}
+
+		if (!scumm_stricmp(_tokens[0], "location")) {
+			data->_location = strdup(_tokens[1]);
+		}
+
+		if (!scumm_stricmp(_tokens[0], "file")) {
+//				printf("file: '%s'", _tokens[0]);
+
+			uint16 frame = (z->_flags & kFlagsClosed ? 0 : 1);
+
+			GfxObj *obj = _vm->_gfx->loadDoor(_tokens[1]);
+			obj->frame = frame;
+			obj->x = z->getX();
+			obj->y = z->getY();
+			_vm->_gfx->showGfxObj(obj, true);
+
+			data->gfxobj = obj;
+		}
+
+		if (!scumm_stricmp(_tokens[0],	"startpos")) {
+			data->_startPos.x = atoi(_tokens[1]);
+			data->_startPos.y = atoi(_tokens[2]);
+			data->_startFrame = atoi(_tokens[3]);
+		}
+
+		if (!scumm_stricmp(_tokens[0],	"startpos2")) {
+			data->_startPos2.x = atoi(_tokens[1]);
+			data->_startPos2.y = atoi(_tokens[2]);
+			data->_startFrame2 = atoi(_tokens[3]);
+		}
+
+		_script->readLineToken(true);
+	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
+
+	z->u.door = data;
+
+}
+
 void LocationParser_br::parseZoneTypeBlock(ZonePtr z) {
 	debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
 


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