From 027ef33b6b1f6e47274fc641e754d2f42d826e61 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 28 Jul 2002 13:45:51 +0000 Subject: allow to print (and draw!) only one specified box svn-id: r4667 --- debug.cpp | 71 +++++++++++++++++++++++++++++++++++++++------------------------ debug.h | 4 +++- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/debug.cpp b/debug.cpp index d9fe1f9895..af69ae87bb 100644 --- a/debug.cpp +++ b/debug.cpp @@ -67,7 +67,7 @@ bool ScummDebugger::do_command() case CMD_HELP: printf("Debugger commands:\n" "(a)ctor [actornum] -> show actor information\n" - "(b)oxes -> list and draw boxen\n" + "(b)ox [boxnum] -> list and draw the specified (or all) boxes\n" "(c)ontinue -> exit the debugger and continue the program\n" "(h)elp -> display this help text\n" "(g)o [numframes] -> increase frame\n" @@ -108,32 +108,10 @@ bool ScummDebugger::do_command() } return true; case CMD_DUMPBOX: - { - int num, i = 0; - BoxCoords box; - byte *boxm = _s->getBoxMatrixBaseAddr(); - int flags; - num = _s->getNumBoxes(); - - printf("Walk matrix:\n"); - for (i = 0; i < num; i++) { - while (*boxm != 0xFF) { - printf("[%d] ", *boxm); - boxm++; - } - boxm++; - printf("\n"); - } - - printf("\nWalk boxes:\n"); - for (i = 0; i < num; i++) { - boxTest(i); - _s->getBoxCoordinates(i, &box); - flags = _s->getBoxFlags(i); - printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d], flags=0x%02x\n", i, - box.ul.x, box.ul.y, box.ll.x, box.ll.y, box.ur.x, box.ur.y, box.lr.x, box.lr.y, flags); - } - } + if (!_parameters[0]) + printBoxes(); + else + printBox(atoi(_parameters)); return true; case CMD_VAR: if (!_parameters[0]) { @@ -317,6 +295,45 @@ void ScummDebugger::printScripts() } +void ScummDebugger::printBoxes() +{ + int num, i = 0; + byte *boxm = _s->getBoxMatrixBaseAddr(); + num = _s->getNumBoxes(); + + printf("Walk matrix:\n"); + for (i = 0; i < num; i++) { + while (*boxm != 0xFF) { + printf("[%d] ", *boxm); + boxm++; + } + boxm++; + printf("\n"); + } + + printf("\nWalk boxes:\n"); + for (i = 0; i < num; i++) + printBox(i); +} + +void ScummDebugger::printBox(int box) +{ + BoxCoords coords; + int flags = _s->getBoxFlags(box); + int mask = _s->getMaskFromBox(box); + + _s->getBoxCoordinates(box, &coords); + + // Draw the box + boxTest(box); + + // Print out coords, flags, zbuffer mask + printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d], flags=0x%02x, mask=%d\n", + box, + coords.ul.x, coords.ul.y, coords.ll.x, coords.ll.y, + coords.ur.x, coords.ur.y, coords.lr.x, coords.lr.y, + flags, mask); +} /************ ENDER: Temporary debug code for boxen **************/ diff --git a/debug.h b/debug.h index d620f42a02..4a5f8f9b4c 100644 --- a/debug.h +++ b/debug.h @@ -43,7 +43,9 @@ struct ScummDebugger { void printActors(int act); void printScripts(); - + + void printBox(int box); + void printBoxes(); void boxTest(int box); }; -- cgit v1.2.3