bug fixes, code cleanup

svn-id: r3446
This commit is contained in:
Ludvig Strigeus
2001-10-26 17:34:50 +00:00
parent f9daf35824
commit 056dd5b15d
17 changed files with 1178 additions and 1110 deletions
+52 -2
View File
@@ -17,6 +17,9 @@
*
* Change Log:
* $Log$
* Revision 1.3 2001/10/26 17:34:50 strigeus
* bug fixes, code cleanup
*
* Revision 1.2 2001/10/23 19:56:57 strigeus
* fixed spelling error
*
@@ -36,6 +39,8 @@ enum {
CMD_HELP,
CMD_QUIT,
CMD_GO,
CMD_ACTOR,
CMD_SCRIPTS,
};
void ScummDebugger::attach(Scumm *s) {
@@ -57,7 +62,7 @@ bool ScummDebugger::do_command() {
printf("Debugger commands:\n"
"help -> display this help text\n"
"quit -> quit the debugger\n"
"step -> increase one frame\n"
"go [numframes] -> increase frame\n"
);
return true;
@@ -71,7 +76,15 @@ bool ScummDebugger::do_command() {
else
_go_amount = atoi(_parameters);
return false;
case CMD_ACTOR:
if (!_parameters[0])
printActors(-1);
else
printActors(atoi(_parameters));
return true;
case CMD_SCRIPTS:
printScripts();
return true;
}
}
@@ -108,6 +121,8 @@ static const DebuggerCommands debugger_commands[] = {
{ "h", 1, CMD_HELP },
{ "q", 1, CMD_QUIT },
{ "g", 1, CMD_GO },
{ "a", 1, CMD_ACTOR },
{ "s", 1, CMD_SCRIPTS },
{ 0, 0, 0 },
};
@@ -143,4 +158,39 @@ int ScummDebugger::get_command() {
if (*s==32) { *s=0; break; }
printf("Invalid command '%s'. Type 'help' for a list of available commands.\n", _cmd_buffer);
} while (1);
}
void ScummDebugger::printActors(int act) {
int i;
Actor *a;
if (act==-1) {
printf("+--------------------------------------------------------------+\n");
printf("|# |room| x y |elev|cos|width|box|mov|zp|frame|scale|spd|dir|\n");
printf("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n");
for(i=1; i<13; i++) {
a = &_s->actor[i];
if (a->visible)
printf("|%2d|%4d|%3d %3d|%4d|%3d|%5d|%3d|%3d|%2d|%5d|%5d|%3d|%3d|\n",
i,a->room,a->x,a->y,a->elevation,a->costume,a->width,a->walkbox,a->moving,a->neverZClip,a->animIndex,a->scalex,a->speedx,a->facing);
}
printf("+--------------------------------------------------------------+\n");
}
}
void ScummDebugger::printScripts() {
int i;
ScriptSlot *ss;
printf("+---------------------------------+\n");
printf("|# |num|sta|typ|un1|un2|fc|cut|un5|\n");
printf("+--+---+---+---+---+---+--+---+---+\n");
for(i=0; i<25; i++) {
ss = &_s->vm.slot[i];
if (ss->number) {
printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|%3d|\n",
i, ss->number, ss->status, ss->type, ss->unk1, ss->unk2, ss->freezeCount, ss->cutsceneOverride, ss->unk5);
}
}
printf("+---------------------------------+\n");
}