Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6706 in orxonox.OLD


Ignore:
Timestamp:
Jan 25, 2006, 3:59:22 PM (18 years ago)
Author:
rennerc
Message:
 
Location:
branches/network/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_game_manager.cc

    r6695 r6706  
    527527        PNode *p = dynamic_cast<PNode*>(b);
    528528        p->setAbsCoor(pos);
    529         //p->updateNode(0);
     529        p->updateNode(0);
    530530        pos += Vector(1000.0, 1000.0, 1000.0);
    531531      }
  • branches/network/src/world_entities/space_ships/space_ship.cc

    r6696 r6706  
    289289  this->weaponAction();
    290290
    291   if( xMouse != 0 || yMouse != 0)
     291  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner()==this->getHostID() )
    292292   {
    293293    if (xMouse > controlVelocityX) xMouse = controlVelocityX;
     
    528528
    529529  byte b;
    530   SYNCHELP_READ_BYTE( b );
    531 
    532   if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
    533   {
    534     PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
    535     setRequestedSync( false );
    536     setIsOutOfSync( false );
    537     SYNCHELP_READ_FKT( WorldEntity::writeState );
    538     //SYNCHELP_READ_FLOAT( cycle );
    539 
    540     return SYNCHELP_READ_N;
    541   }
    542 
    543 
    544   if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
    545   {
    546     int flags = 0;
    547     SYNCHELP_READ_INT( flags );
    548 
    549     bUp = (flags & MASK_bUp) != 0;
    550     bDown = (flags & MASK_bDown) != 0;
    551     bLeft = (flags & MASK_bLeft) != 0;
    552     bRight = (flags & MASK_bRight) != 0;
    553     bAscend = (flags & MASK_bAscend) != 0;
    554     bDescend = (flags & MASK_bDescend) != 0;
    555     bFire = (flags & MASK_bFire) != 0;
    556     bRollL = (flags & MASK_bRollL) != 0;
    557     bRollR = (flags & MASK_bRollR) != 0;
    558 
    559   }
     530 
     531  do
     532  {
     533    SYNCHELP_READ_BYTE( b );
     534
     535    if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
     536    {
     537     PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
     538     setRequestedSync( false );
     539     setIsOutOfSync( false );
     540     SYNCHELP_READ_FKT( WorldEntity::writeState );
     541     //SYNCHELP_READ_FLOAT( cycle );
     542
     543      return SYNCHELP_READ_N;
     544    }
     545
     546
     547    //TODO: do not recieve data if you are the owner
     548    if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
     549    {
     550      int flags = 0;
     551      SYNCHELP_READ_INT( 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;
     562
     563    }
     564   
     565    //TODO: do not recieve data if you are the owner
     566    if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ )
     567    {
     568      SYNCHELP_READ_FLOAT( mouseDir.w );
     569      SYNCHELP_READ_FLOAT( mouseDir.v.x );
     570      SYNCHELP_READ_FLOAT( mouseDir.v.y );
     571      SYNCHELP_READ_FLOAT( mouseDir.v.z );
     572    }
     573  } while( b != 0 );
    560574
    561575  /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
     
    634648      SYNCHELP_WRITE_INT( mask );
    635649    }
    636     else
    637     {
    638       SYNCHELP_WRITE_BYTE( 0 );
    639     }
    640 
    641     /*if ( oldxMouse != xMouse || oldyMouse != yMouse )
    642     {
    643       oldxMouse = xMouse;
    644       oldyMouse = yMouse;
     650#define __OFFSET_ROT 0.05
     651    if ( fabs( oldMouseDir.w - mouseDir.w ) > __OFFSET_ROT ||
     652         fabs( oldMouseDir.v.x - mouseDir.v.x ) > __OFFSET_ROT ||
     653         fabs( oldMouseDir.v.y - mouseDir.v.y ) > __OFFSET_ROT ||
     654         fabs( oldMouseDir.v.z - mouseDir.v.z ) > __OFFSET_ROT )
     655    {
     656      oldMouseDir = mouseDir;
     657     
    645658      SYNCHELP_WRITE_BYTE( DATA_mouse );
    646       SYNCHELP_WRITE_FLOAT( xMouse );
    647       SYNCHELP_WRITE_FLOAT( yMouse );
    648       SYNCHELP_WRITE_FLOAT( mouseSensitivity );
    649       SYNCHELP_WRITE_FLOAT( cycle );
    650     }*/
    651   }
    652   else
    653   {
    654     SYNCHELP_WRITE_BYTE( 0 );
    655   }
     659      SYNCHELP_WRITE_FLOAT( mouseDir.w );
     660      SYNCHELP_WRITE_FLOAT( mouseDir.v.x );
     661      SYNCHELP_WRITE_FLOAT( mouseDir.v.y );
     662      SYNCHELP_WRITE_FLOAT( mouseDir.v.z );
     663    }
     664
     665  }
     666
     667  SYNCHELP_WRITE_BYTE( 0 );
     668
    656669
    657670  if ( this->getOwner() == this->getHostID() )
  • branches/network/src/world_entities/space_ships/space_ship.h

    r6637 r6706  
    7272    Vector                velocity;           //!< the velocity of the player.
    7373    Quaternion            mouseDir;           //!< the direction where the player wants to fly
     74    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
    7475    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
    7576    Quaternion            rotQuat;
  • branches/network/src/world_entities/weapons/weapon_manager.cc

    r6679 r6706  
    217217bool WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID)
    218218{
    219   assert(weapon != NULL);
     219  if ( weapon == NULL )
     220    return false;
    220221
    221222  if (unlikely(configID >= WM_MAX_CONFIGS || slotID >= (int)this->slotCount))
Note: See TracChangeset for help on using the changeset viewer.