Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5833 in orxonox.OLD for branches/network/src/world_entities


Ignore:
Timestamp:
Nov 30, 2005, 11:09:18 AM (19 years ago)
Author:
patrick
Message:

network: server/client orxonox now works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/player.cc

    r5829 r5833  
    445445void Player::writeBytes(const byte* data, int length)
    446446{
    447   PRINTF(0)("Player: got %i bytes of data\n", length);
     447 // PRINTF(0)("Player: got %i bytes of data\n", length);
    448448  this->inLength = length;
    449449
     
    476476  for( int i = 0; i < length; i++)
    477477  {
     478   
    478479    code = data[i];
    479480
     481    //PRINTF(0)("got byte: %u\n", data[i]);
    480482    /* is it a time code? */
    481483    if( code == TIME)
    482484    {
    483485      /* is it the first time */
    484       if( time > 0.0f )
    485       {
    486         /* apply movement */
    487         Vector move = accel * time;
    488 
    489         if (accel.z < 0)
    490           this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5);
    491         else if (accel.z > 0)
    492           this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5);
    493         else
    494           this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
    495         this->shiftCoor (move);
    496       }
     486     
    497487      /* read out new movement */
    498488      time = (float)(data[++i] / 100.0f);
    499       PRINTF(0)("Got time: %f msec\n", time);
     489      //PRINTF(0)("Got time: %f msec\n", time);
    500490    }
     491   
    501492    else if( code == UP && this->getRelCoor().x < 20)
    502493      accel = accel+(direction*acceleration);
     
    507498    else if( code == RIGHT && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    508499      accel = accel + (orthDirection*acceleration);
    509   }
    510 
     500 
     501    if( time > 0.0f )
     502    {
     503      /* apply movement */
     504      Vector move = accel * time;
     505
     506      if (accel.z < 0)
     507        this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5);
     508      else if (accel.z > 0)
     509        this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5);
     510      else
     511        this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
     512      this->shiftCoor (move);
     513    }
     514
     515  }
     516
     517 
    511518
    512519
     
    522529int Player::readBytes(byte* data)
    523530{
    524   PRINTF(0)("Player: sent %i bytes of data\n", this->sentLength);
     531 // PRINTF(0)("Player: sent %i bytes of data\n", this->sentLength);
    525532
    526533  /* copy data */
Note: See TracChangeset for help on using the changeset viewer.