aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorMax Horn2006-09-16 16:58:27 +0000
committerMax Horn2006-09-16 16:58:27 +0000
commit919092e5fcd0389b4cbd862e9e8cceab202e6741 (patch)
tree7d9c8f643191812bb1eb24f2e7cc2e67586149d5 /engines/saga
parent1add07becae0179e026a90924b419b74ffb1078f (diff)
downloadscummvm-rg350-919092e5fcd0389b4cbd862e9e8cceab202e6741.tar.gz
scummvm-rg350-919092e5fcd0389b4cbd862e9e8cceab202e6741.tar.bz2
scummvm-rg350-919092e5fcd0389b4cbd862e9e8cceab202e6741.zip
Overhaul of the debugger code
* Moved Common::Debuggger to GUI::Debugger (mainly to satisfy linker restrictions) * Change the base Debugger class to *not* be a template class anymore; instead, a thin (template based) wrapper class is used to hook up debugger commands * Removed duplicate Cmd_Exit and Cmd_Help methods in favor of a single version of each in GUI::Debugger * New Cmd_Help doesn't word wrap after 39/78 chars, but rather queries the console to determine when to wrap * Debugger::preEnter and postEnter aren't pure virtual anymore svn-id: r23890
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/console.cpp68
-rw-r--r--engines/saga/console.h11
2 files changed, 9 insertions, 70 deletions
diff --git a/engines/saga/console.cpp b/engines/saga/console.cpp
index 3455c8c1c3..6aa7c60de9 100644
--- a/engines/saga/console.cpp
+++ b/engines/saga/console.cpp
@@ -32,26 +32,21 @@
#include "saga/console.h"
-#include "common/debugger.cpp"
-
namespace Saga {
-Console::Console(SagaEngine *vm) : Common::Debugger<Console>() {
+Console::Console(SagaEngine *vm) : GUI::Debugger() {
_vm = vm;
- DCmd_Register("continue", &Console::Cmd_Exit);
- DCmd_Register("exit", &Console::Cmd_Exit);
- DCmd_Register("quit", &Console::Cmd_Exit);
- DCmd_Register("help", &Console::Cmd_Help);
+ DCmd_Register("continue", WRAP_METHOD(Console, Cmd_Exit));
// CVAR_Register_I(&_soundEnabled, "sound", NULL, CVAR_CFG, 0, 1);
// CVAR_Register_I(&_musicEnabled, "music", NULL, CVAR_CFG, 0, 1);
// Actor commands
- DCmd_Register("actor_walk_to", &Console::cmdActorWalkTo);
+ DCmd_Register("actor_walk_to", WRAP_METHOD(Console, cmdActorWalkTo));
// Animation commands
- DCmd_Register("anim_info", &Console::Cmd_AnimInfo);
+ DCmd_Register("anim_info", WRAP_METHOD(Console, Cmd_AnimInfo));
// Game stuff
@@ -66,63 +61,14 @@ Console::Console(SagaEngine *vm) : Common::Debugger<Console>() {
#endif
// Scene commands
- DCmd_Register("scene_change", &Console::cmdSceneChange);
- DCmd_Register("action_map_info", &Console::cmdActionMapInfo);
- DCmd_Register("object_map_info", &Console::cmdObjectMapInfo);
+ DCmd_Register("scene_change", WRAP_METHOD(Console, cmdSceneChange));
+ DCmd_Register("action_map_info", WRAP_METHOD(Console, cmdActionMapInfo));
+ DCmd_Register("object_map_info", WRAP_METHOD(Console, cmdObjectMapInfo));
}
Console::~Console() {
}
-void Console::preEnter() {
-}
-
-void Console::postEnter() {
-}
-
-bool Console::Cmd_Exit(int argc, const char **argv) {
- _detach_now = true;
- return false;
-}
-
-bool Console::Cmd_Help(int argc, const char **argv) {
- // console normally has 39 line width
- // wrap around nicely
- int width = 0, size, i;
-
- DebugPrintf("Commands are:\n");
- for (i = 0 ; i < _dcmd_count ; i++) {
- size = strlen(_dcmds[i].name) + 1;
-
- if ((width + size) >= 39) {
- DebugPrintf("\n");
- width = size;
- } else
- width += size;
-
- DebugPrintf("%s ", _dcmds[i].name);
- }
-
- width = 0;
-
- DebugPrintf("\n\nVariables are:\n");
- for (i = 0 ; i < _dvar_count ; i++) {
- size = strlen(_dvars[i].name) + 1;
-
- if ((width + size) >= 39) {
- DebugPrintf("\n");
- width = size;
- } else
- width += size;
-
- DebugPrintf("%s ", _dvars[i].name);
- }
-
- DebugPrintf("\n");
-
- return true;
-}
-
bool Console::cmdActorWalkTo(int argc, const char **argv) {
if (argc != 4)
DebugPrintf("Usage: %s <Actor id> <lx> <ly>\n", argv[0]);
diff --git a/engines/saga/console.h b/engines/saga/console.h
index c93373960f..1a2693e25e 100644
--- a/engines/saga/console.h
+++ b/engines/saga/console.h
@@ -27,23 +27,16 @@
#ifndef SAGA_CONSOLE_H_
#define SAGA_CONSOLE_H_
-#include "common/debugger.h"
+#include "gui/debugger.h"
namespace Saga {
-class Console : public Common::Debugger<Console> {
+class Console : public GUI::Debugger {
public:
Console(SagaEngine *vm);
virtual ~Console(void);
-protected:
- virtual void preEnter();
- virtual void postEnter();
-
private:
- bool Cmd_Exit(int argc, const char **argv);
- bool Cmd_Help(int argc, const char **argv);
-
bool cmdActorWalkTo(int argc, const char **argv);
bool Cmd_AnimInfo(int argc, const char **argv);