Index: orxonox/branches/dave/src/Makefile.am
===================================================================
--- orxonox/branches/dave/src/Makefile.am	(revision 3139)
+++ orxonox/branches/dave/src/Makefile.am	(revision 3151)
@@ -8,9 +8,9 @@
 
 orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc
-noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h
+noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h story_entity.h story_def.h game_loader.h campaign.h
 
 
 
-#  uncomment the following if bencoder requires the math library
+#  uncomment the following if orxonox requires the math library
 #orxonox_LDADD=-lm
 
Index: orxonox/branches/dave/src/Makefile.in
===================================================================
--- orxonox/branches/dave/src/Makefile.in	(revision 3139)
+++ orxonox/branches/dave/src/Makefile.in	(revision 3151)
@@ -38,4 +38,5 @@
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+host_triplet = @host@
 bin_PROGRAMS = orxonox$(EXEEXT)
 subdir = src
@@ -113,4 +114,8 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+GTK2_CFLAGS = @GTK2_CFLAGS@
+GTK2_LIBS = @GTK2_LIBS@
+HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@
+HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -146,8 +151,16 @@
 am__quote = @am__quote@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 datadir = @datadir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 includedir = @includedir@
 infodir = @infodir@
@@ -164,9 +177,13 @@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
+target = @target@
 target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
 AM_CXXFLAGS = "-I/usr/X11R6/include"
 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib  -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS)
 orxonox_SOURCES = orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc
-noinst_HEADERS = ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h
+noinst_HEADERS = ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h story_entity.h story_def.h game_loader.h campaign.h
 all: all-am
 
@@ -441,5 +458,5 @@
 
 
-#  uncomment the following if bencoder requires the math library
+#  uncomment the following if orxonox requires the math library
 #orxonox_LDADD=-lm
 
Index: orxonox/branches/dave/src/array.cc
===================================================================
--- orxonox/branches/dave/src/array.cc	(revision 3139)
+++ orxonox/branches/dave/src/array.cc	(revision 3151)
@@ -69,4 +69,5 @@
     printf ("Finalizing array.\n");  
   if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
+  //  if ((array = new GLfloat [entryCount]) == NULL)
     printf ("could not allocate %i data Blocks\n", entryCount);
   Entry* walker = firstEntry;
@@ -77,4 +78,5 @@
     }
   finalized = true;
+
   return;
 }
@@ -91,9 +93,9 @@
 	printf ("adding new Entry to Array: %f\n", entry);
       
-      entryCount++;
       currentEntry->value = entry;
       currentEntry->next = new Entry;
       currentEntry = currentEntry->next;
       currentEntry->next = NULL;
+      ++entryCount;
     }
   else 
Index: orxonox/branches/dave/src/keynames.cc
===================================================================
--- orxonox/branches/dave/src/keynames.cc	(revision 3139)
+++ orxonox/branches/dave/src/keynames.cc	(revision 3151)
@@ -13,5 +13,4 @@
    co-programmer: ...
 */
-#include <SDL/SDL.h>
 
 #include "keynames.h"
Index: orxonox/branches/dave/src/keynames.h
===================================================================
--- orxonox/branches/dave/src/keynames.h	(revision 3139)
+++ orxonox/branches/dave/src/keynames.h	(revision 3151)
@@ -10,5 +10,9 @@
 #endif
 
+#ifndef __APPLE__
 #include <SDL/SDL.h>
+#else
+#include <SDL.h>
+#endif
 
 /**
Index: orxonox/branches/dave/src/object.cc
===================================================================
--- orxonox/branches/dave/src/object.cc	(revision 3139)
+++ orxonox/branches/dave/src/object.cc	(revision 3151)
@@ -119,5 +119,5 @@
 
 /**
-   \brief finalizes an Object.
+  \brief finalizes an Object.
    This funcion is needed, to close the glList and all the other lists.
 */
@@ -226,6 +226,7 @@
   if (verbose >= 2)
     printf("Adding new Group\n");
+  group->name = "";
   group->faceMode = -1;
-  group->name = "";
+  group->faceCount =0;  
   if ((group->listNumber = glGenLists(1)) == 0 )
     {
@@ -246,5 +247,6 @@
       group->firstVertexTexture = currentGroup->firstVertexTexture + currentGroup->vTexture->getCount()/2;
     }
-
+  if (verbose >=2)
+    printf ("Creating new Arrays, with starting points v:%i, vt:%i, vn:%i .\n", group->firstVertex, group->firstVertexTexture, group->firstNormal);
   group->vertices = new Array();
   group->normals = new Array();
@@ -256,9 +258,21 @@
 /**
    \brief finalizes a Group.
+   \param group the group to finalize.
 */
 bool Object::finalizeGroup(Group* group)
 {
+  if (verbose >=2)
+    printf ("Finalize group %s.\n", group->name);
   glEnd();
   glEndList();
+}
+/**
+   \brief deletes the Arrays of the Group to save space.
+   \param group the group to delete the arrays from.
+*/
+bool Object::cleanupGroup(Group* group)
+{
+  if (verbose >=2)
+    printf ("cleaning up group %s.\n", group->name);
   
   delete group->vertices;
@@ -266,4 +280,5 @@
   delete group->vTexture;
 }
+
 /**
    \brief Reads in the .obj File and sets all the Values.
@@ -282,8 +297,8 @@
     }
   objFileName = fileName;
-  char Buffer[500];
+  char Buffer[10000];
   while(!OBJ_FILE->eof())
     {
-      OBJ_FILE->getline(Buffer, 500);
+      OBJ_FILE->getline(Buffer, 10000);
       if (verbose >=4)
 	printf ("Read input line: %s\n",Buffer);
@@ -330,4 +345,5 @@
     }
   OBJ_FILE->close();
+  return true;
 
 }
@@ -363,17 +379,37 @@
     {
       currentGroup->vertices->finalizeArray();
-      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
+      //      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
       currentGroup->normals->finalizeArray();
-      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
+      //      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
       currentGroup->vTexture->finalizeArray();
     }
 
   readingVertices = false;
-  char subbuffer1[20];
-  char subbuffer2[20];
-  char subbuffer3[20];
-  char subbuffer4[20] ="";
-  sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
-  if (!strcmp(subbuffer4, ""))
+  currentGroup->faceCount++;
+
+  int elemCount = 0;
+  
+  FaceElement* firstElem = new FaceElement;
+  FaceElement* tmpElem = firstElem;
+
+  
+  while(strcmp (faceString, "\0"))
+    {
+      if (elemCount>0)
+	  tmpElem = tmpElem->next = new FaceElement;
+      tmpElem->next = NULL;
+
+
+      sscanf (faceString, "%s", tmpElem->value);
+      faceString += strlen(tmpElem->value);
+      if (strcmp (faceString, "\0"))
+	faceString++;
+      elemCount++;
+
+
+    }
+  
+  
+  if (elemCount == 3)
     {
       if (currentGroup->faceMode != 3)
@@ -386,11 +422,8 @@
       currentGroup->faceMode = 3;
       if (verbose >=3)
-	printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
-      addGLElement(subbuffer1);
-      addGLElement(subbuffer2);
-      addGLElement(subbuffer3);
-      return true;
-    }
-  else
+	printf ("found triag.\n");
+    }
+  
+  else if (elemCount == 4)
     {
       if (currentGroup->faceMode != 4)
@@ -402,11 +435,25 @@
       currentGroup->faceMode = 4;
       if (verbose >=3 )
-	printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
-      addGLElement(subbuffer1);
-      addGLElement(subbuffer2);
-      addGLElement(subbuffer3);
-      addGLElement(subbuffer4);
-      return true;
-    }
+	printf ("found quad.\n");
+    }
+  
+  else if (elemCount > 4)
+    {
+      if (currentGroup->faceMode != -1)
+	glEnd();
+      glBegin(GL_POLYGON);
+      if (verbose >=3)
+	printf ("Polygon with %i faces found.", elemCount);
+      currentGroup->faceMode = elemCount;
+    }
+
+  tmpElem = firstElem;
+  while (tmpElem != NULL)
+    {
+      //      printf ("%s\n", tmpElem->value);
+      addGLElement(tmpElem->value);
+      tmpElem = tmpElem->next;
+    }
+
 }
 
@@ -423,21 +470,27 @@
 {
   if (verbose >=3)
-    printf ("importing grafical Element.... including to openGL\n");
+    printf ("importing grafical Element to openGL\n");
   char* vertex = elementString;
 
   char* texture;
-  texture = strstr (vertex, "/");
-  texture[0] = '\0';
-  texture ++;
-  glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
-
-  char* normal;
-  if ((normal = strstr (texture, "/")) !=NULL)
-    {
-      normal[0] = '\0';
-      normal ++;
-      //glArrayElement(atoi(vertex)-1);
-      glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
-    }
+  if ((texture = strstr (vertex, "/")) != NULL)
+    {
+      texture[0] = '\0';
+      texture ++;
+      if (verbose>=3)
+	printf ("includeing texture #%i, and mapping it to group texture #%i, textureArray has %i entries.\n", atoi(texture), (atoi(texture)-1 - currentGroup->firstVertexTexture)*3, currentGroup->vTexture->getCount());
+      glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
+
+      char* normal;
+      if ((normal = strstr (texture, "/")) !=NULL)
+	{
+	  normal[0] = '\0';
+	  normal ++;
+	  //glArrayElement(atoi(vertex)-1);
+	  glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
+	}
+    }
+  if (verbose>=3)
+    printf ("includeing vertex #%i, and mapping it to group vertex #%i, vertexArray has %i entries.\n", atoi(vertex), (atoi(vertex)-1 - currentGroup->firstVertex)*3, currentGroup->vertices->getCount());
   glVertex3fv(currentGroup->vertices->getArray() +(atoi(vertex)-1 - currentGroup->firstVertex)*3);
 
@@ -488,23 +541,22 @@
 bool Object::readGroup (char* groupString)
 {
-  //  printf ("test\n");
-  if (!strcmp(groupString, "default"))
-    {
-      if (groupCount != 0)
-	{
-	  Group* newGroup = new Group;
-	  finalizeGroup(currentGroup);
-	  currentGroup->nextGroup = newGroup;
-	  initGroup(newGroup);
-	  currentGroup = newGroup; // must be after init see initGroup for more info
-	}
-      ++groupCount;
-    }
-  else
-    {
-      
-      currentGroup->name = new char [strlen(groupString)];      
+  // setting the group name if not default.
+  if (strcmp(currentGroup->name, "default"))
+    {
+      currentGroup->name = (char*) malloc ( strlen(groupString) * sizeof (char));
       strcpy(currentGroup->name, groupString);
     }
+  if (groupCount != 0 && currentGroup->faceCount>0)
+    {
+      Group* newGroup = new Group;
+      finalizeGroup(currentGroup);
+      currentGroup->nextGroup = newGroup;
+      initGroup(newGroup);
+      cleanupGroup(currentGroup); // deletes the arrays of the group; must be after initGroup.
+      currentGroup = newGroup; // must be after init see initGroup for more info
+    }
+
+  ++groupCount;
+
 }
 
Index: orxonox/branches/dave/src/object.h
===================================================================
--- orxonox/branches/dave/src/object.h	(revision 3139)
+++ orxonox/branches/dave/src/object.h	(revision 3151)
@@ -18,4 +18,10 @@
 extern int verbose; //!< fill be removed and added again as a verbose-class
 
+
+struct FaceElement
+{
+  char value[20];
+  FaceElement* next;
+};
 
 //! Class that handles 3D-Objects. it can also read them in and display them.
@@ -49,4 +55,5 @@
     Array* vTexture;
     int faceMode;
+    int faceCount;
 
     int firstVertex;
@@ -74,4 +81,5 @@
   bool initGroup(Group* group);
   bool finalizeGroup (Group* group);
+  bool cleanupGroup(Group* group);
 
 
Index: orxonox/branches/dave/src/orxonox.cc
===================================================================
--- orxonox/branches/dave/src/orxonox.cc	(revision 3139)
+++ orxonox/branches/dave/src/orxonox.cc	(revision 3151)
@@ -148,6 +148,5 @@
   
   // Set window labeling
-  // TO DO: Add version information to caption
-  SDL_WM_SetCaption( "Orxonox", "Orxonox");
+  SDL_WM_SetCaption( "Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
   
   // TO DO: Create a cool icon and use it here
Index: orxonox/branches/dave/src/orxonox.h
===================================================================
--- orxonox/branches/dave/src/orxonox.h	(revision 3139)
+++ orxonox/branches/dave/src/orxonox.h	(revision 3151)
@@ -7,5 +7,8 @@
 #define ORXONOX_H
 
-#include <SDL/SDL.h>
+// this includes the information from configure/makefiles
+#if HAVE_CONFIG_H 
+#include <config.h> 
+#endif
 
 #include "stdincl.h"
Index: orxonox/branches/dave/src/player.cc
===================================================================
--- orxonox/branches/dave/src/player.cc	(revision 3139)
+++ orxonox/branches/dave/src/player.cc	(revision 3151)
@@ -26,5 +26,5 @@
 {
 
-  obj = new Object ("reaphigh.obj");
+  obj = new Object ("reaplow.obj");
   /*
   objectList = glGenLists(1);
Index: orxonox/branches/dave/src/stdincl.h
===================================================================
--- orxonox/branches/dave/src/stdincl.h	(revision 3139)
+++ orxonox/branches/dave/src/stdincl.h	(revision 3151)
@@ -8,5 +8,11 @@
 #include <windows.h>
 #endif
+
+#ifndef __APPLE__
 #include <SDL/SDL.h>
+#else
+#include <SDL.h>
+#endif
+
 #include <GL/gl.h>
 #include <GL/glu.h>
Index: orxonox/branches/dave/src/vector.cc
===================================================================
--- orxonox/branches/dave/src/vector.cc	(revision 3139)
+++ orxonox/branches/dave/src/vector.cc	(revision 3151)
@@ -843,2 +843,123 @@
   return (n.dot(p) + k);
 }
+
+
+/**
+   \brief Creates a new BezierCurve
+*/
+BezierCurve::BezierCurve (void)
+{
+  nodeCount = 0;
+  firstNode = new PathNode;
+  currentNode = firstNode;
+
+  firstNode->position = Vector (.0, .0, .0);
+  firstNode->number = 0;
+  firstNode->next = 0; // not sure if this really points to NULL!!
+
+  return;
+}
+
+/**
+   \brief Deletes a BezierCurve.
+   It does this by freeing all the space taken over from the nodes
+*/
+BezierCurve::~BezierCurve (void)
+{
+  PathNode* tmpNode;
+  currentNode = firstNode;
+  while (tmpNode != 0)
+    {
+      tmpNode = currentNode;
+      currentNode = currentNode->next;
+      delete tmpNode;
+    }
+}
+
+/**
+   \brief adds a new Node to the bezier Curve
+   \param newNode a Vector to the position of the new node
+*/
+void BezierCurve::addNode(const Vector& newNode)
+{
+  PathNode* tmpNode;
+  if (nodeCount == 0 )
+    tmpNode = firstNode;
+  else
+    {
+      tmpNode = new PathNode;
+      currentNode = currentNode->next = tmpNode;
+    }
+  tmpNode->position = newNode;
+  tmpNode->next = 0; // not sure if this really points to NULL!!
+  tmpNode->number = (++nodeCount);
+  return;
+}
+
+/**
+   \brief calculates the Position on the curve
+   \param t The position on the Curve (0<=t<=1)
+   \return the Position on the Path
+*/
+Vector BezierCurve::calcPos(float t) 
+{
+  if (nodeCount <=4)
+    {
+      //      if (verbose >= 1)
+      //      printf ("Please define at least 4 nodes, until now you have only defined %i.\n", nodeCount);
+      curvePoint = Vector(0,0,0);
+    }
+  PathNode* tmpNode = firstNode;
+    
+  int k,kn,nn,nkn;
+  double blend,muk,munk;
+  Vector b = Vector(0.0,0.0,0.0);
+  
+  muk = 1;
+  munk = pow(1-t,(double)nodeCount);
+  
+  for (k=0; k<=nodeCount; k++) {
+    nn = nodeCount;
+    kn = k;
+    nkn = nodeCount - k;
+    blend = muk * munk;
+    muk *= t;
+    munk /= (1-t);
+    while (nn >= 1) {
+      blend *= nn;
+      nn--;
+      if (kn > 1) {
+	blend /= (double)kn;
+	kn--;
+      }
+      if (nkn > 1) {
+	blend /= (double)nkn;
+	nkn--;
+      }
+    }
+    b.x += tmpNode->position.x * blend;
+    b.y += tmpNode->position.y * blend;
+    b.z += tmpNode->position.z * blend;
+
+    tmpNode = tmpNode->next;
+  }
+  return b;
+}
+
+Vector BezierCurve::calcDirection (float t)
+{
+  double diff = .00000000001;
+  
+  Vector diffV = ((calcPos(t+diff) - calcPos(t))/diff);
+  diffV.normalize();
+  return diffV;
+}
+
+/**
+  \brief returns the Position of the point calculated on the Curve
+  \return a Vector to the calculated position
+*/
+Vector BezierCurve::getPos() const
+{
+  return curvePoint;
+}
Index: orxonox/branches/dave/src/vector.h
===================================================================
--- orxonox/branches/dave/src/vector.h	(revision 3139)
+++ orxonox/branches/dave/src/vector.h	(revision 3151)
@@ -149,3 +149,39 @@
 };
 
+
+
+//! Bezier Curve
+/**
+   Class to handle bezier curves in 3-dimesnsional space
+   
+   needed for  the Tracking system in OrxOnoX.
+*/
+class BezierCurve
+{
+ private:
+  int nodeCount;
+  Vector curvePoint;
+  
+  struct PathNode
+  {
+    int number;
+    Vector position;
+    PathNode* next;
+  };
+
+  PathNode* firstNode; 
+  PathNode* currentNode; 
+
+ public:
+  BezierCurve (void);
+  ~BezierCurve (void);
+  void addNode (const Vector& newNode);
+  Vector calcPos (float t);
+  Vector calcDirection (float t);
+  
+  Vector getPos () const;
+};
+
+
+
 #endif
