changeset 10:ab09325f901e

Camera was attached to instance on a different layer, resulting in strange scrolling. Fixed it, and added a check to prevent this happening again (attach-to-other-layer fails and logs a warning).
author jwt@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 06 Jul 2008 17:13:06 +0000
parents 983c0af2a1e1
children b153abbd9900
files clients/rio_de_hola/maps/shrine.xml engine/core/view/camera.cpp engine/extensions/loaders.py
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/clients/rio_de_hola/maps/shrine.xml	Sun Jul 06 10:12:17 2008 +0000
+++ b/clients/rio_de_hola/maps/shrine.xml	Sun Jul 06 17:13:06 2008 +0000
@@ -6106,7 +6106,7 @@
 			<i r="0" id="NPC:girl" z="0.0" x="8.0" o="girl" y="2.0"></i>
 		</instances>
 	</layer>
-	<camera ref_cell_width="128" zoom="1.157625" tilt="-42.0" viewport="0,0,1280,960" id="main" ref_layer_id="TechdemoMapTileLayer" ref_cell_height="96" rotation="45.0">
+	<camera ref_cell_width="64" zoom="1.0" tilt="-42.0" viewport="0,0,1280,960" id="main" ref_layer_id="TechdemoMapGroundObjectLayer" ref_cell_height="48" rotation="45.0">
 	</camera>
 	<camera ref_cell_width="128" zoom="1.0" tilt="-42.0" viewport="10,10,400,250" id="small" ref_layer_id="TechdemoMapTileLayer" ref_cell_height="96" rotation="45.0">
 	</camera>
--- a/engine/core/view/camera.cpp	Sun Jul 06 10:12:17 2008 +0000
+++ b/engine/core/view/camera.cpp	Sun Jul 06 17:13:06 2008 +0000
@@ -343,6 +343,11 @@
 	}
 
 	void Camera::attach(Instance *instance) {
+		// fail if the layers aren't the same
+		if (m_location.getLayer()->getId() != instance->getLocation().getLayer()->getId()) {
+			FL_WARN(_log, "Tried to attach camera to instance on different layer.");
+			return ;
+		}
 		m_attachedto = instance;
 	}
 
--- a/engine/extensions/loaders.py	Sun Jul 06 10:12:17 2008 +0000
+++ b/engine/extensions/loaders.py	Sun Jul 06 17:13:06 2008 +0000
@@ -21,9 +21,11 @@
 		res = object_loader.loadResource(fife.ResourceLocation(path))
 		print 'imported object file ' + path
 	except WrongFileType:
-		print 'ignored non-object file ' + path
+		pass
+#		print 'ignored non-object file ' + path
 	except NameClash:
-		print 'ignored already loaded file ' + path
+		pass
+#		print 'ignored already loaded file ' + path
 	return res
 
 def loadImportDir(path, engine):