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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Jan 16 22:30:29 CET 2007


Revision: 25106
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25106&view=rev
Author:   peres001
Date:     2007-01-16 13:30:18 -0800 (Tue, 16 Jan 2007)

Log Message:
-----------
added first debug messages

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/archive.cpp
    scummvm/trunk/engines/parallaction/defs.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/walk.cpp

Modified: scummvm/trunk/engines/parallaction/archive.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/archive.cpp	2007-01-16 13:12:05 UTC (rev 25105)
+++ scummvm/trunk/engines/parallaction/archive.cpp	2007-01-16 21:30:18 UTC (rev 25106)
@@ -40,7 +40,7 @@
 
 
 void openArchive(const char *file) {
-//	printf("openArchive(%s)\n", file);
+	debugC(1, kDebugDisk, "open archive '%s'", file);
 
 	uint32	offset = DIRECTORY_OFFSET_IN_FILE;
 	char	path[PATH_LEN];
@@ -72,7 +72,7 @@
 
 
 void closeArchive() {
-//	printf("closeArchive()\n");
+	debugC(1, kDebugDisk, "close current archive");
 
 	if (!_archive.isOpen()) return;
 
@@ -81,7 +81,6 @@
 
 
 ArchivedFile *openArchivedFile(const char *name) {
-//	printf("openArchivedFile(%s)\n", name);
 
 	uint16 i = 0;
 	for ( ; i < MAX_ARCHIVE_ENTRIES; i++) {
@@ -89,12 +88,12 @@
 	}
 	if (i == MAX_ARCHIVE_ENTRIES) return NULL;
 
-	printf("found file %s in slot %i\n", name, i);
+	debugC(1, kDebugDisk, "file '%s' found in slot %i", name, i);
 
 	ArchivedFile *file = (ArchivedFile*)memAlloc(sizeof(ArchivedFile));
 
 	if (!file)
-		printf("can't allocate archive file\n");
+        error("openArchivedFile: can't allocate buffer for '%s'", name);
 
 	file->_index = i;
 	file->_offset = _archiveOffsets[i];

Modified: scummvm/trunk/engines/parallaction/defs.h
===================================================================
--- scummvm/trunk/engines/parallaction/defs.h	2007-01-16 13:12:05 UTC (rev 25105)
+++ scummvm/trunk/engines/parallaction/defs.h	2007-01-16 21:30:18 UTC (rev 25106)
@@ -100,6 +100,11 @@
 void beep();
 char *skip_whitespace(char *s);
 
+enum {
+    kDebugDisk = 1 << 0,
+    kDebugWalk = 1 << 1
+};
+
 } // namespace Parallaction
 
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-01-16 13:12:05 UTC (rev 25105)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-01-16 21:30:18 UTC (rev 25106)
@@ -172,6 +172,16 @@
 
 	Common::File::addDefaultDirectory( _gameDataPath );
 
+/*    Common::addSpecialDebugLevel(kDebugAnimation, "Animation", "Animations debug level");
+    Common::addSpecialDebugLevel(kDebugZone, "Zone", "Zones debug level");
+    Common::addSpecialDebugLevel(kDebugCommand, "Command", "Commands debug level");
+    Common::addSpecialDebugLevel(kDebugDialogue, "Dialogue", "Dialogues debug level");
+    Common::addSpecialDebugLevel(kDebugIntro, "Intro", "Intro debug level");
+    Common::addSpecialDebugLevel(kDebugInventory, "Inventory", "Inventory debug level");
+    Common::addSpecialDebugLevel(kDebugLocation, "Location", "Locations debug level");
+*/
+    Common::addSpecialDebugLevel(kDebugDisk, "Disk", "Disk debug level");
+    Common::addSpecialDebugLevel(kDebugWalk, "Walk", "Walk debug level");
 }
 
 

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2007-01-16 13:12:05 UTC (rev 25105)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2007-01-16 21:30:18 UTC (rev 25106)
@@ -49,7 +49,7 @@
 //	x, y: mouse click (foot) coordinates
 //
 WalkNode *buildWalkPath(uint16 x, uint16 y) {
-//	printf("buildWalkPath(%i, %i)\n", x, y);
+    debugC(1, kDebugWalk, "buildWalkPath to (%i, %i)", x, y);
 
 	int16 to_x = x;
 	int16 to_y = y;
@@ -63,7 +63,7 @@
 
 		do {
 			right++;
-		} while ((queryPath(right, to_y) == 0) && (x < SCREEN_WIDTH));
+		} while ((queryPath(right, to_y) == 0) && (right < SCREEN_WIDTH));
 
 		do {
 			left--;
@@ -107,9 +107,8 @@
 		}
 
 	}
-//	printf("closest path Point: %i, %i\n", to_x, to_y);
+    debugC(1, kDebugWalk, "found closest path point at (%i, %i)", to_x, to_y);
 
-
 	WalkNode *v48 = (WalkNode*)memAlloc(sizeof(WalkNode));
 	WalkNode *v44 = (WalkNode*)memAlloc(sizeof(WalkNode));
 
@@ -121,12 +120,13 @@
 	uint16 v38 = walkFunc1(to_x, to_y, v44);
 	if (v38 == 1) {
 		// destination directly reachable
-//		printf("moving to destination (%i, %i)\n", to_x, to_y);
+        debugC(1, kDebugWalk, "direct move to (%i, %i)", to_x, to_y);
 		memFree(v44);
 		return v48;
 	}
 
 	// path is obstructed: find alternative
+    debugC(1, kDebugWalk, "trying to build walk path to (%i, %i)", to_x, to_y);
 
 	WalkNode	v58;
 	memset(&v58, 0, sizeof(WalkNode));
@@ -191,6 +191,9 @@
 
 			v34 = v30 = (_si - v20._x) * (_si - v20._x) + (_di - v20._y) * (_di - v20._y);
 
+
+            debugC(1, kDebugWalk, "adding walk node (%i, %i) to path", _newnode->_x, _newnode->_y);
+
 			addNode(&v48->_node, &_newnode->_node);
 			v48 = _newnode;
 		}
@@ -200,7 +203,7 @@
 		if (v38 != 0 && v34 > v38) {
 			// no alternative path (gap?)
 			freeNodeList(v58._node._next);
-//			printf("can't reach destination, moving to (%i, %i)\n", v44->_x, v44->_y);
+            debugC(1, kDebugWalk, "can't find a path node: rejecting partial path");
 			return v44;
 		} else {
 			_si = ((WalkNode*)(v58._node._next))->_x;
@@ -211,14 +214,7 @@
 
 	} while (true);
 
-	// alternative path exists
-	WalkNode *tmp = (WalkNode*)v58._node._next;
-//	printf("moving along path ");
-	while (tmp) {
-//		printf(" -> (%i, %i)", tmp->_x, tmp->_y);
-		tmp = (WalkNode*)tmp->_node._next;
-	}
-//	printf("\n");
+    debugC(1, kDebugWalk, "walk path completed");
 
 	memFree(v44);
 	return (WalkNode*)v58._node._next;
@@ -311,12 +307,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;
 
+    debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _yourself._cnv._width / 2, node->_y + _yourself._cnv._height);
+
 	_yourself._zone.pos._oldposition._x = _si;
 	_yourself._zone.pos._oldposition._y = _di;
 
@@ -410,7 +407,6 @@
 
 	} else {
 
-//		printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n");
 		_yourself._frame = v16 + walkData2 + 1;
 
 	}


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