aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2008-01-09 09:19:17 +0000
committerFilippos Karapetis2008-01-09 09:19:17 +0000
commitc14d4201417d02b09520b524bc6ea6448c201220 (patch)
treecc817c2b2e191d61f9dd1bccdcf19b12fe080f00 /engines
parent34c3c89267bade81b1b8225455be46638ef73360 (diff)
downloadscummvm-rg350-c14d4201417d02b09520b524bc6ea6448c201220.tar.gz
scummvm-rg350-c14d4201417d02b09520b524bc6ea6448c201220.tar.bz2
scummvm-rg350-c14d4201417d02b09520b524bc6ea6448c201220.zip
Added a debug console for Mickey's Space Adventures
svn-id: r30349
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/console.cpp21
-rw-r--r--engines/agi/console.h18
-rw-r--r--engines/agi/preagi_mickey.cpp14
-rw-r--r--engines/agi/preagi_mickey.h6
4 files changed, 57 insertions, 2 deletions
diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp
index 33daea0626..cc29f0ba92 100644
--- a/engines/agi/console.cpp
+++ b/engines/agi/console.cpp
@@ -247,6 +247,27 @@ PreAGI_Console::PreAGI_Console(PreAgiEngine *vm) {
_vm = vm;
}
+Mickey_Console::Mickey_Console(PreAgiEngine *vm, Mickey *mickey) : PreAGI_Console(vm) {
+ _mickey = mickey;
+
+ DCmd_Register("curRoom", WRAP_METHOD(Mickey_Console, Cmd_CurRoom));
+ DCmd_Register("showPic", WRAP_METHOD(Mickey_Console, Cmd_ShowPic));
+}
+
+bool Mickey_Console::Cmd_CurRoom(int argc, const char **argv) {
+ _mickey->debugCurRoom();
+
+ return true;
+}
+
+bool Mickey_Console::Cmd_ShowPic(int argc, const char **argv) {
+ if (argc != 2)
+ DebugPrintf("Usage: %s <Picture number>\n", argv[0]);
+ else
+ _mickey->drawPic(atoi(argv[1]));
+ return true;
+}
+
Winnie_Console::Winnie_Console(PreAgiEngine *vm, Winnie *winnie) : PreAGI_Console(vm) {
_winnie = winnie;
diff --git a/engines/agi/console.h b/engines/agi/console.h
index 0160137d54..ee951d1964 100644
--- a/engines/agi/console.h
+++ b/engines/agi/console.h
@@ -28,6 +28,7 @@
#include "gui/debugger.h"
+#include "agi/preagi_mickey.h"
#include "agi/preagi_winnie.h"
namespace Agi {
@@ -88,6 +89,23 @@ private:
PreAgiEngine *_vm;
};
+
+class Mickey_Console : public PreAGI_Console {
+public:
+ Mickey_Console(PreAgiEngine *vm, Mickey *mickey);
+ virtual ~Mickey_Console(void) {}
+
+protected:
+ virtual void preEnter() {}
+ virtual void postEnter() {}
+
+private:
+ Mickey *_mickey;
+
+ bool Cmd_CurRoom(int argc, const char **argv);
+ bool Cmd_ShowPic(int argc, const char **argv);
+};
+
class Winnie_Console : public PreAGI_Console {
public:
Winnie_Console(PreAgiEngine *vm, Winnie *winnie);
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index dbca91233b..e5ca2c650f 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -401,6 +401,12 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
}
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_2:
// Hidden message
@@ -2101,9 +2107,15 @@ void Mickey::debug_DrawPics(){
}
}
-// Init
+
+// Console-related functions
+
+void Mickey::debugCurRoom() {
+ _vm->_console->DebugPrintf("Current Room = %d\n", _game.iRoom);
+}
Mickey::Mickey(PreAgiEngine *vm) : _vm(vm) {
+ _vm->_console = new Mickey_Console(_vm, this);
}
Mickey::~Mickey() {
diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h
index 548bd3c009..2c35c7b733 100644
--- a/engines/agi/preagi_mickey.h
+++ b/engines/agi/preagi_mickey.h
@@ -729,6 +729,8 @@ struct MSA_GAME {
int8 nFrame;
};
+class PreAgiEngine;
+
class Mickey {
public:
Mickey(PreAgiEngine *vm);
@@ -737,6 +739,9 @@ public:
void init();
void run();
+ void debugCurRoom();
+ void drawPic(int);
+
protected:
PreAgiEngine *_vm;
@@ -766,7 +771,6 @@ protected:
void playSound(ENUM_MSA_SOUND);
void debug();
void drawObj(ENUM_MSA_OBJECT, int, int);
- void drawPic(int);
void drawRoomAnimation();
void drawRoom();
void drawLogo();