aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/console.cpp
diff options
context:
space:
mode:
authorSven Hesse2012-01-29 00:00:04 +0100
committerSven Hesse2012-01-29 00:10:11 +0100
commit2f7ae1109bb94ab9b0bf1fe20d554c7124eb8465 (patch)
treef13ab5ba5722ffdf3a1620c1d267cde08e270c57 /engines/gob/console.cpp
parentcaeae1a7d66843823a31bb99e081da0165a18a22 (diff)
downloadscummvm-rg350-2f7ae1109bb94ab9b0bf1fe20d554c7124eb8465.tar.gz
scummvm-rg350-2f7ae1109bb94ab9b0bf1fe20d554c7124eb8465.tar.bz2
scummvm-rg350-2f7ae1109bb94ab9b0bf1fe20d554c7124eb8465.zip
GOB: Add a cheat debug command
- Cheat the Diving minigame to a win - Get the mastermind solution
Diffstat (limited to 'engines/gob/console.cpp')
-rw-r--r--engines/gob/console.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/gob/console.cpp b/engines/gob/console.cpp
index e7296fb81b..76ccb70dca 100644
--- a/engines/gob/console.cpp
+++ b/engines/gob/console.cpp
@@ -24,22 +24,32 @@
#include "gob/gob.h"
#include "gob/inter.h"
#include "gob/dataio.h"
+#include "gob/cheater.h"
namespace Gob {
-GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm) {
+GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm), _cheater(0) {
DCmd_Register("varSize", WRAP_METHOD(GobConsole, cmd_varSize));
DCmd_Register("dumpVars", WRAP_METHOD(GobConsole, cmd_dumpVars));
DCmd_Register("var8", WRAP_METHOD(GobConsole, cmd_var8));
DCmd_Register("var16", WRAP_METHOD(GobConsole, cmd_var16));
DCmd_Register("var32", WRAP_METHOD(GobConsole, cmd_var32));
DCmd_Register("varString", WRAP_METHOD(GobConsole, cmd_varString));
+ DCmd_Register("cheat", WRAP_METHOD(GobConsole, cmd_cheat));
DCmd_Register("listArchives", WRAP_METHOD(GobConsole, cmd_listArchives));
}
GobConsole::~GobConsole() {
}
+void GobConsole::registerCheater(Cheater *cheater) {
+ _cheater = cheater;
+}
+
+void GobConsole::unregisterCheater() {
+ _cheater = 0;
+}
+
bool GobConsole::cmd_varSize(int argc, const char **argv) {
DebugPrintf("Size of the variable space: %d bytes\n", _vm->_inter->_variables->getSize());
return true;
@@ -155,6 +165,13 @@ bool GobConsole::cmd_varString(int argc, const char **argv) {
return true;
}
+bool GobConsole::cmd_cheat(int argc, const char **argv) {
+ if (_cheater)
+ return _cheater->cheat(*this);
+
+ return true;
+}
+
bool GobConsole::cmd_listArchives(int argc, const char **argv) {
Common::Array<ArchiveInfo> info;