[Scummvm-cvs-logs] SF.net SVN: scummvm: [30349] scummvm/trunk/engines/agi

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Jan 9 10:19:17 CET 2008


Revision: 30349
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30349&view=rev
Author:   thebluegr
Date:     2008-01-09 01:19:17 -0800 (Wed, 09 Jan 2008)

Log Message:
-----------
Added a debug console for Mickey's Space Adventures

Modified Paths:
--------------
    scummvm/trunk/engines/agi/console.cpp
    scummvm/trunk/engines/agi/console.h
    scummvm/trunk/engines/agi/preagi_mickey.cpp
    scummvm/trunk/engines/agi/preagi_mickey.h

Modified: scummvm/trunk/engines/agi/console.cpp
===================================================================
--- scummvm/trunk/engines/agi/console.cpp	2008-01-09 09:15:05 UTC (rev 30348)
+++ scummvm/trunk/engines/agi/console.cpp	2008-01-09 09:19:17 UTC (rev 30349)
@@ -247,6 +247,27 @@
 	_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;
 

Modified: scummvm/trunk/engines/agi/console.h
===================================================================
--- scummvm/trunk/engines/agi/console.h	2008-01-09 09:15:05 UTC (rev 30348)
+++ scummvm/trunk/engines/agi/console.h	2008-01-09 09:19:17 UTC (rev 30349)
@@ -28,6 +28,7 @@
 
 #include "gui/debugger.h"
 
+#include "agi/preagi_mickey.h"
 #include "agi/preagi_winnie.h"
 
 namespace Agi {
@@ -88,6 +89,23 @@
 	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);

Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp	2008-01-09 09:15:05 UTC (rev 30348)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp	2008-01-09 09:19:17 UTC (rev 30349)
@@ -401,6 +401,12 @@
 				}
 				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 @@
 	}
 }
 
-// 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() {

Modified: scummvm/trunk/engines/agi/preagi_mickey.h
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.h	2008-01-09 09:15:05 UTC (rev 30348)
+++ scummvm/trunk/engines/agi/preagi_mickey.h	2008-01-09 09:19:17 UTC (rev 30349)
@@ -729,6 +729,8 @@
 	int8 nFrame;
 };
 
+class PreAgiEngine;
+
 class Mickey {
 public:
 	Mickey(PreAgiEngine *vm);
@@ -737,6 +739,9 @@
 	void init();
 	void run();
 
+	void debugCurRoom();
+	void drawPic(int);
+
 protected:
 	PreAgiEngine *_vm;
 
@@ -766,7 +771,6 @@
 	void playSound(ENUM_MSA_SOUND);
 	void debug();
 	void drawObj(ENUM_MSA_OBJECT, int, int);
-	void drawPic(int);
 	void drawRoomAnimation();
 	void drawRoom();
 	void drawLogo();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list