aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-07-28 13:45:51 +0000
committerMax Horn2002-07-28 13:45:51 +0000
commit027ef33b6b1f6e47274fc641e754d2f42d826e61 (patch)
treedb4ddf6296658288906a1101af88db0f99bcb20c
parentb233f5573a0988f13b9fb3da05e48b95761c79a3 (diff)
downloadscummvm-rg350-027ef33b6b1f6e47274fc641e754d2f42d826e61.tar.gz
scummvm-rg350-027ef33b6b1f6e47274fc641e754d2f42d826e61.tar.bz2
scummvm-rg350-027ef33b6b1f6e47274fc641e754d2f42d826e61.zip
allow to print (and draw!) only one specified box
svn-id: r4667
-rw-r--r--debug.cpp71
-rw-r--r--debug.h4
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);
};