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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Mar 23 21:41:54 CET 2009


Revision: 39645
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39645&view=rev
Author:   peres001
Date:     2009-03-23 20:41:54 +0000 (Mon, 23 Mar 2009)

Log Message:
-----------
Merged GetData, HearData, SpeakData, PathData, ExamineData, MergeData into TypeData struct. This simplifies life a bit especially in the parsers.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/input.cpp
    scummvm/trunk/engines/parallaction/objects.cpp
    scummvm/trunk/engines/parallaction/objects.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parser_br.cpp
    scummvm/trunk/engines/parallaction/parser_ns.cpp
    scummvm/trunk/engines/parallaction/walk.cpp

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -176,9 +176,9 @@
 	} else
 		error("unsupported game in DialogueManager");
 
-	_dialogue = _z->u.speak->_dialogue;
-	isNpc = scumm_stricmp(_z->u.speak->_name, "yourself") && _z->u.speak->_name[0] != '\0';
-	_questioner = isNpc ? _vm->_disk->loadTalk(_z->u.speak->_name) : _vm->_char._talk;
+	_dialogue = _z->u._speakDialogue;
+	isNpc = !_z->u._filename.empty() && _z->u._filename.compareToIgnoreCase("yourself");
+	_questioner = isNpc ? _vm->_disk->loadTalk(_z->u._filename.c_str()) : _vm->_char._talk;
 	_answerer = _vm->_char._talk;
 
 	_askPassword = false;
@@ -432,7 +432,7 @@
 }
 
 void Parallaction::enterDialogueMode(ZonePtr z) {
-	debugC(1, kDebugDialogue, "Parallaction::enterDialogueMode(%s)", z->u.speak->_name);
+	debugC(1, kDebugDialogue, "Parallaction::enterDialogueMode(%s)", z->u._filename.c_str());
 	_dialogueMan = _vm->createDialogueManager(z);
 	_input->_inputMode = Input::kInputModeDialogue;
 }

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -203,7 +203,7 @@
 
 DECLARE_COMMAND_OPCODE(leave) {
 	ZonePtr z = ctxt._cmd->u._zone;
-	_vm->dropItem(z->u.get->_icon);
+	_vm->dropItem(z->u._getIcon);
 	_vm->showZone(z, true);
 }
 

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/input.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -375,9 +375,9 @@
 		ZonePtr z = _vm->hitZone(kZoneMerge, _activeItem._index, _vm->getInventoryItemIndex(pos));
 
 		if (z) {
-			_vm->dropItem(z->u.merge->_obj1);
-			_vm->dropItem(z->u.merge->_obj2);
-			_vm->addInventoryItem(z->u.merge->_obj3);
+			_vm->dropItem(z->u._mergeObj1);
+			_vm->dropItem(z->u._mergeObj2);
+			_vm->addInventoryItem(z->u._mergeObj3);
 			_vm->_cmdExec->run(z->_commands);
 		}
 

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -191,47 +191,6 @@
 Zone::~Zone() {
 //	printf("~Zone(%s)\n", _name);
 
-	switch (ACTIONTYPE(this)) {
-	case kZoneExamine:
-		free(u.examine->_filename);
-		u.examine->_description.clear();
-		delete u.examine->_cnv;
-		delete u.examine;
-		break;
-
-	case kZoneDoor:
-		free(u.door->_location);
-		u.door->gfxobj->release();
-		delete u.door;
-		break;
-
-	case kZoneSpeak:
-		delete u.speak->_dialogue;
-		delete u.speak;
-		break;
-
-	case kZoneGet:
-		u.get->gfxobj->release();
-		delete u.get;
-		break;
-
-	case kZoneHear:
-		delete u.hear;
-		break;
-
-	case kZoneMerge:
-		delete u.merge;
-		break;
-
-	case kZonePath:
-		delete u.path;
-		break;
-
-	default:
-		break;
-	}
-
-
 	free(_linkedName);
 }
 

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/objects.h	2009-03-23 20:41:54 UTC (rev 39645)
@@ -193,103 +193,64 @@
 	~Dialogue();
 };
 
-struct GetData {
-	uint32			_icon;
-	GfxObj			*gfxobj;
+#define MAX_WALKPOINT_LISTS 20
 
-	GetData() {
-		_icon = 0;
-		gfxobj = NULL;
-	}
-};
-struct SpeakData {
-	char		_name[32];
-	Dialogue	*_dialogue;
+struct TypeData {
+	// common
+	GfxObj		*_gfxobj;	// get, examine, door
+	Common::String	_filename; // speak, examine, hear
 
-	SpeakData() {
-		_name[0] = '\0';
-		_dialogue = NULL;
-	}
-};
-struct ExamineData {
-	GfxObj	*_cnv;
-	Common::String	_description;
-	char*		_filename;
+	// get
+	uint32		_getIcon;
 
-	ExamineData() {
-		_filename = NULL;
-		_cnv = NULL;
-	}
-};
-struct DoorData {
-	char*	_location;
-	GfxObj	*gfxobj;
-	Common::Point	_startPos;
-	uint16	_startFrame;
-	// BRA specific
-	Common::Point	_startPos2;
-	uint16	_startFrame2;
+	// speak
+	Dialogue		*_speakDialogue;
 
-	DoorData() {
-		_location = NULL;
-		_startFrame = 0;
-		_startPos.x = -1000;
-		_startPos.y = -1000;
-		_startFrame2 = 0;
-		_startPos2.x = -1000;
-		_startPos2.y = -1000;
-		gfxobj = NULL;
-	}
-};
-struct HearData {	// size = 20
-	char		_name[20];
-	int			_channel;
-	int			_freq;
+	// examine
+	Common::String	_examineText;
 
-	HearData() {
-		_channel = -1;
-		_freq = -1;
-		_name[0] = '\0';
-	}
-};
-struct MergeData {	// size = 12
-	uint32	_obj1;
-	uint32	_obj2;
-	uint32	_obj3;
+	// door
+	Common::String	_doorLocation;
+	Common::Point	_doorStartPos;
+	uint16		_doorStartFrame;
+	Common::Point	_doorStartPos2_br;
+	uint16		_doorStartFrame2_br;
 
-	MergeData() {
-		_obj1 = _obj2 = _obj3 = 0;
-	}
-};
-#define MAX_WALKPOINT_LISTS 20
-struct PathData {
-	int	_numLists;
-	PointList	_lists[MAX_WALKPOINT_LISTS];
+	// hear
+	int		_hearChannel;
+	int		_hearFreq;
 
-	PathData() {
-		_numLists = 0;
-	}
-};
+	// merge
+	uint32	_mergeObj1;
+	uint32	_mergeObj2;
+	uint32	_mergeObj3;
 
-struct TypeData {
-	GetData		*get;
-	SpeakData	*speak;
-	ExamineData *examine;
-	DoorData	*door;
-	HearData	*hear;
-	MergeData	*merge;
-	// BRA specific field
-	PathData	*path;
+	// path
+	int		_pathNumLists;
+	PointList	_pathLists[MAX_WALKPOINT_LISTS];
 
 	TypeData() {
-		get = NULL;
-		speak = NULL;
-		examine = NULL;
-		door = NULL;
-		hear = NULL;
-		merge = NULL;
-		path = NULL;
+		_gfxobj = 0;
+		_getIcon = 0;
+		_speakDialogue = 0;
+		_doorStartFrame = 0;
+		_doorStartPos.x = -1000;
+		_doorStartPos.y = -1000;
+		_doorStartFrame2_br = 0;
+		_doorStartPos2_br.x = -1000;
+		_doorStartPos2_br.y = -1000;
+		_hearChannel = -1;
+		_hearFreq = -1;
+		_mergeObj1 = 0;
+		_mergeObj2 = 0;
+		_mergeObj3 = 0;
+		_pathNumLists = 0;
 	}
+
+	~TypeData() {
+		_gfxobj->release();
+		delete _speakDialogue;
+	}
 };
 
 #define ACTIONTYPE(z) ((z)->_type & 0xFFFF)

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -467,10 +467,10 @@
 
 	GfxObj *obj = 0;
 	if (ACTIONTYPE(zone) == kZoneGet) {
-		obj = zone->u.get->gfxobj;
+		obj = zone->u._gfxobj;
 	} else
 	if (ACTIONTYPE(zone) == kZoneDoor) {
-		obj = zone->u.door->gfxobj;
+		obj = zone->u._gfxobj;
 	}
 
 	if (!obj) {
@@ -520,7 +520,7 @@
 	}
 
 	if (ACTIONTYPE(z) == kZoneGet) {
-		_gfx->showGfxObj(z->u.get->gfxobj, visible);
+		_gfx->showGfxObj(z->u._gfxobj, visible);
 	}
 }
 
@@ -536,32 +536,32 @@
 
 	_commentZone = z;
 
-	ExamineData *data = _commentZone->u.examine;
+	TypeData *data = &_commentZone->u;
 
-	if (data->_description.empty()) {
+	if (data->_examineText.empty()) {
 		return;
 	}
 
 	// TODO: move this balloons stuff into DialogueManager and BalloonManager
 	if (getGameType() == GType_Nippon) {
-		if (data->_filename) {
-			if (data->_cnv == 0) {
-				data->_cnv = _disk->loadStatic(data->_filename);
+		if (!data->_filename.empty()) {
+			if (data->_gfxobj == 0) {
+				data->_gfxobj = _disk->loadStatic(data->_filename.c_str());
 			}
 
 			_gfx->setHalfbriteMode(true);
-			_balloonMan->setSingleBalloon(data->_description.c_str(), 0, 90, 0, BalloonManager::kNormalColor);
+			_balloonMan->setSingleBalloon(data->_examineText.c_str(), 0, 90, 0, BalloonManager::kNormalColor);
 			Common::Rect r;
-			data->_cnv->getRect(0, r);
-			_gfx->setItem(data->_cnv, 140, (_screenHeight - r.height())/2);
+			data->_gfxobj->getRect(0, r);
+			_gfx->setItem(data->_gfxobj, 140, (_screenHeight - r.height())/2);
 			_gfx->setItem(_char._head, 100, 152);
 		} else {
-			_balloonMan->setSingleBalloon(data->_description.c_str(), 140, 10, 0, BalloonManager::kNormalColor);
+			_balloonMan->setSingleBalloon(data->_examineText.c_str(), 140, 10, 0, BalloonManager::kNormalColor);
 			_gfx->setItem(_char._talk, 190, 80);
 		}
 	} else
 	if (getGameType() == GType_BRA) {
-		_balloonMan->setSingleBalloon(data->_description.c_str(), 0, 0, 1, BalloonManager::kNormalColor);
+		_balloonMan->setSingleBalloon(data->_examineText.c_str(), 0, 0, 1, BalloonManager::kNormalColor);
 		_gfx->setItem(_char._talk, 10, 80);
 	}
 
@@ -611,10 +611,10 @@
 		break;
 
 	case kZoneHear:
-		_soundMan->execute(SC_SETSFXCHANNEL, z->u.hear->_channel);
+		_soundMan->execute(SC_SETSFXCHANNEL, z->u._hearChannel);
 		_soundMan->execute(SC_SETSFXLOOPING, (int)((z->_flags & kFlagsLooping) == kFlagsLooping));
 		_soundMan->execute(SC_SETSFXVOLUME, 60);
-		_soundMan->execute(SC_PLAYSFX, z->u.hear->_name);
+		_soundMan->execute(SC_PLAYSFX, z->u._filename.c_str());
 		break;
 
 	case kZoneSpeak:
@@ -635,10 +635,10 @@
 void Parallaction::updateDoor(ZonePtr z, bool close) {
 	z->_flags = close ? (z->_flags |= kFlagsClosed) : (z->_flags &= ~kFlagsClosed);
 
-	if (z->u.door->gfxobj) {
+	if (z->u._gfxobj) {
 		uint frame = (close ? 0 : 1);
-//		z->u.door->gfxobj->setFrame(frame);
-		z->u.door->gfxobj->frame = frame;
+//		z->u._gfxobj->setFrame(frame);
+		z->u._gfxobj->frame = frame;
 	}
 
 	return;
@@ -655,7 +655,7 @@
 		return false;
 	}
 
-	int slot = addInventoryItem(z->u.get->_icon);
+	int slot = addInventoryItem(z->u._getIcon);
 	if (slot != -1) {
 		showZone(z, false);
 	}
@@ -673,8 +673,8 @@
 	// WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
 	// instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
 	// but we need to check it separately here. The same workaround is applied in freeZones.
-	if (((ACTIONTYPE(z) == kZoneMerge) && (((x == z->u.merge->_obj1) && (y == z->u.merge->_obj2)) || ((x == z->u.merge->_obj2) && (y == z->u.merge->_obj1)))) ||
-		((ACTIONTYPE(z) == kZoneGet) && ((x == z->u.get->_icon) || (y == z->u.get->_icon)))) {
+	if (((ACTIONTYPE(z) == kZoneMerge) && (((x == z->u._mergeObj1) && (y == z->u._mergeObj2)) || ((x == z->u._mergeObj2) && (y == z->u._mergeObj1)))) ||
+		((ACTIONTYPE(z) == kZoneGet) && ((x == z->u._getIcon) || (y == z->u._getIcon)))) {
 
 		// WORKAROUND for bug 2070751: special zones are only used in NS, to allow the
 		// the EXAMINE/USE action to be applied on some particular item in the inventory.

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -754,27 +754,21 @@
 }
 
 void LocationParser_br::parsePathData(ZonePtr z) {
-
-	PathData *data = new PathData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp("zone", _tokens[0])) {
 			int id = atoi(_tokens[1]);
-			parsePointList(data->_lists[id]);
-			data->_numLists++;
+			parsePointList(data->_pathLists[id]);
+			data->_pathNumLists++;
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp("endzone", _tokens[0]));
-
-	z->u.path = data;
 }
 
 void LocationParser_br::parseGetData(ZonePtr z) {
-
-	GetData *data = new GetData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "file")) {
@@ -784,31 +778,27 @@
 			obj->x = z->getX();
 			obj->y = z->getY();
 			obj->_prog = _zoneProg;
-			data->gfxobj = obj;
+			data->_gfxobj = obj;
 		}
 
 		if (!scumm_stricmp(_tokens[0], "mask")) {
-			ctxt.info->loadGfxObjMask(_tokens[1], data->gfxobj);
+			ctxt.info->loadGfxObjMask(_tokens[1], data->_gfxobj);
 		}
 
 		if (!scumm_stricmp(_tokens[0], "path")) {
-			ctxt.info->loadGfxObjPath(_tokens[1], data->gfxobj);
+			ctxt.info->loadGfxObjPath(_tokens[1], data->_gfxobj);
 		}
 
 		if (!scumm_stricmp(_tokens[0], "icon")) {
-			data->_icon = 4 + _vm->_objectsNames->lookup(_tokens[1]);
+			data->_getIcon = 4 + _vm->_objectsNames->lookup(_tokens[1]);
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone"));
-
-	z->u.get = data;
 }
 
 void LocationParser_br::parseDoorData(ZonePtr z) {
-
-	DoorData *data = new DoorData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "slidetext")) {
@@ -817,7 +807,7 @@
 		}
 
 		if (!scumm_stricmp(_tokens[0], "location")) {
-			data->_location = strdup(_tokens[1]);
+			data->_doorLocation = strdup(_tokens[1]);
 		}
 
 		if (!scumm_stricmp(_tokens[0], "file")) {
@@ -831,26 +821,23 @@
 			obj->y = z->getY();
 			_vm->_gfx->showGfxObj(obj, true);
 
-			data->gfxobj = obj;
+			data->_gfxobj = obj;
 		}
 
 		if (!scumm_stricmp(_tokens[0],	"startpos")) {
-			data->_startPos.x = atoi(_tokens[1]);
-			data->_startPos.y = atoi(_tokens[2]);
-			data->_startFrame = atoi(_tokens[3]);
+			data->_doorStartPos.x = atoi(_tokens[1]);
+			data->_doorStartPos.y = atoi(_tokens[2]);
+			data->_doorStartFrame = atoi(_tokens[3]);
 		}
 
 		if (!scumm_stricmp(_tokens[0],	"startpos2")) {
-			data->_startPos2.x = atoi(_tokens[1]);
-			data->_startPos2.y = atoi(_tokens[2]);
-			data->_startFrame2 = atoi(_tokens[3]);
+			data->_doorStartPos2_br.x = atoi(_tokens[1]);
+			data->_doorStartPos2_br.y = atoi(_tokens[2]);
+			data->_doorStartFrame2_br = atoi(_tokens[3]);
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.door = data;
-
 }
 
 void LocationParser_br::parseZoneTypeBlock(ZonePtr z) {

Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -1385,9 +1385,7 @@
 
 
 void LocationParser_ns::parseGetData(ZonePtr z) {
-
-	GetData *data = new GetData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "file")) {
@@ -1401,46 +1399,35 @@
 			obj->_prog = _zoneProg;
 			_vm->_gfx->showGfxObj(obj, visible);
 
-			data->gfxobj = obj;
+			data->_gfxobj = obj;
 		}
 
 		if (!scumm_stricmp(_tokens[0], "icon")) {
-			data->_icon = 4 + _vm->_objectsNames->lookup(_tokens[1]);
+			data->_getIcon = 4 + _vm->_objectsNames->lookup(_tokens[1]);
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.get = data;
-
 }
 
 
 void LocationParser_ns::parseExamineData(ZonePtr z) {
-
-	ExamineData *data = new ExamineData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "file")) {
 			data->_filename = strdup(_tokens[1]);
 		}
 		if (!scumm_stricmp(_tokens[0], "desc")) {
-			data->_description = parseComment();
+			data->_examineText = parseComment();
 		}
-
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.examine = data;
-
 }
 
 
 void LocationParser_ns::parseDoorData(ZonePtr z) {
-
-	DoorData *data = new DoorData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "slidetext")) {
@@ -1449,7 +1436,7 @@
 		}
 
 		if (!scumm_stricmp(_tokens[0], "location")) {
-			data->_location = strdup(_tokens[1]);
+			data->_doorLocation = strdup(_tokens[1]);
 		}
 
 		if (!scumm_stricmp(_tokens[0], "file")) {
@@ -1463,85 +1450,66 @@
 			obj->y = z->getY();
 			_vm->_gfx->showGfxObj(obj, true);
 
-			data->gfxobj = obj;
+			data->_gfxobj = obj;
 		}
 
 		if (!scumm_stricmp(_tokens[0],	"startpos")) {
-			data->_startPos.x = atoi(_tokens[1]);
-			data->_startPos.y = atoi(_tokens[2]);
-			data->_startFrame = atoi(_tokens[3]);
+			data->_doorStartPos.x = atoi(_tokens[1]);
+			data->_doorStartPos.y = atoi(_tokens[2]);
+			data->_doorStartFrame = atoi(_tokens[3]);
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.door = data;
-
 }
 
 
 void LocationParser_ns::parseMergeData(ZonePtr z) {
-
-	MergeData *data = new MergeData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "obj1")) {
-			data->_obj1 = 4 + _vm->_objectsNames->lookup(_tokens[1]);
+			data->_mergeObj1 = 4 + _vm->_objectsNames->lookup(_tokens[1]);
 		}
 		if (!scumm_stricmp(_tokens[0], "obj2")) {
-			data->_obj2 = 4 + _vm->_objectsNames->lookup(_tokens[1]);
+			data->_mergeObj2 = 4 + _vm->_objectsNames->lookup(_tokens[1]);
 		}
 		if (!scumm_stricmp(_tokens[0], "newobj")) {
-			data->_obj3 = 4 + _vm->_objectsNames->lookup(_tokens[1]);
+			data->_mergeObj3 = 4 + _vm->_objectsNames->lookup(_tokens[1]);
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.merge = data;
-
 }
 
 void LocationParser_ns::parseHearData(ZonePtr z) {
-
-	HearData *data = new HearData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "sound")) {
-			strcpy(data->_name, _tokens[1]);
-			data->_channel = atoi(_tokens[2]);
+			data->_filename = _tokens[1];
+			data->_hearChannel = atoi(_tokens[2]);
 		}
 		if (!scumm_stricmp(_tokens[0], "freq")) {
-			data->_freq = atoi(_tokens[1]);
+			data->_hearFreq = atoi(_tokens[1]);
 		}
-
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.hear = data;
-
 }
 
 void LocationParser_ns::parseSpeakData(ZonePtr z) {
-
-	SpeakData *data = new SpeakData;
-
+	TypeData *data = &z->u;
 	do {
 
 		if (!scumm_stricmp(_tokens[0], "file")) {
-			strcpy(data->_name, _tokens[1]);
+			data->_filename = _tokens[1];
 		}
 		if (!scumm_stricmp(_tokens[0], "Dialogue")) {
-			data->_dialogue = parseDialogue();
+			data->_speakDialogue = parseDialogue();
 		}
 
 		_script->readLineToken(true);
 	} while (scumm_stricmp(_tokens[0], "endzone") && scumm_stricmp(_tokens[0], "endanimation"));
-
-	z->u.speak = data;
-
 }
 
 

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2009-03-23 20:31:19 UTC (rev 39644)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2009-03-23 20:41:54 UTC (rev 39645)
@@ -287,9 +287,9 @@
 	ZonePtr z = _vm->hitZone(kZoneDoor, foot.x, foot.y);
 	if (z) {
 		if ((z->_flags & kFlagsClosed) == 0) {
-			_vm->_location._startPosition = z->u.door->_startPos;
-			_vm->_location._startFrame = z->u.door->_startFrame;
-			_vm->scheduleLocationSwitch(z->u.door->_location);
+			_vm->_location._startPosition = z->u._doorStartPos;
+			_vm->_location._startFrame = z->u._doorStartFrame;
+			_vm->scheduleLocationSwitch(z->u._doorLocation.c_str());
 			_vm->_zoneTrap.reset();
 		} else {
 			_vm->_cmdExec->run(z->_commands, z);
@@ -478,14 +478,14 @@
 	// build complex path
 	int id = atoi(z0->_name);
 
-	if (z1->u.path->_lists[id].empty()) {
+	if (z1->u._pathLists[id].empty()) {
 		s._walkPath.clear();
 		debugC(3, kDebugWalk, "buildPath: no path");
 		return;
 	}
 
-	PointList::iterator b = z1->u.path->_lists[id].begin();
-	PointList::iterator e = z1->u.path->_lists[id].end();
+	PointList::iterator b = z1->u._pathLists[id].begin();
+	PointList::iterator e = z1->u._pathLists[id].end();
 	for ( ; b != e; ++b) {
 		s._walkPath.push_front(*b);
 	}
@@ -502,21 +502,21 @@
 
 	ZonePtr z = _vm->hitZone(kZoneDoor, foot.x, foot.y);
 	if (z && ((z->_flags & kFlagsClosed) == 0)) {
-		_vm->_location._startPosition = z->u.door->_startPos; // foot pos
-		_vm->_location._startFrame = z->u.door->_startFrame;
+		_vm->_location._startPosition = z->u._doorStartPos; // foot pos
+		_vm->_location._startFrame = z->u._doorStartFrame;
 
 		// TODO: implement working follower. Must find out a location in which the code is
 		// used and which is stable enough.
 		if (_follower._active) {
-			_vm->_location._followerStartPosition = z->u.door->_startPos2;	// foot pos
-			_vm->_location._followerStartFrame = z->u.door->_startFrame2;
+			_vm->_location._followerStartPosition = z->u._doorStartPos2_br;	// foot pos
+			_vm->_location._followerStartFrame = z->u._doorStartFrame2_br;
 		} else {
 			_vm->_location._followerStartPosition.x = -1000;
 			_vm->_location._followerStartPosition.y = -1000;
 			_vm->_location._followerStartFrame = 0;
 		}
 
-		_vm->scheduleLocationSwitch(z->u.door->_location);
+		_vm->scheduleLocationSwitch(z->u._doorLocation.c_str());
 		_vm->_cmdExec->run(z->_commands, z);
 	}
 


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