[Scummvm-cvs-logs] SF.net SVN: scummvm:[54140] scummvm/trunk/engines/sword1

tdhs at users.sourceforge.net tdhs at users.sourceforge.net
Mon Nov 8 13:22:59 CET 2010


Revision: 54140
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54140&view=rev
Author:   tdhs
Date:     2010-11-08 12:22:58 +0000 (Mon, 08 Nov 2010)

Log Message:
-----------
SWORD1: Added basic debugging console to engine

SWORD1 does not currently use Debug Channels, but this does provide a base for adding them along with any other debugging commands.

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/module.mk
    scummvm/trunk/engines/sword1/sword1.cpp
    scummvm/trunk/engines/sword1/sword1.h

Added Paths:
-----------
    scummvm/trunk/engines/sword1/console.cpp
    scummvm/trunk/engines/sword1/console.h

Added: scummvm/trunk/engines/sword1/console.cpp
===================================================================
--- scummvm/trunk/engines/sword1/console.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sword1/console.cpp	2010-11-08 12:22:58 UTC (rev 54140)
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "sword1/console.h"
+#include "sword1/sword1.h"
+
+namespace Sword1 {
+
+SwordConsole::SwordConsole(SwordEngine *vm) : GUI::Debugger(), _vm(vm) {
+}
+
+SwordConsole::~SwordConsole() {
+}
+
+void SwordConsole::preEnter() {
+}
+
+void SwordConsole::postEnter() {
+}
+
+} // End of namespace Sword


Property changes on: scummvm/trunk/engines/sword1/console.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/trunk/engines/sword1/console.h
===================================================================
--- scummvm/trunk/engines/sword1/console.h	                        (rev 0)
+++ scummvm/trunk/engines/sword1/console.h	2010-11-08 12:22:58 UTC (rev 54140)
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SWORD1_CONSOLE_H
+#define SWORD1_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Sword1 {
+
+class SwordEngine;
+
+class SwordConsole : public GUI::Debugger {
+public:
+	SwordConsole(SwordEngine *vm);
+	virtual ~SwordConsole(void);
+
+protected:
+	virtual void preEnter();
+	virtual void postEnter();
+
+private:
+	SwordEngine *_vm;
+};
+
+} // End of namespace Sword1
+
+#endif


Property changes on: scummvm/trunk/engines/sword1/console.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/engines/sword1/module.mk
===================================================================
--- scummvm/trunk/engines/sword1/module.mk	2010-11-08 12:17:19 UTC (rev 54139)
+++ scummvm/trunk/engines/sword1/module.mk	2010-11-08 12:22:58 UTC (rev 54140)
@@ -2,6 +2,7 @@
 
 MODULE_OBJS := \
 	animation.o \
+	console.o \
 	control.o \
 	debug.o \
 	detection.o \

Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp	2010-11-08 12:17:19 UTC (rev 54139)
+++ scummvm/trunk/engines/sword1/sword1.cpp	2010-11-08 12:22:58 UTC (rev 54140)
@@ -66,6 +66,8 @@
 	SearchMan.addSubDirectoryMatching(gameDataDir, "smackshi");
 	SearchMan.addSubDirectoryMatching(gameDataDir, "english");//PSX Demo
 	SearchMan.addSubDirectoryMatching(gameDataDir, "italian");//PSX Demo
+
+	_console = new SwordConsole(this);
 }
 
 SwordEngine::~SwordEngine() {
@@ -78,6 +80,7 @@
 	delete _mouse;
 	delete _objectMan;
 	delete _resMan;
+	delete _console;
 }
 
 Common::Error SwordEngine::init() {
@@ -678,6 +681,13 @@
 				if (retCode == CONTROL_NOTHING_DONE)
 					_screen->fullRefresh();
 			}
+
+			// Check for Debugger Activation
+			if (_keyPressed.hasFlags(Common::KBD_CTRL) && _keyPressed.keycode == Common::KEYCODE_d) {
+				this->getDebugger()->attach();
+				this->getDebugger()->onFrame();
+			}
+
 			_mouseState = 0;
 			_keyPressed.reset();
 		} while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0) && (!shouldQuit()));

Modified: scummvm/trunk/engines/sword1/sword1.h
===================================================================
--- scummvm/trunk/engines/sword1/sword1.h	2010-11-08 12:17:19 UTC (rev 54139)
+++ scummvm/trunk/engines/sword1/sword1.h	2010-11-08 12:22:58 UTC (rev 54140)
@@ -30,6 +30,7 @@
 #include "common/events.h"
 #include "common/util.h"
 #include "sword1/sworddefs.h"
+#include "sword1/console.h"
 
 /**
  * This is the namespace of the Sword1 engine.
@@ -106,6 +107,8 @@
 	virtual bool hasFeature(EngineFeature f) const;
 	virtual void syncSoundSettings();
 
+	GUI::Debugger *getDebugger() { return _console; }
+
 	Common::Error loadGameState(int slot);
 	bool canLoadGameStateCurrently();
 	Common::Error saveGameState(int slot, const char *desc);
@@ -121,6 +124,8 @@
 
 	void reinitRes(); //Reinits the resources after a GMM load
 
+	SwordConsole *_console;
+
 	uint8 mainLoop();
 
 	Common::Point _mouseCoord;


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