add script command to debugger and convert old printscripts function to new debugger

svn-id: r7082
This commit is contained in:
Jonathan Gray 2003-04-23 05:05:20 +00:00
parent 91fcad01e5
commit 8d39d6ddb1
2 changed files with 47 additions and 0 deletions

View File

@ -85,6 +85,8 @@ void ScummDebugger::attach(Scumm *s, char *entry) {
DCmd_Register("room", &ScummDebugger::Cmd_Room);
DCmd_Register("objects", &ScummDebugger::Cmd_PrintObjects);
DCmd_Register("object", &ScummDebugger::Cmd_Object);
DCmd_Register("script", &ScummDebugger::Cmd_Script);
DCmd_Register("scripts", &ScummDebugger::Cmd_PrintScript);
DCmd_Register("loadgame", &ScummDebugger::Cmd_LoadGame);
DCmd_Register("savegame", &ScummDebugger::Cmd_SaveGame);
@ -395,6 +397,49 @@ bool ScummDebugger::Cmd_Hide(int argc, const char **argv) {
return true;
}
bool ScummDebugger::Cmd_Script(int argc, const char** argv) {
int scriptnum;
if (argc < 2) {
Debug_Printf("Syntax: script <scriptnum> <command>\n");
return true;
}
scriptnum = atoi(argv[1]);
if (scriptnum >= _s->_maxScripts) {
Debug_Printf("Script number %d is out of range (range: 1 - %d)\n", scriptnum, _s->_maxScripts);
return true;
}
if ((!strcmp(argv[2], "kill")) || (!strcmp(argv[2], "stop"))) {
_s->stopScriptNr(scriptnum);
} else {
Debug_Printf("Unknown script command '%s'\n", argv[2]);
}
return true;
}
bool ScummDebugger::Cmd_PrintScript(int argc, const char **argv) {
int i;
ScriptSlot *ss;
Debug_Printf("+-----------------------------+\n");
Debug_Printf("|# |num|sta|typ|un1|un2|fc|cut|\n");
Debug_Printf("+--+---+---+---+---+--+---+---+\n");
for (i=0; i < 25; i++) {
ss = &(_s->vm.slot[i]);
if (ss->number) {
Debug_Printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|\n",
i, ss->number, ss->status, ss->where, ss->unk1, ss->unk2,
ss->freezeCount, ss->cutsceneOverride);
}
}
Debug_Printf("+-----------------------------+\n");
return true;
}
bool ScummDebugger::Cmd_Actor(int argc, const char **argv) {
Actor *a;
int actnum;

View File

@ -80,6 +80,8 @@ protected:
bool Cmd_PrintObjects(int argc, const char **argv);
bool Cmd_Actor(int argc, const char **argv);
bool Cmd_Object(int argc, const char **argv);
bool Cmd_Script(int argc, const char **argv);
bool Cmd_PrintScript(int argc, const char **argv);
bool Cmd_DebugLevel(int argc, const char **argv);
bool Cmd_Help(int argc, const char **argv);