diff options
author | Paul Gilbert | 2008-01-07 03:53:30 +0000 |
---|---|---|
committer | Paul Gilbert | 2008-01-07 03:53:30 +0000 |
commit | 841cc77e5c8eb45ed27288b8094888d23b249002 (patch) | |
tree | 222a22d402f7684d8bf8b10136135055218d9d2f /engines | |
parent | 1ddc8ab0fa0f0479a50e6436f3ff9eaa0568e117 (diff) | |
download | scummvm-rg350-841cc77e5c8eb45ed27288b8094888d23b249002.tar.gz scummvm-rg350-841cc77e5c8eb45ed27288b8094888d23b249002.tar.bz2 scummvm-rg350-841cc77e5c8eb45ed27288b8094888d23b249002.zip |
Made debugging keys disabled by default, with a debugger command to allow them to be turned on
svn-id: r30317
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lure/debugger.cpp | 21 | ||||
-rw-r--r-- | engines/lure/debugger.h | 1 | ||||
-rw-r--r-- | engines/lure/game.cpp | 27 | ||||
-rw-r--r-- | engines/lure/game.h | 2 |
4 files changed, 41 insertions, 10 deletions
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp index 3d64e2b5b9..cdaf98670f 100644 --- a/engines/lure/debugger.cpp +++ b/engines/lure/debugger.cpp @@ -29,6 +29,7 @@ #include "lure/luredefs.h" #include "lure/debugger.h" #include "lure/decode.h" +#include "lure/game.h" #include "lure/res.h" #include "lure/res_struct.h" #include "lure/room.h" @@ -49,6 +50,7 @@ Debugger::Debugger(): GUI::Debugger() { DCmd_Register("room", WRAP_METHOD(Debugger, cmd_room)); DCmd_Register("showanim", WRAP_METHOD(Debugger, cmd_showAnim)); DCmd_Register("strings", WRAP_METHOD(Debugger, cmd_saveStrings)); + DCmd_Register("debug", WRAP_METHOD(Debugger, cmd_debug)); } static int strToInt(const char *s) { @@ -575,5 +577,24 @@ bool Debugger::cmd_saveStrings(int argc, const char **argv) { return true; } +bool Debugger::cmd_debug(int argc, const char **argv) { + Game &game = Game::getReference(); + Room &room = Room::getReference(); + + if ((argc == 2) && (strcmp(argv[1], "on") == 0)) { + DebugPrintf("debug keys are on\n"); + game.debugFlag() = true; + + } else if ((argc == 2) && (strcmp(argv[1], "off") == 0)) { + DebugPrintf("debug keys are off\n"); + game.debugFlag() = false; + room.setShowInfo(false); + + } else { + DebugPrintf("debug [on | off]]\n"); + } + + return true; +} } // End of namespace Lure diff --git a/engines/lure/debugger.h b/engines/lure/debugger.h index 46023134ba..3936f9fb10 100644 --- a/engines/lure/debugger.h +++ b/engines/lure/debugger.h @@ -47,6 +47,7 @@ protected: bool cmd_room(int argc, const char **argv); bool cmd_showAnim(int argc, const char **argv); bool cmd_saveStrings(int argc, const char **argv); + bool cmd_debug(int argc, const char **argv); }; } // End of namespace Lure diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index 7cfad3e0e0..9ee3854b14 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -49,6 +49,7 @@ Game::Game() { _debugger = new Debugger(); _fastTextFlag = false; _preloadFlag = false; + _debugFlag = false; _soundFlag = true; _musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume")); @@ -206,26 +207,32 @@ void Game::execute() { break; case Common::KEYCODE_KP_PLUS: - while (++roomNum <= 51) - if (res.getRoom(roomNum) != NULL) break; - if (roomNum == 52) roomNum = 1; - room.setRoomNumber(roomNum); + if (_debugFlag) { + while (++roomNum <= 51) + if (res.getRoom(roomNum) != NULL) break; + if (roomNum == 52) roomNum = 1; + room.setRoomNumber(roomNum); + } break; case Common::KEYCODE_KP_MINUS: - if (roomNum == 1) roomNum = 55; - while (res.getRoom(--roomNum) == NULL) ; - room.setRoomNumber(roomNum); + if (_debugFlag) { + if (roomNum == 1) roomNum = 55; + while (res.getRoom(--roomNum) == NULL) ; + room.setRoomNumber(roomNum); + } break; case Common::KEYCODE_KP_MULTIPLY: - res.getActiveHotspot(PLAYER_ID)->setRoomNumber( - room.roomNumber()); + if (_debugFlag) + res.getActiveHotspot(PLAYER_ID)->setRoomNumber( + room.roomNumber()); break; case Common::KEYCODE_KP_DIVIDE: case Common::KEYCODE_SLASH: - room.setShowInfo(!room.showInfo()); + if (_debugFlag) + room.setShowInfo(!room.showInfo()); break; case Common::KEYCODE_ESCAPE: diff --git a/engines/lure/game.h b/engines/lure/game.h index 34b9e5e021..5054074fb2 100644 --- a/engines/lure/game.h +++ b/engines/lure/game.h @@ -53,6 +53,7 @@ private: uint16 _tellCommands[MAX_TELL_COMMANDS * 3 + 1]; int _numTellCommands; bool _preloadFlag; + bool _debugFlag; void handleMenuResponse(uint8 selection); void handleClick(); @@ -81,6 +82,7 @@ public: void execute(); void setState(uint8 flags) { _state = flags; } bool &preloadFlag() { return _preloadFlag; } + bool &debugFlag() { return _debugFlag; } bool fastTextFlag() { return _fastTextFlag; } bool soundFlag() { return _soundFlag; } uint8 sfxVolume() { return _sfxVolume; } |