Index: /orxonox/branches/levelloader/src/defs/debug.h
===================================================================
--- /orxonox/branches/levelloader/src/defs/debug.h	(revision 3541)
+++ /orxonox/branches/levelloader/src/defs/debug.h	(revision 3542)
@@ -27,4 +27,8 @@
 
 #include <stdio.h>
+
+#ifndef DEBUG
+#define DEBUG 4
+#endif
 
 #define NO              0
Index: /orxonox/branches/levelloader/src/factory.cc
===================================================================
--- /orxonox/branches/levelloader/src/factory.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/factory.cc	(revision 3542)
@@ -63,5 +63,4 @@
 {
 	assert( classname != NULL);
-	PRINTF(3)("Initializing %sFactory\n", classname);
 	GameLoader* gl = GameLoader::getInstance();
 	gl->registerFactory( this);
Index: /orxonox/branches/levelloader/src/game_loader.cc
===================================================================
--- /orxonox/branches/levelloader/src/game_loader.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/game_loader.cc	(revision 3542)
@@ -161,5 +161,5 @@
   if( name == NULL)
   {
-		PRINTF(1)("No filename specified for loading");
+		PRINTF0("No filename specified for loading");
 		return NULL;
   }
@@ -170,5 +170,5 @@
 	{
 		// report an error
-		PRINTF(1)("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
+		PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
 		delete XMLDoc;
 		return NULL;
@@ -176,13 +176,11 @@
 	
 	// check basic validity
-	TiXmlElement* element = XMLDoc->RootElement();
-	assert( element != NULL);
-	
-	element = element->FirstChildElement( "Campaign");
-	
-	if( element == NULL )
+	TiXmlElement* root = XMLDoc->RootElement();
+	assert( root != NULL);
+	
+	if( strcmp( root->Value(), "Campaign"))
 	{
 		// report an error
-		PRINTF(1)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
+		PRINTF0("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
 		delete XMLDoc;
 		return NULL;
@@ -190,5 +188,5 @@
 	
 	// construct campaign
-	Campaign* c = new Campaign( element);
+	Campaign* c = new Campaign( root);
 	
 	// free the XML data
@@ -272,5 +270,5 @@
 	assert( factory != NULL);
 	
-	printf("Registered factory for '%s'\n", factory->getClassname());
+	PRINTF0("Registered factory for '%s'\n", factory->getClassname());
 	
 	if( first == NULL) first = factory;
@@ -286,5 +284,5 @@
 	if( first == NULL)
 	{
-		PRINTF(1)("GameLoader does not know any factories, fabricate() failed\n");
+		PRINTF0("GameLoader does not know any factories, fabricate() failed\n");
 		return NULL;
 	}
Index: /orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc
===================================================================
--- /orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc	(revision 3542)
@@ -24,5 +24,5 @@
    \param fileName file to parse and load (must be a .obj file)
 */
-OBJModel::OBJModel(char* fileName)
+OBJModel::OBJModel(const char* fileName)
 {
   this->initializeOBJ();
@@ -40,5 +40,5 @@
    \param scaling The factor that the model will be scaled with.
 */
-OBJModel::OBJModel(char* fileName, float scaling)
+OBJModel::OBJModel(const char* fileName, float scaling)
 {
   this->initializeOBJ();
@@ -84,5 +84,5 @@
    \param fileName The file to import
 */
-bool OBJModel::importFile (char* fileName)
+bool OBJModel::importFile (const char* fileName)
 {
   PRINTF(3)("preparing to read in file: %s\n", fileName);
@@ -96,8 +96,8 @@
   char pathSplitter='/';
 #endif /* __WIN32__ */
-  char* tmpName = fileName;
+  const char* tmpName = fileName;
   if (tmpName[0] == pathSplitter)
     tmpName++;
-  char* name = tmpName;
+  const char* name = tmpName;
   while (( tmpName = strchr (tmpName+1, pathSplitter)))
     {
@@ -212,5 +212,5 @@
 
 */
-bool OBJModel::readMtlLib (char* mtlFile)
+bool OBJModel::readMtlLib (const char* mtlFile)
 {
   this->mtlFileName = new char [strlen(mtlFile)+1];
Index: /orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h
===================================================================
--- /orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h	(revision 3541)
+++ /orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h	(revision 3542)
@@ -13,6 +13,6 @@
 {
  public:
-  OBJModel(char* fileName);
-  OBJModel(char* fileName, float scaling);
+  OBJModel(const char* fileName);
+  OBJModel(const char* fileName, float scaling);
   virtual ~OBJModel();
   void initializeOBJ(void);
@@ -25,7 +25,7 @@
 
   ///// readin /////
-  bool importFile (char* fileName);
+  bool importFile (const char* fileName);
   bool readFromObjFile (void);
-  bool readMtlLib (char* matFile);
+  bool readMtlLib (const char* matFile);
 
 };
Index: /orxonox/branches/levelloader/src/orxonox.cc
===================================================================
--- /orxonox/branches/levelloader/src/orxonox.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/orxonox.cc	(revision 3542)
@@ -251,5 +251,6 @@
   
   this->gameLoader = GameLoader::getInstance();
-  this->gameLoader->loadDebugCampaign(DEBUG_CAMPAIGN_0);
+  this->gameLoader->loadCampaign("../data/worlds/DefaultCampaign.oxc");
+  //this->gameLoader->loadDebugCampaign(DEBUG_CAMPAIGN_0);
   this->gameLoader->init();
   this->gameLoader->start();
Index: /orxonox/branches/levelloader/src/story_entities/campaign.cc
===================================================================
--- /orxonox/branches/levelloader/src/story_entities/campaign.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/story_entities/campaign.cc	(revision 3542)
@@ -56,15 +56,22 @@
 	}
 	else this->setStoryID( id);
-  	
+  
   // find WorldList
   element = root->FirstChildElement( "WorldList");
   
   // load Worlds/Subcampaigns/Whatever
+  StoryEntity* lastCreated = NULL;
 	while( element != NULL)
 	{
 		StoryEntity* created = (StoryEntity*) loader->fabricate( element);
-		if( created != NULL) addEntity( created);
+		if( lastCreated != NULL) created->setNextStoryID( lastCreated->getStoryID());
+		if( created != NULL)
+		{
+			this->addEntity( created);	
+			lastCreated = created;
+		}
 		element = element->NextSiblingElement();
 	}
+	if( lastCreated != NULL)	lastCreated->setStoryID( WORLD_ID_GAMEEND);
 }
 
Index: /orxonox/branches/levelloader/src/story_entities/world.cc
===================================================================
--- /orxonox/branches/levelloader/src/story_entities/world.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/story_entities/world.cc	(revision 3542)
@@ -42,9 +42,11 @@
 	int id;
 
+	PRINTF0("Creating a World\n");
+	
 	// identifier
 	string = grabParameter( root, "identifier");
 	if( string == NULL || sscanf(string, "%d", &id) != 1)
 	{
-		PRINTF(1)("World is missing a proper 'identifier'\n");
+		PRINTF0("World is missing a proper 'identifier'\n");
 		this->setStoryID( -1);
 	}
@@ -55,5 +57,5 @@
 	if( string == NULL)
 	{
-		PRINTF(1)("World is missing a proper 'path'\n");
+		PRINTF0("World is missing a proper 'path'\n");
 		this->setPath( NULL);
 	}
@@ -65,5 +67,6 @@
 	}
 	
-	
+	localPlayer = NULL;
+		
 }
 
@@ -138,9 +141,12 @@
 ErrorMessage World::load()
 {
+	
+	PRINTF0("Loading world: '%s'\n", getPath());
+	
 	GameLoader* loader = GameLoader::getInstance();
 	
   if( getPath() == NULL)
   {
-		PRINTF(1)("World has no path specified for loading");
+		PRINTF0("World has no path specified for loading");
 		return (ErrorMessage){213,"Path not specified","World::load()"};
   }
@@ -151,5 +157,5 @@
 	{
 		// report an error
-		PRINTF(1)("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
+		PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
 		delete XMLDoc;
 		return (ErrorMessage){213,"XML File parsing error","World::load()"};
@@ -165,5 +171,5 @@
 	{
 		// report an error
-		PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
+		PRINTF0("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
 		delete XMLDoc;
 		return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"};
@@ -176,10 +182,14 @@
 	if( string == NULL)
 	{
-		PRINTF(1)("World is missing a proper 'name'\n");
-		this->setStoryID( -1);
+		PRINTF0("World is missing a proper 'name'\n");
+		string = "Unknown";
+		temp = new char[strlen(string + 2)];
+		strcpy( temp, string);
+		this->worldName = temp;
 	}
 	else
 	{
 		temp = new char[strlen(string + 2)];
+		strcpy( temp, string);
 		this->worldName = temp;
 	}
@@ -191,5 +201,5 @@
   if( element == NULL)
   {
-		PRINTF(1)("World is missing 'WorldEntities'\n");
+		PRINTF0("World is missing 'WorldEntities'\n");
   }
   else
@@ -201,4 +211,7 @@
 			WorldEntity* created = (WorldEntity*) loader->fabricate( element);
 			if( created != NULL) spawn( created);
+			assert( element->Value() != NULL);
+				// if we load a 'Player' we use it as localPlayer
+			if( !strcmp( element->Value(), "Player")) localPlayer = (Player*) created;
 			element = element->NextSiblingElement();
 		}
@@ -209,5 +222,5 @@
   if( element == NULL)
   {
-		PRINTF(1)("World is missing a 'Track'\n");
+		PRINTF0("World is missing a 'Track'\n");
   }
   else
@@ -216,67 +229,42 @@
   	trackManager = TrackManager::getInstance();
   	trackManager->loadTrack( element);
-	}
-  
+  	trackManager->finalize();
+	}
+
 	
 	// free the XML data
 	delete XMLDoc;
 	
-  //  BezierCurve* tmpCurve = new BezierCurve();
-  if(this->debugWorldNr != -1)
-    {
-      // initializing Font
-      testFont = new FontSet();
-      testFont->buildFont("../data/pictures/font.tga");
-
+	// finalize world
+	  // initialize Font
+	  testFont = new FontSet();
+	  testFont->buildFont("../data/pictures/font.tga");
+	
+		// create null parent
+    this->nullParent = NullParent::getInstance ();
+    this->nullParent->setName ("NullParent");
+    
+    // finalize myPlayer
+		if( localPlayer == NULL)
+		{
+			PRINTF0("No Player specified in World '%s'\n", this->worldName);
+			return (ErrorMessage){213,"No Player defined","World::load()"};
+		}
+		
+    	// bind input
+    Orxonox *orx = Orxonox::getInstance ();
+    orx->getLocalInput()->bind (localPlayer);
+    
+    	// bind camera
+    this->localCamera = new Camera(this);
+    this->localCamera->setName ("camera");
+    this->localCamera->bind (localPlayer);
+    this->localPlayer->addChild (this->localCamera);
+
+	
+	// stuff beyond this point remains to be loaded properly
+	
       /*monitor progress*/
-      this->glmis->step();
-
-      /*
-	tmpCurve->addNode(Vector(10,  -1,  -1));
-	tmpCurve->addNode(Vector(10,  -2,   2));
-	tmpCurve->addNode(Vector(10,   3,   3));
-	tmpCurve->addNode(Vector(10,   4,  -4), 0);
-	tmpCurve->addNode(Vector(10,  -1,  -1));
-	tmpCurve->addNode(Vector(10,  -2,   2));
-	tmpCurve->addNode(Vector(10,   3,   3));
-	tmpCurve->addNode(Vector(10,   4,  -4), 0);
-	tmpCurve->debug();
-      */
-      switch(this->debugWorldNr)
-	{
-	  /*
-	    this loads the hard-coded debug world. this only for simplicity and will be 
-	    removed by a reald world-loader, which interprets a world-file.
-	    if you want to add an own debug world, just add a case DEBUG_WORLD_[nr] and
-	    make whatever you want...
-	   */
-	case DEBUG_WORLD_0:
-	  {
-	    this->nullParent = NullParent::getInstance ();
-	    this->nullParent->setName ("NullParent");
-
-	    // !\todo old track-system has to be removed
-
-	    //create helper for player
-	    HelperParent* hp = new HelperParent ();
-	    /* the player has to be added to this helper */
-
-	    // create a player
-	    WorldEntity* myPlayer = new Player ();
-	    myPlayer->setName ("player");
-	    this->spawn (myPlayer);
-	    this->localPlayer = myPlayer;
-	    /*monitor progress*/
-	    this->glmis->step();	    
-
-	    // bind input
-	    Orxonox *orx = Orxonox::getInstance ();
-	    orx->getLocalInput()->bind (myPlayer);
-	    
-	    // bind camera
-	    this->localCamera = new Camera(this);
-	    this->localCamera->setName ("camera");
-	    this->localCamera->bind (myPlayer);
-	    this->localPlayer->addChild (this->localCamera);
+  //  this->glmis->step();
 
 	    // Create SkySphere
@@ -284,67 +272,7 @@
 
 	    /*monitor progress*/
-	    this->glmis->step();
-
-	    Vector* es = new Vector (50, 2, 0);
-	    Quaternion* qs = new Quaternion ();
-	    WorldEntity* env = new Environment();
-	    env->setName ("env");
-	    this->spawn(env, es, qs);
-	   
-	    /*monitor progress*/
-	    this->glmis->step();
-
-	    trackManager->setBindSlave(env);
-
-	    break;
-	  }
-	case DEBUG_WORLD_1:
-	  {
-	    /*
-	    this->testCurve = new UPointCurve();
-	    this->testCurve->addNode(Vector( 0, 0, 0));
-	    this->testCurve->addNode(Vector(10, 0, 5));
-	    this->testCurve->addNode(Vector(20, -5,-5));
-	    this->testCurve->addNode(Vector(30, 5, 10));
-	    this->testCurve->addNode(Vector(40, 0,-10));
-	    this->testCurve->addNode(Vector(50, 0,-10));
-	    */
-
-	    this->nullParent = NullParent::getInstance ();
-	    this->nullParent->setName ("NullParent");
-
-
-
-	    // create a player
-	    WorldEntity* myPlayer = new Player();
-	    myPlayer->setName ("player");
-	    this->spawn(myPlayer);
-	    this->localPlayer = myPlayer;	    
-	    
-	    // bind input
-	    Orxonox *orx = Orxonox::getInstance();
-	    orx->getLocalInput()->bind (myPlayer);
-	    
-	    // bind camera
-	    this->localCamera = new Camera (this);
-	    this->localCamera->setName ("camera");
-	    this->localCamera->bind (myPlayer);	
-	    this->localPlayer->addChild (this->localCamera);
-
-	    // Create SkySphere
-	    skySphere = new Skysphere("../data/pictures/sky-replace.jpg");
-
-	    break;
-
-
-	  }
-	default:
-	  printf("World::load() - no world with ID %i found", this->debugWorldNr );
-	}
-    }
-  else if(this->worldName != NULL)
-    {
-
-    }
+	  //  this->glmis->step();
+	  
+	  //  trackManager->setBindSlave(env);
 
   // initialize debug coord system
Index: /orxonox/branches/levelloader/src/world_entities/environment.cc
===================================================================
--- /orxonox/branches/levelloader/src/world_entities/environment.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/world_entities/environment.cc	(revision 3542)
@@ -26,4 +26,5 @@
 
 
+CREATE_FACTORY(Environment);
 
 Environment::Environment () : WorldEntity()
@@ -32,5 +33,69 @@
 }
 
-
+Environment::Environment ( TiXmlElement* root)
+{
+	char* temp;
+	const char* string = grabParameter( root, "name");
+	if( string == NULL)
+	{
+		PRINTF(1)("Environment is missing a proper 'name'\n");
+		string = "Unknown";
+		temp = new char[strlen(string + 2)];
+		strcpy( temp, string);
+		this->setName( temp);
+	}
+	else
+	{
+		temp = new char[strlen(string + 2)];
+		strcpy( temp, string);
+		this->setName( temp);
+	}
+	
+	this->model = NULL;
+	string = grabParameter( root, "model");
+	if( string != NULL)
+		this->model = new OBJModel( string);
+	else
+	{
+		PRINTF(1)("Environment is missing a proper 'model'\n");
+		this->model = new OBJModel( "../data/models/reaplow.obj");
+	}
+	if( this->model == NULL)
+	{
+		PRINTF(1)("Environment model '%s' could not be loaded\n", string);
+	}
+	
+	double buff[3];
+	
+	string = grabParameter( root, "position");
+	if( string != NULL && sscanf( string, "%f,%f,%f", &(buff[0]), &(buff[1]), &(buff[2])) == 3)
+	{
+		Vector* es = new Vector( buff[0], buff[1], buff[2]);
+		this->setAbsCoor(es);
+		delete es;
+	}
+	else
+	{
+		PRINTF(1)("Environment is missing a proper 'position'\n");
+		Vector* es = new Vector();
+		this->setAbsCoor(es);
+		delete es;
+	}
+	
+	string = grabParameter( root, "orientation");
+	if( string != NULL && sscanf( string, "%f,%f,%f", &(buff[0]), &(buff[1]), &(buff[2])) == 3)
+	{
+		Quaternion* qs = new Quaternion( buff[0], buff[1], buff[2]);
+		this->setAbsDir(qs);
+		delete qs;
+	}
+	else
+	{
+		PRINTF(1)("Environment is missing a proper 'orientation'\n");
+  	Quaternion* qs = new Quaternion ();
+		this->setAbsDir(qs);
+		delete qs;
+	}
+}
 
 Environment::~Environment () 
Index: /orxonox/branches/levelloader/src/world_entities/environment.h
===================================================================
--- /orxonox/branches/levelloader/src/world_entities/environment.h	(revision 3541)
+++ /orxonox/branches/levelloader/src/world_entities/environment.h	(revision 3542)
@@ -18,4 +18,5 @@
  public:
   Environment ();
+  Environment (TiXmlElement* root);
   ~Environment ();
 
Index: /orxonox/branches/levelloader/src/world_entities/player.cc
===================================================================
--- /orxonox/branches/levelloader/src/world_entities/player.cc	(revision 3541)
+++ /orxonox/branches/levelloader/src/world_entities/player.cc	(revision 3542)
@@ -22,4 +22,6 @@
 
 using namespace std;
+
+CREATE_FACTORY(Player);
 
 /**
@@ -59,4 +61,45 @@
 
 /**
+   \brief creates a new Player from Xml Data
+   \param root the xml element containing player data
+   
+   \todo add more parameters to load
+*/
+Player::Player(TiXmlElement* root)
+{
+	char* temp;
+	const char* string;
+	string = grabParameter( root, "name");
+	if( string == NULL)
+	{
+		PRINTF(1)("Player is missing a proper 'name'\n");
+		string = "Unknown";
+		temp = new char[strlen(string + 2)];
+		strcpy( temp, string);
+		this->setName( temp);
+	}
+	else
+	{
+		temp = new char[strlen(string + 2)];
+		strcpy( temp, string);
+		this->setName( temp);
+	}
+	
+	this->model = NULL;
+	string = grabParameter( root, "model");
+	if( string != NULL)
+		this->model = new OBJModel( string);
+	else
+	{
+		PRINTF(1)("Player is missing a proper 'model'\n");
+		this->model = new OBJModel( "../data/models/reaplow.obj");
+	}
+	if( this->model == NULL)
+	{
+		PRINTF(1)("Player model '%s' could not be loaded\n", string);
+	}
+}
+
+/**
    \brief destructs the player
 */
Index: /orxonox/branches/levelloader/src/world_entities/player.h
===================================================================
--- /orxonox/branches/levelloader/src/world_entities/player.h	(revision 3541)
+++ /orxonox/branches/levelloader/src/world_entities/player.h	(revision 3542)
@@ -18,4 +18,5 @@
  public:
   Player(bool isFree = false);
+  Player(TiXmlElement* root);
   ~Player();
   
