diff options
Diffstat (limited to 'engines/zvision/core')
-rw-r--r-- | engines/zvision/core/clock.h | 10 | ||||
-rw-r--r-- | engines/zvision/core/console.cpp | 45 | ||||
-rw-r--r-- | engines/zvision/core/console.h | 2 | ||||
-rw-r--r-- | engines/zvision/core/events.cpp | 10 |
4 files changed, 56 insertions, 11 deletions
diff --git a/engines/zvision/core/clock.h b/engines/zvision/core/clock.h index cbf52be560..ae8c968111 100644 --- a/engines/zvision/core/clock.h +++ b/engines/zvision/core/clock.h @@ -67,14 +67,14 @@ public: } /** - * Pause the clock. Any future delta times will take this pause into account. - * Has no effect if the clock is already paused. - */ + * Un-pause the clock. + * Has no effect if the clock is already un-paused. + */ void start(); /** - * Un-pause the clock. - * Has no effect if the clock is already un-paused. + * Pause the clock. Any future delta times will take this pause into account. + * Has no effect if the clock is already paused. */ void stop(); }; diff --git a/engines/zvision/core/console.cpp b/engines/zvision/core/console.cpp index 65821b1702..336541d82a 100644 --- a/engines/zvision/core/console.cpp +++ b/engines/zvision/core/console.cpp @@ -54,6 +54,8 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { registerCmd("dumpfile", WRAP_METHOD(Console, cmdDumpFile)); registerCmd("dumpfiles", WRAP_METHOD(Console, cmdDumpFiles)); registerCmd("dumpimage", WRAP_METHOD(Console, cmdDumpImage)); + registerCmd("statevalue", WRAP_METHOD(Console, cmdStateValue)); + registerCmd("stateflag", WRAP_METHOD(Console, cmdStateFlag)); } bool Console::cmdLoadVideo(int argc, const char **argv) { @@ -204,7 +206,7 @@ bool Console::cmdLocation(int argc, const char **argv) { Common::String scrFile = Common::String::format("%c%c%c%c.scr", curLocation.world, curLocation.room, curLocation.node, curLocation.view); debugPrintf("Current location: world '%c', room '%c', node '%c', view '%c', offset %d, script %s\n", curLocation.world, curLocation.room, curLocation.node, curLocation.view, curLocation.offset, scrFile.c_str()); - + if (argc != 6) { debugPrintf("Use %s <char: world> <char: room> <char:node> <char:view> <int: x offset> to change your location\n", argv[0]); return true; @@ -263,7 +265,8 @@ bool Console::cmdDumpFiles(int argc, const char **argv) { debugPrintf("Dumping %s\n", fileName.c_str()); in = iter->_value.arch->createReadStreamForMember(iter->_value.name); - dumpFile(in, fileName.c_str()); + if (in) + dumpFile(in, fileName.c_str()); delete in; } @@ -272,7 +275,7 @@ bool Console::cmdDumpFiles(int argc, const char **argv) { bool Console::cmdDumpImage(int argc, const char **argv) { if (argc != 2) { - debugPrintf("Use %s <TGA/TGZ name> to dump a ZVision TGA/TGZ image into a regular BMP image\n", argv[0]); + debugPrintf("Use %s <TGA/TGZ name> to dump a Z-Vision TGA/TGZ image into a regular BMP image\n", argv[0]); return true; } @@ -328,4 +331,40 @@ bool Console::cmdDumpImage(int argc, const char **argv) { return true; } +bool Console::cmdStateValue(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("Use %s <valuenum> to show the value of a state variable\n", argv[0]); + debugPrintf("Use %s <valuenum> <newvalue> to set the value of a state variable\n", argv[0]); + return true; + } + + int valueNum = atoi(argv[1]); + int newValue = (argc > 2) ? atoi(argv[2]) : -1; + + if (argc == 2) + debugPrintf("[%d] = %d\n", valueNum, _engine->getScriptManager()->getStateValue(valueNum)); + else if (argc == 3) + _engine->getScriptManager()->setStateValue(valueNum, newValue); + + return true; +} + +bool Console::cmdStateFlag(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("Use %s <flagnum> to show the value of a state flag\n", argv[0]); + debugPrintf("Use %s <flagnum> <newvalue> to set the value of a state flag\n", argv[0]); + return true; + } + + int valueNum = atoi(argv[1]); + int newValue = (argc > 2) ? atoi(argv[2]) : -1; + + if (argc == 2) + debugPrintf("[%d] = %d\n", valueNum, _engine->getScriptManager()->getStateFlag(valueNum)); + else if (argc == 3) + _engine->getScriptManager()->setStateFlag(valueNum, newValue); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/core/console.h b/engines/zvision/core/console.h index ffce87869f..ac834185a0 100644 --- a/engines/zvision/core/console.h +++ b/engines/zvision/core/console.h @@ -48,6 +48,8 @@ private: bool cmdDumpFile(int argc, const char **argv); bool cmdDumpFiles(int argc, const char **argv); bool cmdDumpImage(int argc, const char **argv); + bool cmdStateValue(int argc, const char **argv); + bool cmdStateFlag(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp index 7804130e2a..cc1c00b6d0 100644 --- a/engines/zvision/core/events.cpp +++ b/engines/zvision/core/events.cpp @@ -93,6 +93,11 @@ void ZVision::shortKeys(Common::Event event) { } void ZVision::cheatCodes(uint8 key) { + Location loc = _scriptManager->getCurrentLocation(); + // Do not process cheat codes while in the game menus + if (loc.world == 'g' && loc.room == 'j') + return; + pushKeyToCheatBuf(key); if (getGameId() == GID_GRANDINQUISITOR) { @@ -146,9 +151,8 @@ void ZVision::cheatCodes(uint8 key) { } if (checkCode("HELLOSAILOR")) { - Location loc = _scriptManager->getCurrentLocation(); Audio::AudioStream *soundStream; - if (loc.world == 'v' && loc.room == 'b' && loc.node == '1' && loc.view == '0') { + if (loc == "vb10") { soundStream = makeRawZorkStream("v000hpta.raw", this); } else { soundStream = makeRawZorkStream("v000hnta.raw", this); @@ -336,7 +340,7 @@ void ZVision::onMouseMove(const Common::Point &pos) { mspeed = 25; } _mouseVelocity = MIN(((Common::Rational(mspeed, ROTATION_SCREEN_EDGE_OFFSET) * (clippedPos.x - _workingWindow.left)) - mspeed).toInt(), -1); - + _cursorManager->changeCursor(CursorIndex_Left); cursorWasChanged = true; |