Ticket #9185: 0009-add-toggleglobalflag-to-parallaction-s-debugger.txt

File 0009-add-toggleglobalflag-to-parallaction-s-debugger.txt, 2.3 KB (added by fuzzie, 14 years ago)
Line 
1From c3dc59229371cba8113c7ac5bdedf7bb37f6670d Mon Sep 17 00:00:00 2001
2From: Alyssa Milburn <fuzzie@fuzzie.org>
3Date: Fri, 21 May 2010 17:58:30 +0200
4Subject: [PATCH] add toggleglobalflag to parallaction's debugger
5
6---
7 engines/parallaction/debug.cpp | 27 +++++++++++++++++++++++++++
8 engines/parallaction/debug.h | 1 +
9 2 files changed, 28 insertions(+), 0 deletions(-)
10
11diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
12index 8864c84..b5eb82b 100644
13--- a/engines/parallaction/debug.cpp
14+++ b/engines/parallaction/debug.cpp
15@@ -42,6 +42,7 @@ Debugger::Debugger(Parallaction *vm)
16 DCmd_Register("zones", WRAP_METHOD(Debugger, Cmd_Zones));
17 DCmd_Register("animations", WRAP_METHOD(Debugger, Cmd_Animations));
18 DCmd_Register("globalflags",WRAP_METHOD(Debugger, Cmd_GlobalFlags));
19+ DCmd_Register("toggleglobalflag",WRAP_METHOD(Debugger, Cmd_ToggleGlobalFlag));
20 DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags));
21 DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations));
22 DCmd_Register("gfxobjects", WRAP_METHOD(Debugger, Cmd_GfxObjects));
23@@ -117,6 +118,32 @@ bool Debugger::Cmd_GlobalFlags(int argc, const char **argv) {
24 return true;
25 }
26
27+bool Debugger::Cmd_ToggleGlobalFlag(int argc, const char **argv) {
28+
29+ int i;
30+
31+ switch (argc) {
32+ case 2:
33+ i = _vm->_globalFlagsNames->lookup(argv[1]);
34+ if (i == Table::notFound) {
35+ DebugPrintf("invalid flag '%s'\n", argv[1]);
36+ } else {
37+ i--;
38+ if ((_globalFlags & (1 << i)) == 0)
39+ _globalFlags |= (1 << i);
40+ else
41+ _globalFlags &= ~(1 << i);
42+ }
43+ break;
44+
45+ default:
46+ DebugPrintf("toggleglobalflag <flag name>\n");
47+
48+ }
49+
50+ return true;
51+}
52+
53 bool Debugger::Cmd_LocalFlags(int argc, const char **argv) {
54
55 uint32 flags = _vm->getLocationFlags();
56diff --git a/engines/parallaction/debug.h b/engines/parallaction/debug.h
57index 54b578e..5267206 100644
58--- a/engines/parallaction/debug.h
59+++ b/engines/parallaction/debug.h
60@@ -28,6 +28,7 @@ protected:
61 bool Cmd_Animations(int argc, const char **argv);
62 bool Cmd_LocalFlags(int argc, const char **argv);
63 bool Cmd_GlobalFlags(int argc, const char **argv);
64+ bool Cmd_ToggleGlobalFlag(int argc, const char **argv);
65 bool Cmd_Locations(int argc, const char **argv);
66 bool Cmd_GfxObjects(int argc, const char **argv);
67 bool Cmd_Programs(int argc, const char** argv);
68--
691.6.3.3
70