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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Mar 18 20:35:57 CET 2007


Revision: 26226
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26226&view=rev
Author:   peres001
Date:     2007-03-18 12:35:54 -0700 (Sun, 18 Mar 2007)

Log Message:
-----------
- Made global Node's (_zones, _animations, _helperNode) and the functions using them members of the engine.
- Added a constructor for Node

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/callables.cpp
    scummvm/trunk/engines/parallaction/commands.cpp
    scummvm/trunk/engines/parallaction/defs.h
    scummvm/trunk/engines/parallaction/intro.cpp
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/walk.cpp
    scummvm/trunk/engines/parallaction/zone.cpp
    scummvm/trunk/engines/parallaction/zone.h

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -53,15 +53,15 @@
 
 
 void	wrapLocalVar(LocalVariable *local);
-void	sortAnimations();
 
+
 LValue	getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation *a);
 
 
 uint16	_numLocals = 0;
 char	_localNames[10][10];
 
-Animation *findAnimation(const char *name) {
+Animation *Parallaction::findAnimation(const char *name) {
 
 	Animation *v4 = (Animation*)_animations._next;
 
@@ -166,7 +166,7 @@
 
 
 
-void freeAnimations() {
+void Parallaction::freeAnimations() {
 	Animation *v4 = (Animation*)_animations._next;
 	while (v4) {
 		freeScript(v4->_program);
@@ -182,7 +182,7 @@
 void jobDisplayAnimations(void *parm, Job *j) {
 //	printf("jobDisplayAnimations()...\n");
 
-	Animation *v18 = (Animation*)_animations._next;
+	Animation *v18 = (Animation*)_vm->_animations._next;
 	StaticCnv v14;
 
 	uint16 _si = 0;
@@ -226,7 +226,7 @@
 void jobEraseAnimations(void *arg_0, Job *j) {
 	debugC(3, kDebugJobs, "jobEraseAnimations");
 
-	Animation *a = (Animation*)_animations._next;
+	Animation *a = (Animation*)_vm->_animations._next;
 
 	for (; a; a=(Animation*)a->_zone._next) {
 
@@ -457,7 +457,7 @@
 	}
 
 	if (str[1] == '.') {
-		a = findAnimation(&str[2]);
+		a = _vm->findAnimation(&str[2]);
 	}
 
 	if (str[0] == 'X') {
@@ -483,7 +483,7 @@
 
 	static uint16 modCounter = 0;
 
-	Animation *a = (Animation*)_animations._next;
+	Animation *a = (Animation*)_vm->_animations._next;
 
 	StaticCnv v18;
 	WalkNode *v4 = NULL;
@@ -634,7 +634,7 @@
 			a->_z = a->_zone._top + a->height();
 	}
 
-	sortAnimations();
+	_vm->sortAnimations();
 	modCounter++;
 
 	return;
@@ -653,7 +653,7 @@
 
 
 
-void sortAnimations() {
+void Parallaction::sortAnimations() {
 	Node v14;
 	memset(&v14, 0, sizeof(Node));
 

Modified: scummvm/trunk/engines/parallaction/callables.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/callables.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -92,21 +92,21 @@
 		_introSarcData2 = 0;
 		if (_moveSarcZones[0] == NULL) {
 
-			_moveSarcZones[0] = findZone("sarc1");
-			_moveSarcZones[1] = findZone("sarc2");
-			_moveSarcZones[2] = findZone("sarc3");
-			_moveSarcZones[3] = findZone("sarc4");
-			_moveSarcZones[4] = findZone("sarc5");
+			_moveSarcZones[0] = _vm->findZone("sarc1");
+			_moveSarcZones[1] = _vm->findZone("sarc2");
+			_moveSarcZones[2] = _vm->findZone("sarc3");
+			_moveSarcZones[3] = _vm->findZone("sarc4");
+			_moveSarcZones[4] = _vm->findZone("sarc5");
 
-			_moveSarcExaZones[0] = findZone("sarc1exa");
-			_moveSarcExaZones[1] = findZone("sarc2exa");
-			_moveSarcExaZones[2] = findZone("sarc3exa");
-			_moveSarcExaZones[3] = findZone("sarc4exa");
-			_moveSarcExaZones[4] = findZone("sarc5exa");
+			_moveSarcExaZones[0] = _vm->findZone("sarc1exa");
+			_moveSarcExaZones[1] = _vm->findZone("sarc2exa");
+			_moveSarcExaZones[2] = _vm->findZone("sarc3exa");
+			_moveSarcExaZones[3] = _vm->findZone("sarc4exa");
+			_moveSarcExaZones[4] = _vm->findZone("sarc5exa");
 
 		}
 
-		a = findAnimation("sposta");
+		a = _vm->findAnimation("sposta");
 
 		_moveSarcZone1 = (Zone*)parm;
 
@@ -147,7 +147,7 @@
 		_moveSarcZones[3]->_left == 134 &&
 		_moveSarcZones[4]->_left == 167) {
 
-		a = findAnimation("finito");
+		a = _vm->findAnimation("finito");
 
 		a->_zone._flags |= (kFlagsActive | kFlagsActing);
 		_localFlags[_vm->_currentLocationIndex] |= 0x20;		// GROSS HACK: activates 'finito' flag in dinoit_museo.loc
@@ -319,17 +319,17 @@
 
 	_engineFlags |= kEngineQuit;
 
-	freeZones(_zones._next);
-	freeNodeList(_zones._next);
-	_zones._next = NULL;
+	_vm->freeZones(_vm->_zones._next);
+	freeNodeList(_vm->_zones._next);
+	_vm->_zones._next = NULL;
 
-	freeZones(_animations._next);
-	freeNodeList(_animations._next);
-	_animations._next = NULL;
+	_vm->freeZones(_vm->_animations._next);
+	freeNodeList(_vm->_animations._next);
+	_vm->_animations._next = NULL;
 
 	_engineFlags &= ~kEngineQuit;
 
-	addNode(&_animations, &_vm->_char._ani._zone);
+	addNode(&_vm->_animations, &_vm->_char._ani._zone);
 	_score = 0;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/commands.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/commands.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/commands.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -88,7 +88,7 @@
 
 		case CMD_START: // start
 		case CMD_STOP:	// stop
-			cmd->u._animation = findAnimation(_tokens[_si]);
+			cmd->u._animation = _vm->findAnimation(_tokens[_si]);
 			_si++;
 			if (cmd->u._animation == NULL) {
 				strcpy(_forwardedAnimationNames[_numForwards], _tokens[_si-1]);
@@ -103,7 +103,7 @@
 		case CMD_CLOSE: // close
 		case CMD_ON:	// on
 		case CMD_OFF:	// off
-			cmd->u._zone = findZone(_tokens[_si]);
+			cmd->u._zone = _vm->findZone(_tokens[_si]);
 			_si++;
 			break;
 

Modified: scummvm/trunk/engines/parallaction/defs.h
===================================================================
--- scummvm/trunk/engines/parallaction/defs.h	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/defs.h	2007-03-18 19:35:54 UTC (rev 26226)
@@ -36,6 +36,11 @@
 struct Node {
 	Node*	_prev;
 	Node*	_next;
+
+	Node() {
+		_prev = NULL;
+		_next = NULL;
+	}
 };
 
 struct WalkNode : public Node {

Modified: scummvm/trunk/engines/parallaction/intro.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/intro.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/intro.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -123,7 +123,7 @@
 
 
 void _c_startIntro(void *parm) {
-	_rightHandAnim = findAnimation("righthand");
+	_rightHandAnim = _vm->findAnimation("righthand");
 	_vm->_midiPlayer->play("intro");
 	_engineFlags |= kEngineMouse;
 

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -33,10 +33,10 @@
 void resolveLocationForwards();
 void switchBackground(const char* background, const char* mask);
 void parseWalkNodes(Script &script, Node *list);
-void freeAnimations();
 
-Node helperNode = { NULL, NULL };
 
+
+
 void Parallaction::parseLocation(const char *filename) {
 //	printf("parseLocation(%s)", filename);
     debugC(1, kDebugLocation, "parseLocation('%s')", filename);
@@ -168,7 +168,7 @@
 //	printf("# forwards: %i", _numForwards);
 
 	for (uint16 _si = 0; _forwardedCommands[_si]; _si++) {
-		_forwardedCommands[_si]->u._animation = findAnimation(_forwardedAnimationNames[_si]);
+		_forwardedCommands[_si]->u._animation = _vm->findAnimation(_forwardedAnimationNames[_si]);
 		_forwardedCommands[_si] = NULL;
 	}
 
@@ -177,7 +177,7 @@
 }
 
 
-void freeLocation() {
+void Parallaction::freeLocation() {
 	debugC(7, kDebugLocation, "freeLocation");
 
 	uint16 _si = 1;
@@ -194,14 +194,14 @@
 	debugC(7, kDebugLocation, "freeLocation: walk nodes freed");
 
 	helperNode._prev = helperNode._next = NULL;
-	freeZones(_zones._next);
+	_vm->freeZones(_zones._next);
 	freeNodeList(_zones._next);
 	memcpy(&_zones, &helperNode, sizeof(Node));
 	debugC(7, kDebugLocation, "freeLocation: zones freed");
 
 	helperNode._prev = helperNode._next = NULL;
-	freeZones(_animations._next);
-	freeAnimations();
+	_vm->freeZones(_animations._next);
+	_vm->freeAnimations();
 	freeNodeList(_animations._next);
 	memcpy(&_animations, &helperNode, sizeof(Node));
 	debugC(7, kDebugLocation, "freeLocation: animations freed");

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-03-18 19:35:54 UTC (rev 26226)
@@ -162,8 +162,8 @@
 void runCommands(Command *list, Zone *z = NULL);
 void freeCommands(Command*);
 
-void freeZones(Node *list);
 
+
 void runDialogue(SpeakData*);
 
 WalkNode *buildWalkPath(uint16 x, uint16 y);
@@ -308,6 +308,14 @@
 	void resumeJobs();
 	void runJobs();
 
+	void 		freeZones(Node *list);
+	Animation  	*findAnimation(const char *name);
+	Zone 		*findZone(const char *name);
+	Zone   		*hitZone(uint32 type, uint16 x, uint16 y);
+	void 		freeAnimations();
+	void		sortAnimations();
+	void 		freeLocation();
+
 public:
 	int getGameType() const;
 	uint32 getFeatures() const;
@@ -339,6 +347,9 @@
 
 	Common::Point	_mousePos;
 
+	Node 	_zones;
+	Node 	_animations;
+
 protected:		// data
 
 	struct InputData {
@@ -370,6 +381,8 @@
 
 	Job			_jobs;
 
+	Node helperNode;			// used for freeZones
+
 protected:		// members
 	bool detectGame(void);
 

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -414,7 +414,7 @@
 	}
 
 	_engineFlags &= ~kEngineWalking;
-	Zone *z = hitZone(kZoneDoor, _vm->_char._ani._zone._left + _vm->_char._ani.width() / 2,	_vm->_char._ani._zone._top + _vm->_char._ani.height());
+	Zone *z = _vm->hitZone(kZoneDoor, _vm->_char._ani._zone._left + _vm->_char._ani.width() / 2,	_vm->_char._ani._zone._top + _vm->_char._ani.height());
 
 	if (z != NULL) {
 
@@ -432,7 +432,7 @@
 		}
 	}
 
-	z = hitZone(kZoneTrap, _vm->_char._ani._zone._left + _vm->_char._ani.width() / 2, _vm->_char._ani._zone._top + _vm->_char._ani.height());
+	z = _vm->hitZone(kZoneTrap, _vm->_char._ani._zone._left + _vm->_char._ani.width() / 2, _vm->_char._ani._zone._top + _vm->_char._ani.height());
 
 	if (z != NULL) {
 		_localFlags[_vm->_currentLocationIndex] |= kFlagsEnter;

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-03-18 19:35:54 UTC (rev 26226)
@@ -33,13 +33,8 @@
 
 void freeDialogue(Dialogue *d);
 
-Node _zones = { NULL, NULL };
-Node _animations = { NULL, NULL };
+Zone *Parallaction::findZone(const char *name) {
 
-extern Node helperNode;
-
-Zone *findZone(const char *name) {
-
 	Zone *v4 = (Zone*)_zones._next;
 
 	while (v4) {
@@ -120,7 +115,7 @@
 	return;
 }
 
-void freeZones(Node *list) {
+void Parallaction::freeZones(Node *list) {
 	debugC(1, kDebugLocation, "freeZones: kEngineQuit = %i", _engineFlags & kEngineQuit);
 
 	Zone *z = (Zone*)list;
@@ -569,7 +564,7 @@
 
 
 
-Zone *hitZone(uint32 type, uint16 x, uint16 y) {
+Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
 //	printf("hitZone(%i, %i, %i)", type, x, y);
 
 	uint16 _di = y;

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-03-18 18:59:35 UTC (rev 26225)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-03-18 19:35:54 UTC (rev 26226)
@@ -237,21 +237,15 @@
 	}
 };
 
-extern Node _zones;
-extern Node _animations;
 
-
-Zone   *findZone(const char *name);
 uint16	runZone(Zone *z);
 void	dropItem(uint16 v);
 int16	pickupItem(Zone *z);
 
 
-Zone   *hitZone(uint32 type, uint16 x, uint16 y);
 uint16	checkDoor();
 
 
-Animation  *findAnimation(const char *name);
 void		loadProgram(Animation *, char *filename);
 
 


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