Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 21, 2006, 1:18:19 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the network-branche back to the trunk

merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r6500:HEAD
minor conflicts in texture and one Makefile resolved to the trunk

also made a small patch to texture, so it Modulates with GL_REPEAT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6617 r6634  
    4040
    4141#include "plane.h"
     42
     43#include "state.h"
     44#include "player.h"
    4245
    4346
     
    272275void SpaceShip::tick (float time)
    273276{
     277  this->getWeaponManager()->tick(time);
     278  // weapon system manipulation
     279  this->weaponAction();
     280
     281//   if( this != State::getPlayer()->getControllable())
     282//     return;
    274283
    275284  // spaceship controlled movement
     
    293302
    294303  //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);
    297306
    298307  //readjust
     
    311320  this->shiftCoor (move);
    312321
    313   this->getWeaponManager()->tick(time);
    314   // weapon system manipulation
    315   this->weaponAction();
     322
    316323}
    317324
     
    508515  SYNCHELP_READ_BYTE( b );
    509516
    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());
    512520    setRequestedSync( false );
    513521    setIsOutOfSync( false );
    514522    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;
    521532    SYNCHELP_READ_INT( flags );
    522533
    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() )
    535547  {
    536548    SYNCHELP_READ_FLOAT( xMouse );
     
    538550    SYNCHELP_READ_FLOAT( mouseSensitivity );
    539551    SYNCHELP_READ_FLOAT( cycle );
    540   }
     552}*/
     553
     554  if ( this->getOwner() != this->getHostID() )
     555    SYNCHELP_READ_FKT( PNode::writeSync );
    541556
    542557  return SYNCHELP_READ_N;
     
    549564  SYNCHELP_WRITE_BEGIN();
    550565
    551   if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     566  if ( isOutOfSync() && !requestedSync() /*&& this->getHostID()!=this->getOwner()*/ )
    552567  {
    553568    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
    554569    setRequestedSync( true );
     570    PRINTF(0)("REQUESTED STATE %d\n", this->getUniqueID());
    555571  }
    556572
     
    560576    *reciever = rec;
    561577
     578    PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec);
     579
    562580    SYNCHELP_WRITE_BYTE( (byte)DATA_state );
    563581
    564582    SYNCHELP_WRITE_FKT( WorldEntity::readState );
    565     SYNCHELP_WRITE_FLOAT( cycle );
     583    //SYNCHELP_WRITE_FLOAT( cycle );
    566584
    567585    return SYNCHELP_WRITE_N;
    568586  }
    569 
    570587
    571588  *reciever = 0;
     
    592609      mask |= MASK_bRollR;
    593610
    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;
    597614
    598615    if ( mask != oldMask )
     
    602619      SYNCHELP_WRITE_INT( mask );
    603620    }
    604 
    605     if ( oldxMouse != xMouse || oldyMouse != yMouse )
     621    else
     622    {
     623      SYNCHELP_WRITE_BYTE( 0 );
     624    }
     625
     626    /*if ( oldxMouse != xMouse || oldyMouse != yMouse )
    606627    {
    607628      oldxMouse = xMouse;
     
    612633      SYNCHELP_WRITE_FLOAT( mouseSensitivity );
    613634      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 );
    616644
    617645  return SYNCHELP_WRITE_N;
Note: See TracChangeset for help on using the changeset viewer.