Index: /trunk/src/lib/graphics/importer/bsp/bsp_manager.cc
===================================================================
--- /trunk/src/lib/graphics/importer/bsp/bsp_manager.cc	(revision 10518)
+++ /trunk/src/lib/graphics/importer/bsp/bsp_manager.cc	(revision 10519)
@@ -21,4 +21,5 @@
 
 
+#include "limits.h"
 #include "vector.h"
 #include "bsp_file.h"
@@ -300,50 +301,133 @@
 
   // now sort the transparent faces in the right order
-  int size = this->trasparent.size();
-
-  // bubble sort
-  bool hasSwapped = true;
-  Vector v1, v2;
-
-  while( hasSwapped)
-  {
-    hasSwapped = false;
-
-    for( int i = 0; i < size - 1; i++)
-    {
-      // sorting test
-      face& fac1 =  (this->bspFile->faces)[this->trasparent[i]];
-      face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
-
-      // get center of face 1
-      const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
-
-      // assign the values of the vertices
-      v1(curVertex[fac1.vertex].position[0], curVertex[fac1.vertex].position[1], curVertex[fac1.vertex].position[2]);
-      v2(curVertex[fac2.vertex].position[0], curVertex[fac2.vertex].position[1], curVertex[fac2.vertex].position[2]);
-      // relativly to observer
-      v1 = this->cam - v1;
-      v2 = this->cam - v2;
-
-
-
-      // swap if necessary
-      if( v1.len() - v2.len() > 1)
+  if (this->sortTransparency == 1) {
+      int size = this->trasparent.size();
+      
+      // bubble sort
+      bool hasSwapped = true;
+      Vector v1, v2;
+
+      // initialize distance array
+      float * distToPlayer = new float [size];
+      for (int i = 0; i < size; i++)
       {
-        // swap elements
-        int tmp = this->trasparent[i+1];
-        this->trasparent[i+1] = this->trasparent[i];
-        this->trasparent[i] = tmp;
-
-        //printf( "has swapped: %d\n", i );
-
-        //v1.debug();
-        //v2.debug();
-        hasSwapped = true;
+          face& fac1 =  (this->bspFile->faces)[this->trasparent[i]];
+//          face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
+
+          // get center of face 1
+          const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
+
+          if (this->sortTransparencyMore == 1)
+          {
+              // assign the values of the vertices
+              float maxDist = 0;
+              float curDist = 0;
+              int maxVert = fac1.vertex;
+              for (int v = 0; v < fac1.n_vertexes; v++)
+              {
+                    v1(curVertex[fac1.vertex + v].position[0], curVertex[fac1.vertex + v].position[1], curVertex[fac1.vertex + v].position[2]);
+                    curDist = (this->cam - v1).len();
+                    if (curDist > maxDist)
+                    {
+                        maxDist = curDist;
+                        maxVert = fac1.vertex + v;
+                    }
+              }
+              v1(curVertex[maxVert].position[0], curVertex[maxVert].position[1], curVertex[maxVert].position[2]);
+          }
+          else
+          {
+              v1(curVertex[fac1.vertex].position[0], curVertex[fac1.vertex].position[1], curVertex[fac1.vertex].position[2]);
+          }
+
+          // relativly to observer
+          v1 = this->cam - v1;
+
+          // save in array
+          distToPlayer[i] = v1.len();
       }
-    }
-  }
-  //printf("hasSwapped == false\n");
-
+
+      while( hasSwapped)
+      {
+        hasSwapped = false;
+
+        for( int i = 0; i < size - 1; i++)
+        {
+/*
+          // sorting test
+          face& fac1 =  (this->bspFile->faces)[this->trasparent[i]];
+          face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
+
+          // get center of face 1
+          const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
+          
+          if (this->sortTransparencyMore == 1)
+          {
+              // assign the values of the vertices
+              float maxDist = 0;
+              float curDist = 0;
+              int maxVert = fac1.vertex;
+              for (int v = 0; v < fac1.n_vertexes; v++)
+              {
+                    v1(curVertex[fac1.vertex + v].position[0], curVertex[fac1.vertex + v].position[1], curVertex[fac1.vertex + v].position[2]);
+                    curDist = (this->cam - v1).len();
+                    if (curDist > maxDist)
+                    {
+                        maxDist = curDist;
+                        maxVert = fac1.vertex + v;
+                    }
+              }
+              v1(curVertex[maxVert].position[0], curVertex[maxVert].position[1], curVertex[maxVert].position[2]);
+
+              maxDist = 0;
+              curDist = 0;
+              maxVert = fac1.vertex;
+              for (int v = 0; v < fac2.n_vertexes; v++)
+              {
+                    v2(curVertex[fac2.vertex + v].position[0], curVertex[fac2.vertex + v].position[1], curVertex[fac2.vertex + v].position[2]);
+                    curDist = (this->cam - v2).len();
+                    if (curDist > maxDist)
+                    {
+                        maxDist = curDist;
+                        maxVert = fac2.vertex + v;
+                    }
+              }
+              v2(curVertex[maxVert].position[0], curVertex[maxVert].position[1], curVertex[maxVert].position[2]);
+          }
+          else
+          {
+              v1(curVertex[fac1.vertex].position[0], curVertex[fac1.vertex].position[1], curVertex[fac1.vertex].position[2]);
+              v2(curVertex[fac2.vertex].position[0], curVertex[fac2.vertex].position[1], curVertex[fac2.vertex].position[2]);
+          }
+
+          // relativly to observer
+          v1 = this->cam - v1;
+          v2 = this->cam - v2;
+
+
+*/
+          // swap if necessary
+//          if( v1.len() - v2.len() > 1)
+          if( distToPlayer[i] - distToPlayer[i+1] > 1)
+          {
+            // swap elements
+            float tmp1 = distToPlayer[i+1];
+            distToPlayer[i+1] = distToPlayer[i];
+            distToPlayer[i] = tmp1;
+            
+            int tmp2 = this->trasparent[i+1];
+            this->trasparent[i+1] = this->trasparent[i];
+            this->trasparent[i] = tmp2;
+
+            //printf( "has swapped: %d\n", i );
+
+            //v1.debug();
+            //v2.debug();
+            hasSwapped = true;
+          }
+        }
+      }
+      //printf("hasSwapped == false\n");
+  }
 
 
Index: /trunk/src/lib/graphics/importer/bsp/bsp_manager.h
===================================================================
--- /trunk/src/lib/graphics/importer/bsp/bsp_manager.h	(revision 10518)
+++ /trunk/src/lib/graphics/importer/bsp/bsp_manager.h	(revision 10519)
@@ -78,4 +78,7 @@
                                                       If a collision has been detected, the collides-function of worldEntity will be called.*/
 
+  int sortTransparency;              //!< sort transparent textures
+  int sortTransparencyMore;          //!< sort transparent textures better
+
 private:
   // collision functions
Index: /trunk/src/world_entities/bsp_entity.cc
===================================================================
--- /trunk/src/world_entities/bsp_entity.cc	(revision 10518)
+++ /trunk/src/world_entities/bsp_entity.cc	(revision 10519)
@@ -57,4 +57,7 @@
 
   this->bspManager = NULL;
+  this->sortTransparency = 1;
+  this->sortTransparencyMore = 0;
+
 
   this->name_handle = registerVarId( new SynchronizeableString( &this->name, &this->name_write, "name", PERMISSION_MASTER_SERVER ) );
@@ -74,4 +77,6 @@
 
     this->bspManager = new BspManager(this);
+    this->bspManager->sortTransparency = this->sortTransparency;
+    this->bspManager->sortTransparencyMore = this->sortTransparencyMore;
 
     if(this->bspManager->load(name.c_str(), 0.1f) == -1 ) {
@@ -87,4 +92,15 @@
 }
 
+void BspEntity::setTransparency(int sort, int sortMore)
+{
+  this->sortTransparency = sort;
+  this->sortTransparencyMore = sortMore;
+  
+  if (this->bspManager != NULL)
+  {
+    this->bspManager->sortTransparency = sort;
+    this->bspManager->sortTransparencyMore = sortMore;
+  }
+}
 
 /**
@@ -101,4 +117,8 @@
   .describe("Sets the of the BSP file.");
 
+  LoadParam(root, "Transparency", this, BspEntity, setTransparency)
+  .describe("1. argument: true -> sort transparent textures; 2. argument: true -> better but slower sorting")
+  .defaultValues(1, 0);
+  
   /*  LoadParam(root, "Scale", this, BSpEntity, setScale)
         .describe("Sets the scale factore of the bsp level.");
Index: /trunk/src/world_entities/bsp_entity.h
===================================================================
--- /trunk/src/world_entities/bsp_entity.h	(revision 10518)
+++ /trunk/src/world_entities/bsp_entity.h	(revision 10519)
@@ -26,4 +26,5 @@
 
   void setName(const std::string& name);
+  void setTransparency(int sort, int sortMore = 0);
 
   void init();
@@ -44,5 +45,6 @@
    std::string name_write;             //!< temp variable to store name
    int name_handle;                    //!< handle for name
-
+   int sortTransparency;              //!< sort transparent textures
+   int sortTransparencyMore;          //!< sort transparent textures better
 };
 
Index: /trunk/src/world_entities/environments/rotor.cc
===================================================================
--- /trunk/src/world_entities/environments/rotor.cc	(revision 10518)
+++ /trunk/src/world_entities/environments/rotor.cc	(revision 10519)
@@ -30,6 +30,6 @@
 {
   this->registerObject(this, Rotor::_objectList);
-  this->toList(OM_GROUP_00);
-  
+  this->toList(OM_ENVIRON);
+
   //PRINTF(0)("loading Rotor");
 
@@ -63,5 +63,5 @@
 {
      this->shiftDir(Quaternion(rotation.x*dt, Vector(1,0,0)) * Quaternion(rotation.y*dt, Vector(0,1,0)) * Quaternion(rotation.z*dt, Vector(0,0,1)));
-     
+
 }
 
Index: /trunk/src/world_entities/npcs/mover.cc
===================================================================
--- /trunk/src/world_entities/npcs/mover.cc	(revision 10518)
+++ /trunk/src/world_entities/npcs/mover.cc	(revision 10519)
@@ -20,4 +20,6 @@
 
 #include "mover.h"
+#include "state.h"
+#include "camera.h"
 
 
@@ -31,5 +33,5 @@
 {
     this->registerObject(this, Mover::_objectList);
-    this->toList(OM_COMMON);
+    this->toList(OM_ENVIRON);
 
     this->targetCoordinates = Vector(0, 0, 0);
@@ -224,7 +226,7 @@
         if (distance < this->actionRadius)
         {
-            this->soundSource_starting.setSourceNode(entity);   // bad hack!
-            this->soundSource_moving.setSourceNode(entity);     // TODO: make the sound louder without
-            this->soundSource_ending.setSourceNode(entity);     // attaching him to the player
+            this->soundSource_starting.setSourceNode((PNode*)State::getCamera());   // bad hack!
+            this->soundSource_moving.setSourceNode((PNode*)State::getCamera());     // TODO: make the sound louder without
+            this->soundSource_ending.setSourceNode((PNode*)State::getCamera());     // attaching him to the player
             return true;
         }
Index: /trunk/src/world_entities/particles/particle_system.cc
===================================================================
--- /trunk/src/world_entities/particles/particle_system.cc	(revision 10518)
+++ /trunk/src/world_entities/particles/particle_system.cc	(revision 10519)
@@ -264,4 +264,8 @@
   emitter->system = this;
   this->emitters.push_back(emitter);
+
+  // init the emitertter with the coordinates of the system
+  emitter->setAbsCoor(this->getAbsCoor());
+
 }
 
