Index: trunk/src/defs/class_id.h
===================================================================
--- trunk/src/defs/class_id.h	(revision 6633)
+++ trunk/src/defs/class_id.h	(revision 6634)
@@ -73,4 +73,7 @@
 
   CL_STORY_ENTITY               =    0x02000000,
+
+  CL_GAME_WORLD                 =    0x50000000,
+  CL_GAME_WORLD_DATA            =    0x60000000,
 
   CL_PHYSICS_INTERFACE          =    0x04000000,
@@ -96,4 +99,6 @@
   CL_PLAYER                     =    0x00202000,
   CL_NPC                        =    0x00204000,
+  CL_IMAGE_ENTITY               =    0x00206000,
+  CL_PLANET                     =    0x00207000,
   CL_PROJECTILE                 =    0x00208000,
   CL_WEAPON                     =    0x00210000,
@@ -148,6 +153,6 @@
   CL_CAMPAIGN                   =    0x00000101,
   CL_CAMPAIGN_DATA              =    0x00000102,
-  CL_GAME_WORLD                 =    0x00000103,
-  CL_GAME_WORLD_DATA            =    0x00000104,
+  CL_SIMPLE_GAME_MENU           =    0x00000103,
+  CL_SIMPLE_GAME_MENU_DATA      =    0x00000104,
   CL_SINGLE_PLAYER_WORLD        =    0x00000105,
   CL_SINGLE_PLAYER_WORLD_DATA   =    0x00000106,
@@ -155,4 +160,5 @@
   CL_MULTI_PLAYER_WORLD_DATA    =    0x00000108,
   CL_MOVIE_LOADER               =    0x00000109,
+
 
   // WorldEntities (range from 0x00000200 to 0x000004ff)
Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 6633)
+++ trunk/src/lib/coord/p_node.cc	(revision 6634)
@@ -505,6 +505,10 @@
 {
   PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE));
+//  PRINTF(0)("Adding the Child: %s to: %s\n", childName, this->getName());
+//  assert( childNode != NULL );
   if (childNode != NULL)
+  {
     this->addChild(childNode);
+  }
 }
 
@@ -1069,10 +1073,5 @@
   SYNCHELP_READ_FLOAT( f3 );
   this->setRelCoor( f1, f2, f3 );
-  //this->setRelCoor( 5, 0, 0 );
-
-  /*SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );*/
-  //this->setAbsCoor( f1, f2, f3 );
+
 
   SYNCHELP_READ_FLOAT( f1 );
@@ -1082,19 +1081,15 @@
   this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
-  /*SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );
-  SYNCHELP_READ_FLOAT( f4 );*/
-  //this->setAbsDir( Quaternion( Vector(f2, f3, f4), f1 ) );
-
   int n;
   char * childName;
 
+  PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]);
   SYNCHELP_READ_INT( n );
+  PRINTF(0)("read %s:n=%d\n", this->getName(), n);
 
   for (int i = 0; i<n; i++)
   {
     SYNCHELP_READ_STRINGM( childName );
-    //PRINTF(0)("childname = %s\n", childName);
+    PRINTF(0)("RCVD CHILD = %s\n", childName);
     addChild( childName );
     delete childName;
@@ -1132,12 +1127,4 @@
   SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
 
-  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z);
-
-  /*SYNCHELP_WRITE_FLOAT( this->absCoordinate.x );
-  SYNCHELP_WRITE_FLOAT( this->absCoordinate.y );
-  SYNCHELP_WRITE_FLOAT( this->absCoordinate.z );*/
-
-  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z);
-
   SYNCHELP_WRITE_FLOAT( this->relDirection.w );
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );
@@ -1145,17 +1132,145 @@
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
 
-  /*SYNCHELP_WRITE_FLOAT( this->absDirection.w );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );*/
-
   int n = children.size();
+
+  //check if camera is in children
+  for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
+  {
+    if ( (*it)->isA(CL_CAMERA) )
+      n--;
+  }
+  PRINTF(0)("write %s:n=%d\n", this->getName(), n);
   SYNCHELP_WRITE_INT( n );
+  PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]);
 
   for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
   {
-    SYNCHELP_WRITE_STRING( (*it)->getName() );
+    //dont add camera because there is only one camera attached to local player
+    if ( !(*it)->isA(CL_CAMERA) )
+    {
+      PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName());
+      SYNCHELP_WRITE_STRING( (*it)->getName() );
+    }
   }
 
   return SYNCHELP_WRITE_N;
 }
+
+#define __FLAG_COOR 1
+#define __FLAG_ROT  2
+
+#define __OFFSET_POS 1
+#define __OFFSET_ROT 0.05
+
+/**
+ * Writes data from network containing information about the state which has changed
+ * @param data pointer to data
+ * @param length length of data
+ * @param sender hostID of sender
+ */
+int PNode::writeSync( const byte * data, int length, int sender )
+{
+  SYNCHELP_READ_BEGIN();
+
+  if ( this->getHostID()==this->getOwner() )
+  {
+    return SYNCHELP_READ_N;
+  }
+
+  byte flags = 0;
+  SYNCHELP_READ_BYTE( flags );
+  //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags);
+
+  float f1, f2, f3, f4;
+
+  if ( flags & __FLAG_COOR )
+  {
+    SYNCHELP_READ_FLOAT( f1 );
+    SYNCHELP_READ_FLOAT( f2 );
+    SYNCHELP_READ_FLOAT( f3 );
+    PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3);
+    this->setRelCoor( f1, f2, f3 );
+  }
+
+  if ( flags & __FLAG_ROT )
+  {
+    SYNCHELP_READ_FLOAT( f1 );
+    SYNCHELP_READ_FLOAT( f2 );
+    SYNCHELP_READ_FLOAT( f3 );
+    SYNCHELP_READ_FLOAT( f4 );
+    PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4);
+    //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
+    Quaternion q;
+    q.w = f1;
+    q.v.x = f2;
+    q.v.y = f3;
+    q.v.z = f4;
+    this->setAbsDir( q );
+  }
+
+  return SYNCHELP_READ_N;
+}
+
+/**
+ * data copied in data will bee sent to another host
+ * @param data pointer to data
+ * @param maxLength max length of data
+ * @return the number of bytes writen
+ */
+int PNode::readSync( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+
+  if ( this->getHostID()!=this->getOwner() )
+  {
+    return SYNCHELP_WRITE_N;
+  }
+
+  byte flags = 0;
+  if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS ||
+       fabs( coory - relCoordinate.y ) > __OFFSET_POS ||
+       fabs( coorz - relCoordinate.z ) > __OFFSET_POS )
+    flags |= __FLAG_COOR;
+
+  if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT ||
+       fabs( rotx - absDirection.v.x ) > __OFFSET_ROT ||
+       fabs( roty - absDirection.v.y ) > __OFFSET_ROT ||
+       fabs( rotz - absDirection.v.z ) > __OFFSET_ROT )
+    flags |= __FLAG_ROT;
+
+
+  SYNCHELP_WRITE_BYTE( flags );
+  //PRINTF(0)("FLAGS = %d\n", flags);
+
+  if ( flags & __FLAG_COOR )
+  {
+
+    PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
+
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
+
+    coorx = relCoordinate.x;
+    coory = relCoordinate.y;
+    coorz = relCoordinate.z;
+  }
+
+  if ( flags & __FLAG_ROT )
+  {
+
+    PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
+
+    SYNCHELP_WRITE_FLOAT( this->absDirection.w );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );
+
+    rotw = absDirection.w;
+    rotx = absDirection.v.x;
+    roty = absDirection.v.y;
+    rotz = absDirection.v.z;
+  }
+
+  return SYNCHELP_WRITE_N;
+}
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 6633)
+++ trunk/src/lib/coord/p_node.h	(revision 6634)
@@ -186,4 +186,6 @@
   int       writeState(const byte* data, int length, int sender);
   int       readState(byte* data, int maxLength );
+  int       writeSync(const byte* data, int length, int sender);
+  int       readSync(byte* data, int maxLength );
 
  private:
@@ -229,4 +231,14 @@
 
   static PNode*      nullParent;         //!< The ROOT of the main PNode Tree.
+
+  private:
+    float coorx;
+    float coory;
+    float coorz;
+
+    float rotw;
+    float rotx;
+    float roty;
+    float rotz;
 };
 
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 6633)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 6634)
@@ -274,5 +274,5 @@
     this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), " \n\t,");
 
-  PRINT(4)("Running on : %s %s %s\n", vendor, renderer, version);
+  PRINT(4)("Running on : vendor: %s,  renderer: %s,  version:%s\n", vendor, renderer, version);
   PRINT(4)("Extensions:\n");
   if (this->hwExtensions != NULL)
Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 6633)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 6634)
@@ -260,15 +260,16 @@
   glBindTexture(target, texture);
 
-  glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+  glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
+  glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_REPEAT);
+
+  glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR/*_MIPMAP_LINEAR*/);
   glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-
-  glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
-  glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT);
+  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_PRIORITY, this->priority);
+
 
   /* control the mipmap levels */
-//   glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);f
-//   glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0);
-  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_PRIORITY, this->priority);
+  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);
+  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0);
 
   /* build the Texture  OpenGL V >= 1.1 */
@@ -295,6 +296,8 @@
     PRINTF(1)("Error while loading texture (mipmap generation), gluBuild2DMipmaps returned %i\n", errorCode);
 
+  // Deselect newly built texture, as we do not want to display with this texture.
   if (target == GL_TEXTURE_2D)
     glBindTexture(target, 0);
+
   return texture;
 }
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 6633)
+++ trunk/src/lib/lang/base_object.cc	(revision 6634)
@@ -224,4 +224,5 @@
   SYNCHELP_WRITE_BEGIN();
 
+  //PRINTF(0)("objectname = %s\n", this->objectName);
   SYNCHELP_WRITE_STRING( this->objectName );
 
Index: trunk/src/lib/network/converter.cc
===================================================================
--- trunk/src/lib/network/converter.cc	(revision 6633)
+++ trunk/src/lib/network/converter.cc	(revision 6634)
@@ -22,4 +22,9 @@
 /* include your own header */
 #include "converter.h"
+#include "shell_command.h"
+
+#include <limits>
+
+SHELL_COMMAND_STATIC(debug, Converter, Converter::debug);
 
 
@@ -182,4 +187,13 @@
 const int expmult = 8388608; //2^23
 
+float Converter::getDenormConst()
+{
+  const int exp = 126;
+  float result = 1.0f;
+  for (int i = 0; i < exp; i++)
+    result /= 2.0f;
+  return result;
+}
+
 /*!
  * Converts a float value into a byte-array
@@ -189,4 +203,8 @@
 byte* Converter::floatToByteArray(float x)
 {
+  byte* result = new byte[4];
+  floatToByteArray(x, result, 4);
+  return result;
+  /*
   int mantisse = 0;
   int exponent = 128;
@@ -201,34 +219,54 @@
     sgn = 1;
 
-  float sub = 1;
-  while (sub < x)
-  {
-    sub *= 2;
+  if (x == 0)
+  {
+    exponent = 255;
+    mantisse = 0;
+  }
+  else
+  {
+    //if (x < getDenormConst())
+    //  printf("Denormalisiert!\n");
+    //printf("DenormConst = %e", getDenormConst());
+
+    float sub = 1;
+    while (sub < x)
+    {
+      sub *= 2;
+      exponent++;
+    }
+
+    while (x > 0)
+    {
+      if (x >= sub)
+      {
+        mantisse += 1;
+        x -= sub;
+      }
+
+      mantisse *= 2;
+      exponent--;
+      sub /= 2;
+    }
     exponent++;
-  }
-
-  while (x > 0)
-  {
-    if (x >= sub)
-    {
-      mantisse += 1;
-      x -= sub;
-    }
-
-    mantisse *= 2;
-    exponent--;
-    sub /= 2;
-  }
-  exponent++;
-  mantisse /= 2;
-  while (mantisse < expmult)
-  {
-    mantisse *= 2;
-    exponent--;
-  }
-
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
-
-  mantisse -= expmult;
+    mantisse /= 2;
+
+    printf("Conv:        mantisse = %i exponent = %i \n", mantisse, exponent);
+
+
+    if (mantisse != 0)
+    {
+      while (mantisse < expmult)
+      {
+        mantisse *= 2;
+        exponent--;
+      }
+
+      mantisse -= expmult;
+    }
+  }
+
+  printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent);
+
 
   int hx = mantisse + expmult * exponent;
@@ -238,4 +276,5 @@
 
   return result;
+  */
 }
 
@@ -248,10 +287,20 @@
 float Converter::byteArrayToFloat(byte* a)
 {
+  byte* h = new byte[4];
+  float result = 0.0f;
+  byteArrayToFloat(a, &result);
+  return result;
+  /*
+  int hexp = a[2] + a[3] * 256;
+  int exponent = (hexp / 128) % 256;
+
   int hmant = a[0] + a[1] * 256 + a[2] * 65536;
   int mantisse = hmant % expmult;
+  if (mantisse == 0 && exponent == 255)
+    return 0;
+
   mantisse += expmult;
-
-  int hexp = a[2] + a[3] * 256;
-  int exponent = (hexp / 128) % 256 - 128;
+  exponent -= 128;
+
 
   int sgn;
@@ -261,5 +310,5 @@
     sgn = 1;
 
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
+  printf("ReConv: mantisse = %i exponent = %i \n", mantisse, exponent);
 
   float emult = 1;
@@ -276,31 +325,5 @@
 
   return result;
-}
-
-/*!
- * Converts a float value into a byte-array
- * @param x: The float which is to convert
- * @return: A byte-array which accords the given float
- */
-byte* Converter::_floatToByteArray(float x)
-{
-  byte* p = (byte*)&x;
-  byte* result = new byte[4];
-  for (int i = 0; i < 4; i++)
-    result[i] = p[i];
-  return result;
-}
-
-
-/*!
- * Converts a byte-array into a float value
- * @param a: The byte-array which is to convert
- * @return: A float value which accords the given byte-array
- */
-float Converter::_byteArrayToFloat(byte* a)
-{
-  float* p = (float*)a;
-  float result = *p;
-  return result;
+  */
 }
 
@@ -310,5 +333,5 @@
  * @return: A byte-array which accords the given float
  */
-int Converter::floatToByteArray(float x, byte* a, int length)
+int Converter::_floatToByteArray(float x, byte* a, int length)
 {
   if (length < FLOATSIZE)
@@ -319,10 +342,10 @@
 
   //handle 0 else function will loop for ever
-  if ( x == 0 )
+  /*if ( x == 0 )
   {
     for ( int i = 0; i<FLOATSIZE; i++)
       a[i] = 0;
     return FLOATSIZE;
-  }
+}*/
 
   int mantisse = 0;
@@ -338,34 +361,55 @@
     sgn = 1;
 
-  float sub = 1;
-  while (sub < x)
-  {
-    sub *= 2;
+  if (x == 0)
+  {
+    exponent = 255;
+    mantisse = 0;
+  }
+  else
+  {
+    //if (x < getDenormConst())
+    //  printf("Denormalisiert!\n");
+    //printf("DenormConst = %e", getDenormConst());
+
+    float sub = 1;
+    while (sub < x)
+    {
+      sub *= 2;
+      exponent++;
+    }
+
+    while (x > 0)
+    {
+      if (x >= sub)
+      {
+        mantisse += 1;
+        x -= sub;
+      }
+
+      mantisse *= 2;
+      exponent--;
+      sub /= 2;
+    }
     exponent++;
-  }
-
-  while (x > 0)
-  {
-    if (x >= sub)
-    {
-      mantisse += 1;
-      x -= sub;
-    }
-
-    mantisse *= 2;
-    exponent--;
-    sub /= 2;
-  }
-  exponent++;
-  mantisse /= 2;
-  while (mantisse < expmult)
-  {
-    mantisse *= 2;
-    exponent--;
-  }
-
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
-
-  mantisse -= expmult;
+    mantisse /= 2;
+
+
+///    printf("Conv:        mantisse = %i exponent = %i \n", mantisse, exponent);
+
+
+    if (mantisse != 0)
+    {
+      while (mantisse < expmult)
+      {
+        mantisse *= 2;
+        exponent--;
+      }
+
+      mantisse -= expmult;
+    }
+  }
+
+///  printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent);
+
 
   int hx = mantisse + expmult * exponent;
@@ -374,4 +418,10 @@
     a[3] += sgnadd;
 
+
+//  int hx = mantisse + expmult * exponent;
+//  byte* result = intToByteArray(hx);
+//  if (sgn == -1)
+//    result[3] += sgnadd;
+
   return result;
 }
@@ -383,8 +433,8 @@
  * @return: A float value which accords the given byte-array
  */
-int Converter::byteArrayToFloat(const byte* a, float* x)
-{
-  //handle 0
-  for (int i = 0; i<FLOATSIZE; i++)
+int Converter::_byteArrayToFloat(const byte* a, float* x)
+{
+    //handle 0
+  /*for (int i = 0; i<FLOATSIZE; i++)
   {
     if (a[i]!=0)
@@ -395,13 +445,22 @@
       return FLOATSIZE;
     }
-  }
-
+}*/
+
+  int hexp = a[2] + a[3] * 256;
+  int exponent = (hexp / 128) % 256;
 
   int hmant = a[0] + a[1] * 256 + a[2] * 65536;
   int mantisse = hmant % expmult;
+
+  //handle 0
+  if (mantisse == 0 && exponent == 255)
+  {
+    *x = 0;
+    return FLOATSIZE;
+  }
+
   mantisse += expmult;
-
-  int hexp = a[2] + a[3] * 256;
-  int exponent = (hexp / 128) % 256 - 128;
+  exponent -= 128;
+
 
   int sgn;
@@ -411,5 +470,5 @@
     sgn = 1;
 
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
+///  printf("ReConv: mantisse = %i exponent = %i \n", mantisse, exponent);
 
   float emult = 1;
@@ -421,4 +480,12 @@
       emult /= 2;
 
+  /*
+  float result = mantisse * emult;
+  if (sgn == -1)
+    result = -result;
+
+  return result;
+  */
+
   *x = mantisse * emult;
   if (sgn == -1)
@@ -426,4 +493,36 @@
 
   return FLOATSIZE;
+}
+
+/*!
+ * Converts a float value into a byte-array
+ * @param x: The float which is to convert
+ * @return: A byte-array which accords the given float
+ */
+int Converter::floatToByteArray(float x, byte* a, int length)
+{
+  if ( length<4 )
+  {
+    PRINTF(1)("Byte Array to small\n");
+    return 0;
+  }
+  byte* p = (byte*)&x;
+
+  for (int i = 0; i < 4; i++)
+    a[i] = p[i];
+  return 4;
+}
+
+
+/*!
+ * Converts a byte-array into a float value
+ * @param a: The byte-array which is to convert
+ * @return: A float value which accords the given byte-array
+ */
+int Converter::byteArrayToFloat(const byte* a, float* x)
+{
+  *x = *((float*)a);
+
+  return 4;
 }
 
@@ -504,2 +603,52 @@
 }
 
+
+
+
+void Converter::floatTest(float x)
+{
+  //float x = 8.0f;
+  //float x = numeric_limits<float>::infinity();
+
+  printf("To Convert: %e\n", x);
+
+  byte* res = floatToByteArray(x);
+  for (int i = 0; i < 4; i++)
+    printf("%i ", res[i]);
+  printf("\n");
+
+  float y = byteArrayToFloat(res);
+  printf("ReConvert: %e\n", y);
+
+  if (x == y)
+    printf("equal\n");
+  else
+    printf("different\n");
+}
+
+void Converter::debug()
+{
+  printf("We rulez\n");
+
+  //Denormalized?
+  //floatTest(-9.87624e-38f);
+  //floatTest(-9.87624e-37f);
+  //floatTest(-9.87624e-36f);
+  //floatTest(-9.87624e-35f);
+
+  /*
+  floatTest(14.7f);
+  floatTest(12.07e15f);
+  floatTest(0.0f);
+  floatTest(5.67e-15f);
+  */
+
+  //floatTest(-18.0098f);
+  //floatTest(-24.07e23f);
+  //floatTest(-0.0f);
+  //floatTest(-5.67e-29f);
+  floatTest(-45.7e-32f);
+  floatTest(45.7e-33f);
+  floatTest(-45.7e-34f);
+  floatTest(45.7e-35f);
+}
Index: trunk/src/lib/network/converter.h
===================================================================
--- trunk/src/lib/network/converter.h	(revision 6633)
+++ trunk/src/lib/network/converter.h	(revision 6634)
@@ -9,4 +9,5 @@
 /* include this file, it contains some default definitions */
 #include "netdefs.h"
+
 
 /* include base_object.h since all classes are derived from this one */
@@ -21,5 +22,5 @@
  * a class that can convert int to byte-array and vice versa
  */
-class Converter: public BaseObject
+class Converter : public BaseObject
 {
   public:
@@ -43,6 +44,13 @@
     static float byteArrayToFloat(byte* a);
 
-    static byte* _floatToByteArray(float x);
-    static float _byteArrayToFloat(byte* a);
+    static int _floatToByteArray(float x, byte* a, int length);
+    static int _byteArrayToFloat(const byte* a, float* x);
+
+
+    static void debug();
+    static void floatTest(float x);
+    static float getDenormConst();
+
+
   private:
     Converter();
@@ -50,3 +58,5 @@
 };
 
+#undef byte
+
 #endif /*_CONVERTER*/
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 6633)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 6634)
@@ -52,10 +52,4 @@
   this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");
 
-  allOutBuffer.length = 0;
-
-  allOutBuffer.maxLength = 10*1024;
-
-  allOutBuffer.buffer = new byte[10*1024];
-
   newUniqueID = MAX_CONNECTIONS + 2;
 
@@ -74,6 +68,4 @@
   }
 
-  if ( allOutBuffer.buffer )
-    delete allOutBuffer.buffer;
 }
 
@@ -107,4 +99,5 @@
       if ( b == CREATE_ENTITY )
       {
+        PRINTF(0)("CREATE_ENTITY\n");
         if ( !handleCreateEntity( i, data, length, sender ) )
           return i;
@@ -137,14 +130,14 @@
     }
 
+    if ( b == REQUEST_ENTITY_LIST )
+    {
+      sendEntityList( sender );
+      continue;
+    }
+
     if ( b == REQUEST_SYNC )
     {
       if ( !handleRequestSync( i, data, length, sender ) )
         return i;
-      continue;
-    }
-
-    if ( b == REQUEST_ENTITY_LIST )
-    {
-      sendEntityList( sender );
       continue;
     }
@@ -188,19 +181,5 @@
   }
 
-  *reciever = 0;
-  int nbytes = allOutBuffer.length;
-  allOutBuffer.length = 0;
-
-  if ( nbytes <=0 )
-    return 0;
-
-  if ( nbytes > maxLength )
-  {
-    PRINTF(1)("OutBuffer.length (%d) > (%d) networkStreamBuffer.length\n", nbytes, maxLength);
-    return 0;
-  }
-
-  memcpy( data, allOutBuffer.buffer, nbytes );
-  return nbytes;
+  return 0;
 }
 
@@ -221,5 +200,4 @@
 int NetworkGameManager::createEntity( ClassID classID, int owner )
 {
-
   if ( this->isServer() )
   {
@@ -254,5 +232,4 @@
       return NULL;
     }
-    newUniqueID++;
 
     BaseObject * b = Factory::fabricate( element );
@@ -268,5 +245,5 @@
     {
       Synchronizeable * s = dynamic_cast<Synchronizeable*>(b);
-      s->setUniqueID( newUniqueID );
+      s->setUniqueID( newUniqueID++ );
       s->setOwner( 0 );
       this->networkStream->connectSynchronizeable( *s );
@@ -313,8 +290,14 @@
 void NetworkGameManager::requestCreateEntity(ClassID classID)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)REQUEST_CREATE ) )
-    return;
-  if ( !writeToClientBuffer( allOutBuffer, (int)classID ) )
-    return;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)REQUEST_CREATE ) )
+      return;
+    if ( !writeToClientBuffer( outBuffer[i], (int)classID ) )
+      return;
+  }
 }
 
@@ -325,8 +308,14 @@
 void NetworkGameManager::requestRemoveEntity(int uniqueID)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)REQUEST_REMOVE ) )
-    return;
-  if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)REQUEST_REMOVE ) )
+      return;
+    if ( !writeToClientBuffer( outBuffer[i], uniqueID ) )
+      return;
+  }
 }
 
@@ -338,12 +327,18 @@
 int NetworkGameManager::executeCreateEntity(ClassID classID, int uniqueID, int owner)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)CREATE_ENTITY ) )
-    return -1;
-  if ( !writeToClientBuffer( allOutBuffer, (int)classID ) )
-    return -1;
-  if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return -1;
-  if ( !writeToClientBuffer( allOutBuffer, owner ) )
-    return -1;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)CREATE_ENTITY ) )
+      return -1;
+    if ( !writeToClientBuffer( outBuffer[i], (int)classID ) )
+      return -1;
+    if ( !writeToClientBuffer( outBuffer[i], uniqueID ) )
+      return -1;
+    if ( !writeToClientBuffer( outBuffer[i], owner ) )
+      return -1;
+  }
 
   doCreateEntity( classID, uniqueID, owner );
@@ -359,8 +354,14 @@
 void NetworkGameManager::executeRemoveEntity(int uniqueID)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)REMOVE_ENTITY ) )
-    return;
-  if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)REMOVE_ENTITY ) )
+      return;
+    if ( !writeToClientBuffer( outBuffer[i], uniqueID ) )
+      return;
+  }
 
   doRemoveEntity(uniqueID);
@@ -406,5 +407,5 @@
   while ( it != e )
   {
-
+    PRINTF(5)("SENDING ENTITY %s id %d\n", (*it)->getClassName(), (*it)->getUniqueID() );
     if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getLeafClassID()) ) )
       return;
@@ -426,4 +427,6 @@
 bool NetworkGameManager::signalNewPlayer(int userId)
 {
+  if ( userId >= outBuffer.size() )
+    resizeBufferVector( userId );
 
   /* create new playable for Player*/
@@ -483,5 +486,5 @@
 
     //HACK: hack to prevent collision
-    if ( b->isA(CL_WORLD_ENTITY) )
+    if ( b->isA(CL_WORLD_ENTITY) && !b->isA(CL_PLAYABLE) )
     {
       if ( NetworkManager::getInstance()->getHostID()!=0 )
@@ -489,6 +492,6 @@
         static Vector pos = Vector(1000.0, 1000.0, 1000.0);
         PNode *p = dynamic_cast<PNode*>(b);
-        p->setRelCoor(pos);
-        p->updateNode(0);
+        p->setAbsCoor(pos);
+        //p->updateNode(0);
         pos += Vector(1000.0, 1000.0, 1000.0);
       }
@@ -596,4 +599,5 @@
 
   Playable *p = NULL;
+  Synchronizeable *s = NULL;
 
   for ( ; it !=networkStream->getSyncEnd(); it++ )
@@ -601,4 +605,8 @@
     if ( (*it)->getUniqueID()==uniqueID )
     {
+      if ( (*it)->isA( CL_SYNCHRONIZEABLE ) )
+      {
+        s = dynamic_cast<Synchronizeable*>(*it);
+      }
       if ( (*it)->isA( CL_PLAYABLE ) )
       {
@@ -614,5 +622,10 @@
   Player* player = State::getPlayer();
   assert(p != NULL);
+  assert(s != NULL);
   assert(player != NULL);
+
+  s->setIsOutOfSync( true );
+
+  PRINTF(0)("uniqueID = %d\n", s->getUniqueID());
 
   player->setControllable(p);
@@ -871,6 +884,6 @@
 void NetworkGameManager::sync( int uniqueID, int owner )
 {
-  if ( owner==this->getHostID() )
-    return;
+  /*if ( owner==this->getHostID() )
+  return;*/
 
   if ( !isServer() )
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 6633)
+++ trunk/src/lib/network/network_game_manager.h	(revision 6634)
@@ -122,5 +122,5 @@
   private:
     std::vector<clientBuffer>     outBuffer;
-    clientBuffer                  allOutBuffer;
+    //clientBuffer                  allOutBuffer;
     static NetworkGameManager*    singletonRef;
 
Index: trunk/src/lib/network/network_socket.cc
===================================================================
--- trunk/src/lib/network/network_socket.cc	(revision 6633)
+++ trunk/src/lib/network/network_socket.cc	(revision 6634)
@@ -398,5 +398,8 @@
 bool NetworkSocket::writePacket( byte * data, int length )
 {
-  PRINTF(5)("NetworkSocket::writePacket()\n");
+  PRINTF(5)("NetworkSocket::writePacket() size=%d\n", length);
+
+  if ( length > 1024 )
+  PRINTF(2)("WARNING SENDING BIG PACKET SIZE = %d\n", length);
 
   byte blen[INTSIZE];
Index: trunk/src/lib/network/network_stream.cc
===================================================================
--- trunk/src/lib/network/network_stream.cc	(revision 6633)
+++ trunk/src/lib/network/network_stream.cc	(revision 6634)
@@ -78,4 +78,5 @@
   this->connectionMonitor = new ConnectionMonitor();
   this->networkSockets.push_back( NULL );
+  this->networkSockets[0] = NULL; //TODO: remove this
   this->handshakes.push_back( NULL );
   this->bActive = true;
@@ -266,5 +267,5 @@
             if ( networkSockets[i] != NULL )
             {
-              PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);
+              PRINTF(5)("write %d bytes to socket %d\n", dataLength, i);
               networkSockets[i]->writePacket(downBuffer, dataLength);
             }
@@ -310,5 +311,5 @@
             if ( (*it)->writeBytes(upBuffer+sizeof(header), dataLength, i) != header.length )
             {
-              PRINTF(1)("%s did not read all the data!\n", (*it)->getClassName());
+              PRINTF(1)("%s did not read all the data id = %d!\n", (*it)->getClassName(), (*it)->getUniqueID());
               break;
             }
Index: trunk/src/lib/network/network_stream.h
===================================================================
--- trunk/src/lib/network/network_stream.h	(revision 6633)
+++ trunk/src/lib/network/network_stream.h	(revision 6634)
@@ -55,4 +55,6 @@
     inline int getSyncCount(){ return synchronizeables.size(); }
 
+    inline bool isUserIdActive( int userID ) { if (userID>=networkSockets.size()) return false; else return networkSockets[userID]!=NULL; }
+
   private:
     NetworkProtocol*       networkProtocol;
Index: trunk/src/lib/sound/sound_source.h
===================================================================
--- trunk/src/lib/sound/sound_source.h	(revision 6633)
+++ trunk/src/lib/sound/sound_source.h	(revision 6634)
@@ -44,5 +44,5 @@
     ALuint                 sourceID;              //!< The ID of the Source
     const SoundBuffer*     buffer;                //!< The buffer to play in this source.
-    const PNode*           sourceNode;            //!< The SourceNode represente the position/velocity... of this source.
+    const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
 };
 #endif /* _SOUND_SOURCE_H */
Index: trunk/src/story_entities/Makefile.am
===================================================================
--- trunk/src/story_entities/Makefile.am	(revision 6633)
+++ trunk/src/story_entities/Makefile.am	(revision 6634)
@@ -12,5 +12,6 @@
 		story_entities/multi_player_world.cc \
 		story_entities/multi_player_world_data.cc \
-		story_entities/movie_loader.cc
+		story_entities/movie_loader.cc \
+		story_entities/simple_game_menu.cc
 
 StoryEntities_HEADERS_ = \
@@ -25,3 +26,4 @@
 		story_entities/multi_player_world.h \
 		story_entities/multi_player_world_data.h \
-		story_entities/movie_loader.h
+		story_entities/movie_loader.h \
+		story_entities/simple_game_menu.h
Index: trunk/src/story_entities/campaign_data.cc
===================================================================
--- trunk/src/story_entities/campaign_data.cc	(revision 6633)
+++ trunk/src/story_entities/campaign_data.cc	(revision 6634)
@@ -76,5 +76,5 @@
   LOAD_PARAM_START_CYCLE(root, element);
   {
-    StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
+    StoryEntity* created = dynamic_cast<StoryEntity*>(Factory::fabricate(element));
     if( created != NULL)
       this->addStoryEntity(created);
Index: trunk/src/story_entities/game_world.cc
===================================================================
--- trunk/src/story_entities/game_world.cc	(revision 6633)
+++ trunk/src/story_entities/game_world.cc	(revision 6634)
@@ -114,4 +114,6 @@
   .describe("The Filename of this GameWorld (relative from the data-dir)");
 
+//   LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack);
+
   PRINTF(4)("Loaded GameWorld specific stuff\n");
 }
@@ -150,5 +152,5 @@
   if( getPath() == NULL)
   {
-    PRINTF(1)("GameWorld has no path specified for loading");
+    PRINTF(1)("GameWorld has no path specified for loading\n");
     return (ErrorMessage){213,"Path not specified","GameWorld::load()"};
   }
@@ -241,4 +243,8 @@
 void GameWorld::run()
 {
+  /* start the music */
+  if(this->dataTank->music != NULL)
+    this->dataTank->music->playback();
+
   this->lastFrame = SDL_GetTicks ();
   PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n");
Index: trunk/src/story_entities/game_world_data.cc
===================================================================
--- trunk/src/story_entities/game_world_data.cc	(revision 6633)
+++ trunk/src/story_entities/game_world_data.cc	(revision 6634)
@@ -72,7 +72,4 @@
   this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData");
 
-  this->localPlayer = NULL;
-  this->localCamera = NULL;
-
   this->glmis = NULL;
 
@@ -283,9 +280,4 @@
   if( this->sky != NULL)
     this->localCamera->addChild(this->sky);
-
-  /* sound loading */
-  this->music = NULL;
-  //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
-  //music->playback();
   SoundEngine::getInstance()->setListener(this->localCamera);
 }
@@ -310,2 +302,10 @@
 }
 
+
+void GameWorldData::setSoundTrack(const char* name)
+{
+  PRINTF(3)("Setting Sound Track to %s\n", name);
+  this->music = (OggPlayer*)ResourceManager::getInstance()->load(name, OGG, RP_LEVEL);
+}
+
+
Index: trunk/src/story_entities/game_world_data.h
===================================================================
--- trunk/src/story_entities/game_world_data.h	(revision 6633)
+++ trunk/src/story_entities/game_world_data.h	(revision 6634)
@@ -40,4 +40,6 @@
     virtual ErrorMessage unloadData();
 
+    /* interface functions */
+    void setSoundTrack(const char* name);
 
   protected:
Index: trunk/src/story_entities/multi_player_world_data.cc
===================================================================
--- trunk/src/story_entities/multi_player_world_data.cc	(revision 6633)
+++ trunk/src/story_entities/multi_player_world_data.cc	(revision 6634)
@@ -263,4 +263,7 @@
 
 
+  Playable* pl = this->localPlayer->getControllable();
+  PRINTF(0)("The current regisered playable is hid: %i\n", pl->getUniqueID());
+
 
   PNode* cam = State::getCameraTarget();
Index: trunk/src/story_entities/simple_game_menu.cc
===================================================================
--- trunk/src/story_entities/simple_game_menu.cc	(revision 6634)
+++ trunk/src/story_entities/simple_game_menu.cc	(revision 6634)
@@ -0,0 +1,367 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 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: Patrick Boenzli
+
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+
+#include "simple_game_menu.h"
+
+#include "state.h"
+#include "class_list.h"
+
+#include "load_param.h"
+#include "fast_factory.h"
+#include "factory.h"
+
+#include "p_node.h"
+#include "world_entity.h"
+#include "image_entity.h"
+#include "terrain.h"
+#include "camera.h"
+
+#include "event_handler.h"
+#include "graphics_engine.h"
+
+#include "cd_engine.h"
+
+
+using namespace std;
+
+
+//! This creates a Factory to fabricate a SimpleGameMenu
+CREATE_FACTORY(SimpleGameMenu, CL_SIMPLE_GAME_MENU);
+
+
+
+SimpleGameMenu::SimpleGameMenu(const TiXmlElement* root)
+  : GameWorld(root)
+{
+  this->setClassID(CL_SIMPLE_GAME_MENU, "SimpleGameMenu");
+  this->setName("SimpleGameMenu uninitialized");
+
+  this->dataTank = new SimpleGameMenuData();
+
+  this->cameraVector = Vector(50.0, 0.0, 0.0);
+
+  this->loadParams(root);
+}
+
+
+/**
+ *  remove the SimpleGameMenu from memory
+ *
+ *  delete everything explicitly, that isn't contained in the parenting tree!
+ *  things contained in the tree are deleted automaticaly
+ */
+SimpleGameMenu::~SimpleGameMenu ()
+{
+  PRINTF(3)("SimpleGameMenu::~SimpleGameMenu() - deleting current world\n");
+
+  if( this->dataTank)
+    delete this->dataTank;
+}
+
+
+/**
+ * loads the parameters of a SimpleGameMenu from an XML-element
+ * @param root the XML-element to load from
+ */
+void SimpleGameMenu::loadParams(const TiXmlElement* root)
+{
+  /* skip the GameWorld, since it does not define any useful loadParams for this class */
+  static_cast<GameWorld*>(this)->loadParams(root);
+
+  PRINTF(4)("Loaded SimpleGameMenu specific stuff\n");
+}
+
+
+/**
+ * this is executed just before load
+ *
+ * since the load function sometimes needs data, that has been initialized
+ * before the load and after the proceeding storyentity has finished
+ */
+ErrorMessage SimpleGameMenu::init()
+{
+  /* call underlying init funciton */
+  GameWorld::init();
+
+  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_UP);
+  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_DOWN);
+  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_RETURN);
+  EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_SPACE);
+
+  this->dataTank->localCamera->setRelCoor(this->cameraVector);
+
+  GraphicsEngine::getInstance()->displayFPS(false);
+}
+
+
+/**
+ * load the data
+ */
+ErrorMessage SimpleGameMenu::loadData()
+{
+  GameWorld::loadData();
+
+  /* get the menu list */
+  const std::list<BaseObject*>* imageEntityList = ClassList::getList(CL_IMAGE_ENTITY);
+  std::list<BaseObject*>::const_iterator entity;
+  for (entity = imageEntityList->begin(); entity != imageEntityList->end(); entity++)
+  {
+
+    if( !strcmp("Selector_Menu", (*entity)->getName()))
+    {
+      this->menuSelector = dynamic_cast<ImageEntity*>(*entity);
+      PRINTF(0)("Found the selector: %s\n", (*entity)->getName());
+    }
+    else if( !strcmp( "StartGame_Menu", (*entity)->getName()))
+    {
+      PRINTF(0)("Found a StartItem: %s\n", (*entity)->getName());
+      this->menuStartGame = dynamic_cast<ImageEntity*>(*entity);
+      this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
+    }
+    else if( !strcmp( "Multiplayer_Menu", (*entity)->getName()))
+    {
+      PRINTF(0)("Found a MultiplayerItem: %s\n", (*entity)->getName());
+      this->menuStartMultiplayerGame = dynamic_cast<ImageEntity*>(*entity);
+      this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
+    }
+    else if( !strcmp( "Quit_Menu", (*entity)->getName()))
+    {
+      PRINTF(0)("Found a QuitItem: %s\n", (*entity)->getName());
+      this->menuQuitGame = dynamic_cast<ImageEntity*>(*entity);
+      this->menuList.push_back(dynamic_cast<ImageEntity*>(*entity));
+    }
+  }
+  this->menuSelectedIndex = 0;
+  this->menuSelected = this->menuList[this->menuSelectedIndex];
+  this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
+}
+
+
+
+/**
+ * start the menu
+ */
+bool SimpleGameMenu::start()
+{
+  EventHandler::getInstance()->pushState(ES_MENU);
+
+  /* now call the underlying*/
+  GameWorld::start();
+}
+
+
+
+/**
+ * stop the menu
+ */
+bool SimpleGameMenu::stop()
+{
+  EventHandler::getInstance()->popState();
+
+  /* now call the underlying*/
+  GameWorld::stop();
+}
+
+
+/**
+ *  override the standard tick for more functionality
+ */
+void SimpleGameMenu::tick()
+{
+  GameWorld::tick();
+
+  this->animateScene(this->dt);
+}
+
+
+/**
+ *  no collision detection in the menu
+ */
+void SimpleGameMenu::collide()
+{
+//   this->dataTank->localCamera->
+}
+
+
+/**
+ *  animate the scene
+ */
+void SimpleGameMenu::animateScene(float dt)
+{
+  Quaternion q(/*0.00005*/ 0.0001* dt, Vector(0.0, 1.0, 0.0));
+  this->cameraVector = q.apply(this->cameraVector);
+  this->dataTank->localCamera->setRelCoor(this->cameraVector);
+  this->dataTank->localCamera->getTarget()->setRelCoorSoft(0,0,0);
+}
+
+
+/**
+ * event dispatcher funciton
+ * @param event the incoming event
+ */
+void SimpleGameMenu::process(const Event &event)
+{
+  if( event.type == SDLK_RETURN)
+  {
+    if( this->menuSelected == this->menuQuitGame)
+    {
+      this->setNextStoryID(WORLD_ID_GAMEEND);
+      this->stop();
+    }
+    if( this->menuSelected == this->menuStartGame)
+    {
+      this->stop();
+    }
+  }
+  else if( event.type == SDLK_DOWN && event.bPressed == true)
+  {
+//     ImageEntity*
+    if(this->menuSelectedIndex < (this->menuList.size() - 1))
+    {
+      this->menuSelected = this->menuList[++this->menuSelectedIndex];
+      this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
+    }
+  }
+  else if( event.type == SDLK_UP && event.bPressed == true)
+  {
+    if(this->menuSelectedIndex > 0)
+    {
+      this->menuSelected = this->menuList[--this->menuSelectedIndex];
+      this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
+    }
+  }
+}
+
+
+
+
+
+
+/**********************************************************************************************
+    SimpleGameMenuData
+ **********************************************************************************************/
+
+
+/**
+ * SimpleGameMenuData constructor
+ */
+SimpleGameMenuData::SimpleGameMenuData()
+{}
+
+/**
+ * SimpleGameMenuData decontructor
+ */
+SimpleGameMenuData::~SimpleGameMenuData()
+{}
+
+
+/**
+ *  initialize the GameWorldDataData
+ */
+ErrorMessage SimpleGameMenuData::init()
+{
+  /* call underlying function */
+  GameWorldData::init();
+}
+
+
+/**
+ *  loads the GUI data
+ * @param root reference to the xml root element
+ */
+ErrorMessage SimpleGameMenuData::loadGUI(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadGUI(root);
+}
+
+
+/**
+ *  unloads the GUI data
+ */
+ErrorMessage SimpleGameMenuData::unloadGUI()
+{
+  /* call underlying function */
+  GameWorldData::unloadGUI();
+}
+
+
+/**
+ *  overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff)
+ * @param root reference to the xml root parameter
+ */
+ErrorMessage SimpleGameMenuData::loadWorldEntities(TiXmlElement* root)
+{
+  TiXmlElement* element = root->FirstChildElement("WorldEntities");
+
+  if( element != NULL)
+  {
+    element = element->FirstChildElement();
+    PRINTF(4)("Loading WorldEntities\n");
+    while( element != NULL)
+    {
+      BaseObject* created = Factory::fabricate(element);
+      if( created != NULL )
+        printf("Created a %s: %s\n", created->getClassName(), created->getName());
+
+      if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
+        this->sky = dynamic_cast<WorldEntity*>(created);
+      if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
+        this->terrain = dynamic_cast<Terrain*>(created);
+      element = element->NextSiblingElement();
+    }
+    PRINTF(4)("Done loading WorldEntities\n");
+  }
+
+  /* init the pnode tree */
+  PNode::getNullParent()->init();
+}
+
+
+/**
+ *  unloads the world entities from the xml file
+ */
+ErrorMessage SimpleGameMenuData::unloadWorldEntities()
+{
+  /* call underlying function */
+  GameWorldData::unloadWorldEntities();
+}
+
+
+/**
+ *  loads the scene data
+ * @param root reference to the xml root element
+ */
+ErrorMessage SimpleGameMenuData::loadScene(TiXmlElement* root)
+{
+  /* call underlying function */
+  GameWorldData::loadScene(root);
+}
+
+
+/**
+ *  unloads the scene data
+ */
+ErrorMessage SimpleGameMenuData::unloadScene()
+{
+  /* call underlying function */
+  GameWorldData::unloadScene();
+}
+
+
+
Index: trunk/src/story_entities/simple_game_menu.h
===================================================================
--- trunk/src/story_entities/simple_game_menu.h	(revision 6634)
+++ trunk/src/story_entities/simple_game_menu.h	(revision 6634)
@@ -0,0 +1,90 @@
+/*!
+ * @file simple_game_menu.h
+ *  a StoryEntity that contains a simple game menu
+ */
+
+#ifndef _SIMPLE_GAME_MENU_H
+#define _SIMPLE_GAME_MENU_H
+
+
+#include "game_world.h"
+#include "event_listener.h"
+#include "game_world_data.h"
+#include <vector>
+#include "vector.h"
+
+
+class SimpleGameMenuData;
+class TiXmlElement;
+class ImageEntity;
+
+//! a simple game menu based on a story entity
+/**
+ * This is a simple menu, that is based on the StoryEntity. Therefore this menu is absolutly
+ * loadable and is exchangeable very easely :D
+ */
+class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
+{
+
+  public:
+    SimpleGameMenu(const TiXmlElement* root = NULL);
+    virtual ~SimpleGameMenu();
+
+    void loadParams(const TiXmlElement* root);
+
+    virtual ErrorMessage init();
+    virtual ErrorMessage loadData();
+
+    virtual bool start();
+    virtual bool stop();
+
+    virtual void process(const Event &event);
+
+
+  protected:
+    virtual void tick();
+    virtual void collide();
+
+
+  private:
+    void animateScene(float dt);
+
+
+  private:
+    std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
+    ImageEntity*                      menuSelected;                    //!< ref to the selected menu entity
+    ImageEntity*                      menuSelector;                    //!< ref to the selector image
+    ImageEntity*                      menuStartGame;
+    ImageEntity*                      menuStartMultiplayerGame;
+    ImageEntity*                      menuQuitGame;
+    int                               menuSelectedIndex;
+
+    Vector                            cameraVector;
+};
+
+
+
+//! the simple game menu data
+class SimpleGameMenuData : public GameWorldData
+{
+
+  public:
+    SimpleGameMenuData();
+    virtual ~SimpleGameMenuData();
+
+    virtual ErrorMessage init();
+
+
+  protected:
+    virtual ErrorMessage loadGUI(TiXmlElement* root);
+    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
+    virtual ErrorMessage loadScene(TiXmlElement* root);
+
+    virtual ErrorMessage unloadGUI();
+    virtual ErrorMessage unloadWorldEntities();
+    virtual ErrorMessage unloadScene();
+
+};
+
+
+#endif /* _GAME_WORLD_H */
Index: trunk/src/story_entities/story_entity.h
===================================================================
--- trunk/src/story_entities/story_entity.h	(revision 6633)
+++ trunk/src/story_entities/story_entity.h	(revision 6634)
@@ -24,5 +24,5 @@
 
 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
-class StoryEntity : public BaseObject {
+class StoryEntity : virtual public BaseObject {
 
  public:
Index: trunk/src/subprojects/network/Makefile.am
===================================================================
--- trunk/src/subprojects/network/Makefile.am	(revision 6633)
+++ trunk/src/subprojects/network/Makefile.am	(revision 6634)
@@ -27,5 +27,10 @@
                   $(MAINSRCDIR)/lib/util/helper_functions.cc \
                   $(MAINSRCDIR)/lib/util/executor/executor.cc \
-                  $(MAINSRCDIR)/lib/util/multi_type.cc 
+                  $(MAINSRCDIR)/lib/util/multi_type.cc \
+                  \
+                  \
+                  $(MAINSRCDIR)/lib/coord/p_node.cc        \
+                  $(MAINSRCDIR)/world_entities/world_entity.cc
+                  
 
 
Index: trunk/src/subprojects/network/isolated_unit_test.cc
===================================================================
--- trunk/src/subprojects/network/isolated_unit_test.cc	(revision 6634)
+++ trunk/src/subprojects/network/isolated_unit_test.cc	(revision 6634)
@@ -0,0 +1,15 @@
+
+
+
+#include "../../lib/network/converter.h"
+
+
+int main(int argc, char** argv)
+{
+ 
+  float x = 3234.0f;
+  
+  byte* b = Converter::floatToByteArray(x);
+  
+  return 0;
+}
Index: trunk/src/subprojects/network/read_sync.cc
===================================================================
--- trunk/src/subprojects/network/read_sync.cc	(revision 6633)
+++ trunk/src/subprojects/network/read_sync.cc	(revision 6634)
@@ -29,5 +29,5 @@
  */
 ReadSync::ReadSync(const char* name)
-  : Synchronizeable(name)
+  : Synchronizeable()
 {
   /* define the local buffer size */
Index: trunk/src/subprojects/network/simple_sync.cc
===================================================================
--- trunk/src/subprojects/network/simple_sync.cc	(revision 6633)
+++ trunk/src/subprojects/network/simple_sync.cc	(revision 6634)
@@ -29,5 +29,5 @@
  */
 SimpleSync::SimpleSync(const char* name)
-  : Synchronizeable(name)
+  : Synchronizeable()
 {
   /* define the local buffer size */
Index: trunk/src/subprojects/network/write_sync.cc
===================================================================
--- trunk/src/subprojects/network/write_sync.cc	(revision 6633)
+++ trunk/src/subprojects/network/write_sync.cc	(revision 6634)
@@ -29,5 +29,5 @@
  */
 WriteSync::WriteSync(const char* name)
-  : Synchronizeable(name)
+  : Synchronizeable()
 {
   /* define the local buffer size */
Index: trunk/src/world_entities/Makefile.am
===================================================================
--- trunk/src/world_entities/Makefile.am	(revision 6633)
+++ trunk/src/world_entities/Makefile.am	(revision 6634)
@@ -23,4 +23,6 @@
                   world_entities/character_attributes.cc \
                   world_entities/test_entity.cc \
+		  world_entities/image_entity.cc \
+		  world_entities/planet.cc \
                   \
                   world_entities/weapons/weapon_manager.cc \
@@ -72,4 +74,6 @@
                  world_entities/character_attributes.h \
                  world_entities/test_entity.h \
+                 world_entities/image_entity.h \
+                 world_entities/planet.h \
                  \
                  world_entities/weapons/weapon_manager.h \
Index: trunk/src/world_entities/image_entity.cc
===================================================================
--- trunk/src/world_entities/image_entity.cc	(revision 6634)
+++ trunk/src/world_entities/image_entity.cc	(revision 6634)
@@ -0,0 +1,184 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 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: Patrick Boenzli
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "image_entity.h"
+
+#include "load_param.h"
+#include "factory.h"
+
+#include "graphics_engine.h"
+#include "material.h"
+#include "glincl.h"
+#include "state.h"
+
+
+using namespace std;
+
+
+CREATE_FACTORY(ImageEntity, CL_IMAGE_ENTITY);
+
+
+/**
+ * standart constructor
+ */
+ImageEntity::ImageEntity (const TiXmlElement* root)
+{
+  this->init();
+  this->loadParams(root);
+}
+
+
+/**
+ * destroys a ImageEntity
+*/
+ImageEntity::~ImageEntity ()
+{
+  if (this->material)
+  delete this->material;
+
+  // delete what has to be deleted here
+
+  GraphicsEngine::showMouse(true);
+  GraphicsEngine::stealWMEvents(false);
+}
+
+
+/**
+ * initializes the ImageEntity
+ */
+void ImageEntity::init()
+{
+  this->setClassID(CL_IMAGE_ENTITY, "ImageEntity");
+  this->setName("ImageEntity");
+
+  this->setLayer(E2D_LAYER_TOP);
+  this->setRotationSpeed(5);
+  this->setSize(GraphicsEngine::getInstance()->getResolutionX()/10.0, GraphicsEngine::getInstance()->getResolutionY()/10.0);
+
+  this->setBindNode(this);
+  this->material = new Material;
+  this->setTexture("pictures/error_texture.png");
+  this->bBillboarding = false;
+}
+
+
+void ImageEntity::loadParams(const TiXmlElement* root)
+{
+  static_cast<PNode*>(this)->loadParams(root);
+
+  LoadParam(root, "texture", this, ImageEntity, setTexture)
+      .describe("the texture-file to load onto the ImageEntity");
+
+  LoadParam(root, "size", this, ImageEntity, setSize)
+      .describe("the size of the ImageEntity in Pixels");
+
+  LoadParam(root, "rotation-speed", this, ImageEntity, setRotationSpeed)
+      .describe("the Speed with which the ImageEntity should rotate");
+
+  LoadParam(root, "billboarding", this, ImageEntity, toggleBillboard)
+      .describe("sets the ImageEntity to always look in the direction of the Player");
+}
+
+
+/**
+ * sets the size of the ImageEntity.
+ * @param size the size in pixels
+ */
+void ImageEntity::setSize(float sizeX, float sizeY)
+{
+  this->setSize2D(sizeX, sizeY);
+}
+
+
+/**
+ * sets the material to load
+ * @param textureFile The texture-file to load onto the crosshair
+ */
+void ImageEntity::setTexture(const char* textureFile)
+{
+  this->material->setDiffuseMap(textureFile);
+}
+
+
+/** this turns on/off the billboarding of this WorldEntity
+ *
+ * This means that the image will always look in the direction of the Player
+ */
+void ImageEntity::toggleBillboard()
+{
+  this->bBillboarding = !this->bBillboarding;
+}
+
+
+/**
+ * ticks the ImageEntity
+ * @param dt the time to ticks
+ */
+void ImageEntity::tick(float dt)
+{
+  // let the crosshair rotate
+  //this->shiftDir2D(dt * rotationSpeed);
+
+
+  float z = 0.0f;
+  glReadPixels ((int)this->getAbsCoor2D().x,
+                 GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1,
+                 1,
+                 1,
+                 GL_DEPTH_COMPONENT,
+                 GL_FLOAT,
+                 &z);
+
+
+  GLdouble objX=.0, objY=.0, objZ=.0;
+  gluUnProject(this->getAbsCoor2D().x,
+               GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1,
+               .99,  // z
+               GraphicsEngine::modMat,
+               GraphicsEngine::projMat,
+               GraphicsEngine::viewPort,
+               &objX,
+               &objY,
+               &objZ );
+
+  //this->setAbsCoor(objX, objY, objZ);
+}
+
+
+/**
+ * draws the crosshair
+ */
+void ImageEntity::draw() const
+{
+  glPushMatrix();
+  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
+
+  //glRotatef(this->getAbsDir2D(), 0,0,1);
+  this->material->select();
+  glBegin(GL_TRIANGLE_STRIP);
+  glTexCoord2f(0, 0);
+  glVertex2f(-this->getSizeX2D(), -this->getSizeY2D());
+  glTexCoord2f(1, 0);
+  glVertex2f(this->getSizeX2D(), -this->getSizeY2D());
+  glTexCoord2f(0, 1);
+  glVertex2f(-this->getSizeX2D(), this->getSizeY2D());
+  glTexCoord2f(1, 1);
+  glVertex2f(this->getSizeX2D(), this->getSizeY2D());
+  glEnd();
+  glPopMatrix();
+
+}
Index: trunk/src/world_entities/image_entity.h
===================================================================
--- trunk/src/world_entities/image_entity.h	(revision 6634)
+++ trunk/src/world_entities/image_entity.h	(revision 6634)
@@ -0,0 +1,47 @@
+/*!
+ * @file crosshair.h
+  *  Definition of ...
+
+*/
+
+#ifndef _IMAGE_ENTITY_H
+#define _IMAGE_ENTITY_H
+
+#include "p_node.h"
+#include "element_2d.h"
+#include "event_listener.h"
+
+#include "vector.h"
+
+
+// FORWARD DECLARATION
+class Model;
+class Material;
+class TiXmlElement;
+
+//! A class that enables the
+class ImageEntity : public PNode, public Element2D {
+
+ public:
+  ImageEntity(const TiXmlElement* root = NULL);
+  virtual ~ImageEntity();
+
+  void init();
+  void loadParams(const TiXmlElement* root);
+
+  void setSize(float sizeX, float sizeY);
+  void setTexture(const char* textureFile);
+  /** @param rotationSpeed the speed at what the crosshair should rotate */
+  void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
+  void toggleBillboard();
+
+  virtual void tick(float dt);
+  virtual void draw() const;
+
+ private:
+   Material*        material;             //!< a material for the Aim.
+   float            rotationSpeed;        //!< Speed of the Rotation.
+   bool             bBillboarding;        //!< true if billboarding is on
+};
+
+#endif /* _IMAGE_ENTITY_H */
Index: trunk/src/world_entities/planet.cc
===================================================================
--- trunk/src/world_entities/planet.cc	(revision 6634)
+++ trunk/src/world_entities/planet.cc	(revision 6634)
@@ -0,0 +1,182 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 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: Patrick Boenzli
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "planet.h"
+
+#include "load_param.h"
+#include "factory.h"
+#include "static_model.h"
+
+#include "material.h"
+#include "texture.h"
+
+#include "network_game_manager.h"
+#include "converter.h"
+
+using namespace std;
+
+
+CREATE_FACTORY(Planet, CL_PLANET);
+
+
+
+/**
+ *  initializes a skybox from a XmlElement
+*/
+Planet::Planet(const TiXmlElement* root)
+{
+  this->setClassID(CL_PLANET, "Planet");
+  this->toList(OM_GROUP_01);
+
+  this->material = new Material();
+  this->material->setIllum(10);
+
+  this->loadParams(root);
+}
+
+
+/**
+ *  default destructor
+*/
+Planet::~Planet()
+{
+  PRINTF(5)("Deleting Planet\n");
+  if( this->material)
+    delete this->material;
+}
+
+
+void Planet::loadParams(const TiXmlElement* root)
+{
+  static_cast<WorldEntity*>(this)->loadParams(root);
+
+  LoadParam(root, "texture", this, Planet, setTexture)
+      .describe("Sets the material on the Planet. The string must be the path relative to the data-dir, and without a trailing .jpg");
+
+  LoadParam(root, "size", this, Planet, setSize)
+      .describe("Sets the Size of the Planet (normally this should be 90% of the maximal viewing Distance).");
+}
+
+
+/**
+ *  Defines which textures should be loaded onto the Planet.
+ * @param textureName the top texture.
+*/
+void Planet::setTexture(const char* textureName)
+{
+  this->material->setDiffuseMap(textureName);
+}
+
+
+/**
+ * @param size The new size of the Planet
+
+ * do not forget to rebuild the Planet after this.
+*/
+void Planet::setSize(float size)
+{
+  this->size = size;
+}
+
+
+
+void Planet::draw() const
+{
+
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+
+  /* translate */
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y,
+                this->getAbsCoor ().z);
+
+
+  this->material->select();
+
+
+  Vector c;
+  double r = this->size;
+  int n = 200;
+  int method = 1;
+  double theta1 = 0;
+  double theta2 = 2 * M_PI;
+  double phi1 = -M_PI/2.0;
+  double phi2 = M_PI/2.0;
+
+
+  int i,j;
+  double jdivn,j1divn,idivn,dosdivn,unodivn=1/(double)n,ndiv2=(double)n/2,t1,t2,t3,cost1,cost2,cte1,cte3;
+  cte3 = (theta2-theta1)/n;
+  cte1 = (phi2-phi1)/ndiv2;
+  dosdivn = 2*unodivn;
+  Vector e,p,e2,p2;
+
+
+  t2=phi1;
+  cost2=cos(phi1);
+  j1divn=0;
+  for (j=0;j<ndiv2;j++) {
+    t1 = t2;//t1 = phi1 + j * cte1;
+    t2 += cte1;//t2 = phi1 + (j + 1) * cte1;
+    t3 = theta1 - cte3;
+    cost1 = cost2;//cost1=cos(t1);
+    cost2 = cos(t2);
+    e.y = sin(t1);
+    e2.y = sin(t2);
+    p.y = c.y + r * e.y;
+    p2.y = c.y + r * e2.y;
+
+    if (method == 0)
+      glBegin(GL_QUAD_STRIP);
+    else
+      glBegin(GL_TRIANGLE_STRIP);
+
+    idivn=0;
+    jdivn=j1divn;
+    j1divn+=dosdivn;//=2*(j+1)/(double)n;
+    for (i=0;i<=n;i++) {
+       //t3 = theta1 + i * (theta2 - theta1) / n;
+      t3 += cte3;
+      e.x = cost1 * cos(t3);
+       //e.y = sin(t1);
+      e.z = cost1 * sin(t3);
+      p.x = c.x + r * e.x;
+       //p.y = c.y + r * e.y;
+      p.z = c.z + r * e.z;
+      glNormal3f(e.x,e.y,e.z);
+      glTexCoord2f(idivn,jdivn);
+      glVertex3f(p.x,p.y,p.z);
+
+
+      e2.x = cost2 * cos(t3);
+       //e.y = sin(t2);
+      e2.z = cost2 * sin(t3);
+      p2.x = c.x + r * e2.x;
+       //p.y = c.y + r * e.y;
+      p2.z = c.z + r * e2.z;
+      glNormal3f(e2.x,e2.y,e2.z);
+      glTexCoord2f(idivn,j1divn);
+      glVertex3f(p2.x,p2.y,p2.z);
+      idivn += unodivn;
+    }
+    glEnd();
+  }
+}
+
+
+
Index: trunk/src/world_entities/planet.h
===================================================================
--- trunk/src/world_entities/planet.h	(revision 6634)
+++ trunk/src/world_entities/planet.h	(revision 6634)
@@ -0,0 +1,48 @@
+/*!
+ * @file planet.h
+ *  Definition of the Planet, that handles the Display of an atmosphere for orxonox.
+ */
+
+#ifndef _PLANET_H
+#define _PLANET_H
+
+/* INCLUDES */
+#include "world_entity.h"
+
+/* FORWARD DECLARATION */
+class Material;
+class Texture;
+
+//! A Class to handle a Planet
+class Planet : public WorldEntity
+{
+ public:
+  Planet(const TiXmlElement* root);
+
+  virtual ~Planet();
+
+  void loadParams(const TiXmlElement* root);
+
+  void setSize(float size);
+  /** assumes jpg as input-format */
+  void setTexture(const char* textureName);
+
+
+  virtual void draw() const;
+
+
+
+ private:
+  Material*       material;        //!< Materials for the Planet. sorted by number (0-5) top, bottom, left, right, front, back
+  Texture*        texture;         //!< Textures for the CubeMap.
+
+  float           size;            //!< Size of the Planet. This should match the frustum maximum range.
+  float           textureSize;     //!< this is the length of a texture (assumes a square texture)
+  char*           textureName;     //!< Name of the Texture
+
+};
+
+#endif  /* _PLANET_H */
+
+
+
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 6633)
+++ trunk/src/world_entities/skybox.cc	(revision 6634)
@@ -71,5 +71,6 @@
   this->setClassID(CL_SKYBOX, "SkyBox");
   this->toList(OM_ENVIRON_NOTICK);
-  this->size = 100.0;
+  //this->size = 100.0;
+  this->textureSize = 1024.0f;
 
   for (int i = 0; i < 6; i++)
@@ -215,4 +216,19 @@
 }
 
+
+
+void SkyBox::draw()
+{
+  glPushAttrib(GL_ENABLE_BIT);
+//   glPushAttrib(GL_LIGHTING_BIT);
+  glDisable(GL_LIGHTING);
+
+  WorldEntity::draw();
+
+  glPopAttrib();
+
+}
+
+
 /**
  *  rebuilds the SkyBox
@@ -233,8 +249,14 @@
   model->addVertex (0.5*size, -0.5*size, -0.5*size);
 
-  model->addVertexTexture (0.0, 1.0);
-  model->addVertexTexture (1.0, 1.0);
-  model->addVertexTexture (1.0, 0.0);
-  model->addVertexTexture (0.0, 0.0);
+//   model->addVertexTexture (0.0, 1.0);
+//   model->addVertexTexture (1.0, 1.0);
+//   model->addVertexTexture (1.0, 0.0);
+//   model->addVertexTexture (0.0, 0.0);
+
+  model->addVertexTexture (1.0/this->textureSize, (this->textureSize - 1.0)/this->textureSize);
+  model->addVertexTexture ((this->textureSize - 1.0)/this->textureSize, (this->textureSize - 1.0)/this->textureSize);
+  model->addVertexTexture ((this->textureSize - 1.0)/this->textureSize, 1.0/this->textureSize);
+  model->addVertexTexture (1.0/this->textureSize, 1.0/this->textureSize);
+
 
   model->addVertexNormal (0.0, 0.0, 1.0);
Index: trunk/src/world_entities/skybox.h
===================================================================
--- trunk/src/world_entities/skybox.h	(revision 6633)
+++ trunk/src/world_entities/skybox.h	(revision 6634)
@@ -33,4 +33,5 @@
   void postInit();
 
+  virtual void draw();
 
   void setSize(float size);
@@ -60,4 +61,5 @@
 
   float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
+  float           textureSize;     //!< this is the length of a texture (assumes a square texture)
   char*           textureName;     //!< Name of the Texture
 
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 6633)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 6634)
@@ -40,4 +40,7 @@
 
 #include "plane.h"
+
+#include "state.h"
+#include "player.h"
 
 
@@ -272,4 +275,10 @@
 void SpaceShip::tick (float time)
 {
+  this->getWeaponManager()->tick(time);
+  // weapon system manipulation
+  this->weaponAction();
+
+//   if( this != State::getPlayer()->getControllable())
+//     return;
 
   // spaceship controlled movement
@@ -293,6 +302,6 @@
 
   //hoover effect
-  cycle += time;
-  this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
+  //cycle += time;
+  //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
 
   //readjust
@@ -311,7 +320,5 @@
   this->shiftCoor (move);
 
-  this->getWeaponManager()->tick(time);
-  // weapon system manipulation
-  this->weaponAction();
+
 }
 
@@ -508,29 +515,34 @@
   SYNCHELP_READ_BYTE( b );
 
-  if ( b == DATA_state && this->getHostID()!=this->getOwner() )
-  {
+  if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
+  {
+    PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
     setRequestedSync( false );
     setIsOutOfSync( false );
     SYNCHELP_READ_FKT( WorldEntity::writeState );
-    SYNCHELP_READ_FLOAT( cycle );
-  }
-
-  if ( b == DATA_flags && this->getHostID()!=this->getOwner() )
-  {
-    int flags;
+    //SYNCHELP_READ_FLOAT( cycle );
+
+    return SYNCHELP_READ_N;
+  }
+
+
+  if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
+  {
+    int flags = 0;
     SYNCHELP_READ_INT( flags );
 
-    bUp = flags & MASK_bUp != 0;
-    bDown = flags & MASK_bDown != 0;
-    bLeft = flags & MASK_bLeft != 0;
-    bRight = flags & MASK_bRight != 0;
-    bAscend = flags & MASK_bAscend != 0;
-    bDescend = flags & MASK_bDescend != 0;
-    bFire = flags & MASK_bFire != 0;
-    bRollL = flags & MASK_bRollL != 0;
-    bRollR = flags & MASK_bRollR != 0;
-  }
-
-  if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
+    bUp = (flags & MASK_bUp) != 0;
+    bDown = (flags & MASK_bDown) != 0;
+    bLeft = (flags & MASK_bLeft) != 0;
+    bRight = (flags & MASK_bRight) != 0;
+    bAscend = (flags & MASK_bAscend) != 0;
+    bDescend = (flags & MASK_bDescend) != 0;
+    bFire = (flags & MASK_bFire) != 0;
+    bRollL = (flags & MASK_bRollL) != 0;
+    bRollR = (flags & MASK_bRollR) != 0;
+
+  }
+
+  /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
   {
     SYNCHELP_READ_FLOAT( xMouse );
@@ -538,5 +550,8 @@
     SYNCHELP_READ_FLOAT( mouseSensitivity );
     SYNCHELP_READ_FLOAT( cycle );
-  }
+}*/
+
+  if ( this->getOwner() != this->getHostID() )
+    SYNCHELP_READ_FKT( PNode::writeSync );
 
   return SYNCHELP_READ_N;
@@ -549,8 +564,9 @@
   SYNCHELP_WRITE_BEGIN();
 
-  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
+  if ( isOutOfSync() && !requestedSync() /*&& this->getHostID()!=this->getOwner()*/ )
   {
     (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
     setRequestedSync( true );
+    PRINTF(0)("REQUESTED STATE %d\n", this->getUniqueID());
   }
 
@@ -560,12 +576,13 @@
     *reciever = rec;
 
+    PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec);
+
     SYNCHELP_WRITE_BYTE( (byte)DATA_state );
 
     SYNCHELP_WRITE_FKT( WorldEntity::readState );
-    SYNCHELP_WRITE_FLOAT( cycle );
+    //SYNCHELP_WRITE_FLOAT( cycle );
 
     return SYNCHELP_WRITE_N;
   }
-
 
   *reciever = 0;
@@ -592,7 +609,7 @@
       mask |= MASK_bRollR;
 
-    static int oldMask = mask+1; //so it is different the first time!
-    static float oldxMouse = xMouse + 1.0;
-    static float oldyMouse = yMouse + 1.0;
+
+    //static float oldxMouse = xMouse + 1.0;
+    //static float oldyMouse = yMouse + 1.0;
 
     if ( mask != oldMask )
@@ -602,6 +619,10 @@
       SYNCHELP_WRITE_INT( mask );
     }
-
-    if ( oldxMouse != xMouse || oldyMouse != yMouse )
+    else
+    {
+      SYNCHELP_WRITE_BYTE( 0 );
+    }
+
+    /*if ( oldxMouse != xMouse || oldyMouse != yMouse )
     {
       oldxMouse = xMouse;
@@ -612,6 +633,13 @@
       SYNCHELP_WRITE_FLOAT( mouseSensitivity );
       SYNCHELP_WRITE_FLOAT( cycle );
-    }
-  }
+    }*/
+  }
+  else
+  {
+    SYNCHELP_WRITE_BYTE( 0 );
+  }
+
+  if ( this->getOwner() == this->getHostID() )
+    SYNCHELP_WRITE_FKT( PNode::readSync );
 
   return SYNCHELP_WRITE_N;
Index: trunk/src/world_entities/space_ships/space_ship.h
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.h	(revision 6633)
+++ trunk/src/world_entities/space_ships/space_ship.h	(revision 6634)
@@ -75,4 +75,6 @@
     float                 airViscosity;
 
+    int oldMask;
+
 };
 
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 6633)
+++ trunk/src/world_entities/world_entity.cc	(revision 6634)
@@ -517,17 +517,9 @@
   if ( strcmp(modelFileName, "") )
   {
-
-    if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
-    {
-      loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
-    }
-    else
-    {
-      loadModel( modelFileName, scaling );
-    }
+    loadModel( modelFileName, scaling );
   }
   delete[] modelFileName;
 
-  SYNCHELP_READ_STRINGM( modelFileName );
+  /*SYNCHELP_READ_STRINGM( modelFileName );
 
   if ( strcmp(modelFileName, "") )
@@ -541,4 +533,5 @@
       this->md2TextureFileName = modelFileName;
     }
+  */
 
   return SYNCHELP_READ_N;
@@ -558,7 +551,22 @@
   SYNCHELP_WRITE_FKT( PNode::readState );
 
-  SYNCHELP_WRITE_STRING( getModel( 0 )->getName() );
+  if ( getModel(0) && getModel(0)->getName() )
+  {
+    char* name = (char*)(getModel( 0 )->getName());
+
+    if ( strstr(name, ResourceManager::getInstance()->getDataDir()) )
+    {
+      name += strlen(ResourceManager::getInstance()->getDataDir());
+    }
+
+    SYNCHELP_WRITE_STRING( name );
+  }
+  else
+  {
+    SYNCHELP_WRITE_STRING("");
+  }
+
   SYNCHELP_WRITE_FLOAT( scaling );
-  if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
+  /*if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
   {
     SYNCHELP_WRITE_STRING(this->md2TextureFileName);
@@ -567,5 +575,5 @@
   {
     SYNCHELP_WRITE_STRING("");
-  }
+}*/
 
   return SYNCHELP_WRITE_N;
