diff options
-rw-r--r-- | engines/parallaction/archive.cpp | 9 | ||||
-rw-r--r-- | engines/parallaction/defs.h | 5 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 10 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 28 |
4 files changed, 31 insertions, 21 deletions
diff --git a/engines/parallaction/archive.cpp b/engines/parallaction/archive.cpp index 7f6e52da17..1fe6275643 100644 --- a/engines/parallaction/archive.cpp +++ b/engines/parallaction/archive.cpp @@ -40,7 +40,7 @@ static uint32 _handle = MAX_ARCHIVE_ENTRIES; 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 openArchive(const char *file) { void closeArchive() { -// printf("closeArchive()\n"); + debugC(1, kDebugDisk, "close current archive"); if (!_archive.isOpen()) return; @@ -81,7 +81,6 @@ void closeArchive() { ArchivedFile *openArchivedFile(const char *name) { -// printf("openArchivedFile(%s)\n", name); uint16 i = 0; for ( ; i < MAX_ARCHIVE_ENTRIES; i++) { @@ -89,12 +88,12 @@ ArchivedFile *openArchivedFile(const char *name) { } 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]; diff --git a/engines/parallaction/defs.h b/engines/parallaction/defs.h index 4ae99bcf29..5829c603e7 100644 --- a/engines/parallaction/defs.h +++ b/engines/parallaction/defs.h @@ -100,6 +100,11 @@ void errorFileNotFound(const char*); void beep(); char *skip_whitespace(char *s); +enum { + kDebugDisk = 1 << 0, + kDebugWalk = 1 << 1 +}; + } // namespace Parallaction diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 44a378f5f1..0dcefc241c 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -172,6 +172,16 @@ Parallaction::Parallaction(OSystem *syst) : 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"); } diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index a44f16aeb5..b0e29ca9cd 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -49,7 +49,7 @@ int32 dotProduct(Point *p1, Point *p2) { // 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 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { do { right++; - } while ((queryPath(right, to_y) == 0) && (x < SCREEN_WIDTH)); + } while ((queryPath(right, to_y) == 0) && (right < SCREEN_WIDTH)); do { left--; @@ -107,8 +107,7 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { } } -// 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 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { 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 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { 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 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { 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 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { } 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 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) { 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 @@ void jobWalk(void *parm, Job *j) { } else { -// printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); _yourself._frame = v16 + walkData2 + 1; } |