From f4ae774751a82c934203e371b93a144ef1991e7d Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Mon, 25 Oct 2010 14:03:01 +0000 Subject: HUGO: Add a debug channel for Object functions svn-id: r53826 --- engines/hugo/hugo.cpp | 1 + engines/hugo/hugo.h | 17 +++++++++-------- engines/hugo/object.cpp | 22 ++++++++++++---------- engines/hugo/object_v1d.cpp | 6 +++--- engines/hugo/object_v1w.cpp | 6 +++--- engines/hugo/object_v2d.cpp | 4 ++-- engines/hugo/object_v3d.cpp | 4 ++-- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index ce44466918..7f0c346eff 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -77,6 +77,7 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy DebugMan.addDebugChannel(kDebugFile, "File", "File IO debug level"); DebugMan.addDebugChannel(kDebugRoute, "Route", "Route debug level"); DebugMan.addDebugChannel(kDebugInventory, "Inventory", "Inventory debug level"); + DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level"); for (int j = 0; j < NUM_FONTS; j++) _arrayFont[j] = 0; diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index af82e3e2bb..2be56e345d 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -72,14 +72,15 @@ enum GameVariant { }; enum HugoDebugChannels { - kDebugSchedule = 1 << 0, - kDebugEngine = 1 << 1, - kDebugDisplay = 1 << 2, - kDebugMouse = 1 << 3, - kDebugParser = 1 << 4, - kDebugFile = 1 << 5, - kDebugRoute = 1 << 6, - kDebugInventory = 1 << 7 + kDebugSchedule = 1 << 0, + kDebugEngine = 1 << 1, + kDebugDisplay = 1 << 2, + kDebugMouse = 1 << 3, + kDebugParser = 1 << 4, + kDebugFile = 1 << 5, + kDebugRoute = 1 << 6, + kDebugInventory = 1 << 7, + kDebugObject = 1 << 8 }; enum HugoGameFeatures { diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index 2dd77075c4..0ab008415b 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -53,7 +53,7 @@ ObjectHandler::~ObjectHandler() { void ObjectHandler::saveSeq(object_t *obj) { // Save sequence number and image number in given object - debugC(1, kDebugFile, "saveSeq"); + debugC(1, kDebugObject, "saveSeq"); bool found = false; for (int j = 0; !found && (j < obj->seqNumb); j++) { @@ -72,7 +72,7 @@ void ObjectHandler::saveSeq(object_t *obj) { void ObjectHandler::restoreSeq(object_t *obj) { // Set up cur_seq_p from stored sequence and image number in object - debugC(1, kDebugFile, "restoreSeq"); + debugC(1, kDebugObject, "restoreSeq"); seq_t *q = obj->seqList[obj->curSeqNum].seqPtr; for (int j = 0; j < obj->curImageNum; j++) @@ -83,7 +83,7 @@ void ObjectHandler::restoreSeq(object_t *obj) { // If status.objid = -1, pick up objid, else use status.objid on objid, // if objid can't be picked up, use it directly void ObjectHandler::useObject(int16 objId) { - debugC(1, kDebugEngine, "useObject(%d)", objId); + debugC(1, kDebugObject, "useObject(%d)", objId); char *verb; // Background verb to use directly object_t *obj = &_objects[objId]; // Ptr to object @@ -142,7 +142,7 @@ void ObjectHandler::useObject(int16 objId) { // Return object index of the topmost object under the cursor, or -1 if none // Objects are filtered if not "useful" int16 ObjectHandler::findObject(uint16 x, uint16 y) { - debugC(3, kDebugEngine, "findObject(%d, %d)", x, y); + debugC(3, kDebugObject, "findObject(%d, %d)", x, y); int16 objIndex = -1; // Index of found object uint16 y2Max = 0; // Greatest y2 @@ -183,7 +183,7 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) { // Issue "Look at " command // Note special case of swapped hero image void ObjectHandler::lookObject(object_t *obj) { - debugC(1, kDebugEngine, "lookObject"); + debugC(1, kDebugObject, "lookObject"); if (obj == _vm->_hero) // Hero swapped - look at other @@ -194,7 +194,7 @@ void ObjectHandler::lookObject(object_t *obj) { // Free all object images void ObjectHandler::freeObjects() { - debugC(1, kDebugEngine, "freeObjects"); + debugC(1, kDebugObject, "freeObjects"); // Nothing to do if not allocated yet if (_vm->_hero->seqList[0].seqPtr == 0) @@ -220,7 +220,7 @@ void ObjectHandler::freeObjects() { // increasing vertical position, using y+y2 as the baseline // Returns -1 if ay2 < by2 else 1 if ay2 > by2 else 0 int ObjectHandler::y2comp(const void *a, const void *b) { - debugC(6, kDebugEngine, "y2comp"); + debugC(6, kDebugObject, "y2comp"); // const object_t *p1 = &s_Engine->_objects[*(const byte *)a]; // const object_t *p2 = &s_Engine->_objects[*(const byte *)b]; @@ -251,7 +251,7 @@ int ObjectHandler::y2comp(const void *a, const void *b) { // Return TRUE if object being carried by hero bool ObjectHandler::isCarrying(uint16 wordIndex) { - debugC(1, kDebugParser, "isCarrying(%d)", wordIndex); + debugC(1, kDebugObject, "isCarrying(%d)", wordIndex); for (int i = 0; i < _vm->_numObj; i++) { if ((wordIndex == _objects[i].nounIndex) && _objects[i].carriedFl) @@ -262,7 +262,7 @@ bool ObjectHandler::isCarrying(uint16 wordIndex) { // Describe any takeable objects visible in this screen void ObjectHandler::showTakeables() { - debugC(1, kDebugParser, "showTakeables"); + debugC(1, kDebugObject, "showTakeables"); for (int j = 0; j < _vm->_numObj; j++) { object_t *obj = &_objects[j]; @@ -276,7 +276,7 @@ void ObjectHandler::showTakeables() { // Find a clear space around supplied object that hero can walk to bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { - debugC(1, kDebugEngine, "findObjectSpace(obj, %d, %d)", *destx, *desty); + debugC(1, kDebugObject, "findObjectSpace(obj, %d, %d)", *destx, *desty); seq_t *curImage = obj->currImagePtr; int16 y = obj->y + curImage->y2 - 1; @@ -318,6 +318,8 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { } void ObjectHandler::loadObject(Common::File &in) { + debugC(6, kDebugObject, "loadObject(&in)"); + // TODO: For Hugo3, if not in story mode, set _objects[2].state to 3 for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { uint16 numElem = in.readUint16BE(); diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp index 0b59b9f39b..2ad4134a72 100644 --- a/engines/hugo/object_v1d.cpp +++ b/engines/hugo/object_v1d.cpp @@ -56,7 +56,7 @@ ObjectHandler_v1d::~ObjectHandler_v1d() { // 2. Display new object frames/positions in dib // Finally, cycle any animating objects to next frame void ObjectHandler_v1d::updateImages() { - debugC(5, kDebugEngine, "updateImages"); + debugC(5, kDebugObject, "updateImages"); // Initialise the index array to visible objects in current screen int num_objs = 0; @@ -169,7 +169,7 @@ void ObjectHandler_v1d::updateImages() { // Update all object positions. Process object 'local' events // including boundary events and collisions void ObjectHandler_v1d::moveObjects() { - debugC(4, kDebugEngine, "moveObjects"); + debugC(4, kDebugObject, "moveObjects"); static int dxOld, dyOld; // previous directions for CHASEing @@ -339,7 +339,7 @@ void ObjectHandler_v1d::swapImages(int objNumb1, int objNumb2) { // Swap all the images of one object with another. Set hero_image (we make // the assumption for now that the first obj is always the HERO) to the object // number of the swapped image - debugC(1, kDebugSchedule, "swapImages(%d, %d)", objNumb1, objNumb2); + debugC(1, kDebugObject, "swapImages(%d, %d)", objNumb1, objNumb2); seqList_t tmpSeqList[MAX_SEQUENCES]; int seqListSize = sizeof(seqList_t) * MAX_SEQUENCES; diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp index e619942627..05fa4bd35c 100644 --- a/engines/hugo/object_v1w.cpp +++ b/engines/hugo/object_v1w.cpp @@ -56,7 +56,7 @@ ObjectHandler_v1w::~ObjectHandler_v1w() { // 2. Display new object frames/positions in dib // Finally, cycle any animating objects to next frame void ObjectHandler_v1w::updateImages() { - debugC(5, kDebugEngine, "updateImages"); + debugC(5, kDebugObject, "updateImages"); // Initialise the index array to visible objects in current screen int num_objs = 0; @@ -169,7 +169,7 @@ void ObjectHandler_v1w::updateImages() { // Update all object positions. Process object 'local' events // including boundary events and collisions void ObjectHandler_v1w::moveObjects() { - debugC(4, kDebugEngine, "moveObjects"); + debugC(4, kDebugObject, "moveObjects"); // If route mode enabled, do special route processing if (_vm->getGameStatus().routeIndex >= 0) @@ -349,7 +349,7 @@ void ObjectHandler_v1w::swapImages(int objNumb1, int objNumb2) { // Swap all the images of one object with another. Set hero_image (we make // the assumption for now that the first obj is always the HERO) to the object // number of the swapped image - debugC(1, kDebugSchedule, "swapImages(%d, %d)", objNumb1, objNumb2); + debugC(1, kDebugObject, "swapImages(%d, %d)", objNumb1, objNumb2); saveSeq(&_objects[objNumb1]); diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp index 983c422500..11146de0b1 100644 --- a/engines/hugo/object_v2d.cpp +++ b/engines/hugo/object_v2d.cpp @@ -56,7 +56,7 @@ ObjectHandler_v2d::~ObjectHandler_v2d() { // 2. Display new object frames/positions in dib // Finally, cycle any animating objects to next frame void ObjectHandler_v2d::updateImages() { - debugC(5, kDebugEngine, "updateImages"); + debugC(5, kDebugObject, "updateImages"); // Initialise the index array to visible objects in current screen int num_objs = 0; @@ -169,7 +169,7 @@ void ObjectHandler_v2d::updateImages() { // Update all object positions. Process object 'local' events // including boundary events and collisions void ObjectHandler_v2d::moveObjects() { - debugC(4, kDebugEngine, "moveObjects"); + debugC(4, kDebugObject, "moveObjects"); // Added to DOS version in order to handle mouse properly // If route mode enabled, do special route processing diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index 9281469fce..aee373b26e 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -54,7 +54,7 @@ ObjectHandler_v3d::~ObjectHandler_v3d() { // Update all object positions. Process object 'local' events // including boundary events and collisions void ObjectHandler_v3d::moveObjects() { - debugC(4, kDebugEngine, "moveObjects"); + debugC(4, kDebugObject, "moveObjects"); // Added to DOS version in order to handle mouse properly // If route mode enabled, do special route processing @@ -235,7 +235,7 @@ void ObjectHandler_v3d::swapImages(int objNumb1, int objNumb2) { // Swap all the images of one object with another. Set hero_image (we make // the assumption for now that the first obj is always the HERO) to the object // number of the swapped image - debugC(1, kDebugSchedule, "swapImages(%d, %d)", objNumb1, objNumb2); + debugC(1, kDebugObject, "swapImages(%d, %d)", objNumb1, objNumb2); saveSeq(&_objects[objNumb1]); -- cgit v1.2.3