aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/debugger.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-01 22:03:27 +0000
committerJohannes Schickel2009-06-01 22:03:27 +0000
commitf57be08d6d24ce196098f39296b5796e6a86ea92 (patch)
treed34faf9de046b3e0ae5807fd3a58ee8a2cbae3dd /engines/kyra/debugger.cpp
parentbdea557d7f98b6aeba3b72efd57c4e4aa39c36be (diff)
downloadscummvm-rg350-f57be08d6d24ce196098f39296b5796e6a86ea92.tar.gz
scummvm-rg350-f57be08d6d24ce196098f39296b5796e6a86ea92.tar.bz2
scummvm-rg350-f57be08d6d24ce196098f39296b5796e6a86ea92.zip
- Add some basic debugger for Lands of Lore.
- Allow the "flags" command in all Kyra games to be working properly with 320x200 GUI. svn-id: r41113
Diffstat (limited to 'engines/kyra/debugger.cpp')
-rw-r--r--engines/kyra/debugger.cpp61
1 files changed, 58 insertions, 3 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index dc8dfb0a2c..186696edc9 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -33,6 +33,7 @@
#include "kyra/screen.h"
#include "kyra/timer.h"
#include "kyra/resource.h"
+#include "kyra/lol.h"
namespace Kyra {
@@ -132,10 +133,12 @@ bool Debugger::cmd_gameSpeed(int argc, const char **argv) {
}
bool Debugger::cmd_listFlags(int argc, const char **argv) {
- for (int i = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++) {
- DebugPrintf("(%-3i): %-5i", i, _vm->queryGameFlag(i));
- if (!(i % 10))
+ for (int i = 0, p = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++, ++p) {
+ DebugPrintf("(%-3i): %-2i", i, _vm->queryGameFlag(i));
+ if (p == 5) {
DebugPrintf("\n");
+ p -= 6;
+ }
}
DebugPrintf("\n");
return true;
@@ -457,5 +460,57 @@ bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) {
return true;
}
+#pragma mark -
+
+Debugger_LoL::Debugger_LoL(LoLEngine *vm) : Debugger(vm), _vm(vm) {
+}
+
+bool Debugger_LoL::cmd_listFlags(int argc, const char **argv) {
+ for (int i = 0, p = 0; i < (int)sizeof(_vm->_gameFlags)*8; ++i, ++p) {
+ const uint8 index = (i >> 4);
+ const uint8 offset = i & 0xF;
+
+ DebugPrintf("(%-3i): %-2i", i, (_vm->_gameFlags[index] >> offset) & 1);
+ if (p == 5) {
+ DebugPrintf("\n");
+ p -= 6;
+ }
+ }
+ DebugPrintf("\n");
+ return true;
+}
+
+bool Debugger_LoL::cmd_toggleFlag(int argc, const char **argv) {
+ if (argc > 1) {
+ uint flag = atoi(argv[1]);
+
+ const uint8 index = (flag >> 4);
+ const uint8 offset = flag & 0xF;
+
+ _vm->_gameFlags[index] ^= _vm->_gameFlags[index] & (1 << offset);
+
+ DebugPrintf("Flag %i is now %i\n", flag, (_vm->_gameFlags[index] >> offset) & 1);
+ } else {
+ DebugPrintf("Syntax: toggleflag <flag>\n");
+ }
+
+ return true;
+}
+
+bool Debugger_LoL::cmd_queryFlag(int argc, const char **argv) {
+ if (argc > 1) {
+ uint flag = atoi(argv[1]);
+
+ const uint8 index = (flag >> 4);
+ const uint8 offset = flag & 0xF;
+
+ DebugPrintf("Flag %i is %i\n", flag, (_vm->_gameFlags[index] >> offset) & 1);
+ } else {
+ DebugPrintf("Syntax: queryflag <flag>\n");
+ }
+
+ return true;
+}
+
} // End of namespace Kyra