Changeset 5833 in orxonox.OLD for branches/network/src/world_entities
- Timestamp:
- Nov 30, 2005, 11:09:18 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/player.cc
r5829 r5833 445 445 void Player::writeBytes(const byte* data, int length) 446 446 { 447 PRINTF(0)("Player: got %i bytes of data\n", length);447 // PRINTF(0)("Player: got %i bytes of data\n", length); 448 448 this->inLength = length; 449 449 … … 476 476 for( int i = 0; i < length; i++) 477 477 { 478 478 479 code = data[i]; 479 480 481 //PRINTF(0)("got byte: %u\n", data[i]); 480 482 /* is it a time code? */ 481 483 if( code == TIME) 482 484 { 483 485 /* 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 497 487 /* read out new movement */ 498 488 time = (float)(data[++i] / 100.0f); 499 PRINTF(0)("Got time: %f msec\n", time);489 //PRINTF(0)("Got time: %f msec\n", time); 500 490 } 491 501 492 else if( code == UP && this->getRelCoor().x < 20) 502 493 accel = accel+(direction*acceleration); … … 507 498 else if( code == RIGHT && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2) 508 499 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 511 518 512 519 … … 522 529 int Player::readBytes(byte* data) 523 530 { 524 PRINTF(0)("Player: sent %i bytes of data\n", this->sentLength);531 // PRINTF(0)("Player: sent %i bytes of data\n", this->sentLength); 525 532 526 533 /* copy data */
Note: See TracChangeset
for help on using the changeset viewer.