Index: branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc	(revision 8888)
+++ branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc	(revision 8889)
@@ -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/
@@ -69,9 +69,9 @@
 BspManager::BspManager(const TiXmlElement* root)
 {
-
-
+ 
+ 
   if( root != NULL)
     this->loadParams(root);
-
+ 
   CDEngine::getInstance()->setBSPModel(this);
 } */
@@ -99,5 +99,5 @@
   this->root  = this->bspFile->get_root();
   this->alreadyVisible = new bool [this->bspFile->numFaces];
-
+ 
   CDEngine::getInstance()->setBSPModel(this);
 }
@@ -912,12 +912,10 @@
 {
   leaf& curLeaf = this->bspFile->leaves[node->leafIndex];
-  for(int i = 0; i < curLeaf.n_leaffaces ; i++) {
-  }
+  for(int i = 0; i < curLeaf.n_leaffaces ; i++) {}
   return 10.0f;
 }
 
 void BspManager::checkCollisionBox(void)
-{
-}
+{}
 ;
 
@@ -968,5 +966,5 @@
   Vector out = dest;
 
-  
+
   bool SolidFlag = false;
   bool collision = false;
@@ -984,6 +982,5 @@
 
 
-  if( box != NULL)
-  {
+  if( box != NULL) {
     position = worldEntity->getAbsCoor() +  box->center; // + box->axis[1] * box->halfLength[1];
     dest     = worldEntity->getAbsCoor() +  box->center - box->axis[1] * box->halfLength[1] * 40.0;
@@ -996,7 +993,5 @@
     dest2     = worldEntity->getAbsCoor() +  box->center - box->axis[2] * box->halfLength[2] * 2.0f;
 
-  }
-  else
-  {
+  } else {
     // Init positions and destinations to anything useful!
 
@@ -1032,5 +1027,5 @@
 
 
-        out = dest;
+      out = dest;
 
     } else {
@@ -1049,37 +1044,48 @@
   plane* testPlane = this->collPlane;
 
-  
+
   bool xCollision = false;
   bool zCollision = false;
-  if(!SolidFlag)
-  {
-
-  // 2nd Collision Detection
-  this->outputStartsOut = true;
-  this->outputAllSolid = false;
-  this->outputFraction = 1.0f;
-  this->inputStart =  position1;
-  this->inputEnd =   dest1;
-  this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
-  out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction;
-  xCollision = true;
-  //out.z = this->outputFraction;
-
-  if(!SolidFlag)
-  {
-
-    // 3rd Collision Detection
-  this->outputStartsOut = true;
-  this->outputAllSolid = false;
-  this->outputFraction = 1.0f;
-  this->inputStart =  position2;
-  this->inputEnd =   dest2;
-  this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
-  //out.x = this->outputFraction;
-  out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
-  if(this->outputFraction != 1.0 )
-    zCollision = true;
-  }
-  }
+  if(!SolidFlag) {
+
+    // 2nd Collision Detection
+    this->outputStartsOut = true;
+    this->outputAllSolid = false;
+    this->outputFraction = 1.0f;
+    this->inputStart =  position1;
+    this->inputEnd =   dest1;
+    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
+
+    if(!this->outputAllSolid != 1.0f) {
+      out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction;
+      xCollision = true;
+    }
+    if(this->outputAllSolid) {
+      SolidFlag = true;
+      xCollision = true;   
+    }
+    //out.z = this->outputFraction;
+
+    if(!SolidFlag) {
+
+      // 3rd Collision Detection
+      this->outputStartsOut = true;
+      this->outputAllSolid = false;
+      this->outputFraction = 1.0f;
+      this->inputStart =  position2;
+      this->inputEnd =   dest2;
+      this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
+      //out.x = this->outputFraction;
+
+      if(this->outputFraction != 1.0f ) {
+        out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
+        zCollision = true;
+      }
+      if(this->outputAllSolid) {
+          SolidFlag = true;
+          zCollision = true;   
+      }
+    }
+  }//end if
   /*
   This is how you would calculate the Coordinates where worldEntity Collided with the BSP world.
@@ -1090,17 +1096,13 @@
 
   // Return the normal here: Normal's stored in this->collPlane;
-  if( collision)
-  {
+  if( collision) {
     PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y || (xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0), this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
-  }
-  else 
-  {
-    if(xCollision || yCollision)
-    {
-      
-      worldEntity->registerCollision((xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0) , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, false);
-    }
-    
+  } else {
+    if(xCollision || zCollision) {
+
+      worldEntity->registerCollision((xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0) , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
+    }
+
   }
   //else  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false);
