[Scummvm-cvs-logs] SF.net SVN: scummvm:[41113] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jun 2 00:03:27 CEST 2009


Revision: 41113
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41113&view=rev
Author:   lordhoto
Date:     2009-06-01 22:03:27 +0000 (Mon, 01 Jun 2009)

Log Message:
-----------
- Add some basic debugger for Lands of Lore.
- Allow the "flags" command in all Kyra games to be working properly with 320x200 GUI.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/debugger.cpp
    scummvm/trunk/engines/kyra/debugger.h
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/lol.h

Modified: scummvm/trunk/engines/kyra/debugger.cpp
===================================================================
--- scummvm/trunk/engines/kyra/debugger.cpp	2009-06-01 21:56:14 UTC (rev 41112)
+++ scummvm/trunk/engines/kyra/debugger.cpp	2009-06-01 22:03:27 UTC (rev 41113)
@@ -33,6 +33,7 @@
 #include "kyra/screen.h"
 #include "kyra/timer.h"
 #include "kyra/resource.h"
+#include "kyra/lol.h"
 
 namespace Kyra {
 
@@ -132,10 +133,12 @@
 }
 
 bool Debugger::cmd_listFlags(int argc, const char **argv) {
-	for (int i = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++) {
-		DebugPrintf("(%-3i): %-5i", i, _vm->queryGameFlag(i));
-		if (!(i % 10))
+	for (int i = 0, p = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++, ++p) {
+		DebugPrintf("(%-3i): %-2i", i, _vm->queryGameFlag(i));
+		if (p == 5) {
 			DebugPrintf("\n");
+			p -= 6;
+		}
 	}
 	DebugPrintf("\n");
 	return true;
@@ -457,5 +460,57 @@
 	return true;
 }
 
+#pragma mark -
+
+Debugger_LoL::Debugger_LoL(LoLEngine *vm) : Debugger(vm), _vm(vm) {
+}
+
+bool Debugger_LoL::cmd_listFlags(int argc, const char **argv) {
+	for (int i = 0, p = 0; i < (int)sizeof(_vm->_gameFlags)*8; ++i, ++p) {
+		const uint8 index = (i >> 4);
+		const uint8 offset = i & 0xF;
+
+		DebugPrintf("(%-3i): %-2i", i, (_vm->_gameFlags[index] >> offset) & 1);
+		if (p == 5) {
+			DebugPrintf("\n");
+			p -= 6;
+		}
+	}
+	DebugPrintf("\n");
+	return true;
+}
+
+bool Debugger_LoL::cmd_toggleFlag(int argc, const char **argv) {
+	if (argc > 1) {
+		uint flag = atoi(argv[1]);
+
+		const uint8 index = (flag >> 4);
+		const uint8 offset = flag & 0xF;
+
+		_vm->_gameFlags[index] ^= _vm->_gameFlags[index] & (1 << offset);
+
+		DebugPrintf("Flag %i is now %i\n", flag, (_vm->_gameFlags[index] >> offset) & 1);
+	} else {
+		DebugPrintf("Syntax: toggleflag <flag>\n");
+	}
+
+	return true;
+}
+
+bool Debugger_LoL::cmd_queryFlag(int argc, const char **argv) {
+	if (argc > 1) {
+		uint flag = atoi(argv[1]);
+
+		const uint8 index = (flag >> 4);
+		const uint8 offset = flag & 0xF;
+
+		DebugPrintf("Flag %i is %i\n", flag, (_vm->_gameFlags[index] >> offset) & 1);
+	} else {
+		DebugPrintf("Syntax: queryflag <flag>\n");
+	}
+
+	return true;
+}
+
 } // End of namespace Kyra
 

Modified: scummvm/trunk/engines/kyra/debugger.h
===================================================================
--- scummvm/trunk/engines/kyra/debugger.h	2009-06-01 21:56:14 UTC (rev 41112)
+++ scummvm/trunk/engines/kyra/debugger.h	2009-06-01 22:03:27 UTC (rev 41113)
@@ -47,9 +47,9 @@
 	bool cmd_loadPalette(int argc, const char **argv);
 	bool cmd_showFacings(int argc, const char **argv);
 	bool cmd_gameSpeed(int argc, const char **argv);
-	bool cmd_listFlags(int argc, const char **argv);
-	bool cmd_toggleFlag(int argc, const char **argv);
-	bool cmd_queryFlag(int argc, const char **argv);
+	virtual bool cmd_listFlags(int argc, const char **argv);
+	virtual bool cmd_toggleFlag(int argc, const char **argv);
+	virtual bool cmd_queryFlag(int argc, const char **argv);
 	bool cmd_listTimers(int argc, const char **argv);
 	bool cmd_setTimerCountdown(int argc, const char **argv);
 };
@@ -97,6 +97,20 @@
 	bool cmd_passcodes(int argc, const char **argv);
 };
 
+class LoLEngine;
+
+class Debugger_LoL : public Debugger {
+public:
+	Debugger_LoL(LoLEngine *vm);
+
+protected:
+	LoLEngine *_vm;
+
+	bool cmd_listFlags(int argc, const char **argv);
+	bool cmd_toggleFlag(int argc, const char **argv);
+	bool cmd_queryFlag(int argc, const char **argv);
+};
+
 } // End of namespace Kyra
 
 #endif

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-01 21:56:14 UTC (rev 41112)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-01 22:03:27 UTC (rev 41113)
@@ -32,6 +32,7 @@
 #include "kyra/sound.h"
 #include "kyra/timer.h"
 #include "kyra/util.h"
+#include "kyra/debugger.h"
 
 #include "sound/voc.h"
 #include "sound/audiostream.h"
@@ -541,6 +542,9 @@
 	_spellProcs.push_back(new SpellProc(this, 0));
 	_spellProcs.push_back(new SpellProc(this, &LoLEngine::castGuardian));
 
+	_debugger = new Debugger_LoL(this);
+	assert(_debugger);
+
 	return Common::kNoError;
 }
 

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-01 21:56:14 UTC (rev 41112)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-01 22:03:27 UTC (rev 41113)
@@ -292,6 +292,7 @@
 friend class GUI_LoL;
 friend class TextDisplayer_LoL;
 friend class TIMInterpreter_LoL;
+friend class Debugger_LoL;
 public:
 	LoLEngine(OSystem *system, const GameFlags &flags);
 	~LoLEngine();


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