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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Nov 8 16:02:20 CET 2008


Revision: 34940
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34940&view=rev
Author:   peres001
Date:     2008-11-08 15:02:19 +0000 (Sat, 08 Nov 2008)

Log Message:
-----------
* cleanup
* moved find routines from Parallaction to Location

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables_ns.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parser_br.cpp
    scummvm/trunk/engines/parallaction/parser_ns.cpp

Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-11-08 14:56:45 UTC (rev 34939)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-11-08 15:02:19 UTC (rev 34940)
@@ -188,21 +188,21 @@
 		_introSarcData2 = 0;
 		if (!_moveSarcZones[0]) {
 
-			_moveSarcZones[0] = findZone("sarc1");
-			_moveSarcZones[1] = findZone("sarc2");
-			_moveSarcZones[2] = findZone("sarc3");
-			_moveSarcZones[3] = findZone("sarc4");
-			_moveSarcZones[4] = findZone("sarc5");
+			_moveSarcZones[0] = _location.findZone("sarc1");
+			_moveSarcZones[1] = _location.findZone("sarc2");
+			_moveSarcZones[2] = _location.findZone("sarc3");
+			_moveSarcZones[3] = _location.findZone("sarc4");
+			_moveSarcZones[4] = _location.findZone("sarc5");
 
-			_moveSarcExaZones[0] = findZone("sarc1exa");
-			_moveSarcExaZones[1] = findZone("sarc2exa");
-			_moveSarcExaZones[2] = findZone("sarc3exa");
-			_moveSarcExaZones[3] = findZone("sarc4exa");
-			_moveSarcExaZones[4] = findZone("sarc5exa");
+			_moveSarcExaZones[0] = _location.findZone("sarc1exa");
+			_moveSarcExaZones[1] = _location.findZone("sarc2exa");
+			_moveSarcExaZones[2] = _location.findZone("sarc3exa");
+			_moveSarcExaZones[3] = _location.findZone("sarc4exa");
+			_moveSarcExaZones[4] = _location.findZone("sarc5exa");
 
 		}
 
-		a = findAnimation("sposta");
+		a = _location.findAnimation("sposta");
 
 		_moveSarcZone1 = *(ZonePtr*)parm;
 
@@ -239,7 +239,7 @@
 		_moveSarcZones[3]->getX() == 134 &&
 		_moveSarcZones[4]->getX() == 167) {
 
-		a = findAnimation("finito");
+		a = _location.findAnimation("finito");
 
 		a->_flags |= (kFlagsActive | kFlagsActing);
 		setLocationFlags(0x20);		// GROSS HACK: activates 'finito' flag in dinoit_museo.loc
@@ -403,7 +403,7 @@
 */
 
 void Parallaction_ns::_c_startIntro(void *parm) {
-	_rightHandAnim = findAnimation("righthand");
+	_rightHandAnim = _location.findAnimation("righthand");
 
 	if (getPlatform() == Common::kPlatformPC) {
 		_soundMan->setMusicFile("intro");

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-11-08 14:56:45 UTC (rev 34939)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-11-08 15:02:19 UTC (rev 34940)
@@ -189,9 +189,9 @@
 	return;
 }
 
-AnimationPtr Parallaction::findAnimation(const char *name) {
+AnimationPtr Location::findAnimation(const char *name) {
 
-	for (AnimationList::iterator it = _location._animations.begin(); it != _location._animations.end(); it++)
+	for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++)
 		if (!scumm_stricmp((*it)->_name, name)) return *it;
 
 	return nullAnimationPtr;
@@ -808,12 +808,10 @@
 }
 
 
-ZonePtr Parallaction::findZone(const char *name) {
-
-	for (ZoneList::iterator it = _location._zones.begin(); it != _location._zones.end(); it++) {
+ZonePtr Location::findZone(const char *name) {
+	for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
 		if (!scumm_stricmp((*it)->_name, name)) return *it;
 	}
-
 	return findAnimation(name);
 }
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-11-08 14:56:45 UTC (rev 34939)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-11-08 15:02:19 UTC (rev 34940)
@@ -159,6 +159,9 @@
 	Location();
 	~Location();
 
+	AnimationPtr findAnimation(const char *name);
+	ZonePtr findZone(const char *name);
+
 	void cleanup(bool removeAll);
 };
 
@@ -325,15 +328,11 @@
 	bool 		checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y);
 	bool 		checkZoneBox(ZonePtr z, uint32 type, uint x, uint y);
 	bool 		checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y);
-	ZonePtr		findZone(const char *name);
 	ZonePtr		hitZone(uint32 type, uint16 x, uint16 y);
 	void		runZone(ZonePtr z);
-	void		freeZones(bool removeAll);
 	bool		pickupItem(ZonePtr z);
 	void 		updateDoor(ZonePtr z, bool close);
 	void 		showZone(ZonePtr z, bool visible);
-	AnimationPtr findAnimation(const char *name);
-	void		freeAnimations();
 	void		setBackground(const char *background, const char *mask, const char *path);
 	void		freeBackground();
 	void 		highlightInventoryItem(ItemPosition pos);

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-11-08 14:56:45 UTC (rev 34939)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-11-08 15:02:19 UTC (rev 34940)
@@ -717,7 +717,7 @@
 
 	if (isalpha(_tokens[1][1])) {
 		ctxt.z->_flags |= kFlagsAnimLinked;
-		ctxt.z->_linkedAnim = _vm->findAnimation(_tokens[1]);
+		ctxt.z->_linkedAnim = _vm->_location.findAnimation(_tokens[1]);
 		ctxt.z->_linkedName = strdup(_tokens[1]);
 	} else {
 		ctxt.z->setBox(atoi(_tokens[1]), atoi(_tokens[2]), atoi(_tokens[3]), atoi(_tokens[4]));
@@ -912,7 +912,7 @@
 DECLARE_INSTRUCTION_PARSER(zone)  {
 	debugC(7, kDebugParser, "INSTRUCTION_PARSER(zone) ");
 
-	ctxt.inst->_z = _vm->findZone(_tokens[1]);
+	ctxt.inst->_z = _vm->_location.findZone(_tokens[1]);
 	ctxt.inst->_index = _parser->_lookup;
 }
 
@@ -1029,7 +1029,7 @@
 
 	AnimationPtr a;
 	if (str[1] == '.') {
-		a = _vm->findAnimation(&str[2]);
+		a = _vm->_location.findAnimation(&str[2]);
 		if (!a) {
 			error("unknown animation '%s' in script", &str[2]);
 		}

Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-11-08 14:56:45 UTC (rev 34939)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-11-08 15:02:19 UTC (rev 34940)
@@ -306,11 +306,11 @@
 
 	if (_tokens[0][1] == '.') {
 		_tokens[0][1] = '\0';
-		ctxt.a = _vm->findAnimation(&_tokens[0][2]);
+		ctxt.a = _vm->_location.findAnimation(&_tokens[0][2]);
 	} else
 	if (_tokens[1][1] == '.') {
 		_tokens[1][1] = '\0';
-		ctxt.a = _vm->findAnimation(&_tokens[1][2]);
+		ctxt.a = _vm->_location.findAnimation(&_tokens[1][2]);
 	} else
 		ctxt.a = _program->_anim;
 
@@ -369,7 +369,7 @@
 	if (!scumm_stricmp(_tokens[1], ctxt.a->_name)) {
 		ctxt.inst->_a = ctxt.a;
 	} else {
-		ctxt.inst->_a = _vm->findAnimation(_tokens[1]);
+		ctxt.inst->_a = _vm->_location.findAnimation(_tokens[1]);
 	}
 
 	ctxt.inst->_index = _parser->_lookup;
@@ -466,7 +466,7 @@
 	if (!scumm_stricmp(_tokens[1], ctxt.a->_name)) {
 		ctxt.inst->_a = ctxt.a;
 	} else {
-		ctxt.inst->_a = _vm->findAnimation(_tokens[1]);
+		ctxt.inst->_a = _vm->_location.findAnimation(_tokens[1]);
 	}
 
 	parseRValue(ctxt.inst->_opA, _tokens[2]);
@@ -492,7 +492,7 @@
 DECLARE_INSTRUCTION_PARSER(sound)  {
 	debugC(7, kDebugParser, "INSTRUCTION_PARSER(sound) ");
 
-	ctxt.inst->_z = _vm->findZone(_tokens[1]);
+	ctxt.inst->_z = _vm->_location.findZone(_tokens[1]);
 	ctxt.inst->_index = _parser->_lookup;
 }
 
@@ -545,7 +545,7 @@
 
 	AnimationPtr a;
 	if (str[1] == '.') {
-		a = _vm->findAnimation(&str[2]);
+		a = _vm->_location.findAnimation(&str[2]);
 	} else {
 		a = ctxt.a;
 	}
@@ -575,7 +575,7 @@
 
 	AnimationPtr a;
 	if (str[1] == '.') {
-		a = _vm->findAnimation(&str[2]);
+		a = _vm->_location.findAnimation(&str[2]);
 	} else {
 		a = ctxt.a;
 	}
@@ -628,7 +628,7 @@
 
 	createCommand(_parser->_lookup);
 
-	ctxt.cmd->u._zone = _vm->findZone(_tokens[ctxt.nextToken]);
+	ctxt.cmd->u._zone = _vm->_location.findZone(_tokens[ctxt.nextToken]);
 	if (!ctxt.cmd->u._zone) {
 		saveCommandForward(_tokens[ctxt.nextToken], ctxt.cmd);
 	}
@@ -794,7 +794,7 @@
 
 void LocationParser_ns::resolveCommandForwards() {
 	for (uint i = 0; i < _numForwardedCommands; i++) {
-		_forwardedCommands[i].cmd->u._zone = _vm->findZone(_forwardedCommands[i].name);
+		_forwardedCommands[i].cmd->u._zone = _vm->_location.findZone(_forwardedCommands[i].name);
 		if (_forwardedCommands[i].cmd->u._zone == 0) {
 			warning("Cannot find zone '%s' into current location script. This may be a bug in the original scripts.\n", _forwardedCommands[i].name);
 		}
@@ -1367,7 +1367,7 @@
 void LocationParser_ns::parseZone(ZoneList &list, char *name) {
 	debugC(5, kDebugParser, "parseZone(name: %s)", name);
 
-	if (_vm->findZone(name)) {
+	if (_vm->_location.findZone(name)) {
 		_script->skip("endzone");
 		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