[Scummvm-cvs-logs] SF.net SVN: scummvm:[45926] scummvm/trunk/engines/teenagent

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Nov 15 20:12:47 CET 2009


Revision: 45926
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45926&view=rev
Author:   megath
Date:     2009-11-15 19:12:46 +0000 (Sun, 15 Nov 2009)

Log Message:
-----------
added debug features for z-order testing.

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/scene.cpp
    scummvm/trunk/engines/teenagent/scene.h

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2009-11-15 17:49:26 UTC (rev 45925)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2009-11-15 19:12:46 UTC (rev 45926)
@@ -484,7 +484,9 @@
 		return false;
 
 	case Common::EVENT_KEYDOWN:
-		if (event.kbd.keycode == Common::KEYCODE_ESCAPE || event.kbd.keycode == Common::KEYCODE_SPACE) {
+		switch(event.kbd.keycode) {
+		case Common::KEYCODE_ESCAPE:
+		case Common::KEYCODE_SPACE: {
 			if (intro && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
 				intro = false;
 				clearMessage();
@@ -504,7 +506,22 @@
 				nextEvent();
 				return true;
 			}
+			break;
 		}
+		
+		case '1':
+		case '2':
+		case '3':
+		case '4':
+			if (event.kbd.flags & Common::KBD_CTRL) {
+				uint feature = event.kbd.keycode - '1';
+				debug_features.feature[feature] = !debug_features.feature[feature];
+				debug(0, "switched feature %u %s", feature, debug_features.feature[feature] ? "on": "off");
+			}
+			break;
+		default:
+			break;
+		}
 
 	default:
 		return false;
@@ -512,7 +529,6 @@
 }
 
 bool Scene::render(OSystem *system) {
-	//render background
 	Resources *res = Resources::instance();
 	bool busy;
 	bool restart;
@@ -541,7 +557,7 @@
 			return true;
 		}
 
-		if (background.pixels)
+		if (background.pixels && debug_features.feature[DebugFeatures::kShowBack])
 			system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h);
 		else
 			system->fillScreen(0);
@@ -549,7 +565,7 @@
 		Graphics::Surface *surface = system->lockScreen();
 
 
-		if (ons != NULL) {
+		if (ons != NULL && debug_features.feature[DebugFeatures::kShowOns]) {
 			for (uint32 i = 0; i < ons_count; ++i) {
 				Surface *s = ons + i;
 				if (s != NULL)
@@ -557,12 +573,6 @@
 			}
 		}
 
-		//render on
-		if (on.pixels != NULL) {
-			if (_id != 16 || getOns(16)[0] != 0) {
-				on.render(surface); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :(
-			}
-		}
 
 		bool got_any_animation = false;
 
@@ -602,7 +612,8 @@
 			if (s == NULL)
 				continue;
 
-			animation_position[i] = s->render(surface);
+			if (debug_features.feature[DebugFeatures::kShowLan])
+				animation_position[i] = s->render(surface);
 
 			if (a->id == 0)
 				continue;
@@ -672,6 +683,13 @@
 			}
 		}
 
+		//render on
+		if (on.pixels != NULL && debug_features.feature[DebugFeatures::kShowOn]) {
+			if (_id != 16 || getOns(16)[0] != 0) {
+				on.render(surface); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :(
+			}
+		}
+
 		if (!message.empty()) {
 			bool visible = true;
 			if (message_first_frame != 0 && message_animation != NULL) {

Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h	2009-11-15 17:49:26 UTC (rev 45925)
+++ scummvm/trunk/engines/teenagent/scene.h	2009-11-15 19:12:46 UTC (rev 45926)
@@ -216,6 +216,23 @@
 	};
 	typedef Common::List<Sound> Sounds;
 	Sounds sounds;
+	
+	struct DebugFeatures {
+		enum { 
+			kShowBack,
+			kShowLan,
+			kShowOns,
+			kShowOn, 
+			kMax
+		};
+		bool feature[kMax];
+		
+		DebugFeatures() {
+			for(uint i = 0; i < kMax; ++i) {
+				feature[i] = true;
+			}
+		}
+	} debug_features;
 };
 
 } // End of namespace TeenAgent


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