aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/console.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-26 09:29:31 -0400
committerMatthew Hoops2011-09-26 09:29:31 -0400
commite343e4c5d816ffb5502f44dfa7f49fc8c2bcca24 (patch)
tree718132106b22d21496df8dea7e2aeede9b6650fe /engines/pegasus/console.cpp
parente412b62ffce4297da7df8fc4b71a619fa3a89880 (diff)
downloadscummvm-rg350-e343e4c5d816ffb5502f44dfa7f49fc8c2bcca24.tar.gz
scummvm-rg350-e343e4c5d816ffb5502f44dfa7f49fc8c2bcca24.tar.bz2
scummvm-rg350-e343e4c5d816ffb5502f44dfa7f49fc8c2bcca24.zip
PEGASUS: Add a debugger command to die
Diffstat (limited to 'engines/pegasus/console.cpp')
-rw-r--r--engines/pegasus/console.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/pegasus/console.cpp b/engines/pegasus/console.cpp
index d6a8c1e2ec..2c1a761ddf 100644
--- a/engines/pegasus/console.cpp
+++ b/engines/pegasus/console.cpp
@@ -29,10 +29,34 @@
namespace Pegasus {
PegasusConsole::PegasusConsole(PegasusEngine *vm) : GUI::Debugger(), _vm(vm) {
- // TODO! :P
+ DCmd_Register("die", WRAP_METHOD(PegasusConsole, Cmd_Die));
}
PegasusConsole::~PegasusConsole() {
}
+bool PegasusConsole::Cmd_Die(int argc, const char **argv) {
+ if (argc == 1) {
+ DebugPrintf("Usage: die <death reason>\n");
+ return true;
+ }
+
+ int reason = atoi(argv[1]);
+
+ bool invalidReason = (reason == 0 || reason > kPlayerWonGame);
+
+ if (!invalidReason && _vm->isDemo())
+ invalidReason = (reason != kDeathFallOffCliff) && (reason != kDeathEatenByDinosaur) &&
+ (reason != kDeathStranded) && (reason != kPlayerWonGame);
+
+
+ if (invalidReason) {
+ DebugPrintf("Invalid death reason %d\n", reason);
+ return true;
+ }
+
+ _vm->die(atoi(argv[1]));
+ return false;
+}
+
} // End of namespace Pegasus