diff options
author | Filippos Karapetis | 2007-10-13 23:48:59 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-10-13 23:48:59 +0000 |
commit | a08b6606a68eebbb89b6e7adf7c04dafeb968442 (patch) | |
tree | 3f24fe6f67332ac6ae9f67dfee56e09ebd0c7b53 /engines | |
parent | 86b6429e9766d1f9b43734ea89314d9561bc85c7 (diff) | |
download | scummvm-rg350-a08b6606a68eebbb89b6e7adf7c04dafeb968442.tar.gz scummvm-rg350-a08b6606a68eebbb89b6e7adf7c04dafeb968442.tar.bz2 scummvm-rg350-a08b6606a68eebbb89b6e7adf7c04dafeb968442.zip |
Add a debug console in Winnie (patch by clone2727)
svn-id: r29215
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/console.cpp | 16 | ||||
-rw-r--r-- | engines/agi/console.h | 30 | ||||
-rw-r--r-- | engines/agi/preagi.h | 1 | ||||
-rw-r--r-- | engines/agi/preagi_common.cpp | 10 | ||||
-rw-r--r-- | engines/agi/preagi_winnie.cpp | 20 | ||||
-rw-r--r-- | engines/agi/preagi_winnie.h | 3 |
6 files changed, 77 insertions, 3 deletions
diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp index 1107694805..33daea0626 100644 --- a/engines/agi/console.cpp +++ b/engines/agi/console.cpp @@ -243,4 +243,20 @@ bool Console::Cmd_Cont(int argc, const char **argv) { return true; } +PreAGI_Console::PreAGI_Console(PreAgiEngine *vm) { + _vm = vm; +} + +Winnie_Console::Winnie_Console(PreAgiEngine *vm, Winnie *winnie) : PreAGI_Console(vm) { + _winnie = winnie; + + DCmd_Register("curRoom", WRAP_METHOD(Winnie_Console, Cmd_CurRoom)); +} + +bool Winnie_Console::Cmd_CurRoom(int argc, const char **argv) { + _winnie->debugCurRoom(); + + return true; +} + } // End of namespace Agi diff --git a/engines/agi/console.h b/engines/agi/console.h index a6994ce922..0160137d54 100644 --- a/engines/agi/console.h +++ b/engines/agi/console.h @@ -28,6 +28,8 @@ #include "gui/debugger.h" +#include "agi/preagi_winnie.h" + namespace Agi { class AgiEngine; @@ -73,6 +75,34 @@ private: AgiEngine *_vm; }; +class PreAGI_Console : public GUI::Debugger { +public: + PreAGI_Console(PreAgiEngine *vm); + virtual ~PreAGI_Console(void) {} + +protected: + virtual void preEnter() {} + virtual void postEnter() {} + +private: + PreAgiEngine *_vm; +}; + +class Winnie_Console : public PreAGI_Console { +public: + Winnie_Console(PreAgiEngine *vm, Winnie *winnie); + virtual ~Winnie_Console(void) {} + +protected: + virtual void preEnter() {} + virtual void postEnter() {} + +private: + Winnie *_winnie; + + bool Cmd_CurRoom(int argc, const char **argv); +}; + } // End of namespace Agi #endif /* AGI_CONSOLE_H */ diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index c5812130b6..ef2ea41528 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -56,6 +56,7 @@ public: GfxMgr *_gfx; SoundMgr *_sound; PictureMgr *_picture; + PreAGI_Console *_console; void clearImageStack() {} void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index 190625bbdf..65e59892d6 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -133,6 +133,14 @@ int PreAgiEngine::getSelection(SelectionTypes type) { if (type == kSelYesNo || type == kSelAnyKey) return 1; case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL) && _console) { + _console->attach(); + _console->onFrame(); + //FIXME: If not cleared, clicking again will start the console + event.kbd.keycode = Common::KEYCODE_INVALID; + event.kbd.flags = 0; + continue; + } switch (event.kbd.keycode) { case Common::KEYCODE_y: if (type == kSelYesNo) @@ -161,6 +169,8 @@ int PreAgiEngine::getSelection(SelectionTypes type) { if (type == kSelBackspace) return 0; default: + if (event.kbd.flags & Common::KBD_CTRL) + break; if (type == kSelYesNo) { return 2; } else if (type == kSelNumber) { diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 0a39438fff..893742b05c 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -919,6 +919,12 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { incMenuSel(iSel, fCanSel); break; case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL) && _vm->_console) { + _vm->_console->attach(); + _vm->_console->onFrame(); + continue; + } + switch (event.kbd.keycode) { case Common::KEYCODE_ESCAPE: *iSel = IDI_WTP_SEL_HOME; @@ -1006,8 +1012,10 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { break; } default: - keyHelp(); - clrMenuSel(iSel, fCanSel); + if (!(event.kbd.flags & Common::KBD_CTRL)) { + keyHelp(); + clrMenuSel(iSel, fCanSel); + } break; } break; @@ -1213,8 +1221,14 @@ void Winnie::loadGame() { free(buffer); } -Winnie::Winnie(PreAgiEngine* vm) : _vm(vm) { +// Console-related functions + +void Winnie::debugCurRoom() { + _vm->_console->DebugPrintf("Current Room = %d\n", _room); +} +Winnie::Winnie(PreAgiEngine* vm) : _vm(vm) { + _vm->_console = new Winnie_Console(_vm, this); } void Winnie::init() { diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h index 42be6d0f06..bbbcf28fc4 100644 --- a/engines/agi/preagi_winnie.h +++ b/engines/agi/preagi_winnie.h @@ -304,6 +304,8 @@ public: void init(); void run(); + void debugCurRoom(); + private: PreAgiEngine *_vm; WTP_SAVE_GAME _game; @@ -360,3 +362,4 @@ private: #endif + |