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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Feb 10 22:00:16 CET 2007


Revision: 25478
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25478&view=rev
Author:   peres001
Date:     2007-02-10 13:00:15 -0800 (Sat, 10 Feb 2007)

Log Message:
-----------
fixed wrong implementation: zones and animations now survive location switches according to their properties and/or system flags

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/zone.cpp

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-02-10 20:50:00 UTC (rev 25477)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-02-10 21:00:15 UTC (rev 25478)
@@ -36,6 +36,7 @@
 void parseWalkNodes(ArchivedFile *file, Node *list);
 void freeAnimations();
 
+Node helperNode = { NULL, NULL };
 
 void Parallaction::parseLocation(const char *filename) {
 //	printf("parseLocation(%s)", filename);
@@ -217,15 +218,17 @@
 	_locationWalkNodes._next = NULL;
     debugC(7, kDebugLocation, "freeLocation: walk nodes freed");
 
+    helperNode._prev = helperNode._next = NULL;
 	freeZones(_zones._next);
 	freeNodeList(_zones._next);
-	memset(&_zones, 0, sizeof(Node));
+	memcpy(&_zones, &helperNode, sizeof(Node));
     debugC(7, kDebugLocation, "freeLocation: zones freed");
 
+    helperNode._prev = helperNode._next = NULL;
 	freeZones(_animations._next);
 	freeAnimations();
 	freeNodeList(_animations._next);
-    memset(&_animations, 0, sizeof(Node));
+    memcpy(&_animations, &helperNode, sizeof(Node));
     debugC(7, kDebugLocation, "freeLocation: animations freed");
 
 	if (_locationComment) {

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-02-10 20:50:00 UTC (rev 25477)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-02-10 21:00:15 UTC (rev 25478)
@@ -36,6 +36,8 @@
 Node _zones = { NULL, NULL };
 Node _animations = { NULL, NULL };
 
+extern Node helperNode;
+
 Zone *findZone(const char *name) {
 
 	Zone *v4 = (Zone*)_zones._next;
@@ -124,10 +126,8 @@
 	Zone *z = (Zone*)list;
 	Zone *v8 = NULL;
 
-	Node nullNode = { 0, 0 };
+	for (; z; ) {
 
-	for (; z; z=(Zone*)z->_node._next) {
-
 		// TODO: understand and simplify this monster
 		if (((z->_limits._top == -1) || ((z->_limits._left == -2) && ((isItemInInventory(z->u.merge->_obj1) != 0) || (isItemInInventory(z->u.merge->_obj2) != 0)))) &&
 			((_engineFlags & kEngineQuit) == 0)) {
@@ -136,7 +136,7 @@
 
 			v8 = (Zone*)z->_node._next;
 			removeNode(&z->_node);
-			addNode(&nullNode, &z->_node);
+			addNode(&helperNode, &z->_node);
 			z = v8;
 			continue;
 		}
@@ -184,6 +184,8 @@
 		_vm->_graphics->freeStaticCnv(&z->_label._cnv);
 		freeCommands(z->_commands);
 
+        z=(Zone*)z->_node._next;
+
 	}
 
 	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