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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Oct 14 01:48:59 CEST 2007


Revision: 29215
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29215&view=rev
Author:   thebluegr
Date:     2007-10-13 16:48:59 -0700 (Sat, 13 Oct 2007)

Log Message:
-----------
Add a debug console in Winnie (patch by clone2727)

Modified Paths:
--------------
    scummvm/trunk/engines/agi/console.cpp
    scummvm/trunk/engines/agi/console.h
    scummvm/trunk/engines/agi/preagi.h
    scummvm/trunk/engines/agi/preagi_common.cpp
    scummvm/trunk/engines/agi/preagi_winnie.cpp
    scummvm/trunk/engines/agi/preagi_winnie.h

Modified: scummvm/trunk/engines/agi/console.cpp
===================================================================
--- scummvm/trunk/engines/agi/console.cpp	2007-10-13 21:54:37 UTC (rev 29214)
+++ scummvm/trunk/engines/agi/console.cpp	2007-10-13 23:48:59 UTC (rev 29215)
@@ -243,4 +243,20 @@
 	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

Modified: scummvm/trunk/engines/agi/console.h
===================================================================
--- scummvm/trunk/engines/agi/console.h	2007-10-13 21:54:37 UTC (rev 29214)
+++ scummvm/trunk/engines/agi/console.h	2007-10-13 23:48:59 UTC (rev 29215)
@@ -28,6 +28,8 @@
 
 #include "gui/debugger.h"
 
+#include "agi/preagi_winnie.h"
+
 namespace Agi {
 
 class AgiEngine;
@@ -73,6 +75,34 @@
 	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 */

Modified: scummvm/trunk/engines/agi/preagi.h
===================================================================
--- scummvm/trunk/engines/agi/preagi.h	2007-10-13 21:54:37 UTC (rev 29214)
+++ scummvm/trunk/engines/agi/preagi.h	2007-10-13 23:48:59 UTC (rev 29215)
@@ -56,6 +56,7 @@
 	GfxMgr *_gfx;
 	SoundMgr *_sound;
 	PictureMgr *_picture;
+	PreAGI_Console *_console;
 
 	void clearImageStack() {}
 	void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,

Modified: scummvm/trunk/engines/agi/preagi_common.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_common.cpp	2007-10-13 21:54:37 UTC (rev 29214)
+++ scummvm/trunk/engines/agi/preagi_common.cpp	2007-10-13 23:48:59 UTC (rev 29215)
@@ -133,6 +133,14 @@
 				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 @@
 					if (type == kSelBackspace)
 						return 0;
 				default:
+					if (event.kbd.flags & Common::KBD_CTRL)
+						break;
 					if (type == kSelYesNo) {
 						return 2;
 					} else if (type == kSelNumber) {

Modified: scummvm/trunk/engines/agi/preagi_winnie.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_winnie.cpp	2007-10-13 21:54:37 UTC (rev 29214)
+++ scummvm/trunk/engines/agi/preagi_winnie.cpp	2007-10-13 23:48:59 UTC (rev 29215)
@@ -919,6 +919,12 @@
 				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 @@
 						break;
 					}
 				default:
-					keyHelp();
-					clrMenuSel(iSel, fCanSel);
+					if (!(event.kbd.flags & Common::KBD_CTRL)) {
+						keyHelp();
+						clrMenuSel(iSel, fCanSel);
+					}
 					break;
 				}
 				break;
@@ -1213,10 +1221,16 @@
 	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() {
 	memset(&_game, 0, sizeof(_game));
 	_game.fSound = 1;

Modified: scummvm/trunk/engines/agi/preagi_winnie.h
===================================================================
--- scummvm/trunk/engines/agi/preagi_winnie.h	2007-10-13 21:54:37 UTC (rev 29214)
+++ scummvm/trunk/engines/agi/preagi_winnie.h	2007-10-13 23:48:59 UTC (rev 29215)
@@ -304,6 +304,8 @@
 	void init();
 	void run();
 
+	void debugCurRoom();
+
 private:
 	PreAgiEngine *_vm;
 	WTP_SAVE_GAME _game;
@@ -360,3 +362,4 @@
 
 #endif
 
+


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