Changeset 6861 in orxonox.OLD for branches/network/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Jan 30, 2006, 10:24:20 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/space_ships/space_ship.cc
r6820 r6861 128 128 129 129 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; 130 bFire = false; 130 131 131 xMouse = yMouse = 0; 132 132 yInvert = 1; … … 517 517 #define MASK_bAscend 16 518 518 #define MASK_bDescend 32 519 #define MASK_bFire 64 520 #define MASK_bRollL 128 521 #define MASK_bRollR 256 519 #define MASK_bRollL 64 520 #define MASK_bRollR 128 522 521 523 522 #define DATA_state 1 … … 526 525 #define DATA_sync 4 527 526 #define DATA_velocity 5 527 #define DATA_playables 6 528 528 529 529 int SpaceShip::writeBytes( const byte * data, int length, int sender ) … … 548 548 if ( b == DATA_flags ) 549 549 { 550 int flags = 0; 551 SYNCHELP_READ_INT( flags, NWT_SS_FLAGS ); 552 553 bUp = (flags & MASK_bUp) != 0; 554 bDown = (flags & MASK_bDown) != 0; 555 bLeft = (flags & MASK_bLeft) != 0; 556 bRight = (flags & MASK_bRight) != 0; 557 bAscend = (flags & MASK_bAscend) != 0; 558 bDescend = (flags & MASK_bDescend) != 0; 559 bFire = (flags & MASK_bFire) != 0; 560 bRollL = (flags & MASK_bRollL) != 0; 561 bRollR = (flags & MASK_bRollR) != 0; 550 if ( this->getOwner() != this->getHostID() ) 551 { 552 byte flags = 0; 553 SYNCHELP_READ_BYTE( flags, NWT_SS_FLAGS ); 554 555 bUp = (flags & MASK_bUp) != 0; 556 bDown = (flags & MASK_bDown) != 0; 557 bLeft = (flags & MASK_bLeft) != 0; 558 bRight = (flags & MASK_bRight) != 0; 559 bAscend = (flags & MASK_bAscend) != 0; 560 bDescend = (flags & MASK_bDescend) != 0; 561 bRollL = (flags & MASK_bRollL) != 0; 562 bRollR = (flags & MASK_bRollR) != 0; 563 564 } 562 565 563 566 continue; … … 566 569 if ( b == DATA_mouse ) 567 570 { 568 SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW ); 569 SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX ); 570 SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY ); 571 SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ ); 571 if ( this->getOwner() != this->getHostID() ) 572 { 573 SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW ); 574 SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX ); 575 SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY ); 576 SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ ); 577 } 572 578 573 579 continue; … … 584 590 if ( b == DATA_velocity ) 585 591 { 586 SYNCHELP_READ_FLOAT( velocity.x, NWT_SS_VELX ); 587 SYNCHELP_READ_FLOAT( velocity.y, NWT_SS_VELY ); 588 SYNCHELP_READ_FLOAT( velocity.z, NWT_SS_VELZ ); 592 if ( this->getOwner() != this->getHostID() ) 593 { 594 SYNCHELP_READ_FLOAT( velocity.x, NWT_SS_VELX ); 595 SYNCHELP_READ_FLOAT( velocity.y, NWT_SS_VELY ); 596 SYNCHELP_READ_FLOAT( velocity.z, NWT_SS_VELZ ); 597 } 598 599 continue; 600 } 601 602 if ( b == DATA_playables ) 603 { 604 if ( this->getOwner() != this->getHostID() ) 605 SYNCHELP_READ_FKT( Playable::writeSync, NWT_SS_PL_SYNC ); 589 606 } 590 607 } … … 616 633 617 634 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SS_WE_STATE ); 618 //SYNCHELP_WRITE_FLOAT( cycle );619 635 620 636 return SYNCHELP_WRITE_N; … … 631 647 if ( this->getHostID()==this->getOwner() ) 632 648 { 633 intmask = 0;649 byte mask = 0; 634 650 635 651 if ( bUp ) … … 643 659 if ( bAscend ) 644 660 mask |= MASK_bAscend; 645 if ( bFire )646 mask |= MASK_bFire;647 661 if ( bRollL ) 648 662 mask |= MASK_bRollL; … … 651 665 652 666 653 //static float oldxMouse = xMouse + 1.0;654 //static float oldyMouse = yMouse + 1.0;655 656 667 if ( mask != oldMask ) 657 668 { 658 669 oldMask = mask; 659 670 SYNCHELP_WRITE_BYTE( DATA_flags, NWT_SS_B ); 660 SYNCHELP_WRITE_ INT( mask, NWT_SS_FLAGS );671 SYNCHELP_WRITE_BYTE( mask, NWT_SS_FLAGS ); 661 672 } 662 673 #define __OFFSET_MDIR_W 0.01 … … 688 699 SYNCHELP_WRITE_FLOAT( velocity.z, NWT_SS_VELZ ); 689 700 } 701 702 if ( Playable::needsReadSync() ) 703 { 704 SYNCHELP_WRITE_BYTE( DATA_playables, NWT_SS_B ); 705 SYNCHELP_WRITE_FKT( Playable::readSync, NWT_SS_PL_SYNC ); 706 } 690 707 691 708 }
Note: See TracChangeset
for help on using the changeset viewer.