aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorD G Turner2014-05-11 12:27:38 +0100
committerD G Turner2014-05-11 12:27:38 +0100
commit6856b09d5a0024397895984aeb8d79d4a77e9111 (patch)
tree357f2b701924e386798c8b15beac5dc77a7a7831 /engines
parent0844ba0ddeb9b3560660d275cc999b14055e285c (diff)
downloadscummvm-rg350-6856b09d5a0024397895984aeb8d79d4a77e9111.tar.gz
scummvm-rg350-6856b09d5a0024397895984aeb8d79d4a77e9111.tar.bz2
scummvm-rg350-6856b09d5a0024397895984aeb8d79d4a77e9111.zip
AGOS: Switch opcode debugging to a debug flag, rather than level 2 hack.
This is now set by --debugflags=opcode rather than -d 2, though it will still require a debug level greater than 0.
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp5
-rw-r--r--engines/agos/agos.h5
-rw-r--r--engines/agos/script.cpp3
-rw-r--r--engines/agos/subroutine.cpp3
4 files changed, 10 insertions, 6 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 2fc89771d3..8754b11065 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
+#include "common/debug-channels.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/textconsole.h"
@@ -144,6 +145,8 @@ AGOSEngine_Elvira1::AGOSEngine_Elvira1(OSystem *system, const AGOSGameDescriptio
AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
: Engine(system), _rnd("agos"), _gameDescription(gd) {
+ DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level");
+
_vcPtr = 0;
_vcGetOutOfCode = 0;
_gameOffsetsPtr = 0;
@@ -244,7 +247,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
_backFlag = false;
_dumpScripts = false;
- _dumpOpcodes = false;
_dumpVgaScripts = false;
_dumpVgaOpcodes = false;
_dumpImages = false;
@@ -676,7 +678,6 @@ Common::Error AGOSEngine::init() {
// TODO: Use special debug levels instead of the following hack.
switch (gDebugLevel) {
- case 2: _dumpOpcodes = true; break;
case 3: _dumpVgaOpcodes = true; break;
case 4: _dumpScripts = true; break;
case 5: _dumpVgaScripts = true; break;
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 5e49fce5ff..c23f16b690 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -61,6 +61,10 @@ struct Surface;
namespace AGOS {
+enum {
+ kDebugOpcode = 1 << 0
+};
+
uint fileReadItemID(Common::SeekableReadStream *in);
#define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y))
@@ -329,7 +333,6 @@ protected:
bool _copyProtection;
bool _pause;
bool _dumpScripts;
- bool _dumpOpcodes;
bool _dumpVgaScripts;
bool _dumpVgaOpcodes;
bool _dumpImages;
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 6f809d9e2d..1dbb9c255a 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -22,6 +22,7 @@
// Item script opcodes for Simon1/Simon2
+#include "common/debug-channels.h"
#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -987,7 +988,7 @@ int AGOSEngine::runScript() {
return 1;
do {
- if (_dumpOpcodes)
+ if (DebugMan.isDebugChannelEnabled(kDebugOpcode))
dumpOpcode(_codePtr);
if (getGameType() == GType_ELVIRA1) {
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 39bc468dea..a54a6c3b49 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -564,8 +564,7 @@ restart:
else
_codePtr += 8;
- if (_dumpOpcodes)
- debug("; %d", sub->id);
+ debugC(kDebugOpcode, "; %d", sub->id);
result = runScript();
if (result != 0) {
break;