Index: branches/bsp_model/src/lib/graphics/importer/bsp_file.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_file.cc	(revision 8192)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_file.cc	(revision 8195)
@@ -37,4 +37,7 @@
 #include <SDL/SDL_image.h>
 
+// STL Containers
+#include <vector>
+
 using namespace std;
 
@@ -50,5 +53,5 @@
 int BspFile::read(const char* name)
 {
-  //this->scale = 0.4;
+  this->scale = 1.0;
   int offset;
   int size;
@@ -605,5 +608,5 @@
   sc =  ((unsigned char *)(&lightMapTexture))[i];
   sc *= 1/255.0;
-  scale = 2.0;
+  scale = 1.0;
   if(sc > 1.0f && (temp = (1.0f/sc)) < scale) scale=temp;
   scale*=255.0;
Index: branches/bsp_model/src/lib/graphics/importer/bsp_file.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_file.h	(revision 8192)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_file.h	(revision 8195)
@@ -18,4 +18,5 @@
 */
 
+#include <vector>
 class SDL_Surface;
 class BspTreeNode;
@@ -212,5 +213,5 @@
 
  
-
+  ::std::vector<MoviePlayer* > MovieMaterials; //!< Movieplayer Materials
 };
 
Index: branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8192)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8195)
@@ -1,19 +1,19 @@
 /*
    orxonox - the future of 3D-vertical-scrollers
-
+ 
    Copyright (C) 2006 orx
-
+ 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
-
+ 
    ### File Specific:
    main-programmer: bottac@ee.ethz.ch
-
+ 
    Inspired by:
    Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
    Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
-
+ 
    Collision detection adapted from:
    Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
@@ -47,4 +47,5 @@
 
 
+
 //CREATE_FACTORY( BspManager, CL_BSP_MODEL);
 
@@ -59,5 +60,5 @@
   this->alreadyVisible = new bool [this->bspFile->numFaces];
   */
-  CDEngine::getInstance()->setBSPModel(this);
+
 }
 
@@ -66,9 +67,9 @@
 BspManager::BspManager(const TiXmlElement* root)
 {
-
-
+ 
+ 
   if( root != NULL)
     this->loadParams(root);
-
+ 
   CDEngine::getInstance()->setBSPModel(this);
 } */
@@ -77,5 +78,5 @@
 {
   //this->setClassID(CL_BSP_MODEL, "BspManager");
-    // open a BSP file
+  // open a BSP file
   this->bspFile = new BspFile();
   this->bspFile->scale =  scale;
@@ -85,4 +86,5 @@
   this->alreadyVisible = new bool [this->bspFile->numFaces];
 
+  CDEngine::getInstance()->setBSPModel(this);
 
 }
@@ -97,9 +99,13 @@
   this->root  = this->bspFile->get_root();
   this->alreadyVisible = new bool [this->bspFile->numFaces];
-
+ 
   CDEngine::getInstance()->setBSPModel(this);
 }
 */
 
+const void BspManager::tick(float time)
+{
+  
+}
 const void BspManager::draw()
 {
@@ -109,17 +115,19 @@
   this->out1 = this->out;
   this->out2 = this->out;
-  if(this->collPlane != NULL)
-  {
-  this->out1.x += this->collPlane->x*5.0;
-  this->out1.y += this->collPlane->y*5.0;
-  this->out1.z += this->collPlane->z*5.0;
-
-  this->out2.x += this->collPlane->x*10.0;
-  this->out2.y += this->collPlane->y*10.0;
-  this->out2.z += this->collPlane->z*10.0;
+  if(this->collPlane != NULL) {
+    this->out1.x += this->collPlane->x*5.0;
+    this->out1.y += this->collPlane->y*5.0;
+    this->out1.z += this->collPlane->z*5.0;
+
+    this->out2.x += this->collPlane->x*10.0;
+    this->out2.y += this->collPlane->y*10.0;
+    this->out2.z += this->collPlane->z*10.0;
   }
   this->drawDebugCube(&this->out1);
   this->drawDebugCube(&this->out2);
+  
   */
+  
+
   // Draw Debug Terrain
   /*
@@ -148,5 +156,5 @@
 
 
-  // this->viewDir=    State::getCameraTarget()->getAbsCoor() -  State::getCamera()->getAbsCoor() ;
+  this->viewDir=    State::getCamera()->getAbsDirX();
   float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z);
 
@@ -157,13 +165,13 @@
 
 
-  this->cam = State::getCameraTargetNode()->getAbsCoor();
-  // this->checkCollision(this->root, &this->cam);   //!< Test Collision Detection
+ 
+ // this->checkCollision(this->root, &this->cam);   //!< Test Collision Detection
+  
+  
   this->outputStartsOut = true;
   this->outputAllSolid = false;
   this->outputFraction = 1.0f;
-
-  this->checkCollisionRay(this->root,0.0f,1.0f, &(State::getCameraTargetNode()->getLastAbsCoor()), &this->cam);
-
-  //if(this->outputFraction != 1.0f || this->outputAllSolid ) this->drawDebugCube(&this->cam);
+  this->checkCollision(State::getPlayer()->getPlayable());
+  
 
   if ( viscluster < 0  || ((int *)(this->bspFile->header))[35] == 0 )  //!< if (sizeof(Visdata) == 0)
@@ -172,5 +180,5 @@
 
 
-    // Iterate through all Leafspublic final double readLEDouble()
+    // Iterate through all Leafs
     for(int i = 0; i <  this->bspFile->numLeafs   ; i++ )
     {
@@ -179,12 +187,8 @@
       if(curLeaf.cluster<0) continue;
 
-
       /** Do Frustum culling and draw 'em all **/
-      bool inFrustum = true;
-
-      Vector dir;
-      dir.x = State::getCameraNode()->getAbsDirX().x;
-      dir.y =  State::getCameraNode()->getAbsDirX().y;
-      dir.z =  State::getCameraNode()->getAbsDirX().z;
+     
+      Vector dir = State::getCameraNode()->getAbsDirX();
+
       float dist =  dir.x*this->cam.x +dir.y*this->cam.y +dir.z*this->cam.z;
       //if(dist < 0) dist = -dist;
@@ -192,8 +196,8 @@
       const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist ;
 
-      if(dMins < -150.0 && dMaxs < -150.0) {
+      if(dMins < -300.0 && dMaxs < -300.0) {
         continue;
       }
-      if( (this->cam - Vector(curLeaf.mins[0],curLeaf.mins[1], curLeaf.mins[2])).len() > 3000  && (this->cam - Vector(curLeaf.maxs[0],curLeaf.maxs[1], curLeaf.maxs[2])).len() > 3000) {
+      if( (this->cam - Vector(curLeaf.mins[0],curLeaf.mins[1], curLeaf.mins[2])).len() > 2000  && (this->cam - Vector(curLeaf.maxs[0],curLeaf.maxs[1], curLeaf.maxs[2])).len() > 2000) {
         continue;
       }
@@ -206,5 +210,4 @@
         if (f >=0 && !this->isAlreadyVisible(f)) {
           this->alreadyVisible[f] = true;
-
           addFace(f); // "visibleFaces.append(f)"
         }
@@ -794,5 +797,5 @@
     // STEP 3: calculate the middle point for the first side
     middleFraction = startFraction +
-        (endFraction - startFraction) * fraction1;
+                     (endFraction - startFraction) * fraction1;
 
     middle.x = start->x + fraction1 * (end->x - start->x);
@@ -805,9 +808,9 @@
 
     else this->checkCollisionRayN(node->right,startFraction, middleFraction,
-                                 start, &middle );
+                                    start, &middle );
 
     // STEP 5: calculate the middle point for the second side
     middleFraction = startFraction +
-        (endFraction - startFraction) * fraction2;
+                     (endFraction - startFraction) * fraction2;
 
     middle.x = start->x + fraction2 * (end->x - start->x);
@@ -824,8 +827,35 @@
 
 }
+void BspManager::checkCollisionBox(void)
+{
+  
+};
+
+void BspManager::TraceBox( Vector& inputStart, Vector& inputEnd,
+               Vector& inputMins, Vector& inputMaxs )
+{
+  if (inputMins.x == 0 && inputMins.y == 0 && inputMins.z == 0 &&
+      inputMaxs.x == 0 && inputMaxs.y == 0 && inputMaxs.z == 0)
+  {   // the user called TraceBox, but this is actually a ray
+   //!> FIXME TraceRay( inputStart, inputEnd );
+  }
+  else
+  {   // setup for a box
+    //traceType = TT_BOX;
+    this->traceMins = inputMins;
+    this->traceMaxs = inputMaxs;
+    this->traceExtents.x = -traceMins.x > traceMaxs.x ?
+        -traceMins.x : traceMaxs.x;
+    this->traceExtents.y = -traceMins.y > traceMaxs.y ?
+        -traceMins.y : traceMaxs.y;
+    this->traceExtents.z = -traceMins.z > traceMaxs.z ?
+        -traceMins.z : traceMaxs.z;
+   //!> FIXME Trace( inputStart, inputEnd );
+  }
+}
 
 void BspManager::checkCollision(WorldEntity* worldEntity)
 {
-  return;
+
 
   Vector position = worldEntity->getAbsCoor();
@@ -833,7 +863,7 @@
 
   Vector forwardDir = worldEntity->getAbsDirX();
-  forwardDir.x =2.0*forwardDir.x;
-  forwardDir.y =2.0*forwardDir.y;
-  forwardDir.z =2.0*forwardDir.z;
+  forwardDir.x =8.0*forwardDir.x;
+  forwardDir.y =8.0*forwardDir.y;
+  forwardDir.z =8.0*forwardDir.z;
 
   Vector upDir = worldEntity->getAbsDirY();
@@ -842,7 +872,6 @@
   dest.y  += forwardDir.y;
   dest.z  += forwardDir.z;
-  Vector out = Vector(-1875.0,-1875.0,-1875.0);
+  Vector out = dest;
   if(!worldEntity->isA(CL_PLAYABLE)) {
-
 
 
@@ -855,5 +884,5 @@
     Vector dest1 = position1 + forwardDir;
     Vector dest2 = position2 + forwardDir;
-    dest = position - upDir;
+    dest = position - Vector(0.0, 20.0,0.0);
     Vector out1;
     Vector out2;
@@ -871,10 +900,9 @@
     this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
     if(this->outputFraction == 1.0f) out2= dest;
-    else
-    {
+    else {
       collision = true;
-    out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction;
-    out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction;
-    out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction;
+      out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction;
+      out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction;
+      out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction;
 
     }
@@ -882,24 +910,24 @@
     this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
     if(this->outputFraction == 1.0f) out = dest;
-    else
-    {
-    collision = true;
-    out.x = position.x + (dest.x -position.x) * this->outputFraction;
-    out.y = position.y + (dest.y -position.y) * this->outputFraction;
-    out.z = position.z + (dest.z -position.z) * this->outputFraction;
-
-    //Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
-    //this->out = out;
-    //this->out1 = out1;
-    //this->out2 = out2;
-    //this->drawDebugCube(&out1);
-    //this->drawDebugCube(&out2);
-
-    //this->drawDebugCube(&out3);
+    else {
+      collision = true;
+      out.x = position.x + (dest.x -position.x) * this->outputFraction;
+      out.y = position.y + (dest.y -position.y) * this->outputFraction;
+      out.z = position.z + (dest.z -position.z) * this->outputFraction;
+
+      Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
+      this->out = out;
+      this->out1 = out1;
+      this->out2 = out2;
+      //this->drawDebugCube(&out1);
+      //this->drawDebugCube(&out2);
+
+      //this->drawDebugCube(&out3);
 
     }
 
     // Return the normal here: Normal's stored in this->collPlane;
-//    if(collision) worldEntity->collidesWithGround(out,out1,out2);
+    
+    if(collision) worldEntity->collidesWithGround(out,out1,out2);
 
   }
@@ -938,6 +966,6 @@
       this->drawDebugCube(&this->cam);
       this->drawDebugCube(&next);
-      State::getPlayer()->getPlayable()->setRelCoor(-100,-100,-100);
-      State::getPlayer()->getPlayable()->collidesWith(NULL, State::getCameraTargetNode()->getLastAbsCoor());
+     // State::getPlayer()->getPlayable()->setRelCoor(-100,-100,-100);
+      //State::getPlayer()->getPlayable()->collidesWith(NULL, State::getCameraTargetNode()->getLastAbsCoor());
     }
 
Index: branches/bsp_model/src/lib/graphics/importer/bsp_manager.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_manager.h	(revision 8192)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_manager.h	(revision 8195)
@@ -52,4 +52,5 @@
   // Functions
   const void draw();
+  const void tick(float time);
   void draw_debug_face(int Face); 
   void draw_face(int Face);
@@ -57,12 +58,15 @@
   
 
-  void checkCollision(WorldEntity* worldEntity);
+  void checkCollision(WorldEntity* worldEntity); /*!< WorldEntities use this function to check wheter they collided with the BSPEntity.
+                                                      If a collision has been detected, the collides-function of worldEntity will be called.*/
 
 private:
   // Functions
   BspTreeNode* getLeaf(BspTreeNode*  node,   Vector* cam) ;  //!< Traverses the tree
-  void  checkCollision(BspTreeNode* node, Vector* cam);
+  void  checkCollision(BspTreeNode* node, Vector* cam); //!< Obsolete. Use this function for debugging only!
   void  checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end); 
-  void  checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end); 
+  void  checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
+  void TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs );
+  void  checkCollisionBox(void);
   void  checkBrushRay(brush* curBrush);
   void  checkBrushRayN(brush* curBrush);
@@ -80,9 +84,14 @@
   int lastTex;
   
-  //obsolete
+  //obsolete: global variables for collision detection
   bool  outputStartsOut;
   bool  outputAllSolid;
   float outputFraction;
+  Vector traceMins; //!< Mins of current bbox
+  Vector traceMaxs; //!< Maxs of current bbox
+  Vector traceExtents; /*!< Stores the maximum of the absolute value of each axis in the box. 
+                            For example, if traceMins was (-100,-3,-15) and traceMaxs was (55,22,7), traceExtents */
   
+ 
   bool * alreadyVisible;
   // Deques to store the visible faces
@@ -90,7 +99,7 @@
   ::std::deque<int> opal; //!< the others here.
 
-  Vector out;
-  Vector out1;
-  Vector out2;
+  Vector out;  //!< For debugging only
+  Vector out1; //!< For debugging only 
+  Vector out2; //!< For debugging only
 };
 
Index: branches/bsp_model/src/world_entities/bsp_entity.cc
===================================================================
--- branches/bsp_model/src/world_entities/bsp_entity.cc	(revision 8192)
+++ branches/bsp_model/src/world_entities/bsp_entity.cc	(revision 8195)
@@ -96,5 +96,5 @@
 void BSPEntity::tick(float time)
 {
-
+  this->bspManager->tick(time);
 }
 
Index: branches/bsp_model/src/world_entities/world_entity.cc
===================================================================
--- branches/bsp_model/src/world_entities/world_entity.cc	(revision 8192)
+++ branches/bsp_model/src/world_entities/world_entity.cc	(revision 8195)
@@ -499,15 +499,17 @@
 
   Vector v = this->getAbsDirX();
-  v.x *= 10;
-  v.y *= 10;
-  v.z *= 10;
-  Vector u = this->getAbsDirY();
-
-  if(feet.x == (u.x+this->getAbsCoor().x) &&  feet.y == u.y +this->getAbsCoor().y && feet.z == this->getAbsCoor().z)
+  v.x *= 10.1;
+  v.y *= 10.1;
+  v.z *= 10.1;
+  Vector u = Vector(0.0,-20.0,0.0);
+
+         
+  if(!(this->getAbsCoor().x == ray_2.x && this->getAbsCoor().y == ray_2.y && this->getAbsCoor().z == ray_2.z) )
   {
 
   this->setAbsCoor(ray_2 - v);
-  }
-  else
+
+  }
+    else
   {
     if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z)
@@ -519,4 +521,6 @@
 
   }
+   
+    
 }
 
