Index: trunk/src/lib/collision_reaction/cr_defs.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_defs.h	(revision 9059)
+++ trunk/src/lib/collision_reaction/cr_defs.h	(revision 9061)
@@ -29,9 +29,12 @@
 
 //!< the collision axis x collision event
-#define COLLISION_TYPE_AXIS_X   1
+#define COLLISION_TYPE_AXIS_X      1
+#define COLLISION_TZPE_AXIS_X_NEG  2
 //!< the collision axis y collision event
-#define COLLISION_TYPE_AXIS_Y   2
+#define COLLISION_TYPE_AXIS_Y      3
+#define COLLISION_TYPE_AXIS_Y_NEG  4
 //!< the collision axis z collision event
-#define COLLISION_TYPE_AXIS_Z   4
+#define COLLISION_TYPE_AXIS_Z      5
+#define COLLISION_TYPE_AXIS_Z_NEG  6
 //!< the collision is a obb collision
 #define COLLISION_TYPE_OBB      8
Index: trunk/src/lib/collision_reaction/cr_object_damage.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 9059)
+++ trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 9061)
@@ -64,12 +64,12 @@
     damage = collision->getEntityB()->getDamage();
     collision->getEntityA()->hit(damage, collision->getEntityB());
+    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
   }
-  PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
 
   if( collision->isEntityBCollide()) {
     damage = collision->getEntityA()->getDamage();
     collision->getEntityB()->hit(damage, collision->getEntityA());
+    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
   }
-  PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
 
   collision->flushCollisionEvents();
Index: trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 9059)
+++ trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 9061)
@@ -95,16 +95,38 @@
         // collision in the x-axis
       case COLLISION_TYPE_AXIS_X:
-        front = collPos.x - box->halfLength[0]; // should be [0]
+        front = collPos.len() - box->halfLength[0]; // should be [0]
 
         // object is beneath the plane (ground)
         if( front <= 0.0f )
         {
-          Vector backoff = entity->getAbsDirX() * front;
-//           entity->shiftCoor(backoff);
-        }
-        // object is already in the wall
-        else if( ce->isInWall())
-        {
-//           entity->setAbsCoor(entity->getLastAbsCoor());
+          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
+          Vector backoff = dirX * front;
+          
+          entity->setAbsCoor(entity->getLastAbsCoor());
+         // entity->shiftCoor(backoff);
+        }
+        // object is already in the wall
+        else if( ce->isInWall())
+        {
+              entity->setAbsCoor(entity->getLastAbsCoor());
+        }
+        break;
+        
+      case COLLISION_TYPE_AXIS_X_NEG:
+        front = collPos.len() - box->halfLength[0]; // should be [0]
+
+        // object is beneath the plane (ground)
+        if( front <= 0.0f )
+        {
+          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
+          Vector backoff = dirX * front * -1.0f;
+          
+          entity->setAbsCoor(entity->getLastAbsCoor());
+         // entity->shiftCoor(backoff);
+        }
+        // object is already in the wall
+        else if( ce->isInWall())
+        {
+          entity->setAbsCoor(entity->getLastAbsCoor());
         }
         break;
@@ -112,5 +134,5 @@
 
         // collision in the y-axis
-      case COLLISION_TYPE_AXIS_Y:
+      case COLLISION_TYPE_AXIS_Y_NEG:
         // calulate the height above ground
         height = collPos.y - box->halfLength[1];
@@ -118,7 +140,8 @@
 
         // object is beneath the plane (ground)
-        if( height <= 0.0f )
-        {
-          entity->shiftCoor(Vector(0.0f, -height, 0.0f));
+        if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
+        else if( height < 0.0f )
+        {
+          entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
           entity->setOnGround(true);
         }
@@ -140,16 +163,39 @@
       case COLLISION_TYPE_AXIS_Z:
 
-        side = collPos.z - box->halfLength[2]; // should be [2]
+        side = collPos.len()  - box->halfLength[2]; // should be [2]
 
         // object is beneath the plane (ground)
         if( side <= 0.0f )
         {
-          Vector backoff = entity->getAbsDirX() * side;
-//           entity->shiftCoor(backoff);
-        }
-        // object is already in the wall
-        else if( ce->isInWall())
-        {
-//           entity->setAbsCoor(entity->getLastAbsCoor());
+          entity->setAbsCoor(entity->getAbsCoor());
+          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
+          Vector backoff = dirZ * side;
+          entity->shiftCoor(backoff);
+        }
+        // object is already in the wall
+        else if( ce->isInWall())
+        {
+          entity->setAbsCoor(entity->getLastAbsCoor());
+        }
+        break;
+        
+        
+         // collision in the z-axis
+      case COLLISION_TYPE_AXIS_Z_NEG:
+
+        side = collPos.len()  - box->halfLength[2]; // should be [2]
+
+        // object is beneath the plane (ground)
+        if( side <= 0.0f )
+        {
+         
+          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
+          Vector backoff = dirZ * side*-1.0f;
+          entity->shiftCoor(backoff);
+        }
+        // object is already in the wall
+        else if( ce->isInWall())
+        {
+          entity->setAbsCoor(entity->getLastAbsCoor());
         }
         break;
Index: trunk/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- trunk/src/lib/graphics/importer/bsp_manager.cc	(revision 9059)
+++ trunk/src/lib/graphics/importer/bsp_manager.cc	(revision 9061)
@@ -972,7 +972,11 @@
   Vector position1 = position;
   Vector position2 = position + Vector(0.0,1.0,0.0);
+  Vector position3 = position;
+  Vector position4 = position + Vector(0.0,1.0,0.0);
   Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //
   Vector dest1 = position + forwardDir*4.0f;
   Vector dest2 = position2 + forwardDir*4.0;
+  Vector dest3 = position + forwardDir*4.0f;
+  Vector dest4 = position2 + forwardDir*4.0;
   dest = position - Vector(0.0, 40.0,0.0);
   Vector out = dest;
@@ -986,13 +990,17 @@
 
   if( box != NULL) {
-    position = worldEntity->getAbsCoor() +  box->center + Vector(0.0, 1.0, 0.0) * box->halfLength[1];
-    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET);
-
-    position1 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
-    dest1     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
-
-    position2 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
-    dest2     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
-
+    position = worldEntity->getAbsCoor() +  box->center; // + Vector(0.0, 1.0, 0.0) * box->halfLength[1] * 1.0f;
+    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET) *   100;
+
+    Vector dirX =  worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
+
+    //position1 = worldEntity->getAbsCoor() +  box->center - dirX * (box->halfLength[0]  + BSP_X_OFFSET);
+    dest1     = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
+    dest2     = worldEntity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
+    
+    Vector dirZ =  worldEntity->getAbsDirZ(); dirX.y = 0.0f; dirZ.normalize();
+    //position2 = worldEntity->getAbsCoor() +  box->center - dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
+    dest3     = worldEntity->getAbsCoor() +  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
+    dest4     = worldEntity->getAbsCoor() -  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
   } else {
     // Init positions and destinations to anything useful!
@@ -1052,4 +1060,7 @@
   bool xCollision = false;
   bool zCollision = false;
+  bool xCollisionNeg = false;
+  bool zCollisionNeg = false;
+  
 
 
@@ -1120,9 +1131,10 @@
   // Return the normal here: Normal's stored in this->collPlane;
   if( collision) {
-    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
+    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
 }
   if(xCollision) {
     worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
   }
+  
   if(zCollision) {
     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
Index: trunk/src/lib/graphics/importer/bsp_manager.h
===================================================================
--- trunk/src/lib/graphics/importer/bsp_manager.h	(revision 9059)
+++ trunk/src/lib/graphics/importer/bsp_manager.h	(revision 9061)
@@ -28,7 +28,7 @@
 
 
-#define BSP_X_OFFSET 20.0f
+#define BSP_X_OFFSET 40.0f
 #define BSP_Y_OFFSET 40.0f
-#define BSP_Z_OFFSET 20.0f
+#define BSP_Z_OFFSET 40.0f
 
 
Index: trunk/src/lib/graphics/text_engine/font_data.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/font_data.cc	(revision 9059)
+++ trunk/src/lib/graphics/text_engine/font_data.cc	(revision 9061)
@@ -279,5 +279,5 @@
     Glyph* tmpGlyph;
 
-    if (tmpGlyph = this->glyphArray[i])
+    if ((tmpGlyph = this->glyphArray[i]) != NULL)
     {
       if (tmpGlyph->height*this->renderSize > maxLineHeight)
Index: trunk/src/lib/script_engine/script.cc
===================================================================
--- trunk/src/lib/script_engine/script.cc	(revision 9059)
+++ trunk/src/lib/script_engine/script.cc	(revision 9061)
@@ -24,8 +24,9 @@
 
 #include "class_list.h"
-// uncommet this when the std:string and the const bug is fixed
-//CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
-//                               addMethod("addObject", ExecutorLua2<Script,std::string,std::string>(&Script::addObject))
-//                               ):
+CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
+                    addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject))
+                    ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
+                    ->addMethod("executeFunction", ExecutorLua0ret<Script,bool >(&Script::executeFunction))
+                     );
 
 Script::Script(const TiXmlElement* root)
@@ -81,4 +82,7 @@
    filedest += "scripts/" + filename;
    
+   this->addThisScript();
+   this->registerStandartClasses();
+   
    if(currentFile.length() != 0)
    {
@@ -97,5 +101,4 @@
      {
       currentFile = filename;
-      //this->addThisScript();
       return true;
      }
@@ -119,5 +122,5 @@
  void Script::addObject(const std::string& className, const std::string& objectName)
  {
-  // printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str());
+   //printf("Script %s: I am about to add %s of class %s\n",this->getName(),objectName.c_str(),className.c_str());
 
    BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
@@ -163,5 +166,5 @@
  }
 
- bool Script::selectFunction(std::string& functionName, int retCount)
+ bool Script::selectFunction(const std::string& functionName, int retCount)
  {
    if(returnCount == 0 && currentFunction.length() == 0) //no return values left on the stack and no other function selected
@@ -356,5 +359,6 @@
    
    //success = this->registerClass(std::string("Vector"));
-   
+    success = this->registerClass("ScriptTrigger");
+
    return success;
  }
Index: trunk/src/lib/script_engine/script.h
===================================================================
--- trunk/src/lib/script_engine/script.h	(revision 9059)
+++ trunk/src/lib/script_engine/script.h	(revision 9061)
@@ -42,5 +42,5 @@
     /// EXECUTING
     // first select function
-    bool selectFunction(std::string& functionName, int retCount);
+    bool selectFunction(const std::string& functionName, int retCount);
 
     // push parameters for luafunction
