Changeset 6634 in orxonox.OLD for trunk/src/world_entities/space_ships
- Timestamp:
- Jan 21, 2006, 1:18:19 AM (19 years ago)
- Location:
- trunk/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/space_ship.cc
r6617 r6634 40 40 41 41 #include "plane.h" 42 43 #include "state.h" 44 #include "player.h" 42 45 43 46 … … 272 275 void SpaceShip::tick (float time) 273 276 { 277 this->getWeaponManager()->tick(time); 278 // weapon system manipulation 279 this->weaponAction(); 280 281 // if( this != State::getPlayer()->getControllable()) 282 // return; 274 283 275 284 // spaceship controlled movement … … 293 302 294 303 //hoover effect 295 cycle += time;296 this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);304 //cycle += time; 305 //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02); 297 306 298 307 //readjust … … 311 320 this->shiftCoor (move); 312 321 313 this->getWeaponManager()->tick(time); 314 // weapon system manipulation 315 this->weaponAction(); 322 316 323 } 317 324 … … 508 515 SYNCHELP_READ_BYTE( b ); 509 516 510 if ( b == DATA_state && this->getHostID()!=this->getOwner() ) 511 { 517 if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ ) 518 { 519 PRINTF(0)("GOT STATE %d\n", this->getUniqueID()); 512 520 setRequestedSync( false ); 513 521 setIsOutOfSync( false ); 514 522 SYNCHELP_READ_FKT( WorldEntity::writeState ); 515 SYNCHELP_READ_FLOAT( cycle ); 516 } 517 518 if ( b == DATA_flags && this->getHostID()!=this->getOwner() ) 519 { 520 int flags; 523 //SYNCHELP_READ_FLOAT( cycle ); 524 525 return SYNCHELP_READ_N; 526 } 527 528 529 if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ ) 530 { 531 int flags = 0; 521 532 SYNCHELP_READ_INT( flags ); 522 533 523 bUp = flags & MASK_bUp != 0; 524 bDown = flags & MASK_bDown != 0; 525 bLeft = flags & MASK_bLeft != 0; 526 bRight = flags & MASK_bRight != 0; 527 bAscend = flags & MASK_bAscend != 0; 528 bDescend = flags & MASK_bDescend != 0; 529 bFire = flags & MASK_bFire != 0; 530 bRollL = flags & MASK_bRollL != 0; 531 bRollR = flags & MASK_bRollR != 0; 532 } 533 534 if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) 534 bUp = (flags & MASK_bUp) != 0; 535 bDown = (flags & MASK_bDown) != 0; 536 bLeft = (flags & MASK_bLeft) != 0; 537 bRight = (flags & MASK_bRight) != 0; 538 bAscend = (flags & MASK_bAscend) != 0; 539 bDescend = (flags & MASK_bDescend) != 0; 540 bFire = (flags & MASK_bFire) != 0; 541 bRollL = (flags & MASK_bRollL) != 0; 542 bRollR = (flags & MASK_bRollR) != 0; 543 544 } 545 546 /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) 535 547 { 536 548 SYNCHELP_READ_FLOAT( xMouse ); … … 538 550 SYNCHELP_READ_FLOAT( mouseSensitivity ); 539 551 SYNCHELP_READ_FLOAT( cycle ); 540 } 552 }*/ 553 554 if ( this->getOwner() != this->getHostID() ) 555 SYNCHELP_READ_FKT( PNode::writeSync ); 541 556 542 557 return SYNCHELP_READ_N; … … 549 564 SYNCHELP_WRITE_BEGIN(); 550 565 551 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner())566 if ( isOutOfSync() && !requestedSync() /*&& this->getHostID()!=this->getOwner()*/ ) 552 567 { 553 568 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 554 569 setRequestedSync( true ); 570 PRINTF(0)("REQUESTED STATE %d\n", this->getUniqueID()); 555 571 } 556 572 … … 560 576 *reciever = rec; 561 577 578 PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec); 579 562 580 SYNCHELP_WRITE_BYTE( (byte)DATA_state ); 563 581 564 582 SYNCHELP_WRITE_FKT( WorldEntity::readState ); 565 SYNCHELP_WRITE_FLOAT( cycle );583 //SYNCHELP_WRITE_FLOAT( cycle ); 566 584 567 585 return SYNCHELP_WRITE_N; 568 586 } 569 570 587 571 588 *reciever = 0; … … 592 609 mask |= MASK_bRollR; 593 610 594 static int oldMask = mask+1; //so it is different the first time! 595 static float oldxMouse = xMouse + 1.0;596 static float oldyMouse = yMouse + 1.0;611 612 //static float oldxMouse = xMouse + 1.0; 613 //static float oldyMouse = yMouse + 1.0; 597 614 598 615 if ( mask != oldMask ) … … 602 619 SYNCHELP_WRITE_INT( mask ); 603 620 } 604 605 if ( oldxMouse != xMouse || oldyMouse != yMouse ) 621 else 622 { 623 SYNCHELP_WRITE_BYTE( 0 ); 624 } 625 626 /*if ( oldxMouse != xMouse || oldyMouse != yMouse ) 606 627 { 607 628 oldxMouse = xMouse; … … 612 633 SYNCHELP_WRITE_FLOAT( mouseSensitivity ); 613 634 SYNCHELP_WRITE_FLOAT( cycle ); 614 } 615 } 635 }*/ 636 } 637 else 638 { 639 SYNCHELP_WRITE_BYTE( 0 ); 640 } 641 642 if ( this->getOwner() == this->getHostID() ) 643 SYNCHELP_WRITE_FKT( PNode::readSync ); 616 644 617 645 return SYNCHELP_WRITE_N; -
trunk/src/world_entities/space_ships/space_ship.h
r6547 r6634 75 75 float airViscosity; 76 76 77 int oldMask; 78 77 79 }; 78 80
Note: See TracChangeset
for help on using the changeset viewer.