SCUMM: Remove "level" command from debugger. Replaced by "debuglevel".

This required a small amount of extra code changes to ensure that
_debugMode is kept in sync when the debugger is used to change the
level.
This commit is contained in:
D G Turner 2014-05-13 15:14:54 +01:00
parent c81d0b680e
commit e065b24d56
5 changed files with 19 additions and 27 deletions

View File

@ -89,7 +89,6 @@ ScummDebugger::ScummDebugger(ScummEngine *s)
DCmd_Register("loadgame", WRAP_METHOD(ScummDebugger, Cmd_LoadGame));
DCmd_Register("savegame", WRAP_METHOD(ScummDebugger, Cmd_SaveGame));
DCmd_Register("level", WRAP_METHOD(ScummDebugger, Cmd_DebugLevel));
DCmd_Register("debug", WRAP_METHOD(ScummDebugger, Cmd_Debug));
DCmd_Register("show", WRAP_METHOD(ScummDebugger, Cmd_Show));
@ -104,6 +103,18 @@ ScummDebugger::~ScummDebugger() {
// we need this destructor, even if it is empty, for __SYMBIAN32__
}
void ScummDebugger::preEnter() {
}
void ScummDebugger::postEnter() {
// Runtime debug level change is dealt with by the base class "debuglevel" command
// but need to ensure that the _debugMode parameter is updated in sync.
_vm->_debugMode = (gDebugLevel >= 0);
// Boot params often need debugging switched on to work
if (_vm->_bootParam)
_vm->_debugMode = true;
}
///////////////////////////////////////////////////
// Now the fun stuff:
@ -523,27 +534,6 @@ bool ScummDebugger::Cmd_Debug(int argc, const char **argv) {
return true;
}
bool ScummDebugger::Cmd_DebugLevel(int argc, const char **argv) {
if (argc == 1) {
if (_vm->_debugMode == false)
DebugPrintf("Debugging is not enabled at this time\n");
else
DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
} else { // set level
gDebugLevel = atoi(argv[1]);
if (gDebugLevel >= 0) {
_vm->_debugMode = true;
DebugPrintf("Debug level set to level %d\n", gDebugLevel);
} else if (gDebugLevel < 0) {
_vm->_debugMode = false;
DebugPrintf("Debugging is now disabled\n");
} else
DebugPrintf("Not a valid debug level\n");
}
return true;
}
bool ScummDebugger::Cmd_Camera(int argc, const char **argv) {
DebugPrintf("Camera: cur (%d,%d) - dest (%d,%d) - accel (%d,%d) -- last (%d,%d)\n",
_vm->camera._cur.x, _vm->camera._cur.y, _vm->camera._dest.x, _vm->camera._dest.y,

View File

@ -37,6 +37,9 @@ public:
private:
ScummEngine *_vm;
virtual void preEnter();
virtual void postEnter();
// Commands
bool Cmd_Room(int argc, const char **argv);
bool Cmd_LoadGame(int argc, const char **argv);
@ -58,7 +61,6 @@ private:
bool Cmd_Passcode(int argc, const char **argv);
bool Cmd_Debug(int argc, const char **argv);
bool Cmd_DebugLevel(int argc, const char **argv);
bool Cmd_Show(int argc, const char **argv);
bool Cmd_Hide(int argc, const char **argv);

View File

@ -205,7 +205,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_lastInputScriptTime = 0;
_bootParam = 0;
_dumpScripts = false;
_debugMode = 0;
_debugMode = false;
_objectOwnerTable = NULL;
_objectRoomTable = NULL;
_objectStateTable = NULL;
@ -2281,7 +2281,7 @@ void ScummEngine::scummLoop_updateScummVars() {
VAR(VAR_MOUSE_Y) = _mouse.y;
if (VAR_DEBUGMODE != 0xFF) {
// This is NOT for the Mac version of Indy3/Loom
VAR(VAR_DEBUGMODE) = _debugMode;
VAR(VAR_DEBUGMODE) = (_debugMode ? 1 : 0);
}
} else if (_game.version >= 1) {
// We use shifts below instead of dividing by V12_X_MULTIPLIER resp.

View File

@ -586,7 +586,7 @@ protected:
bool _dumpScripts;
bool _hexdumpScripts;
bool _showStack;
uint16 _debugMode;
bool _debugMode;
// Save/Load class - some of this may be GUI
byte _saveLoadFlag, _saveLoadSlot;

View File

@ -805,7 +805,7 @@ void ScummEngine::resetScummVars() {
}
if (VAR_DEBUGMODE != 0xFF) {
VAR(VAR_DEBUGMODE) = _debugMode;
VAR(VAR_DEBUGMODE) = (_debugMode ? 1 : 0);
if (_game.heversion >= 80 && _debugMode)
VAR(85) = 1;
}