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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Jul 26 04:09:50 CEST 2008


Revision: 33295
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33295&view=rev
Author:   peres001
Date:     2008-07-26 02:09:50 +0000 (Sat, 26 Jul 2008)

Log Message:
-----------
BRA now parses path data from the scripts.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/objects.h
    scummvm/trunk/engines/parallaction/parser.h
    scummvm/trunk/engines/parallaction/parser_br.cpp
    scummvm/trunk/engines/parallaction/walk.h

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-25 22:31:11 UTC (rev 33294)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-26 02:09:50 UTC (rev 33295)
@@ -375,6 +375,13 @@
 		}
 	}
 
+	_varDrawPathZones = getVar("draw_path_zones");
+	if (_varDrawPathZones == 1 && _vm->getGameType() != GType_BRA) {
+		setVar("draw_path_zones", 0);
+		_varDrawPathZones = 0;
+		warning("Path zones are supported only in Big Red Adventure");
+	}
+
 	if (_skipBackground || (_vm->_screenWidth >= _backgroundInfo.width)) {
 		_varScrollX = 0;
 	} else {
@@ -420,6 +427,19 @@
 		g_system->copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo.x, _backgroundInfo.y, w, h);
 	}
 
+	if (_varDrawPathZones == 1) {
+		Graphics::Surface *surf = g_system->lockScreen();
+		ZoneList::iterator b = _vm->_location._zones.begin();
+		ZoneList::iterator e = _vm->_location._zones.end();
+		for (; b != e; b++) {
+			ZonePtr z = *b;
+			if (z->_type & kZonePath) {
+				surf->frameRect(Common::Rect(z->_left, z->_top, z->_right, z->_bottom), 2);
+			}
+		}
+		g_system->unlockScreen();
+	}
+
 	_varRenderMode = _varAnimRenderMode;
 
 	// TODO: transform objects coordinates to be drawn with scrolling
@@ -775,6 +795,8 @@
 	registerVar("anim_render_mode", 1);
 	registerVar("misc_render_mode", 1);
 
+	registerVar("draw_path_zones", 0);
+
 	return;
 }
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-07-25 22:31:11 UTC (rev 33294)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-07-26 02:09:50 UTC (rev 33295)
@@ -564,6 +564,7 @@
 	int32				_varAnimRenderMode;	// 1 = normal, 2 = flat
 	int32				_varMiscRenderMode;	// 1 = normal, 2 = flat
 	int32				_varRenderMode;
+	int32				_varDrawPathZones;	// 0 = don't draw, 1 = draw
 	Graphics::Surface 	_bitmapMask;
 	int32 				getRenderMode(const char *type);
 

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2008-07-25 22:31:11 UTC (rev 33294)
+++ scummvm/trunk/engines/parallaction/objects.h	2008-07-26 02:09:50 UTC (rev 33295)
@@ -54,6 +54,7 @@
 typedef Common::List<InstructionPtr> InstructionList;
 extern InstructionPtr nullInstructionPtr;
 
+typedef Common::List<Common::Point> PointList;
 
 enum ZoneTypes {
 	kZoneExamine	   = 1,					// zone displays comment if activated
@@ -67,7 +68,10 @@
 	kZoneNone		   = 0x100,				// used to prevent parsing on peculiar Animations
 	kZoneTrap		   = 0x200,				// zone activated when character enters
 	kZoneYou		   = 0x400,				// marks the character
-	kZoneCommand	   = 0x800
+	kZoneCommand	   = 0x800,
+
+	// BRA specific
+	kZonePath          = 0x1000				// defines nodes for assisting walk calculation routines
 };
 
 
@@ -256,7 +260,16 @@
 		_obj1 = _obj2 = _obj3 = 0;
 	}
 };
+#define MAX_WALKPOINT_LISTS 20
+struct PathData {
+	int	_numLists;
+	PointList	_lists[MAX_WALKPOINT_LISTS];
 
+	PathData() {
+		_numLists = 0;
+	}
+};
+
 struct TypeData {
 	GetData		*get;
 	SpeakData	*speak;
@@ -264,6 +277,8 @@
 	DoorData	*door;
 	HearData	*hear;
 	MergeData	*merge;
+	// BRA specific field
+	PathData	*path;
 
 	TypeData() {
 		get = NULL;
@@ -272,6 +287,7 @@
 		door = NULL;
 		hear = NULL;
 		merge = NULL;
+		path = NULL;
 	}
 };
 

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2008-07-25 22:31:11 UTC (rev 33294)
+++ scummvm/trunk/engines/parallaction/parser.h	2008-07-26 02:09:50 UTC (rev 33295)
@@ -192,7 +192,7 @@
 	Question	*parseQuestion();
 
 	void		parseZone(ZoneList &list, char *name);
-	void		parseZoneTypeBlock(ZonePtr z);
+	virtual void parseZoneTypeBlock(ZonePtr z);
 	void		parsePointList(PointList &list);
 	void		parseAnimation(AnimationList &list, char *name);
 	void		parseCommands(CommandList&);
@@ -284,6 +284,9 @@
 	DECLARE_UNQUALIFIED_ANIM_PARSER(moveto);
 	DECLARE_UNQUALIFIED_ANIM_PARSER(endanimation);
 
+	virtual void	parseZoneTypeBlock(ZonePtr z);
+	void			parsePathData(ZonePtr z);
+
 public:
 	LocationParser_br(Parallaction_br *vm) : LocationParser_ns((Parallaction_ns*)vm), _vm(vm) {
 	}
@@ -307,6 +310,7 @@
 	Parser	*_parser;
 	Parallaction_ns *_vm;
 
+
 	Script	*_script;
 	ProgramPtr	_program;
 

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-07-25 22:31:11 UTC (rev 33294)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-07-26 02:09:50 UTC (rev 33295)
@@ -750,7 +750,68 @@
 	_parser->popTables();
 }
 
+void LocationParser_br::parsePathData(ZonePtr z) {
 
+	PathData *data = new PathData;
+
+	do {
+
+		if (!scumm_stricmp("zone", _tokens[0])) {
+			int id = atoi(_tokens[1]);
+			parsePointList(data->_lists[id]);
+			data->_numLists++;
+		}
+
+		_script->readLineToken(true);
+	} while (scumm_stricmp("endzone", _tokens[0]));
+
+	z->u.path = data;
+}
+
+void LocationParser_br::parseZoneTypeBlock(ZonePtr z) {
+	debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
+
+	switch (z->_type & 0xFFFF) {
+	case kZoneExamine:	// examine Zone alloc
+		parseExamineData(z);
+		break;
+
+	case kZoneDoor: // door Zone alloc
+		parseDoorData(z);
+		break;
+
+	case kZoneGet:	// get Zone alloc
+		parseGetData(z);
+		break;
+
+	case kZoneMerge:	// merge Zone alloc
+		parseMergeData(z);
+		break;
+
+	case kZoneHear: // hear Zone alloc
+		parseHearData(z);
+		break;
+
+	case kZoneSpeak:	// speak Zone alloc
+		parseSpeakData(z);
+		break;
+
+	// BRA specific zone
+	case kZonePath:
+		parsePathData(z);
+		break;
+
+	default:
+		// eats up 'ENDZONE' line for unprocessed zone types
+		_script->readLineToken(true);
+		break;
+	}
+
+	debugC(7, kDebugParser, "parseZoneTypeBlock() done");
+
+	return;
+}
+
 DECLARE_ANIM_PARSER(file)  {
 	debugC(7, kDebugParser, "ANIM_PARSER(file) ");
 

Modified: scummvm/trunk/engines/parallaction/walk.h
===================================================================
--- scummvm/trunk/engines/parallaction/walk.h	2008-07-25 22:31:11 UTC (rev 33294)
+++ scummvm/trunk/engines/parallaction/walk.h	2008-07-26 02:09:50 UTC (rev 33295)
@@ -29,13 +29,10 @@
 #include "common/ptr.h"
 #include "common/list.h"
 
+#include "parallaction/objects.h"
+
 namespace Parallaction {
 
-struct Animation;
-
-typedef Common::List<Common::Point> PointList;
-
-
 class PathBuilder {
 
 	AnimationPtr	_anim;


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