Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6815 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jan 28, 2006, 5:11:51 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/network back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r6774:HEAD

no conflicts…
thats what i call orthogonal work

Location:
trunk/src/world_entities
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/environments/water.cc

    r6803 r6815  
    302302  SYNCHELP_READ_BEGIN();
    303303
    304   SYNCHELP_READ_FKT( Water::writeState );
     304  SYNCHELP_READ_FKT( Water::writeState, NWT_WAT_STATE );
    305305
    306306  return SYNCHELP_READ_N;
     
    328328  {
    329329    *reciever = rec;
    330     SYNCHELP_WRITE_FKT( Water::readState );
     330    SYNCHELP_WRITE_FKT( Water::readState, NWT_WAT_STATE );
    331331  }
    332332
     
    347347  SYNCHELP_WRITE_BEGIN();
    348348
    349   SYNCHELP_WRITE_FKT( WorldEntity::readState );
     349  SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_WAT_WE_STATE );
    350350
    351351  // sync the size
    352   SYNCHELP_WRITE_FLOAT( this->sizeX );
    353   SYNCHELP_WRITE_FLOAT( this->sizeY );
     352  SYNCHELP_WRITE_FLOAT( this->sizeX, NWT_WAT_SIZEX );
     353  SYNCHELP_WRITE_FLOAT( this->sizeY, NWT_WAT_SIZEY );
    354354
    355355  //sync resolution
    356   SYNCHELP_WRITE_INT( this->resX );
    357   SYNCHELP_WRITE_INT( this->resY );
     356  SYNCHELP_WRITE_INT( this->resX, NWT_WAT_RESX );
     357  SYNCHELP_WRITE_INT( this->resY, NWT_WAT_RESY );
    358358
    359359  //sync the height
    360   SYNCHELP_WRITE_FLOAT( this->height );
     360  SYNCHELP_WRITE_FLOAT( this->height, NWT_WAT_HEIGHT );
    361361
    362362  return SYNCHELP_WRITE_N;
     
    374374  SYNCHELP_READ_BEGIN();
    375375
    376   SYNCHELP_READ_FKT( WorldEntity::writeState );
     376  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_WAT_WE_STATE );
    377377
    378378  float f1, f2;
     
    380380
    381381  //read the size
    382   SYNCHELP_READ_FLOAT( f1 );
    383   SYNCHELP_READ_FLOAT( f2 );
     382  SYNCHELP_READ_FLOAT( f1, NWT_WAT_SIZEX );
     383  SYNCHELP_READ_FLOAT( f2, NWT_WAT_SIZEY );
    384384  this->sizeX = f1;
    385385  this->sizeY = f2;
     
    387387
    388388  //read the resolution
    389   SYNCHELP_READ_INT( i1 );
    390   SYNCHELP_READ_INT( i2 );
     389  SYNCHELP_READ_INT( i1, NWT_WAT_RESX );
     390  SYNCHELP_READ_INT( i2, NWT_WAT_RESY );
    391391  this->resX = i1;
    392392  this->resY = i2;
     
    394394
    395395  //read the height
    396   SYNCHELP_READ_FLOAT( f1 );
     396  SYNCHELP_READ_FLOAT( f1, NWT_WAT_HEIGHT );
    397397  this->height = f1;
    398398
  • trunk/src/world_entities/image_entity.cc

    r6696 r6815  
    4949{
    5050  if (this->material)
    51   delete this->material;
    52 
    53   // delete what has to be deleted here
    54 
    55   GraphicsEngine::showMouse(true);
    56   GraphicsEngine::stealWMEvents(false);
     51    delete this->material;
    5752}
    5853
     
    9085      .describe("the Speed with which the ImageEntity should rotate");
    9186
    92   LoadParam(root, "billboarding", this, ImageEntity, toggleBillboard)
    93       .describe("sets the ImageEntity to always look in the direction of the Player");
     87  LoadParam(root, "billboarding", this, ImageEntity, toggleBillboarding)
     88      .describe("sets the Billboard to always look in the direction of the Player");
    9489}
    9590
     
    119114 * This means that the image will always look in the direction of the Player
    120115 */
    121 void ImageEntity::toggleBillboard()
     116void ImageEntity::toggleBillboarding()
    122117{
    123118  this->bBillboarding = !this->bBillboarding;
  • trunk/src/world_entities/image_entity.h

    r6634 r6815  
    11/*!
    2  * @file crosshair.h
    3   *  Definition of ...
    4 
    5 */
     2 * @file image_entity.h
     3 *  Definition of an ImageEntity
     4 */
    65
    76#ifndef _IMAGE_ENTITY_H
     
    3433  /** @param rotationSpeed the speed at what the crosshair should rotate */
    3534  void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
    36   void toggleBillboard();
     35  void toggleBillboarding();
    3736
    3837  virtual void tick(float dt);
  • trunk/src/world_entities/npcs/ground_turret.cc

    r6736 r6815  
    181181  SYNCHELP_READ_BEGIN();
    182182
    183   SYNCHELP_READ_FKT( WorldEntity::writeState );
     183  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_GT_WE_STATE );
    184184
    185185  return SYNCHELP_READ_N;
     
    207207    *reciever = rec;
    208208
    209     SYNCHELP_WRITE_FKT( WorldEntity::readState );
     209    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_GT_WE_STATE );
    210210
    211211  }
  • trunk/src/world_entities/power_ups/laser_power_up.cc

    r6780 r6815  
    127127  SYNCHELP_READ_BEGIN();
    128128
    129   SYNCHELP_READ_FKT( PowerUp::writeState );
     129  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_LPU_WE_STATE );
    130130
    131131  return SYNCHELP_READ_N;
     
    149149    SYNCHELP_WRITE_BEGIN();
    150150
    151     SYNCHELP_WRITE_FKT( PowerUp::readState );
     151    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_LPU_WE_STATE );
    152152
    153153    return SYNCHELP_WRITE_N;
  • trunk/src/world_entities/power_ups/param_power_up.cc

    r6695 r6815  
    131131  SYNCHELP_READ_BEGIN();
    132132
    133   SYNCHELP_READ_FKT( PowerUp::writeState );
     133  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_PPU_WE_STATE );
    134134
    135135  int i;
    136   SYNCHELP_READ_INT( i );
     136  SYNCHELP_READ_INT( i, NWT_PPU_TYPE );
    137137  this->type = (EnumParamPowerUpType)i;
    138   SYNCHELP_READ_FLOAT( this->value );
     138  SYNCHELP_READ_FLOAT( this->value, NWT_PPU_VALUE );
    139139
    140140  if ( this->value != 0 )
    141141  {
    142     SYNCHELP_READ_FLOAT( this->min_value );
    143     SYNCHELP_READ_FLOAT( this->max_value );
     142    SYNCHELP_READ_FLOAT( this->min_value, NWT_PPU_MINVALUE );
     143    SYNCHELP_READ_FLOAT( this->max_value, NWT_PPU_MAXVALUE );
    144144    respawn();
    145145  }
     
    165165    SYNCHELP_WRITE_BEGIN();
    166166
    167     SYNCHELP_WRITE_FKT( PowerUp::readState );
     167    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_PPU_WE_STATE );
    168168
    169169    int i = (int)this->type;
    170     SYNCHELP_WRITE_INT( i );
    171     SYNCHELP_WRITE_FLOAT( this->value );
     170    SYNCHELP_WRITE_INT( i, NWT_PPU_TYPE );
     171    SYNCHELP_WRITE_FLOAT( this->value, NWT_PPU_VALUE );
    172172
    173173    if ( this->value != 0 )
    174174    {
    175       SYNCHELP_WRITE_FLOAT( this->min_value );
    176       SYNCHELP_WRITE_FLOAT( this->max_value );
     175      SYNCHELP_WRITE_FLOAT( this->min_value, NWT_PPU_MINVALUE );
     176      SYNCHELP_WRITE_FLOAT( this->max_value, NWT_PPU_MAXVALUE );
    177177    }
    178178
  • trunk/src/world_entities/power_ups/power_up.cc

    r6710 r6815  
    2020#include "extendable.h"
    2121#include "primitive_model.h"
     22
     23#include "assert.h"
    2224
    2325using namespace std;
     
    124126{
    125127  SYNCHELP_WRITE_BEGIN();
    126   SYNCHELP_WRITE_FKT( WorldEntity::readState );
     128  SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_PU_WE_STATE );
    127129  return SYNCHELP_WRITE_N;
    128130}
     
    138140{
    139141  SYNCHELP_READ_BEGIN();
    140   SYNCHELP_READ_FKT( WorldEntity::writeState );
     142  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_PU_WE_STATE );
    141143  return SYNCHELP_READ_N;
    142144}
  • trunk/src/world_entities/power_ups/turret_power_up.cc

    r6780 r6815  
    136136  SYNCHELP_READ_BEGIN();
    137137
    138   SYNCHELP_READ_FKT( PowerUp::writeState );
     138  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_TPU_WE_STATE );
    139139
    140140  return SYNCHELP_READ_N;
     
    157157    SYNCHELP_WRITE_BEGIN();
    158158
    159     SYNCHELP_WRITE_FKT( PowerUp::readState );
     159    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_TPU_WE_STATE );
    160160
    161161    return SYNCHELP_WRITE_N;
  • trunk/src/world_entities/power_ups/weapon_power_up.cc

    r6710 r6815  
    100100  SYNCHELP_READ_BEGIN();
    101101
    102   SYNCHELP_READ_FKT( PowerUp::writeState );
     102  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_WPU_WE_STATE );
    103103
    104104  //TODO: sync weapon class ( see loadParams )
     
    124124    SYNCHELP_WRITE_BEGIN();
    125125
    126     SYNCHELP_WRITE_FKT( PowerUp::readState );
     126    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_WPU_WE_STATE );
    127127
    128128    //TODO: sync weapon class ( see loadParams )
  • trunk/src/world_entities/skybox.cc

    r6772 r6815  
    297297  SYNCHELP_READ_BEGIN();
    298298
    299   SYNCHELP_READ_FKT( WorldEntity::writeState );
    300 
    301   SYNCHELP_READ_FLOAT( size );
     299  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SB_WE_STATE );
     300
     301  SYNCHELP_READ_FLOAT( size, NWT_SB_SIZE );
    302302  if ( textureName )
    303303  {
     
    305305    textureName = NULL;
    306306  }
    307   SYNCHELP_READ_STRINGM( textureName );
     307  SYNCHELP_READ_STRINGM( textureName, NWT_SB_TEXTURENAME );
    308308
    309309  this->setSize( size );
     
    331331    SYNCHELP_WRITE_BEGIN();
    332332
    333     SYNCHELP_WRITE_FKT( WorldEntity::readState );
    334 
    335     SYNCHELP_WRITE_FLOAT(this->size);
    336     SYNCHELP_WRITE_STRING(this->textureName);
     333    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SB_WE_STATE );
     334
     335    SYNCHELP_WRITE_FLOAT(this->size, NWT_SB_SIZE);
     336    SYNCHELP_WRITE_STRING(this->textureName, NWT_SB_TEXTURENAME);
    337337
    338338    return SYNCHELP_WRITE_N;
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6807 r6815  
    523523#define DATA_flags       2
    524524#define DATA_mouse       3
     525#define DATA_sync        4
     526#define DATA_velocity    5
    525527
    526528int SpaceShip::writeBytes( const byte * data, int length, int sender )
     
    529531
    530532  byte b;
    531 
    532   do
    533   {
    534     SYNCHELP_READ_BYTE( b );
    535 
    536     if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
    537     {
    538      PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
    539      setRequestedSync( false );
    540      setIsOutOfSync( false );
    541      SYNCHELP_READ_FKT( WorldEntity::writeState );
    542      //SYNCHELP_READ_FLOAT( cycle );
    543 
    544       return SYNCHELP_READ_N;
    545     }
    546 
    547 
    548     //TODO: do not recieve data if you are the owner
    549     if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
     533 
     534  while ( SYNCHELP_READ_REMAINING()>0 )
     535  {
     536    SYNCHELP_READ_BYTE( b, NWT_SS_B );
     537   
     538    if ( b == DATA_state )
     539    {
     540      setRequestedSync( false );
     541      setIsOutOfSync( false );
     542      SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SS_WE_STATE );
     543
     544      continue;
     545    }
     546   
     547    if ( b == DATA_flags )
    550548    {
    551549      int flags = 0;
    552       SYNCHELP_READ_INT( flags );
     550      SYNCHELP_READ_INT( flags, NWT_SS_FLAGS );
    553551
    554552      bUp = (flags & MASK_bUp) != 0;
     
    561559      bRollL = (flags & MASK_bRollL) != 0;
    562560      bRollR = (flags & MASK_bRollR) != 0;
    563 
    564     }
    565 
    566     //TODO: do not recieve data if you are the owner
    567     if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ )
    568     {
    569       SYNCHELP_READ_FLOAT( mouseDir.w );
    570       SYNCHELP_READ_FLOAT( mouseDir.v.x );
    571       SYNCHELP_READ_FLOAT( mouseDir.v.y );
    572       SYNCHELP_READ_FLOAT( mouseDir.v.z );
    573     }
    574   } while( b != 0 );
    575 
    576   /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
    577   {
    578     SYNCHELP_READ_FLOAT( xMouse );
    579     SYNCHELP_READ_FLOAT( yMouse );
    580     SYNCHELP_READ_FLOAT( mouseSensitivity );
    581     SYNCHELP_READ_FLOAT( cycle );
    582 }*/
    583 
    584   if ( this->getOwner() != this->getHostID() )
    585     SYNCHELP_READ_FKT( PNode::writeSync );
    586 
     561     
     562      continue;
     563    }
     564   
     565    if ( b == DATA_mouse )
     566    {
     567      SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW );
     568      SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX );
     569      SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY );
     570      SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ );
     571     
     572      continue;
     573    }
     574   
     575    if ( b == DATA_sync )
     576    {
     577      if ( this->getOwner() != this->getHostID() )
     578        SYNCHELP_READ_FKT( PNode::writeSync, NWT_SS_PN_SYNC );
     579     
     580      continue;
     581    }
     582   
     583    if ( b == DATA_velocity )
     584    {
     585      SYNCHELP_READ_FLOAT( velocity.x, NWT_SS_VELX );
     586      SYNCHELP_READ_FLOAT( velocity.y, NWT_SS_VELY );
     587      SYNCHELP_READ_FLOAT( velocity.z, NWT_SS_VELZ );
     588    }
     589  }
     590 
    587591  return SYNCHELP_READ_N;
    588592}
     
    608612    PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec);
    609613
    610     SYNCHELP_WRITE_BYTE( (byte)DATA_state );
    611 
    612     SYNCHELP_WRITE_FKT( WorldEntity::readState );
     614    SYNCHELP_WRITE_BYTE( (byte)DATA_state, NWT_SS_B );
     615
     616    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SS_WE_STATE );
    613617    //SYNCHELP_WRITE_FLOAT( cycle );
    614618
     
    617621
    618622  *reciever = 0;
     623 
     624  if ( this->getOwner() == this->getHostID() && PNode::needsReadSync() )
     625  {
     626    SYNCHELP_WRITE_BYTE( DATA_sync, NWT_SS_B );
     627    SYNCHELP_WRITE_FKT( PNode::readSync, NWT_SS_PN_SYNC );
     628  }
    619629
    620630  if ( this->getHostID()==this->getOwner() )
     
    646656    {
    647657      oldMask = mask;
    648       SYNCHELP_WRITE_BYTE( DATA_flags );
    649       SYNCHELP_WRITE_INT( mask );
    650     }
    651 #define __OFFSET_ROT 0.05
    652     if ( fabs( oldMouseDir.w - mouseDir.w ) > __OFFSET_ROT ||
    653          fabs( oldMouseDir.v.x - mouseDir.v.x ) > __OFFSET_ROT ||
    654          fabs( oldMouseDir.v.y - mouseDir.v.y ) > __OFFSET_ROT ||
    655          fabs( oldMouseDir.v.z - mouseDir.v.z ) > __OFFSET_ROT )
     658      SYNCHELP_WRITE_BYTE( DATA_flags, NWT_SS_B );
     659      SYNCHELP_WRITE_INT( mask, NWT_SS_FLAGS );
     660    }
     661#define __OFFSET_MDIR_W 0.01
     662#define __OFFSET_MDIR_V 0.01
     663    if ( fabs( oldMouseDir.w - mouseDir.w ) > __OFFSET_MDIR_W ||
     664         fabs( oldMouseDir.v.x - mouseDir.v.x ) > __OFFSET_MDIR_V ||
     665         fabs( oldMouseDir.v.y - mouseDir.v.y ) > __OFFSET_MDIR_V ||
     666         fabs( oldMouseDir.v.z - mouseDir.v.z ) > __OFFSET_MDIR_V )
    656667    {
    657668      oldMouseDir = mouseDir;
    658669
    659       SYNCHELP_WRITE_BYTE( DATA_mouse );
    660       SYNCHELP_WRITE_FLOAT( mouseDir.w );
    661       SYNCHELP_WRITE_FLOAT( mouseDir.v.x );
    662       SYNCHELP_WRITE_FLOAT( mouseDir.v.y );
    663       SYNCHELP_WRITE_FLOAT( mouseDir.v.z );
    664     }
    665 
    666   }
    667 
    668   SYNCHELP_WRITE_BYTE( 0 );
    669 
    670 
    671   if ( this->getOwner() == this->getHostID() )
    672     SYNCHELP_WRITE_FKT( PNode::readSync );
     670      SYNCHELP_WRITE_BYTE( DATA_mouse, NWT_SS_B );
     671      PRINTF(0)("SENDING mousedir\n");
     672      SYNCHELP_WRITE_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW );
     673      SYNCHELP_WRITE_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX );
     674      SYNCHELP_WRITE_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY );
     675      SYNCHELP_WRITE_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ );
     676    }
     677#define __OFFSET_VEL 0.05
     678    if ( fabs( oldVelocity.x - velocity.x ) > __OFFSET_VEL*velocity.x ||
     679         fabs( oldVelocity.y - velocity.y ) > __OFFSET_VEL*velocity.y ||
     680         fabs( oldVelocity.z - velocity.z ) > __OFFSET_VEL*velocity.z )
     681    {
     682      oldVelocity = velocity;
     683      PRINTF(0)("SENDING velocity\n");
     684      SYNCHELP_WRITE_BYTE( DATA_velocity, NWT_SS_B );
     685      SYNCHELP_WRITE_FLOAT( velocity.x, NWT_SS_VELX );
     686      SYNCHELP_WRITE_FLOAT( velocity.y, NWT_SS_VELY );
     687      SYNCHELP_WRITE_FLOAT( velocity.z, NWT_SS_VELZ );
     688    }
     689
     690  }
    673691
    674692  return SYNCHELP_WRITE_N;
    675693}
     694
     695
  • trunk/src/world_entities/space_ships/space_ship.h

    r6807 r6815  
    4242    virtual int       readBytes(byte* data, int maxLength, int * reciever);
    4343
    44 
    4544  private:
    4645    void init();
     
    7069
    7170    Vector                velocity;           //!< the velocity of the player.
     71    Vector                oldVelocity;        //!< the velocity the player had last synced
    7272    Quaternion            mouseDir;           //!< the direction where the player wants to fly
    7373    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
  • trunk/src/world_entities/terrain.cc

    r6780 r6815  
    325325
    326326  SYNCHELP_READ_BEGIN();
    327   SYNCHELP_READ_FKT( WorldEntity::writeState );
     327  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_TER_WE_STATE );
    328328
    329329  return SYNCHELP_READ_N;
     
    343343    *reciever = rec;
    344344
    345     return WorldEntity::readState( data, maxLength );
     345    SYNCHELP_WRITE_BEGIN();
     346    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_TER_WE_STATE );
     347    return SYNCHELP_WRITE_N;
    346348
    347349  }
  • trunk/src/world_entities/world_entity.cc

    r6720 r6815  
    518518  SYNCHELP_READ_BEGIN();
    519519
    520   SYNCHELP_READ_FKT( PNode::writeState );
    521 
    522   SYNCHELP_READ_STRINGM( modelFileName );
    523   SYNCHELP_READ_FLOAT( scaling );
     520  SYNCHELP_READ_FKT( PNode::writeState, NWT_WE_PN_WRITESTATE );
     521
     522  SYNCHELP_READ_STRINGM( modelFileName, NWT_WE_PN_MODELFILENAME );
     523  SYNCHELP_READ_FLOAT( scaling, NWT_WE_PN_SCALING );
    524524  //check if modelFileName is relative to datadir or absolute
    525525
     
    562562  SYNCHELP_WRITE_BEGIN();
    563563
    564   SYNCHELP_WRITE_FKT( PNode::readState );
     564  SYNCHELP_WRITE_FKT( PNode::readState, NWT_WE_PN_WRITESTATE );
    565565
    566566  if ( getModel(0) && getModel(0)->getName() )
     
    573573    }
    574574
    575     SYNCHELP_WRITE_STRING( name );
     575    SYNCHELP_WRITE_STRING( name, NWT_WE_PN_MODELFILENAME );
    576576  }
    577577  else
    578578  {
    579     SYNCHELP_WRITE_STRING("");
    580   }
    581 
    582   SYNCHELP_WRITE_FLOAT( scaling );
     579    SYNCHELP_WRITE_STRING("", NWT_WE_PN_MODELFILENAME);
     580  }
     581
     582  SYNCHELP_WRITE_FLOAT( scaling, NWT_WE_PN_SCALING );
    583583  /*if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
    584584  {
Note: See TracChangeset for help on using the changeset viewer.