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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Mar 17 08:52:48 CET 2007


Revision: 26158
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26158&view=rev
Author:   peres001
Date:     2007-03-17 00:52:47 -0700 (Sat, 17 Mar 2007)

Log Message:
-----------
gathered character related stuff into a new struct Character, and modified calling code accordingly

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/callables.cpp
    scummvm/trunk/engines/parallaction/commands.cpp
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/inventory.cpp
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/saveload.cpp
    scummvm/trunk/engines/parallaction/walk.cpp
    scummvm/trunk/engines/parallaction/zone.cpp

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -658,7 +658,7 @@
 	Node v14;
 	memset(&v14, 0, sizeof(Node));
 
-	_yourself._z = _yourself._cnv._height + _yourself._zone._limits._top;
+	_vm->_char._yourself._z = _vm->_char._yourself._cnv._height + _vm->_char._yourself._zone._limits._top;
 
 	Animation *vC = (Animation*)_animations._next;
 	Node *v8;

Modified: scummvm/trunk/engines/parallaction/callables.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/callables.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -322,7 +322,7 @@
 		_vm->_menu->selectCharacter();
 	}
 
-	removeNode(&_yourself._zone._node);
+	removeNode(&_vm->_char._yourself._zone._node);
 	_vm->_locationNames[0][0] = '\0';
 	_vm->_numLocations = 0;
 	_commandFlags = 0;
@@ -339,7 +339,7 @@
 
 	_engineFlags &= ~kEngineQuit;
 
-	addNode(&_animations, &_yourself._zone._node);
+	addNode(&_animations, &_vm->_char._yourself._zone._node);
 	_score = 0;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/commands.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/commands.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/commands.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -328,7 +328,7 @@
 			break;
 
 		case CMD_MOVE: {	// move
-			if ((_yourself._zone._flags & kFlagsRemove) || (_yourself._zone._flags & kFlagsActive) == 0) {
+			if ((_vm->_char._yourself._zone._flags & kFlagsRemove) || (_vm->_char._yourself._zone._flags & kFlagsActive) == 0) {
 				continue;
 			}
 

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -238,7 +238,7 @@
 	StaticCnv v5C, v48;
 
 	if (!scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') {
-		memcpy(&v6E, &_yourTalk, sizeof(Cnv));
+		memcpy(&v6E, &_vm->_char._yourTalk, sizeof(Cnv));
 		debugC(1, kDebugDialogue, "runDialogue: using default character head");
 	} else {
 		debugC(1, kDebugDialogue, "runDialogue: loading 2nd character head '%s'", _vm->_characterName);
@@ -249,8 +249,8 @@
 	v5C._width = v6E._width;
 	v5C._height = v6E._height;
 
-	v48._width = _yourTalk._width;
-	v48._height = _yourTalk._height;
+	v48._width = _vm->_char._yourTalk._width;
+	v48._height = _vm->_char._yourTalk._height;
 
 	bool displayedAnswers = false;
 	int16 question_width = 0, question_height = 0;
@@ -263,7 +263,7 @@
 
 		v5C._data0 = v6E._array[v60->_mood & 0xF];
 		v5C._data1 = NULL; // v6E.field_8[v60->_mood & 0xF];
-		v48._data0 = _yourTalk._array[0];
+		v48._data0 = _vm->_char._yourTalk._array[0];
 		v48._data1 = NULL; // _yourTalk.field_8[0];
 
 		// display Question if any
@@ -504,7 +504,7 @@
 		_vm->_disk->selectArchive("disk1");
 		_vm->_disk->loadFrames(_dinoName, &_characterFrames);
 
-		memcpy(&_yourself._cnv, &_characterFrames, sizeof(Cnv));
+		memcpy(&_vm->_char._yourself._cnv, &_characterFrames, sizeof(Cnv));
 
 		debugC(1, kDebugDialogue, "runDialogue: special trick for 'museum' location ok");
 	}
@@ -543,8 +543,8 @@
 			0
 		);
 
-		cnv->_data0 = _yourTalk._array[q->_answer_moods[_di] & 0xF];
-//		cnv->_data1 = _yourTalk.field_8[q->_answer_moods[_di] & 0xF];
+		cnv->_data0 = _vm->_char._yourTalk._array[q->_answer_moods[_di] & 0xF];
+//		cnv->_data1 = _vm->_char._yourTalk.field_8[q->_answer_moods[_di] & 0xF];
 
 		_vm->_gfx->flatBlitCnv(
 			cnv,
@@ -585,8 +585,8 @@
 				0
 			);
 
-			cnv->_data0 = _yourTalk._array[q->_answer_moods[_si] & 0xF];
-//			cnv->_data1 = _yourTalk.field_8[q->_answer_moods[_si] & 0xF];
+			cnv->_data0 = _vm->_char._yourTalk._array[q->_answer_moods[_si] & 0xF];
+//			cnv->_data1 = _vm->_char._yourTalk.field_8[q->_answer_moods[_si] & 0xF];
 
 			_vm->_gfx->flatBlitCnv(
 				cnv,

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -51,7 +51,6 @@
 #define INVENTORY_HEIGHT			(INVENTORY_LINES*INVENTORYITEM_HEIGHT)
 
 static byte		*_buffer;
-extern Cnv 		 _yourObjects;
 uint16			 _numInvLines = 0;
 static Point	 _invPosition = { 0, 0 };
 
@@ -188,8 +187,8 @@
 	uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
 
 	// FIXME: this will end up in a general blit function
-	byte* s = _yourObjects._array[item->_index];
-	byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _yourObjects._height * INVENTORY_WIDTH;
+	byte* s = _vm->_char._yourObjects._array[item->_index];
+	byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._yourObjects._height * INVENTORY_WIDTH;
 	for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
 		memcpy(d, s, INVENTORYITEM_WIDTH);
 
@@ -229,8 +228,8 @@
 	uint16 line = pos / INVENTORY_ITEMS_PER_LINE;
 	uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
 
-	Common::Rect r(INVENTORYITEM_WIDTH, _yourObjects._height);
-	r.moveTo(col * INVENTORYITEM_WIDTH, line * _yourObjects._height);
+	Common::Rect r(INVENTORYITEM_WIDTH, _vm->_char._yourObjects._height);
+	r.moveTo(col * INVENTORYITEM_WIDTH, line * _vm->_char._yourObjects._height);
 
 	drawBorder(r, _buffer, color);
 
@@ -248,7 +247,7 @@
 
 	// FIXME: this will end up in a general blit function
 	byte* d = dst;
-	byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _yourObjects._height * INVENTORY_WIDTH;
+	byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._yourObjects._height * INVENTORY_WIDTH;
 	for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
 		memcpy(d, s, INVENTORYITEM_WIDTH);
 
@@ -358,7 +357,7 @@
 
 void initInventory() {
 	_buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT);	  // this buffer is also used by menu so it must stay this size
-	_yourObjects._count = 0;
+	_vm->_char._yourObjects._count = 0;
 }
 
 void cleanInventory() {

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -92,12 +92,12 @@
 			switchBackground(_location._name, mask);
 
 			if (_tokens[2][0] != '\0') {
-				_yourself._zone.pos._position._x = atoi(_tokens[2]);
-				_yourself._zone.pos._position._y = atoi(_tokens[3]);
+				_vm->_char._yourself._zone.pos._position._x = atoi(_tokens[2]);
+				_vm->_char._yourself._zone.pos._position._y = atoi(_tokens[3]);
 			}
 
 			if (_tokens[4][0] != '\0') {
-				_yourself._frame = atoi(_tokens[4]);
+				_vm->_char._yourself._frame = atoi(_tokens[4]);
 			}
 		}
 		if (!scumm_stricmp(_tokens[0], "DISK")) {
@@ -237,8 +237,8 @@
 		if (!scumm_stricmp(_tokens[0], "COORD")) {
 
 			WalkNode *v4 = (WalkNode*)malloc(sizeof(WalkNode));
-			v4->_x = atoi(_tokens[1]) - _yourself._cnv._width/2;
-			v4->_y = atoi(_tokens[2]) - _yourself._cnv._height;
+			v4->_x = atoi(_tokens[1]) - _vm->_char._yourself._cnv._width/2;
+			v4->_y = atoi(_tokens[2]) - _vm->_char._yourself._cnv._height;
 
 			addNode(list, &v4->_node);
 
@@ -342,7 +342,7 @@
 		debugC(2, kDebugLocation, "changeLocation: changed cursor");
 	}
 
-	removeNode(&_yourself._zone._node);
+	removeNode(&_vm->_char._yourself._zone._node);
 	debugC(2, kDebugLocation, "changeLocation: removed character from the animation list");
 
 	freeLocation();
@@ -375,7 +375,7 @@
 		}
 	}
 
-	addNode(&_animations, &_yourself._zone._node);
+	addNode(&_animations, &_vm->_char._yourself._zone._node);
 	debugC(2, kDebugLocation, "changeLocation: new character added to the animation list");
 
 	strcpy(_saveData1, list[0].c_str());
@@ -384,14 +384,14 @@
 	_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
 	debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1);
 
-	_yourself._zone.pos._oldposition._x = -1000;
-	_yourself._zone.pos._oldposition._y = -1000;
+	_vm->_char._yourself._zone.pos._oldposition._x = -1000;
+	_vm->_char._yourself._zone.pos._oldposition._y = -1000;
 
-	_yourself.field_50 = 0;
+	_vm->_char._yourself.field_50 = 0;
 	if (_location._startPosition._x != -1000) {
-		_yourself._zone.pos._position._x = _location._startPosition._x;
-		_yourself._zone.pos._position._y = _location._startPosition._y;
-		_yourself._frame = _location._startFrame;
+		_vm->_char._yourself._zone.pos._position._x = _location._startPosition._x;
+		_vm->_char._yourself._zone.pos._position._y = _location._startPosition._y;
+		_vm->_char._yourself._frame = _location._startFrame;
 		_location._startPosition._y = -1000;
 		_location._startPosition._x = -1000;
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -58,13 +58,8 @@
 char	   *_objectsNames[100];
 Zone	   *_activeZone = NULL;
 
-Animation		_yourself;
-StaticCnv		_yourHead;
-Cnv		    	_yourTalk;
-Cnv 			_characterFrames;
-static Cnv		_miniCharacterFrames;
-Cnv 			_yourObjects;
 
+
 uint16		_score = 1;
 
 uint32		_localFlags[120] = { 0 };
@@ -230,32 +225,32 @@
 
 	initWalk();
 
-	_yourTalk._width = 0;
-	_yourTalk._height = 0;
-	_yourTalk._count = 0;
-	_yourTalk._array = NULL;
+	_vm->_char._yourTalk._width = 0;
+	_vm->_char._yourTalk._height = 0;
+	_vm->_char._yourTalk._count = 0;
+	_vm->_char._yourTalk._array = NULL;
 
-	_yourHead._width = 0;
-	_yourHead._height = 0;
-	_yourHead._data0 = NULL;
-	_yourHead._data1 = NULL;
+	_vm->_char._yourHead._width = 0;
+	_vm->_char._yourHead._height = 0;
+	_vm->_char._yourHead._data0 = NULL;
+	_vm->_char._yourHead._data1 = NULL;
 
-	_yourself._zone.pos._position._x = 150;
-	_yourself._zone.pos._position._y = 100;
+	_vm->_char._yourself._zone.pos._position._x = 150;
+	_vm->_char._yourself._zone.pos._position._y = 100;
 	initInventory();
-	_yourself._z = 10;
+	_vm->_char._yourself._z = 10;
 
-	_yourself._zone.pos._oldposition._x = -1000;
-	_yourself._zone.pos._oldposition._y = -1000;
-	_yourself._frame = 0;
+	_vm->_char._yourself._zone.pos._oldposition._x = -1000;
+	_vm->_char._yourself._zone.pos._oldposition._y = -1000;
+	_vm->_char._yourself._frame = 0;
 
-	_yourself._zone._flags = kFlagsActive | kFlagsNoName;
-	_yourself._zone._type = kZoneYou;
+	_vm->_char._yourself._zone._flags = kFlagsActive | kFlagsNoName;
+	_vm->_char._yourself._zone._type = kZoneYou;
 
-	_yourself._zone._label._cnv._data0 = NULL;
-	_yourself._zone._label._text = strdup("yourself");
+	_vm->_char._yourself._zone._label._cnv._data0 = NULL;
+	_vm->_char._yourself._zone._label._text = strdup("yourself");
 
-	addNode(&_animations, &_yourself._zone._node);
+	addNode(&_animations, &_vm->_char._yourself._zone._node);
 	_gfx = new Gfx(this);
 
 	int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
@@ -300,9 +295,9 @@
 	parseLocation(_location._name);
 
 	if (_location._startPosition._x != -1000) {
-		_yourself._zone.pos._position._x = _location._startPosition._x;
-		_yourself._zone.pos._position._y = _location._startPosition._y;
-		_yourself._frame = _location._startFrame;
+		_vm->_char._yourself._zone.pos._position._x = _location._startPosition._x;
+		_vm->_char._yourself._zone.pos._position._y = _location._startPosition._y;
+		_vm->_char._yourself._frame = _location._startFrame;
 		_location._startPosition._y = -1000;
 		_location._startPosition._x = -1000;
 	}
@@ -544,8 +539,8 @@
 		debugC(2, kDebugInput, "processInput: kEvWalk");
 		_hoverZone = NULL;
 		changeCursor(kCursorArrow);
-		if (_yourself._zone._flags & kFlagsRemove) break;
-		if ((_yourself._zone._flags & kFlagsActive) == 0) break;
+		if (_vm->_char._yourself._zone._flags & kFlagsRemove) break;
+		if ((_vm->_char._yourself._zone._flags & kFlagsActive) == 0) break;
 		v4 = buildWalkPath(data->_mousePos._x, data->_mousePos._y);
 		addJob(jobWalk, v4, kPriority19);
 		_engineFlags |= kEngineWalking; 								   // inhibits processing of input until walking is over
@@ -759,14 +754,14 @@
 
 void freeCharacterFrames() {
 
-	_vm->_gfx->freeCnv(&_characterFrames);
+	_vm->_gfx->freeCnv(&_vm->_char._characterFrames);
 
 	if (!IS_DUMMY_CHARACTER(_vm->_characterName)) {
-		_vm->_gfx->freeCnv(&_miniCharacterFrames);
+		_vm->_gfx->freeCnv(&_vm->_char._miniCharacterFrames);
 		_vm->freeTable(_objectsNames);
-		_vm->_gfx->freeCnv(&_yourTalk);
-		_vm->_gfx->freeStaticCnv(&_yourHead);
-		_vm->_gfx->freeCnv(&_yourObjects);
+		_vm->_gfx->freeCnv(&_vm->_char._yourTalk);
+		_vm->_gfx->freeStaticCnv(&_vm->_char._yourHead);
+		_vm->_gfx->freeCnv(&_vm->_char._yourObjects);
 	}
 
 	return;
@@ -839,15 +834,15 @@
 
 		char path[PATH_LEN];
 		strcpy(path, v32);
-		_disk->loadFrames(path, &_characterFrames);
+		_disk->loadFrames(path, &_vm->_char._characterFrames);
 
 		if (!IS_DUMMY_CHARACTER(name)) {
-			_disk->loadHead(path, &_yourHead);
-			_disk->loadTalk(path, &_yourTalk);
-			_disk->loadObjects(name, &_yourObjects);
+			_disk->loadHead(path, &_vm->_char._yourHead);
+			_disk->loadTalk(path, &_vm->_char._yourTalk);
+			_disk->loadObjects(name, &_vm->_char._yourObjects);
 
 			sprintf(path, "mini%s", v32);
-			_disk->loadFrames(path, &_miniCharacterFrames);
+			_disk->loadFrames(path, &_vm->_char._miniCharacterFrames);
 
 			sprintf(path, "%s.tab", name);
 			initTable(path, _objectsNames);
@@ -860,9 +855,9 @@
 	}
 
 	if (miniCharacter)
-		memcpy(&_yourself._cnv, &_miniCharacterFrames, sizeof(Cnv));
+		memcpy(&_vm->_char._yourself._cnv, &_vm->_char._miniCharacterFrames, sizeof(Cnv));
 	else
-		memcpy(&_yourself._cnv, &_characterFrames, sizeof(Cnv));
+		memcpy(&_vm->_char._yourself._cnv, &_vm->_char._characterFrames, sizeof(Cnv));
 
 	strcpy(_characterName1, v32);
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-03-17 07:52:47 UTC (rev 26158)
@@ -28,6 +28,7 @@
 #include "parallaction/inventory.h"
 #include "parallaction/parser.h"
 #include "parallaction/disk.h"
+#include "parallaction/zone.h"
 #include "common/str.h"
 #include "gui/dialog.h"
 #include "gui/widget.h"
@@ -103,7 +104,7 @@
 extern Zone *_activeZone;
 extern uint32 _engineFlags;
 extern callable _callables[];
-extern Animation _yourself;
+
 extern Node _zones;
 extern Node _animations;
 extern uint32 _localFlags[];
@@ -122,9 +123,7 @@
 extern byte _mouseHidden;
 extern uint32 _commandFlags;
 
-extern Cnv _yourTalk;
 
-extern Cnv _characterFrames;
 
 //extern char _locationName[];
 //extern Node _walkNodes;
@@ -251,6 +250,15 @@
 
 };
 
+struct Character {
+	Animation		_yourself;
+	StaticCnv		_yourHead;
+	Cnv		    	_yourTalk;
+	Cnv 			_characterFrames;
+	Cnv				_miniCharacterFrames;
+	Cnv 			_yourObjects;
+};
+
 class Parallaction : public Engine {
 
 public:
@@ -305,6 +313,7 @@
 	int16	_currentLocationIndex;
 	uint16	_numLocations;
 
+	Character	_char;
 	Location	_location;
 
 	InventoryItem	_activeItem;

Modified: scummvm/trunk/engines/parallaction/saveload.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/saveload.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/saveload.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -175,9 +175,9 @@
 
 	sprintf(s, "%s\n", _saveData1);
 	f->writeString(s);
-	sprintf(s, "%d\n", _yourself._zone.pos._position._x);
+	sprintf(s, "%d\n", _vm->_char._yourself._zone.pos._position._x);
 	f->writeString(s);
-	sprintf(s, "%d\n", _yourself._zone.pos._position._y);
+	sprintf(s, "%d\n", _vm->_char._yourself._zone.pos._position._y);
 	f->writeString(s);
 	sprintf(s, "%d\n", _score);
 	f->writeString(s);

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -95,7 +95,7 @@
 
 		if (close == right) {
 			to_x += right;
-			walkData3 = (_yourself._cnv._count == 20) ? 7 : 9;
+			walkData3 = (_vm->_char._yourself._cnv._count == 20) ? 7 : 9;
 		} else
 		if (close == left) {
 			to_x -= left;
@@ -106,7 +106,7 @@
 		} else
 		if (close == bottom) {
 			to_y += bottom;
-			walkData3 = (_yourself._cnv._count == 20) ? 17 : 21;
+			walkData3 = (_vm->_char._yourself._cnv._count == 20) ? 17 : 21;
 		}
 
 	}
@@ -115,8 +115,8 @@
 	WalkNode *v48 = (WalkNode*)malloc(sizeof(WalkNode));
 	WalkNode *v44 = (WalkNode*)malloc(sizeof(WalkNode));
 
-	v48->_x = to_x - _yourself._cnv._width / 2; 		// target top left coordinates
-	v48->_y = to_y - _yourself._cnv._height;
+	v48->_x = to_x - _vm->_char._yourself._cnv._width / 2; 		// target top left coordinates
+	v48->_y = to_y - _vm->_char._yourself._cnv._height;
 	v48->_node._next = NULL;
 	memcpy(v44, v48, sizeof(WalkNode));
 
@@ -152,11 +152,11 @@
 
 		v48 = &v58;
 
-		v20._x = _yourself._zone.pos._position._x;
-		v20._y = _yourself._zone.pos._position._y;
+		v20._x = _vm->_char._yourself._zone.pos._position._x;
+		v20._y = _vm->_char._yourself._zone.pos._position._y;
 
-		v8._x = _si - _yourself._zone.pos._position._x;
-		v8._y = _di - _yourself._zone.pos._position._y;
+		v8._x = _si - _vm->_char._yourself._zone.pos._position._x;
+		v8._y = _di - _vm->_char._yourself._zone.pos._position._y;
 		v34 = v30 = dotProduct(&v8, &v8);				// square distance from current position and target
 
 		while (_closest_node_found != 0) {
@@ -245,8 +245,8 @@
 	Point v4 = { 0, 0 };
 
 	Point foot = {
-		_yourself._zone.pos._position._x + _yourself._cnv._width/2,
-		_yourself._zone.pos._position._y + _yourself._cnv._height
+		_vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width/2,
+		_vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height
 	};
 
 	Point v8 = {
@@ -297,8 +297,8 @@
 				v8._y = foot._y;
 			}
 
-			Node->_x = v4._x - _yourself._cnv._width / 2;
-			Node->_y = v4._y - _yourself._cnv._height;
+			Node->_x = v4._x - _vm->_char._yourself._cnv._width / 2;
+			Node->_y = v4._y - _vm->_char._yourself._cnv._height;
 
 			return (x - v4._x) * (x - v4._x) + (y - v4._y) * (y - v4._y);
 		}
@@ -316,13 +316,13 @@
 void jobWalk(void *parm, Job *j) {
 	WalkNode *node = (WalkNode*)parm;
 
-	int16 _si = _yourself._zone.pos._position._x;
-	int16 _di = _yourself._zone.pos._position._y;
+	int16 _si = _vm->_char._yourself._zone.pos._position._x;
+	int16 _di = _vm->_char._yourself._zone.pos._position._y;
 
-//	debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _yourself._cnv._width / 2, node->_y + _yourself._cnv._height);
+//	debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _vm->_char._yourself._cnv._width / 2, node->_y + _vm->_char._yourself._cnv._height);
 
-	_yourself._zone.pos._oldposition._x = _si;
-	_yourself._zone.pos._oldposition._y = _di;
+	_vm->_char._yourself._zone.pos._oldposition._x = _si;
+	_vm->_char._yourself._zone.pos._oldposition._y = _di;
 
 	if ((node->_x == _si) && (node->_y == _di)) {
 		if (node->_node._next == NULL) {
@@ -346,8 +346,8 @@
 	}
 
 	Point dist = {
-		node->_x - _yourself._zone.pos._position._x,
-		node->_y - _yourself._zone.pos._position._y
+		node->_x - _vm->_char._yourself._zone.pos._position._x,
+		node->_y - _vm->_char._yourself._zone.pos._position._y
 	};
 
 	if (dist._x < 0)
@@ -359,7 +359,7 @@
 
 	// walk frame selection
 	int16 v16;
-	if (_yourself._cnv._count == 20) {
+	if (_vm->_char._yourself._cnv._count == 20) {
 
 		if (dist._x > dist._y) {
 			walkData2 = (node->_x > _si) ? 0 : 7;
@@ -386,36 +386,36 @@
 	}
 
 //	StaticCnv v14;
-//	v14._width = _yourself._cnv._width;
-//	v14._height = _yourself._cnv._height;
-//	v14._data0 = _yourself._cnv._array[_yourself._frame];
-//	v14._data1 = _yourself._cnv.field_8[_yourself._frame];
+//	v14._width = _vm->_char._yourself._cnv._width;
+//	v14._height = _vm->_char._yourself._cnv._height;
+//	v14._data0 = _vm->_char._yourself._cnv._array[_vm->_char._yourself._frame];
+//	v14._data1 = _vm->_char._yourself._cnv.field_8[_vm->_char._yourself._frame];
 
-	if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_yourself._cnv._width/2 + _si + 2, _yourself._cnv._height + _di) != 0)) {
+	if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si + 2, _vm->_char._yourself._cnv._height + _di) != 0)) {
 //		printf("walk right\n");
 		_si = (_si + 2 < node->_x) ? _si + 2 : node->_x;
 	}
 
-	if ((_si > node->_x) && (_si > -20) && (queryPath(_yourself._cnv._width/2 + _si - 2, _yourself._cnv._height + _di) != 0)) {
+	if ((_si > node->_x) && (_si > -20) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si - 2, _vm->_char._yourself._cnv._height + _di) != 0)) {
 //		printf("walk left\n");
 		_si = (_si - 2 > node->_x) ? _si - 2 :node->_x;
 	}
 
-	if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _yourself._cnv._height)) && (queryPath(_yourself._cnv._width/2 + _si, _yourself._cnv._height + _di + 2) != 0)) {
+	if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _vm->_char._yourself._cnv._height)) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si, _vm->_char._yourself._cnv._height + _di + 2) != 0)) {
 //		printf("walk down\n");
 		_di = (_di + 2 <= node->_y) ? _di + 2 : node->_y;
 	}
 
-	if ((_di > node->_y) && (_di > -20) && (queryPath(_yourself._cnv._width/2 + _si, _yourself._cnv._height + _di - 2) != 0)) {
+	if ((_di > node->_y) && (_di > -20) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si, _vm->_char._yourself._cnv._height + _di - 2) != 0)) {
 //		printf("walk up\n");
 		_di = (_di - 2 >= node->_y) ? _di - 2 : node->_y;
 	}
 
 //	printf("hitZone: %i, %i\n", _si, _di);
-	_yourself._zone.pos._position._x = _si;
-	_yourself._zone.pos._position._y = _di;
+	_vm->_char._yourself._zone.pos._position._x = _si;
+	_vm->_char._yourself._zone.pos._position._y = _di;
 
-	if ((_si == _yourself._zone.pos._oldposition._x) && (_di == _yourself._zone.pos._oldposition._y)) {
+	if ((_si == _vm->_char._yourself._zone.pos._oldposition._x) && (_di == _vm->_char._yourself._zone.pos._oldposition._y)) {
 
 		j->_finished = 1;
 		checkDoor();
@@ -423,7 +423,7 @@
 
 	} else {
 
-		_yourself._frame = v16 + walkData2 + 1;
+		_vm->_char._yourself._frame = v16 + walkData2 + 1;
 
 	}
 
@@ -440,7 +440,7 @@
 	}
 
 	_engineFlags &= ~kEngineWalking;
-	Zone *z = hitZone(kZoneDoor, _yourself._zone.pos._position._x + _yourself._cnv._width / 2,	_yourself._zone.pos._position._y + _yourself._cnv._height);
+	Zone *z = hitZone(kZoneDoor, _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width / 2,	_vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height);
 
 	if (z != NULL) {
 
@@ -458,7 +458,7 @@
 		}
 	}
 
-	z = hitZone(kZoneTrap, _yourself._zone.pos._position._x + _yourself._cnv._width / 2, _yourself._zone.pos._position._y + _yourself._cnv._height);
+	z = hitZone(kZoneTrap, _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width / 2, _vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height);
 
 	if (z != NULL) {
 		_localFlags[_vm->_currentLocationIndex] |= kFlagsEnter;
@@ -475,8 +475,8 @@
 
 //	printf("done\n");
 
-	_yourself._frame = walkData2;
-	return _yourself._frame;
+	_vm->_char._yourself._frame = walkData2;
+	return _vm->_char._yourself._frame;
 }
 
 uint16 queryPath(uint16 x, uint16 y) {

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-03-17 01:11:46 UTC (rev 26157)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-03-17 07:52:47 UTC (rev 26158)
@@ -37,7 +37,6 @@
 Node _animations = { NULL, NULL };
 
 extern Node helperNode;
-extern StaticCnv	_yourHead;
 
 Zone *findZone(const char *name) {
 
@@ -367,9 +366,9 @@
 	if (data->_description == NULL) return;
 
 	StaticCnv v3C;
-	v3C._width = _yourTalk._width;
-	v3C._height = _yourTalk._height;
-	v3C._data0 = _yourTalk._array[0];
+	v3C._width = _vm->_char._yourTalk._width;
+	v3C._height = _vm->_char._yourTalk._height;
+	v3C._data0 = _vm->_char._yourTalk._array[0];
 	v3C._data1 = NULL; //_yourTalk.field_8[0];
 
 	_vm->_gfx->setFont("comic");
@@ -415,7 +414,7 @@
 	Common::Rect r(v6C, v6A);
 	r.moveTo(0, 90);
 	_vm->_gfx->drawBalloon(r, 0);
-	_vm->_gfx->flatBlitCnv(&_yourHead, 100, 152, Gfx::kBitFront, _yourHead._data1);
+	_vm->_gfx->flatBlitCnv(&_vm->_char._yourHead, 100, 152, Gfx::kBitFront, _vm->_char._yourHead._data1);
 	_vm->_gfx->displayWrappedString(data->_description, 0, 90, 130, 0);
 
 	jobEraseAnimations((void*)1, NULL);
@@ -609,13 +608,13 @@
 
 			if (z->_limits._left != -1)
 				continue;
-			if (_si < _yourself._zone.pos._position._x)
+			if (_si < _vm->_char._yourself._zone.pos._position._x)
 				continue;
-			if (_si > (_yourself._zone.pos._position._x + _yourself._cnv._width))
+			if (_si > (_vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width))
 				continue;
-			if (_di < _yourself._zone.pos._position._y)
+			if (_di < _vm->_char._yourself._zone.pos._position._y)
 				continue;
-			if (_di > (_yourself._zone.pos._position._y + _yourself._cnv._height))
+			if (_di > (_vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height))
 				continue;
 
 		}


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