From 90974937a3a56cd2446101d7ee663e1bdbe82db2 Mon Sep 17 00:00:00 2001 From: Julien Templier Date: Fri, 22 Oct 2010 22:00:27 +0000 Subject: LASTEXPRESS: Reorganize and enhance some debug commands Add "time" command to convert between in-game and human-readable forms Rename "dump" command to "show" and use named parameters instead of index Add progress and flags options to show command svn-id: r53715 --- engines/lastexpress/debug.cpp | 88 ++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 31 deletions(-) (limited to 'engines/lastexpress/debug.cpp') diff --git a/engines/lastexpress/debug.cpp b/engines/lastexpress/debug.cpp index 2f52508eca..f26fdf61b9 100644 --- a/engines/lastexpress/debug.cpp +++ b/engines/lastexpress/debug.cpp @@ -81,7 +81,8 @@ Debugger::Debugger(LastExpressEngine *engine) : _engine(engine), _command(NULL), // Game DCmd_Register("delta", WRAP_METHOD(Debugger, cmdTimeDelta)); - DCmd_Register("dump", WRAP_METHOD(Debugger, cmdDump)); + DCmd_Register("time", WRAP_METHOD(Debugger, cmdTime)); + DCmd_Register("show", WRAP_METHOD(Debugger, cmdShow)); DCmd_Register("entity", WRAP_METHOD(Debugger, cmdEntity)); // Misc @@ -201,8 +202,8 @@ bool Debugger::cmdHelp(int, const char **) { DebugPrintf(" beetle - start the beetle game\n"); DebugPrintf("\n"); DebugPrintf(" delta - Adjust the time delta\n"); - DebugPrintf(" dump - Dump game data\n"); - DebugPrintf(" entity - Dump entity data\n"); + DebugPrintf(" show - show game data\n"); + DebugPrintf(" entity - show entity data\n"); DebugPrintf("\n"); DebugPrintf(" loadgame - load a saved game\n"); DebugPrintf(" chapter - switch to a specific chapter\n"); @@ -894,7 +895,7 @@ bool Debugger::cmdBeetle(int argc, const char **argv) { */ bool Debugger::cmdTimeDelta(int argc, const char **argv) { if (argc == 2) { - int delta = getNumber(argv[1]); + int delta = getNumber(argv[1]); if (delta <= 0 || delta > 500) goto label_error; @@ -909,14 +910,43 @@ label_error: } /** - * Command: dumps game logic data + * Command: Convert between in-game time and human readable time * * @param argc The argument count. * @param argv The values. * * @return true if it was handled, false otherwise */ -bool Debugger::cmdDump(int argc, const char **argv) { +bool Debugger::cmdTime(int argc, const char **argv) { + if (argc == 2) { + int time = getNumber(argv[1]); + + if (time < 0) + goto label_error; + + // Convert to human-readable form + uint8 hours = 0; + uint8 minutes = 0; + State::getHourMinutes(time, &hours, &minutes); + + DebugPrintf("%02d:%02d\n", hours, minutes); + } else { +label_error: + DebugPrintf("Syntax: time