diff options
-rw-r--r-- | engines/avalanche/avalanche.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/avalanche.h | 3 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 14 | ||||
-rw-r--r-- | engines/avalanche/console.cpp | 21 | ||||
-rw-r--r-- | engines/avalanche/console.h | 19 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 16 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 1 |
7 files changed, 56 insertions, 26 deletions
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 617d23cd19..0a4e7b1c03 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -60,6 +60,7 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * } _totalTime = 0; + _showDebugLines = false; } AvalancheEngine::~AvalancheEngine() { @@ -442,7 +443,12 @@ void AvalancheEngine::updateEvents() { _holdLeftMouse = false; // Same as above. break; case Common::EVENT_KEYDOWN: - handleKeyDown(event); + if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _console->attach(); + _console->onFrame(); + } else + handleKeyDown(event); break; default: break; diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 69fba35e25..fdb303e441 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -202,7 +202,7 @@ public: static const int16 kGameCode = 2; // Avalot's code number bool _holdLeftMouse; - + // If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value. // If a scroll comes up, or you leave the room, it's automatically set to zero. byte _interrogation; @@ -268,6 +268,7 @@ public: bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim; // End of former DNA Structure + bool _showDebugLines; byte _lineNum; // Number of lines. LineType _lines[50]; // For Also. bool _dropsOk, _soundFx, _cheat; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 10b4dfcdbd..bf0bc35e3e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -368,19 +368,7 @@ void AvalancheEngine::runAvalot() { checkClick(); _timer->updateTimer(); -#ifdef DEBUG - for (int i = 0; i < _lineNum; i++) { - LineType *curLine = &_lines[i]; - _graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); - } - - for (int i = 0; i < _fieldNum; i++) { - FieldType *curField = &_fields[i]; - if (curField->_x1 < 640) - _graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); - } -#endif - + _graphics->drawDebugLines(); _graphics->refreshScreen(); uint32 delay = _system->getMillis() - beginLoop; diff --git a/engines/avalanche/console.cpp b/engines/avalanche/console.cpp index 03f198fbf5..656cc1907c 100644 --- a/engines/avalanche/console.cpp +++ b/engines/avalanche/console.cpp @@ -30,10 +30,25 @@ namespace Avalanche { - AvalancheConsole::AvalancheConsole(AvalancheEngine *vm) : GUI::Debugger(), _vm(vm) { - } +AvalancheConsole::AvalancheConsole(AvalancheEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("magic_lines", WRAP_METHOD(AvalancheConsole, Cmd_MagicLines)); +} + +AvalancheConsole::~AvalancheConsole() { +} - AvalancheConsole::~AvalancheConsole() { +/** + * This command loads up the specified new scene number + */ +bool AvalancheConsole::Cmd_MagicLines(int argc, const char **argv) { + if (argc != 1) { + DebugPrintf("Usage: %s\n", argv[0]); + return true; } + _vm->_showDebugLines = !_vm->_showDebugLines; + return false; +} + + } // End of namespace Avalanche diff --git a/engines/avalanche/console.h b/engines/avalanche/console.h index 138c3db05c..166515d913 100644 --- a/engines/avalanche/console.h +++ b/engines/avalanche/console.h @@ -32,16 +32,19 @@ namespace Avalanche { - class AvalancheEngine; +class AvalancheEngine; - class AvalancheConsole : public GUI::Debugger { - public: - AvalancheConsole(AvalancheEngine *vm); - virtual ~AvalancheConsole(void); +class AvalancheConsole : public GUI::Debugger { +public: + AvalancheConsole(AvalancheEngine *vm); + virtual ~AvalancheConsole(void); - private: - AvalancheEngine *_vm; - }; +protected: + bool Cmd_MagicLines(int argc, const char **argv); + +private: + AvalancheEngine *_vm; +}; } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 9fb9ec17d2..4db93c435c 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -423,6 +423,22 @@ void GraphicManager::drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite) drawPicture(_background, sprite._picture, x, y); } +void GraphicManager::drawDebugLines() { + if (!_vm->_showDebugLines) + return; + + for (int i = 0; i < _vm->_lineNum; i++) { + LineType *curLine = &_vm->_lines[i]; + _surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->_color); + } + + for (int i = 0; i < _vm->_fieldNum; i++) { + FieldType *curField = &_vm->_fields[i]; + if (curField->_x1 < 640) + _surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); + } +} + Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 100a5dad72..80724f8216 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -84,6 +84,7 @@ public: void drawMenuItem(int x1, int y1, int x2, int y2); void wipeChar(int x, int y, Color color); void drawChar(byte ander, int x, int y, Color color); + void drawDebugLines(); void clearAlso(); void clearTextBar(); |