Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 18, 2006, 1:01:27 PM (19 years ago)
Author:
rennerc
Message:

pnode can sync now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/space_ships/space_ship.cc

    r6503 r6526  
    292292
    293293  //hoover effect
    294   cycle += time;
    295   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
     294  //cycle += time;
     295  //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
    296296
    297297  //readjust
     
    531531  SYNCHELP_READ_BYTE( b );
    532532
    533   if ( b == DATA_state && this->getHostID()!=this->getOwner() )
    534   {
     533  if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
     534  {
     535    PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
    535536    setRequestedSync( false );
    536537    setIsOutOfSync( false );
    537538    SYNCHELP_READ_FKT( WorldEntity::writeState );
    538     SYNCHELP_READ_FLOAT( cycle );
    539   }
    540 
    541   return SYNCHELP_READ_N;
    542 
    543   if ( b == DATA_flags && this->getHostID()!=this->getOwner() )
     539    //SYNCHELP_READ_FLOAT( cycle );
     540
     541    return SYNCHELP_READ_N;
     542  }
     543
     544
     545  if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
    544546  {
    545547    int flags;
    546     SYNCHELP_READ_INT( flags );
    547 
    548     bUp = flags & MASK_bUp != 0;
    549     bDown = flags & MASK_bDown != 0;
    550     bLeft = flags & MASK_bLeft != 0;
    551     bRight = flags & MASK_bRight != 0;
    552     bAscend = flags & MASK_bAscend != 0;
    553     bDescend = flags & MASK_bDescend != 0;
    554     bFire = flags & MASK_bFire != 0;
    555     bRollL = flags & MASK_bRollL != 0;
    556     bRollR = flags & MASK_bRollR != 0;
    557   }
    558 
    559   if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
     548    //SYNCHELP_READ_INT( flags );
     549
     550    bUp = (flags & MASK_bUp) != 0;
     551    bDown = (flags & MASK_bDown) != 0;
     552    bLeft = (flags & MASK_bLeft) != 0;
     553    bRight = (flags & MASK_bRight) != 0;
     554    bAscend = (flags & MASK_bAscend) != 0;
     555    bDescend = (flags & MASK_bDescend) != 0;
     556    bFire = (flags & MASK_bFire) != 0;
     557    bRollL = (flags & MASK_bRollL) != 0;
     558    bRollR = (flags & MASK_bRollR) != 0;
     559
     560  }
     561
     562  /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
    560563  {
    561564    SYNCHELP_READ_FLOAT( xMouse );
     
    563566    SYNCHELP_READ_FLOAT( mouseSensitivity );
    564567    SYNCHELP_READ_FLOAT( cycle );
    565   }
     568}*/
     569
     570  SYNCHELP_READ_FKT( PNode::writeSync );
    566571
    567572  return SYNCHELP_READ_N;
     
    574579  SYNCHELP_WRITE_BEGIN();
    575580
    576   if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     581  if ( isOutOfSync() && !requestedSync() /*&& this->getHostID()!=this->getOwner()*/ )
    577582  {
    578583    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
    579584    setRequestedSync( true );
     585    PRINTF(0)("REQUESTED STATE %d\n", this->getUniqueID());
    580586  }
    581587
     
    585591    *reciever = rec;
    586592
     593    PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec);
     594
    587595    SYNCHELP_WRITE_BYTE( (byte)DATA_state );
    588596
    589597    SYNCHELP_WRITE_FKT( WorldEntity::readState );
    590     SYNCHELP_WRITE_FLOAT( cycle );
     598    //SYNCHELP_WRITE_FLOAT( cycle );
    591599
    592600    return SYNCHELP_WRITE_N;
    593601  }
    594 
    595   return 0;
    596602
    597603  *reciever = 0;
     
    619625
    620626    static int oldMask = mask+1; //so it is different the first time!
    621     static float oldxMouse = xMouse + 1.0;
    622     static float oldyMouse = yMouse + 1.0;
     627    //static float oldxMouse = xMouse + 1.0;
     628    //static float oldyMouse = yMouse + 1.0;
    623629
    624630    if ( mask != oldMask )
     
    626632      oldMask = mask;
    627633      SYNCHELP_WRITE_BYTE( DATA_flags );
    628       SYNCHELP_WRITE_INT( mask );
    629     }
    630 
    631     if ( oldxMouse != xMouse || oldyMouse != yMouse )
     634      //SYNCHELP_WRITE_INT( mask );
     635    }
     636    else
     637    {
     638      SYNCHELP_WRITE_BYTE( 0 );
     639    }
     640
     641    /*if ( oldxMouse != xMouse || oldyMouse != yMouse )
    632642    {
    633643      oldxMouse = xMouse;
     
    638648      SYNCHELP_WRITE_FLOAT( mouseSensitivity );
    639649      SYNCHELP_WRITE_FLOAT( cycle );
    640     }
    641   }
     650    }*/
     651  }
     652  else
     653  {
     654    SYNCHELP_WRITE_BYTE( 0 );
     655  }
     656
     657  SYNCHELP_WRITE_FKT( PNode::readSync );
    642658
    643659  return SYNCHELP_WRITE_N;
Note: See TracChangeset for help on using the changeset viewer.