[Scummvm-cvs-logs] SF.net SVN: scummvm: [30317] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Mon Jan 7 04:53:30 CET 2008


Revision: 30317
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30317&view=rev
Author:   dreammaster
Date:     2008-01-06 19:53:30 -0800 (Sun, 06 Jan 2008)

Log Message:
-----------
Made debugging keys disabled by default, with a debugger command to allow them to be turned on

Modified Paths:
--------------
    scummvm/trunk/engines/lure/debugger.cpp
    scummvm/trunk/engines/lure/debugger.h
    scummvm/trunk/engines/lure/game.cpp
    scummvm/trunk/engines/lure/game.h

Modified: scummvm/trunk/engines/lure/debugger.cpp
===================================================================
--- scummvm/trunk/engines/lure/debugger.cpp	2008-01-06 23:53:33 UTC (rev 30316)
+++ scummvm/trunk/engines/lure/debugger.cpp	2008-01-07 03:53:30 UTC (rev 30317)
@@ -29,6 +29,7 @@
 #include "lure/luredefs.h"
 #include "lure/debugger.h"
 #include "lure/decode.h"
+#include "lure/game.h"
 #include "lure/res.h"
 #include "lure/res_struct.h"
 #include "lure/room.h"
@@ -49,6 +50,7 @@
 	DCmd_Register("room",				WRAP_METHOD(Debugger, cmd_room));
 	DCmd_Register("showanim",			WRAP_METHOD(Debugger, cmd_showAnim));
 	DCmd_Register("strings",			WRAP_METHOD(Debugger, cmd_saveStrings));
+	DCmd_Register("debug",				WRAP_METHOD(Debugger, cmd_debug));
 }
 
 static int strToInt(const char *s) {
@@ -575,5 +577,24 @@
 	return true;
 }
 
+bool Debugger::cmd_debug(int argc, const char **argv) {
+	Game &game = Game::getReference();
+	Room &room = Room::getReference();
 
+	if ((argc == 2) && (strcmp(argv[1], "on") == 0)) {
+		DebugPrintf("debug keys are on\n");
+		game.debugFlag() = true;
+
+	} else if ((argc == 2) && (strcmp(argv[1], "off") == 0)) {
+		DebugPrintf("debug keys are off\n");
+		game.debugFlag() = false;
+		room.setShowInfo(false);
+
+	} else {
+		DebugPrintf("debug [on | off]]\n");
+	}
+
+	return true;
+}
+
 } // End of namespace Lure

Modified: scummvm/trunk/engines/lure/debugger.h
===================================================================
--- scummvm/trunk/engines/lure/debugger.h	2008-01-06 23:53:33 UTC (rev 30316)
+++ scummvm/trunk/engines/lure/debugger.h	2008-01-07 03:53:30 UTC (rev 30317)
@@ -47,6 +47,7 @@
 	bool cmd_room(int argc, const char **argv);
 	bool cmd_showAnim(int argc, const char **argv);
 	bool cmd_saveStrings(int argc, const char **argv);
+	bool cmd_debug(int argc, const char **argv);
 };
 
 } // End of namespace Lure

Modified: scummvm/trunk/engines/lure/game.cpp
===================================================================
--- scummvm/trunk/engines/lure/game.cpp	2008-01-06 23:53:33 UTC (rev 30316)
+++ scummvm/trunk/engines/lure/game.cpp	2008-01-07 03:53:30 UTC (rev 30317)
@@ -49,6 +49,7 @@
 	_debugger = new Debugger();
 	_fastTextFlag = false;
 	_preloadFlag = false;
+	_debugFlag = false;
 
 	_soundFlag = true;
 	_musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume"));
@@ -206,26 +207,32 @@
 						break;
 
 					case Common::KEYCODE_KP_PLUS:
-						while (++roomNum <= 51) 
-							if (res.getRoom(roomNum) != NULL) break; 
-						if (roomNum == 52) roomNum = 1;
-						room.setRoomNumber(roomNum);
+						if (_debugFlag) {
+							while (++roomNum <= 51) 
+								if (res.getRoom(roomNum) != NULL) break; 
+							if (roomNum == 52) roomNum = 1;
+							room.setRoomNumber(roomNum);
+						}
 						break;
 
 					case Common::KEYCODE_KP_MINUS:
-						if (roomNum == 1) roomNum = 55;
-						while (res.getRoom(--roomNum) == NULL) ;
-						room.setRoomNumber(roomNum);
+						if (_debugFlag) {
+							if (roomNum == 1) roomNum = 55;
+							while (res.getRoom(--roomNum) == NULL) ;
+							room.setRoomNumber(roomNum);
+						}
 						break;
 
 					case Common::KEYCODE_KP_MULTIPLY:
-						res.getActiveHotspot(PLAYER_ID)->setRoomNumber(
-							room.roomNumber());
+						if (_debugFlag) 
+							res.getActiveHotspot(PLAYER_ID)->setRoomNumber(
+								room.roomNumber());
 						break;
 
 					case Common::KEYCODE_KP_DIVIDE:
 					case Common::KEYCODE_SLASH:
-						room.setShowInfo(!room.showInfo());
+						if (_debugFlag) 
+							room.setShowInfo(!room.showInfo());
 						break;
 
 					case Common::KEYCODE_ESCAPE:

Modified: scummvm/trunk/engines/lure/game.h
===================================================================
--- scummvm/trunk/engines/lure/game.h	2008-01-06 23:53:33 UTC (rev 30316)
+++ scummvm/trunk/engines/lure/game.h	2008-01-07 03:53:30 UTC (rev 30317)
@@ -53,6 +53,7 @@
 	uint16 _tellCommands[MAX_TELL_COMMANDS * 3 + 1];
 	int _numTellCommands;
 	bool _preloadFlag;
+	bool _debugFlag;
 
 	void handleMenuResponse(uint8 selection);
 	void handleClick();
@@ -81,6 +82,7 @@
 	void execute();
 	void setState(uint8 flags) { _state = flags; }
 	bool &preloadFlag() { return _preloadFlag; }
+	bool &debugFlag() { return _debugFlag; }
 	bool fastTextFlag() { return _fastTextFlag; }
 	bool soundFlag() { return _soundFlag; }
 	uint8 sfxVolume() { return _sfxVolume; }


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