Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6815 in orxonox.OLD for trunk/src


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
Files:
28 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r6810 r6815  
    118118  CL_VERTEX_ARRAY_MODEL         =    0x00004000,
    119119
     120
     121  CL_BILLBOARD                  =    0x10000001,
    120122
    121123  // subsuper-classes derivations taken : 1, 2, 5, a, b, c.     << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken
     
    264266  CL_SHADER                     =    0x00000822,
    265267  CL_FOG_EFFECT                 =    0x70000001,
     268  CL_LENSE_FLARE                =    0x70000002,
    266269
    267270  // GL-GUI
  • trunk/src/lib/coord/p_node.cc

    r6780 r6815  
    10771077  SYNCHELP_READ_BEGIN();
    10781078
    1079   SYNCHELP_READ_FKT( BaseObject::writeState );
     1079  SYNCHELP_READ_FKT( BaseObject::writeState, NWT_PN_BO_WRITESTATE );
    10801080
    10811081//   char * parentName = NULL;
     
    10941094
    10951095  int parentMode;
    1096   SYNCHELP_READ_INT( parentMode );
     1096  SYNCHELP_READ_INT( parentMode, NWT_PN_PARENTMODE );
    10971097  this->setParentMode((PARENT_MODE)parentMode);
    10981098
    10991099  float f1, f2, f3, f4;
    11001100
    1101   SYNCHELP_READ_FLOAT( f1 );
    1102   SYNCHELP_READ_FLOAT( f2 );
    1103   SYNCHELP_READ_FLOAT( f3 );
     1101  SYNCHELP_READ_FLOAT( f1, NWT_PN_COORX );
     1102  SYNCHELP_READ_FLOAT( f2, NWT_PN_COORY );
     1103  SYNCHELP_READ_FLOAT( f3, NWT_PN_COORZ );
    11041104  this->setRelCoor( f1, f2, f3 );
    11051105
    11061106
    1107   SYNCHELP_READ_FLOAT( f1 );
    1108   SYNCHELP_READ_FLOAT( f2 );
    1109   SYNCHELP_READ_FLOAT( f3 );
    1110   SYNCHELP_READ_FLOAT( f4 );
     1107  SYNCHELP_READ_FLOAT( f1, NWT_PN_ROTV );
     1108  SYNCHELP_READ_FLOAT( f2, NWT_PN_ROTX );
     1109  SYNCHELP_READ_FLOAT( f3, NWT_PN_ROTY );
     1110  SYNCHELP_READ_FLOAT( f4, NWT_PN_ROTZ );
    11111111  this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
    11121112
     
    11401140  SYNCHELP_WRITE_BEGIN();
    11411141
    1142   SYNCHELP_WRITE_FKT( BaseObject::readState );
     1142  SYNCHELP_WRITE_FKT( BaseObject::readState, NWT_PN_BO_WRITESTATE );
    11431143
    11441144//   if ( this->parent )
     
    11511151//   }
    11521152
    1153   SYNCHELP_WRITE_INT( this->parentMode );
    1154 
    1155   SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
    1156   SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
    1157   SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
    1158 
    1159   SYNCHELP_WRITE_FLOAT( this->relDirection.w );
    1160   SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );
    1161   SYNCHELP_WRITE_FLOAT( this->relDirection.v.y );
    1162   SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
     1153  SYNCHELP_WRITE_INT( this->parentMode, NWT_PN_PARENTMODE );
     1154
     1155  SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_COORX );
     1156  SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_COORY );
     1157  SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_COORZ );
     1158
     1159  SYNCHELP_WRITE_FLOAT( this->relDirection.w, NWT_PN_ROTV );
     1160  SYNCHELP_WRITE_FLOAT( this->relDirection.v.x, NWT_PN_ROTX );
     1161  SYNCHELP_WRITE_FLOAT( this->relDirection.v.y, NWT_PN_ROTY );
     1162  SYNCHELP_WRITE_FLOAT( this->relDirection.v.z, NWT_PN_ROTZ );
    11631163
    11641164//   int n = children.size();
     
    12091209
    12101210  byte flags = 0;
    1211   SYNCHELP_READ_BYTE( flags );
     1211  SYNCHELP_READ_BYTE( flags, NWT_PN_FLAGS );
    12121212  //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags);
    12131213
     
    12161216  if ( flags & __FLAG_COOR )
    12171217  {
    1218     SYNCHELP_READ_FLOAT( f1 );
    1219     SYNCHELP_READ_FLOAT( f2 );
    1220     SYNCHELP_READ_FLOAT( f3 );
     1218    SYNCHELP_READ_FLOAT( f1, NWT_PN_SCOORX );
     1219    SYNCHELP_READ_FLOAT( f2, NWT_PN_SCOORY );
     1220    SYNCHELP_READ_FLOAT( f3, NWT_PN_SCOORZ );
    12211221    PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3);
    12221222    this->setRelCoor( f1, f2, f3 );
     
    12251225  if ( flags & __FLAG_ROT )
    12261226  {
    1227     SYNCHELP_READ_FLOAT( f1 );
    1228     SYNCHELP_READ_FLOAT( f2 );
    1229     SYNCHELP_READ_FLOAT( f3 );
    1230     SYNCHELP_READ_FLOAT( f4 );
     1227    SYNCHELP_READ_FLOAT( f1, NWT_PN_SROTV );
     1228    SYNCHELP_READ_FLOAT( f2, NWT_PN_SROTX );
     1229    SYNCHELP_READ_FLOAT( f3, NWT_PN_SROTY );
     1230    SYNCHELP_READ_FLOAT( f4, NWT_PN_SROTZ );
    12311231    PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4);
    12321232    //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
     
    12501250int PNode::readSync( byte * data, int maxLength )
    12511251{
     1252  //WARNING: if you change this file make sure you also change needsReadSync
    12521253  SYNCHELP_WRITE_BEGIN();
    12531254
     
    12701271
    12711272
    1272   SYNCHELP_WRITE_BYTE( flags );
     1273  SYNCHELP_WRITE_BYTE( flags, NWT_PN_FLAGS );
    12731274  //PRINTF(0)("FLAGS = %d\n", flags);
    12741275
     
    12761277  {
    12771278
    1278     PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
    1279 
    1280     SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
    1281     SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
    1282     SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
     1279    //PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
     1280
     1281    SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_SCOORX );
     1282    SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_SCOORY );
     1283    SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_SCOORZ );
    12831284
    12841285    coorx = relCoordinate.x;
     
    12901291  {
    12911292
    1292     PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
    1293 
    1294     SYNCHELP_WRITE_FLOAT( this->absDirection.w );
    1295     SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
    1296     SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
    1297     SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );
     1293    //PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
     1294
     1295    SYNCHELP_WRITE_FLOAT( this->absDirection.w, NWT_PN_SROTV );
     1296    SYNCHELP_WRITE_FLOAT( this->absDirection.v.x, NWT_PN_SROTX );
     1297    SYNCHELP_WRITE_FLOAT( this->absDirection.v.y, NWT_PN_SROTY );
     1298    SYNCHELP_WRITE_FLOAT( this->absDirection.v.z, NWT_PN_SROTZ );
    12981299
    12991300    rotw = absDirection.w;
     
    13051306  return SYNCHELP_WRITE_N;
    13061307}
     1308
     1309bool PNode::needsReadSync( )
     1310{
     1311  if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS ||
     1312       fabs( coory - relCoordinate.y ) > __OFFSET_POS ||
     1313       fabs( coorz - relCoordinate.z ) > __OFFSET_POS )
     1314    return true;
     1315
     1316  if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT ||
     1317       fabs( rotx - absDirection.v.x ) > __OFFSET_ROT ||
     1318       fabs( roty - absDirection.v.y ) > __OFFSET_ROT ||
     1319       fabs( rotz - absDirection.v.z ) > __OFFSET_ROT )
     1320    return true;
     1321 
     1322  return false;
     1323}
  • trunk/src/lib/coord/p_node.h

    r6695 r6815  
    190190  int       writeSync(const byte* data, int length, int sender);
    191191  int       readSync(byte* data, int maxLength );
     192  bool      needsReadSync();
    192193
    193194 private:
  • trunk/src/lib/graphics/Makefile.am

    r6753 r6815  
    99                           render2D/render_2d.cc \
    1010                           render2D/element_2d.cc \
     11                           render2D/billboard.cc \
    1112                           text_engine/text_engine.cc \
    1213                           text_engine/text.cc \
    1314                           text_engine/font.cc \
    1415                           effects/graphics_effect.cc \
    15                            effects/fog_effect.cc
     16                           effects/fog_effect.cc \
     17                           effects/lense_flare.cc
     18
    1619
    1720noinst_HEADERS = graphics_engine.h \
     
    2023                 render2D/render_2d.h \
    2124                 render2D/element_2d.h \
     25                 render2D/billboard.h \
    2226                 text_engine/text_engine.h \
    2327                 text_engine/text.h \
    2428                 text_engine/font.h \
    2529                 effects/graphics_effect.h \
    26                  effects/fog_effect.h
     30                 effects/fog_effect.h \
     31                 effects/lense_flare.h
    2732
    2833
  • trunk/src/lib/graphics/effects/fog_effect.cc

    r6772 r6815  
    6262void FogEffect::loadParams(const TiXmlElement* root)
    6363{
     64  printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.loadParms\n\n");
    6465  GraphicsEffect::loadParams(root);
    6566
    66    LoadParam(root, "fog-effect", this, FogEffect, setFogMode)
     67   LoadParam(root, "fog-mode", this, FogEffect, setFogMode)
    6768       .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}");
    6869
     
    8788bool FogEffect::activate()
    8889{
     90  printf("fog==============================================>>>>>>>>>>>>>>>>>>>>>>>>...\n\n");
    8991  PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity,
    9092             this->fogStart, this->fogEnd);
     
    9294  glEnable(GL_FOG);
    9395  {
    94     GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0};
     96    GLfloat fogColor[4] = {0.6, 0.6, 0.6, 1.0};
    9597
    9698    glFogi(GL_FOG_MODE, this->fogMode);
  • trunk/src/lib/graphics/effects/graphics_effect.cc

    r6772 r6815  
    7272bool GraphicsEffect::init()
    7373{}
     74
     75
     76
     77/**
     78 * draws the effect, if needed
     79 */
     80void GraphicsEffect::draw() const
     81{}
     82
     83
     84
     85/**
     86 * ticks the effect if there is any time dependancy
     87 */
     88void GraphicsEffect::tick(float dt)
     89{}
  • trunk/src/lib/graphics/effects/graphics_effect.h

    r6772 r6815  
    2525    virtual bool deactivate() = 0;
    2626
    27     inline bool isActivated() { return this->bActivated; }
     27    virtual void draw() const;
     28    virtual void tick(float dt);
     29
     30    inline bool isActivated() const { return this->bActivated; }
    2831
    2932
  • trunk/src/lib/graphics/graphics_engine.cc

    r6780 r6815  
    4141#include "shell_command.h"
    4242
     43
     44#include "parser/tinyxml/tinyxml.h"
     45#include "load_param.h"
     46#include "factory.h"
     47
    4348#ifdef __WIN32__
    4449 #include "class_list.h"
     
    113118  GraphicsEngine::singletonRef = NULL;
    114119}
     120
     121
     122/**
     123 * loads the GraphicsEngine Specific Parameters.
     124 * @param root: the XML-Element to load the Data From
     125 */
     126void GraphicsEngine::loadParams(const TiXmlElement* root)
     127{
     128  LoadParamXML(root, "load-effect", this, GraphicsEngine, loadGraphicsEffectXML)
     129      .describe("loads a graphics effect");
     130}
     131
    115132
    116133/**
     
    150167  this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
    151168
    152   GraphicsEffect* fe = new FogEffect(NULL);
    153   this->loadGraphicsEffect(fe);
    154   fe->activate();
    155   PRINTF(0)("--------------------------------------------------------------\n");
     169//   GraphicsEffect* fe = new FogEffect(NULL);
     170//   this->loadGraphicsEffect(fe);
     171//   fe->activate();
     172//   PRINTF(0)("--------------------------------------------------------------\n");
    156173}
    157174
     
    571588#endif /* NO_TEXT */
    572589
    573 
    574   }
     590  }
     591
    575592  Render2D::getInstance()->tick(dt);
     593
     594  // tick the graphics effects
     595  list<GraphicsEffect*>::iterator it;
     596  for (it = this->graphicsEffects.begin(); it != this->graphicsEffects.end(); it++)
     597    (*it)->tick(dt);
    576598}
    577599
     
    587609  Render2D::getInstance()->draw(E2D_LAYER_ALL);
    588610  Shader::restoreShader();
     611
     612  //draw the graphics
     613  list<GraphicsEffect*>::const_iterator it;
     614  for (it = this->graphicsEffects.begin(); it != this->graphicsEffects.end(); it++)
     615    (*it)->draw();
    589616}
    590617
     
    661688
    662689/**
     690 * @param root The XML-element to load GraphicsEffects from
     691 */
     692void GraphicsEngine::loadGraphicsEffectXML(const TiXmlElement* root)
     693{
     694  const TiXmlElement* element = root->FirstChildElement();
     695
     696  while (element != NULL)
     697  {
     698    Factory::fabricate(element);
     699
     700    element = element->NextSiblingElement();
     701  }
     702}
     703
     704
     705/**
    663706 * loads a GraphicsEffect into the engine
    664707 * @param effect the GraphicsEffect to add
  • trunk/src/lib/graphics/graphics_engine.h

    r6753 r6815  
    2323class WorldEntity;
    2424class GraphicsEffect;
     25class TiXmlElement;
    2526
    2627//! class to handle graphics
     
    3435    /** @returns a Pointer to the only object of this Class */
    3536    inline static GraphicsEngine* getInstance() { if (!GraphicsEngine::singletonRef) GraphicsEngine::singletonRef = new GraphicsEngine();  return GraphicsEngine::singletonRef; };
     37
     38    virtual void loadParams(const TiXmlElement* root);
    3639
    3740    int init();
     
    8386    void process(const Event  &event);
    8487
     88    void loadGraphicsEffectXML(const TiXmlElement* root);
    8589    bool loadGraphicsEffect(GraphicsEffect* effect);
    8690    bool unloadGraphicsEffect(GraphicsEffect* effect);
  • trunk/src/lib/lang/base_object.cc

    r6640 r6815  
    204204    objectName = NULL;
    205205  }
    206   SYNCHELP_READ_STRINGM( this->objectName );
     206  SYNCHELP_READ_STRINGM( this->objectName, NWT_BO_NAME );
    207207  if ( this->objectName && !strcmp(this->objectName, "") )
    208208  {
     
    225225
    226226  //PRINTF(0)("objectname = %s\n", this->objectName);
    227   SYNCHELP_WRITE_STRING( this->objectName );
     227  SYNCHELP_WRITE_STRING( this->objectName, NWT_BO_NAME );
    228228
    229229  return SYNCHELP_WRITE_N;
  • trunk/src/lib/network/handshake.cc

    r6753 r6815  
    9595  if ( !isServer() && hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) )
    9696  {
    97     if ( length != INTSIZE+INTSIZE )
    98     {
    99       PRINTF(0)("hostID packet has wrong size %d instead of %d\n", length, 1);
    100       setState( HS_COMPLETED );
    101       return 0;
    102     }
     97    /*if ( length != INTSIZE+INTSIZE )
     98    {
     99      PRINTF(0)("hostID packet has wrong size %d instead of %d\n", length, INTSIZE+INTSIZE);
     100      setState( HS_COMPLETED );
     101      return 0;
     102  }*/
    103103
    104104    setState( HS_COMPLETED );
    105105    setState( HS_RECVD_HID );
    106106    this->isOk = true;
    107     SYNCHELP_READ_INT( this->newHostId );
    108     SYNCHELP_READ_INT( this->newNetworkGameManagerId );
     107    SYNCHELP_READ_INT( this->newHostId, NWT_HS_HOST_ID );
     108    SYNCHELP_READ_INT( this->newNetworkGameManagerId, NWT_HS_NGM_ID );
    109109
    110110    if ( newHostId == 0 )
     
    180180      isOk = false;
    181181      //memcpy(data, (byte*)0, 4);
    182       SYNCHELP_WRITE_INT( 0 );
    183       SYNCHELP_WRITE_INT( 0 );
     182      SYNCHELP_WRITE_INT( 0, NWT_HS_HOST_ID);
     183      SYNCHELP_WRITE_INT( 0, NWT_HS_NGM_ID);
    184184    }
    185185    else
     
    187187      isOk = true;
    188188      //memcpy(data, &clientId, 4);
    189       SYNCHELP_WRITE_INT( clientId );
    190       SYNCHELP_WRITE_INT( networkGameManagerId );
     189      SYNCHELP_WRITE_INT( clientId, NWT_HS_HOST_ID );
     190      SYNCHELP_WRITE_INT( networkGameManagerId, NWT_HS_NGM_ID );
    191191    }
    192192    *reciever = clientId;
  • trunk/src/lib/network/network_game_manager.cc

    r6737 r6815  
    167167  if ( !isServer() && !hasRequestedWorld )
    168168  {
    169     SYNCHELP_WRITE_BEGIN();
    170     byte b = NET_REQUEST_ENTITY_LIST;
    171     SYNCHELP_WRITE_BYTE( b );
     169    assert( maxLength >= 1 );
     170    data[0] = NET_REQUEST_ENTITY_LIST;
    172171    hasRequestedWorld = true;
    173     return SYNCHELP_WRITE_N;
     172    return 1;
    174173  }
    175174
  • trunk/src/lib/network/synchronizeable.h

    r6753 r6815  
    2020#define STATE_OUTOFSYNC 2
    2121#define STATE_REQUESTEDSYNC 4
     22
     23enum {
     24  NWT_SS_WE_STATE = 1000000,
     25  NWT_SS_B,
     26  NWT_SS_FLAGS,
     27  NWT_SS_MOUSEDIRX,
     28  NWT_SS_MOUSEDIRY,
     29  NWT_SS_MOUSEDIRZ,
     30  NWT_SS_MOUSEDIRW,
     31  NWT_SS_PN_SYNC,
     32  NWT_SS_VELX,
     33  NWT_SS_VELY,
     34  NWT_SS_VELZ,
     35 
     36  NWT_HS_HOST_ID,
     37  NWT_HS_NGM_ID,
     38 
     39  NWT_PN_BO_WRITESTATE,
     40  NWT_PN_PARENTMODE,
     41  NWT_PN_COORX,
     42  NWT_PN_COORY,
     43  NWT_PN_COORZ,
     44  NWT_PN_ROTX,
     45  NWT_PN_ROTY,
     46  NWT_PN_ROTZ,
     47  NWT_PN_ROTV,
     48 
     49  NWT_PN_FLAGS,
     50  NWT_PN_SCOORX,
     51  NWT_PN_SCOORY,
     52  NWT_PN_SCOORZ,
     53  NWT_PN_SROTX,
     54  NWT_PN_SROTY,
     55  NWT_PN_SROTZ,
     56  NWT_PN_SROTV,
     57 
     58  NWT_BO_NAME,
     59 
     60  NWT_WE_PN_WRITESTATE,
     61  NWT_WE_PN_MODELFILENAME,
     62  NWT_WE_PN_SCALING,
     63 
     64  NWT_GT_WE_STATE,
     65 
     66  NWT_SB_WE_STATE,
     67  NWT_SB_SIZE,
     68  NWT_SB_TEXTURENAME,
     69 
     70  NWT_TER_WE_STATE,
     71 
     72  NWT_PU_WE_STATE,
     73 
     74  NWT_TPU_WE_STATE,
     75 
     76  NWT_LPU_WE_STATE,
     77 
     78  NWT_WPU_WE_STATE,
     79 
     80  NWT_PPU_WE_STATE,
     81  NWT_PPU_TYPE,
     82  NWT_PPU_VALUE,
     83  NWT_PPU_MINVALUE,
     84  NWT_PPU_MAXVALUE,
     85
     86  NWT_WAT_STATE,
     87  NWT_WAT_WE_STATE,
     88  NWT_WAT_SIZEX,
     89  NWT_WAT_SIZEY,
     90  NWT_WAT_RESX,
     91  NWT_WAT_RESY,
     92  NWT_WAT_HEIGHT
     93};
    2294
    2395
     
    58130 *
    59131 */
     132#define SYNCHELP_WRITE_DEBUG(n) {\
     133  __synchelp_write_n = Converter::intToByteArray( n, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
     134  assert( __synchelp_write_n == INTSIZE ); \
     135  __synchelp_write_i += __synchelp_write_n; \
     136}
     137
     138#define SYNCHELP_READ_DEBUG(n) {  \
     139  int nn; \
     140  __synchelp_read_n = Converter::byteArrayToInt( data+__synchelp_read_i, &nn );  \
     141  assert( __synchelp_read_n == INTSIZE ); \
     142  if ( n != nn ) { \
     143    PRINTF(1)("Check your code! read/writes not in right order! read %d instead of %d\n", nn, n); \
     144    assert( false ); \
     145  } \
     146  __synchelp_read_i += __synchelp_read_n; \
     147}
     148
    60149#define SYNCHELP_WRITE_BEGIN()    int __synchelp_write_i = 0; \
    61150                                  int __synchelp_write_n
    62 #define SYNCHELP_WRITE_INT(i) { __synchelp_write_n = \
     151#define SYNCHELP_WRITE_INT(i,n) { SYNCHELP_WRITE_DEBUG(n); \
     152                                __synchelp_write_n = \
    63153                                Converter::intToByteArray( i, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
    64154                                assert( __synchelp_write_n == INTSIZE ); \
     
    70160                                __synchelp_write_i += __synchelp_write_n; \
    71161}
    72 #define SYNCHELP_WRITE_FLOAT(f) { __synchelp_write_n = \
     162#define SYNCHELP_WRITE_FLOAT(f,n) { SYNCHELP_WRITE_DEBUG(n); \
     163                                __synchelp_write_n = \
    73164                                Converter::floatToByteArray( f, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
    74165                                assert( __synchelp_write_n == FLOATSIZE ); \
     
    80171                                __synchelp_write_i += __synchelp_write_n; \
    81172}
    82 #define SYNCHELP_WRITE_BYTE(b) { \
     173#define SYNCHELP_WRITE_BYTE(b,n) { SYNCHELP_WRITE_DEBUG(n); \
     174                                \
    83175                                if (maxLength - __synchelp_write_i < 1) \
    84176{ \
     
    89181                                __synchelp_write_i++; \
    90182}
    91 #define SYNCHELP_WRITE_STRING(s) { if (s!=NULL) {\
     183#define SYNCHELP_WRITE_STRING(s,n) { SYNCHELP_WRITE_DEBUG(n); \
     184                                if (s!=NULL) {\
    92185                                __synchelp_write_n = \
    93186                                Converter::stringToByteArray( s, data+__synchelp_write_i, strlen(s), maxLength-__synchelp_write_i ); \
     
    105198}
    106199#define SYNCHELP_WRITE_N        __synchelp_write_i
    107 #define SYNCHELP_WRITE_FKT(f)   { \
     200#define SYNCHELP_WRITE_FKT(f,n)   { SYNCHELP_WRITE_DEBUG(n); \
    108201                                  __synchelp_write_i += \
    109202                                  f( data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
     
    114207                                  int __synchelp_read_n
    115208
    116 #define SYNCHELP_READ_INT(i)       { \
     209#define SYNCHELP_READ_INT(i,n)       { SYNCHELP_READ_DEBUG(n); \
    117210                                    if ( length-__synchelp_read_i < INTSIZE ) \
    118211{ \
     
    124217                                    __synchelp_read_i += __synchelp_read_n; \
    125218}
    126 #define SYNCHELP_READ_FLOAT(f)    { \
     219#define SYNCHELP_READ_FLOAT(f,n)    { SYNCHELP_READ_DEBUG(n); \
    127220                                    if ( length-__synchelp_read_i < FLOATSIZE ) \
    128221{ \
     
    134227                                    __synchelp_read_i += __synchelp_read_n; \
    135228}
    136 #define SYNCHELP_READ_STRING(s,l)    { \
     229#define SYNCHELP_READ_STRING(s,l,n)    {SYNCHELP_READ_DEBUG(n); \
    137230                                    __synchelp_read_n = Converter::byteArrayToString( data+__synchelp_read_i, s, l );  \
    138231                                    assert( __synchelp_read_n == strlen(s)+INTSIZE ) ;\
     
    144237                                    __synchelp_read_i += __synchelp_read_n; \
    145238}
    146 #define SYNCHELP_READ_STRINGM(s)    { \
     239#define SYNCHELP_READ_STRINGM(s,n)    { SYNCHELP_READ_DEBUG(n); \
    147240                                    __synchelp_read_n = Converter::byteArrayToStringM( data+__synchelp_read_i, s );  \
    148241                                    assert( __synchelp_read_n == strlen(s)+INTSIZE ) ;\
     
    154247                                    __synchelp_read_i += __synchelp_read_n; \
    155248}
    156 #define SYNCHELP_READ_BYTE(b)      { \
     249#define SYNCHELP_READ_BYTE(b,n)      { SYNCHELP_READ_DEBUG(n); \
    157250                                    if ( length-__synchelp_read_i < 1 ) \
    158251{ \
     
    163256                                    __synchelp_read_i ++;  \
    164257}
    165 #define SYNCHELP_READ_FKT(f)   { \
     258#define SYNCHELP_READ_FKT(f,n)   { SYNCHELP_READ_DEBUG(n); \
    166259                                  __synchelp_read_i += \
    167260                                  f( data+__synchelp_read_i, length-__synchelp_read_i, sender); \
    168261                                  }
     262#define SYNCHELP_READ_REMAINING() ( length-__synchelp_read_i )
     263#define SYNCHELP_READ_NEXTBYTE() ( data[__synchelp_read_i] )
    169264#define SYNCHELP_READ_N           __synchelp_read_i
    170265
  • trunk/src/story_entities/game_world_data.cc

    r6771 r6815  
    278278{
    279279  LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
     280  LoadParamXML(root, "GraphicsEngine", GraphicsEngine::getInstance(), GraphicsEngine, loadParams);
    280281
    281282//  LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
  • 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.