aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/console.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-10-05 14:37:34 -0400
committerMatthew Hoops2011-10-05 14:37:34 -0400
commit5381f5d56b24ed65e1a4eef32e4e749fb4f85022 (patch)
tree9f0e962919f334541757aa8bb4caf9bf10e65e2b /engines/pegasus/console.cpp
parent3ecc16c9aec6be1853e255f23c610a2dcaaa34d3 (diff)
downloadscummvm-rg350-5381f5d56b24ed65e1a4eef32e4e749fb4f85022.tar.gz
scummvm-rg350-5381f5d56b24ed65e1a4eef32e4e749fb4f85022.tar.bz2
scummvm-rg350-5381f5d56b24ed65e1a4eef32e4e749fb4f85022.zip
PEGASUS: Implement basic jump console command
Diffstat (limited to 'engines/pegasus/console.cpp')
-rw-r--r--engines/pegasus/console.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/engines/pegasus/console.cpp b/engines/pegasus/console.cpp
index 2c1a761ddf..e6738bc83f 100644
--- a/engines/pegasus/console.cpp
+++ b/engines/pegasus/console.cpp
@@ -24,12 +24,18 @@
*/
#include "pegasus/console.h"
+#include "pegasus/interface.h"
#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/neighborhood.h"
namespace Pegasus {
PegasusConsole::PegasusConsole(PegasusEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("die", WRAP_METHOD(PegasusConsole, Cmd_Die));
+
+ // These functions are non-demo specific
+ if (!_vm->isDemo())
+ DCmd_Register("jump", WRAP_METHOD(PegasusConsole, Cmd_Jump));
}
PegasusConsole::~PegasusConsole() {
@@ -59,4 +65,40 @@ bool PegasusConsole::Cmd_Die(int argc, const char **argv) {
return false;
}
+bool PegasusConsole::Cmd_Jump(int argc, const char **argv) {
+ if (!g_interface) {
+ // TODO
+ DebugPrintf("Cannot jump without interface set up\n");
+ return true;
+ }
+
+ // TODO: Default room/direction for each neighborhood
+
+ if (argc < 4) {
+ DebugPrintf("Usage: jump <neighborhood> <room> <direction>\n");
+ return true;
+ }
+
+ tNeighborhoodID neighborhood = (tNeighborhoodID)atoi(argv[1]);
+ tRoomID room = (tRoomID)atoi(argv[2]);
+ tDirectionConstant direction = (tDirectionConstant)atoi(argv[3]);
+
+ if (neighborhood < kCaldoriaID || neighborhood > kNoradDeltaID || neighborhood == kFinalTSAID) {
+ DebugPrintf("Invalid neighborhood %d", neighborhood);
+ return true;
+ }
+
+ // No real way to check room validity at this point
+
+ if (direction > kWest) {
+ DebugPrintf("Invalid direction %d", direction);
+ return true;
+ }
+
+ // Here we go!
+ // TODO: Can't clear menu since the engine is paused
+ _vm->jumpToNewEnvironment(neighborhood, room, direction);
+ return false;
+}
+
} // End of namespace Pegasus