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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Mar 29 15:56:16 CEST 2009


Revision: 39740
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39740&view=rev
Author:   peres001
Date:     2009-03-29 13:56:16 +0000 (Sun, 29 Mar 2009)

Log Message:
-----------
(Re)link bounding animations after location has been completely parsed. This avoids problems due to forward references.

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

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2009-03-29 13:17:34 UTC (rev 39739)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2009-03-29 13:56:16 UTC (rev 39740)
@@ -115,14 +115,11 @@
 
 
 DECLARE_COMMAND_OPCODE(location) {
-	warning("Parallaction_br::cmdOp_location command not yet implemented");
-
 	_vm->_location._startPosition = ctxt._cmd->_startPos;
-	_vm->_location._startFrame = 0; // TODO: verify this against the disassembly!f
+	_vm->_location._startFrame = 0;
 	_vm->_location._followerStartPosition = ctxt._cmd->_startPos2;
 	_vm->_location._followerStartFrame = 0;
 
-	// TODO: handle startPos and startPos2
 	_vm->scheduleLocationSwitch(ctxt._cmd->_string);
 }
 

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2009-03-29 13:17:34 UTC (rev 39739)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2009-03-29 13:56:16 UTC (rev 39740)
@@ -201,13 +201,9 @@
 	// BRA specific
 	_index = INVALID_ZONE_INDEX;
 	_locationIndex = INVALID_LOCATION_INDEX;
-	_linkedName = 0;
 }
 
 Zone::~Zone() {
-//	printf("~Zone(%s)\n", _name);
-
-	free(_linkedName);
 }
 
 void Zone::translate(int16 x, int16 y) {

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2009-03-29 13:17:34 UTC (rev 39739)
+++ scummvm/trunk/engines/parallaction/objects.h	2009-03-29 13:56:16 UTC (rev 39740)
@@ -281,7 +281,7 @@
 	// BRA specific
 	uint			_index;
 	uint			_locationIndex;
-	char			*_linkedName;
+	Common::String	_linkedName;
 	AnimationPtr	_linkedAnim;
 
 	Zone();

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2009-03-29 13:17:34 UTC (rev 39739)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2009-03-29 13:56:16 UTC (rev 39740)
@@ -728,7 +728,9 @@
 	if (z->_flags & kFlagsRemove)
 		return false;
 
-	if ((z->_flags & kFlagsAnimLinked) == 0)
+	// flag kFlagsAnimLinked may be on, but the animation may not be loaded, so
+	// we must use the animation reference to check here
+	if (!z->_linkedAnim)
 		return false;
 
 	debugC(5, kDebugExec, "checkLinkedAnimBox for %s (type = %x, x = %i, y = %i)", z->_name, type, x, y);

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-03-29 13:17:34 UTC (rev 39739)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-03-29 13:56:16 UTC (rev 39740)
@@ -360,8 +360,14 @@
 
 	ZoneList::iterator zit = _vm->_location._zones.begin();
 	for ( ; zit != _vm->_location._zones.end(); ++zit) {
+		ZonePtr z = *zit;
 		// restore the flags if the location has already been visited
-		restoreOrSaveZoneFlags(*zit, visited);
+		restoreOrSaveZoneFlags(z, visited);
+
+		// (re)link the bounding animation if needed
+		if (z->_flags & kFlagsAnimLinked) {
+			z->_linkedAnim = _location.findAnimation(z->_linkedName.c_str());
+		}
 	}
 
 	debugC(1, kDebugParser, "parseLocation('%s') done", filename);

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2009-03-29 13:17:34 UTC (rev 39739)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2009-03-29 13:56:16 UTC (rev 39740)
@@ -717,8 +717,7 @@
 
 	if (isalpha(_tokens[1][1])) {
 		ctxt.z->_flags |= kFlagsAnimLinked;
-		ctxt.z->_linkedAnim = _vm->_location.findAnimation(_tokens[1]);
-		ctxt.z->_linkedName = strdup(_tokens[1]);
+		ctxt.z->_linkedName = _tokens[1];
 	} else {
 		ctxt.z->setRect(atoi(_tokens[1]), atoi(_tokens[2]), atoi(_tokens[3]), atoi(_tokens[4]));
 	}


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