Index: /orxonox/branches/chris/src/camera.cc
===================================================================
--- /orxonox/branches/chris/src/camera.cc	(revision 2079)
+++ /orxonox/branches/chris/src/camera.cc	(revision 2080)
@@ -12,5 +12,5 @@
 
    ### File Specific:
-   main-programmer: ...
+   main-programmer: Christian Meyer
    co-programmer: ...
 */
@@ -70,4 +70,5 @@
   
   glMatrixMode (GL_MODELVIEW);
+  glLoadIdentity ();
 }
 
@@ -87,4 +88,8 @@
 void Camera::bind (WorldEntity* entity)
 {
-	if( entity != NULL) bound = entity; 
+	if( entity != NULL)
+	{
+		if( entity->bFree) printf("Cannot bind camera to free entity");
+		else bound = entity;
+	} 
 }
Index: /orxonox/branches/chris/src/orxonox.cc
===================================================================
--- /orxonox/branches/chris/src/orxonox.cc	(revision 2079)
+++ /orxonox/branches/chris/src/orxonox.cc	(revision 2080)
@@ -87,4 +87,5 @@
 	
 	if( path != NULL) strcpy (configfilename, path);
+	else strcpy (configfilename, "./");
 	strcat (configfilename, "/.orxonox.conf");
 }
@@ -191,5 +192,9 @@
 int Orxonox::init_world () 
 {
-	printf("Not yet implemented\n");
+	world = new World();
+	
+	// TO DO: replace this with a menu/intro
+	world->load_debug_level();
+	
 	return 0;
 }
Index: /orxonox/branches/chris/src/track.cc
===================================================================
--- /orxonox/branches/chris/src/track.cc	(revision 2079)
+++ /orxonox/branches/chris/src/track.cc	(revision 2080)
@@ -12,5 +12,5 @@
 
    ### File Specific:
-   main-programmer: ...
+   main-programmer: Christian Meyer
    co-programmer: ...
 */
@@ -21,8 +21,10 @@
 using namespace std;
 
-
-
-Track::Track ()
+Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
 {
+	ID = number;
+	offset = start;
+	end = finish;
+	nextID = next;
 }
 
@@ -33,9 +35,41 @@
 void Track::map_camera (Location* lookat, Placement* camplc)
 {
+	Line trace(*offset, *end - *offset);
+	float l = trace.len ();
+	
+	camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
+	camplc->w = Rotation( (trace.r + (trace.a * ((lookat->dist) / l))) - camplc->r);
 }
 
-void Track::map_coords (Location* loc, Placement* plc)
+bool Track::map_coords (Location* loc, Placement* plc)
 {
+	Line trace(*offset, *end - *offset);
+	float l = trace.len ();
 	
+	if( loc->dist > l)
+	{
+		loc->dist -= l;
+		loc->part = nextID;
+		return true;
+	}
+	
+	Rotation dir(trace.a);
+	
+	plc->r = trace.r + (trace.a * ((loc->dist) / l)) + rotate_vector( loc->pos, dir);
+	plc->w = dir * loc->rot;
+	
+	return false;
+}
+
+void Track::post_enter (WorldEntity* entity)
+{
+}
+
+void Track::post_leave (WorldEntity* entity)
+{
+}
+
+void Track::tick (float deltaT)
+{
 }
 
Index: /orxonox/branches/chris/src/track.h
===================================================================
--- /orxonox/branches/chris/src/track.h	(revision 2079)
+++ /orxonox/branches/chris/src/track.h	(revision 2080)
@@ -9,11 +9,15 @@
  	Vector* offset;
  	Vector* end;
+ 	Uint32 nextID;
  	
  public:
-  Track ();
+  Track (Uint32 number, Uint32 next, Vector* start, Vector* finish);
   ~Track ();
 	
+	virtual void post_enter (WorldEntity* entity);	// handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
+	virtual void post_leave (WorldEntity* entity);
+	virtual void tick (float deltaT);
 	virtual void map_camera (Location* lookat, Placement* camplc);
-	virtual void map_coords (Location* loc, Placement* plc);
+	virtual bool map_coords (Location* loc, Placement* plc);	// this should return true if the entity left track boundaries
 };
 
Index: /orxonox/branches/chris/src/vector.cc
===================================================================
--- /orxonox/branches/chris/src/vector.cc	(revision 2079)
+++ /orxonox/branches/chris/src/vector.cc	(revision 2080)
@@ -291,4 +291,30 @@
 }
 
+/**
+   \brief multiplies two rotational matrices
+   \param r: another Rotation
+   \return the matrix product of the Rotations
+   
+   Use this to rotate one rotation by another
+*/
+Rotation Rotation::operator* (Rotation& r)
+{
+	Rotation p();
+	
+	p[0] = m[0]*r.m[0] + m[1]*r.m[3] + m[2]*r.m[6];
+	p[1] = m[0]*r.m[1] + m[1]*r.m[4] + m[2]*r.m[7];
+	p[2] = m[0]*r.m[2] + m[1]*r.m[5] + m[2]*r.m[8];
+	
+	p[3] = m[3]*r.m[0] + m[4]*r.m[3] + m[5]*r.m[6];
+	p[4] = m[3]*r.m[1] + m[4]*r.m[4] + m[5]*r.m[7];
+	p[5] = m[3]*r.m[2] + m[4]*r.m[5] + m[5]*r.m[8];
+
+	p[6] = m[6]*r.m[0] + m[7]*r.m[3] + m[8]*r.m[6];
+	p[7] = m[6]*r.m[1] + m[7]*r.m[4] + m[8]*r.m[7];
+	p[8] = m[6]*r.m[2] + m[7]*r.m[5] + m[8]*r.m[8];
+	
+	return p;
+}
+
 
 /**
Index: /orxonox/branches/chris/src/vector.h
===================================================================
--- /orxonox/branches/chris/src/vector.h	(revision 2079)
+++ /orxonox/branches/chris/src/vector.h	(revision 2080)
@@ -58,4 +58,6 @@
   ~Rotation () {}
   
+  Rotation operator* (const Rotation& r);
+  
   glmatrix (float* buffer);
 };
Index: /orxonox/branches/chris/src/world.cc
===================================================================
--- /orxonox/branches/chris/src/world.cc	(revision 2079)
+++ /orxonox/branches/chris/src/world.cc	(revision 2080)
@@ -18,12 +18,4 @@
 #include <stdlib.h>
 #include <cmath>
-
-#include "npc.h"
-#include "player.h"
-#include "environment.h"
-#include "shoot_laser.h"
-#include "shoot_rocket.h"
-#include "stdincl.h"
-#include "data_tank.h"
 
 #include "world.h"
@@ -46,11 +38,42 @@
 World::~World ()
 {
+	unload ();
 	delete entities;
 }
 
-template<class T> T* World::spawn<T>(Location* loc, WorldEntity* owner)
-{
+template<class T> T* World::spawn<T>(Location* loc = NULL, WorldEntity* owner = NULL)
+{
+	Location zeroloc;
 	T* entity = new T();
 	entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
+	if( loc == NULL)
+	{
+		zeroloc.dist = 0;
+		zeroloc.part = 0;
+		zeroloc.pos = Vector();
+		zeroloc.rot = Rotation();
+		loc = &zeroloc;
+	}
+	entity->init (loc, owner);
+	if (entity->bFree)
+	{
+		track[loc->part].map_coords( loc, entity->get_placement())
+	}
+	entity->post_spawn ();
+	return entity;
+}
+
+template<class T> T* World::spawn<T>(Placement* plc, WorldEntity* owner = NULL)
+{
+	T* entity = new T();
+	entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
+	entity->init (plc, owner);
+	if (!entity->bFree)
+	{
+		printf("Can't spawn unfree entity with placement\n"); 
+		entities->remove( (WorldEntity*)entity, LIST_FIND_FW);
+		return NULL;
+	}
+	entity->post_spawn ();
 	return entity;
 }
@@ -107,4 +130,50 @@
 void World::update ()
 {
+	List<WorldEntity> *l;
+	WorldEntity* entity;
+	Location* loc;
+	Placement* plc;
+	Uint32 t;
+	
+	l = entities->get_next();  
+	while( l != NULL) 
+	{ 
+		entity = l->get_object();
+		
+		if( entity != bFree)
+		{
+		 	loc = entity->get_location();
+		 	plc = entity->get_placement();
+		 	t = loc->part;
+		 	
+		 	if( t >= tracklen)
+		 	{
+		 		printf("An entity is out of the game area\n");
+				entity->left_world ();
+		 	}
+		 	else
+		 	{
+		 		while( track[t].map_coords( loc, plc))
+		 		{
+		 			track[t]->post_leave (entity);
+		 			if( loc->part >= tracklen)
+		 			{
+		 				printf("An entity has left the game area\n");
+		 				entity->left_world ();
+		 				break;
+		 			}
+		 			track[loc->part]->post_enter (entity);
+		 		}
+		 	}
+		}
+		else
+		{
+			// TO DO: implement check whether this particular free entity is out of the game area
+			// TO DO: call function to notify the entity that it left the game area
+		}
+	 	
+	  l = l->get_next();
+	}
+	
 }
 
@@ -124,3 +193,36 @@
 	  l = l->get_next();
 	}
-}
+	
+	for( int i = 0; i < tracklen) track[i].tick (seconds);
+}
+
+void World::unload()
+{
+	if( pathnodes) delete []pathnodes;
+	if( track) delete []pathnodes;
+}
+
+void World::load_debug_level()
+{
+	// create some path nodes
+	pathnodes = new Vector[6];
+	pathnodes[0] = Vector(0, 0, 0);
+	pathnodes[1] = Vector(-100, 40, 0);
+	pathnodes[2] = Vector(-100, 140, 0);
+	pathnodes[3] = Vector(0, 180, 0);
+	pathnodes[4] = Vector(100, 140, 0);
+	pathnodes[5] = Vector(100, 40, 0);	
+	
+	// create the tracks
+	tracklen = 6;
+	track = new Track[6];
+	for( int i = 0; i < tracklen; i++)
+	{
+		track[i] = Track( i, (i+1)%tracklen, &pathnodes[i], &pathnodes[(i+1)%tracklen]);
+	}
+	
+	// create a player
+	
+	// bind input
+	// bind camera
+}
Index: /orxonox/branches/chris/src/world.h
===================================================================
--- /orxonox/branches/chris/src/world.h	(revision 2079)
+++ /orxonox/branches/chris/src/world.h	(revision 2080)
@@ -17,4 +17,8 @@
 	void calc_camera_pos (Location* loc, Placement* plc);
 	
+	void unload ();
+	
+	void load_debug_level ();
+	
  private:
  
Index: /orxonox/branches/chris/src/world_entity.cc
===================================================================
--- /orxonox/branches/chris/src/world_entity.cc	(revision 2079)
+++ /orxonox/branches/chris/src/world_entity.cc	(revision 2080)
@@ -37,36 +37,28 @@
 This is some sort of standard interface to all WorldEntities...
 */
-WorldEntity::WorldEntity () 
+WorldEntity::WorldEntity (bool isFree = false) : bFree(isFree)
 {
-  health = 100;
-  speed = 0;
+	collisioncluster = NULL;
+	owner = NULL;
 }
-
 
 WorldEntity::~WorldEntity () {}
 
-/**
-   \brief sets the position of this entity
-   \param position: Vector, pointing (from 0,0,0) to the new position
-*/
-void WorldEntity::setPosition(Vector* position) {} 
+Location* WorldEntity::getLocation ()
+{
+	return &loc;
+}
 
-/**
-   \brief gets the postion of this entity
-   \return a Vector, pointing (from 0,0,0) to the new position
-*/
-Vector* getPosition() {}
+Placement* WorldEntity::getPlacement ()
+{
+	return &place;
+}
 
-/**
-   \brief sets orientation of this entity
-   \param orientation: vector specifying in which direction the entity looks
-*/
-void WorldEntity::setOrientation(Vector* orientation) {}
-
-/**
-   \brief gets orientation of this entity
-   \return vector specifying in which direction the entity looks
-*/
-Vector* WorldEntity::getOrientation() {}
+void WorldEntity::set_collision (CollisionCluster* newhull)
+{
+	if( newhull == NULL) return;
+	if( collisioncluster != NULL) delete collisioncluster;
+	collisioncluster = newhull;
+}
 
 /**
@@ -149,23 +141,13 @@
 void WorldEntity::destroy() {}
 
-/**
-   \brief this function is automatically called before the entity enters the world
-*/
-void WorldEntity::entityPreEnter() {}
+void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)
+{
+	loc = *spawnloc;
+	owner = spawnowner;
+}
 
-/**
-   \brief this function is automatically called after the entity enters the world
-
-*/
-void WorldEntity::entityPostEnter() {}
-
-/**
-   \brief this function is automatically called before the entity quits the world
-
-*/
-void WorldEntity::entityPreQuit() {}
-
-/**
-   \brief this function is automatically called after the entity quits the world
-*/
-void WorldEntity::entityPostQuit() {}
+void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)
+{
+	plc = *spawnplc;
+	owner = spawnowner;
+}
Index: /orxonox/branches/chris/src/world_entity.h
===================================================================
--- /orxonox/branches/chris/src/world_entity.h	(revision 2079)
+++ /orxonox/branches/chris/src/world_entity.h	(revision 2080)
@@ -9,53 +9,43 @@
 class Ability;
 
-class WorldEntity {
+class WorldEntity
+{	
+	friend class World;
 
  public:
-  WorldEntity ();
+  WorldEntity (bool isFree);
   ~WorldEntity ();
 
+ 	Location* get_location ();
+ 	Placement* get_placement ();
+ 	void set_collision (CollisionCluster* newhull);
+ 	
+  //void addAbility(Ability* ability);
+  //void removeAbility(Ability* ability);
 
-  void setPosition(Vector* position);
-  Vector* getPosition();
-  void setOrientation(Vector* orientation);
-  Vector* getOrientation();
-  void setSpawnPoint(Vector* place);
-  void setSpeed(float speed);
-  float getSpeed();
-  void setHealth(float health);
-  float getHealth();
-
-  void addAbility(Ability* ability);
-  void removeAbility(Ability* ability);
-
+	virtual void post_spawn ();
   virtual void tick (float time);
-  virtual void draw ();
-  virtual void collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags);
   virtual void hit (WorldEntity* weapon, Vector loc);
   virtual void destroy ();
-  virtual void command (Command* cmd);
+  virtual void collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags);
+ 	virtual void command (Command* cmd);
+  
+  virtual void draw ();
   virtual void get_lookat (Location* locbuf);
 
-  virtual void entityPreEnter();
-  virtual void entityPostEnter();
-  virtual void entityPreQuit();
-  virtual void entityPostQuit();
+	virtual void left_world ();
 
+ private:
   bool bCollide;
   bool bDraw;
-
- private:
+  bool bFree;		// Whether entity movement is bound to the track
+  
  	WorldEntity* owner;
  	CollisionCluster* collisioncluster;
  	Placement place;
  	Location loc;
-  /* List of abilities */ 
-  float health;
-  float speed;
-  /* entity can be in the air or at ground: */
-  int airGround;
 
-  
-
+	void init( Location* spawnloc, WorldEntity* spawnowner);
+	void init( Placement* spawnplc, WorldEntity* spawnowner);
 };
 
