Changeset 6784 in orxonox.OLD for branches/network
- Timestamp:
- Jan 26, 2006, 8:03:40 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/coord/p_node.cc
r6695 r6784 1077 1077 SYNCHELP_READ_BEGIN(); 1078 1078 1079 SYNCHELP_READ_FKT( BaseObject::writeState );1079 SYNCHELP_READ_FKT( BaseObject::writeState, NWT_PN_BO_WRITESTATE ); 1080 1080 1081 1081 // char * parentName = NULL; … … 1094 1094 1095 1095 int parentMode; 1096 SYNCHELP_READ_INT( parentMode );1096 SYNCHELP_READ_INT( parentMode, NWT_PN_PARENTMODE ); 1097 1097 this->setParentMode((PARENT_MODE)parentMode); 1098 1098 1099 1099 float f1, f2, f3, f4; 1100 1100 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 ); 1104 1104 this->setRelCoor( f1, f2, f3 ); 1105 1105 1106 1106 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 ); 1111 1111 this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1112 1112 … … 1140 1140 SYNCHELP_WRITE_BEGIN(); 1141 1141 1142 SYNCHELP_WRITE_FKT( BaseObject::readState );1142 SYNCHELP_WRITE_FKT( BaseObject::readState, NWT_PN_BO_WRITESTATE ); 1143 1143 1144 1144 // if ( this->parent ) … … 1151 1151 // } 1152 1152 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 ); 1163 1163 1164 1164 // int n = children.size(); … … 1209 1209 1210 1210 byte flags = 0; 1211 SYNCHELP_READ_BYTE( flags );1211 SYNCHELP_READ_BYTE( flags, NWT_PN_FLAGS ); 1212 1212 //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags); 1213 1213 … … 1216 1216 if ( flags & __FLAG_COOR ) 1217 1217 { 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 ); 1221 1221 PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3); 1222 1222 this->setRelCoor( f1, f2, f3 ); … … 1225 1225 if ( flags & __FLAG_ROT ) 1226 1226 { 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 ); 1231 1231 PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4); 1232 1232 //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); … … 1270 1270 1271 1271 1272 SYNCHELP_WRITE_BYTE( flags );1272 SYNCHELP_WRITE_BYTE( flags, NWT_PN_FLAGS ); 1273 1273 //PRINTF(0)("FLAGS = %d\n", flags); 1274 1274 … … 1278 1278 PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z); 1279 1279 1280 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );1281 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );1282 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );1280 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_SCOORX ); 1281 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_SCOORY ); 1282 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_SCOORZ ); 1283 1283 1284 1284 coorx = relCoordinate.x; … … 1292 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 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 );1294 SYNCHELP_WRITE_FLOAT( this->absDirection.w, NWT_PN_SROTV ); 1295 SYNCHELP_WRITE_FLOAT( this->absDirection.v.x, NWT_PN_SROTX ); 1296 SYNCHELP_WRITE_FLOAT( this->absDirection.v.y, NWT_PN_SROTY ); 1297 SYNCHELP_WRITE_FLOAT( this->absDirection.v.z, NWT_PN_SROTZ ); 1298 1298 1299 1299 rotw = absDirection.w; -
branches/network/src/lib/lang/base_object.cc
r6640 r6784 204 204 objectName = NULL; 205 205 } 206 SYNCHELP_READ_STRINGM( this->objectName );206 SYNCHELP_READ_STRINGM( this->objectName, NWT_BO_NAME ); 207 207 if ( this->objectName && !strcmp(this->objectName, "") ) 208 208 { … … 225 225 226 226 //PRINTF(0)("objectname = %s\n", this->objectName); 227 SYNCHELP_WRITE_STRING( this->objectName );227 SYNCHELP_WRITE_STRING( this->objectName, NWT_BO_NAME ); 228 228 229 229 return SYNCHELP_WRITE_N; -
branches/network/src/lib/network/handshake.cc
r6753 r6784 95 95 if ( !isServer() && hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) ) 96 96 { 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 }*/ 103 103 104 104 setState( HS_COMPLETED ); 105 105 setState( HS_RECVD_HID ); 106 106 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 ); 109 109 110 110 if ( newHostId == 0 ) … … 180 180 isOk = false; 181 181 //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); 184 184 } 185 185 else … … 187 187 isOk = true; 188 188 //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 ); 191 191 } 192 192 *reciever = clientId; -
branches/network/src/lib/network/network_game_manager.cc
r6737 r6784 167 167 if ( !isServer() && !hasRequestedWorld ) 168 168 { 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; 172 171 hasRequestedWorld = true; 173 return SYNCHELP_WRITE_N;172 return 1; 174 173 } 175 174 -
branches/network/src/lib/network/synchronizeable.h
r6753 r6784 20 20 #define STATE_OUTOFSYNC 2 21 21 #define STATE_REQUESTEDSYNC 4 22 23 enum { 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 33 NWT_HS_HOST_ID, 34 NWT_HS_NGM_ID, 35 36 NWT_PN_BO_WRITESTATE, 37 NWT_PN_PARENTMODE, 38 NWT_PN_COORX, 39 NWT_PN_COORY, 40 NWT_PN_COORZ, 41 NWT_PN_ROTX, 42 NWT_PN_ROTY, 43 NWT_PN_ROTZ, 44 NWT_PN_ROTV, 45 46 NWT_PN_FLAGS, 47 NWT_PN_SCOORX, 48 NWT_PN_SCOORY, 49 NWT_PN_SCOORZ, 50 NWT_PN_SROTX, 51 NWT_PN_SROTY, 52 NWT_PN_SROTZ, 53 NWT_PN_SROTV, 54 55 NWT_BO_NAME, 56 57 NWT_WE_PN_WRITESTATE, 58 NWT_WE_PN_MODELFILENAME, 59 NWT_WE_PN_SCALING, 60 61 NWT_GT_WE_STATE, 62 63 NWT_SB_WE_STATE, 64 NWT_SB_SIZE, 65 NWT_SB_TEXTURENAME, 66 67 NWT_TER_WE_STATE, 68 69 NWT_PU_WE_STATE, 70 71 NWT_TPU_WE_STATE, 72 73 NWT_LPU_WE_STATE, 74 75 NWT_WPU_WE_STATE, 76 77 NWT_PPU_WE_STATE, 78 NWT_PPU_TYPE, 79 NWT_PPU_VALUE, 80 NWT_PPU_MINVALUE, 81 NWT_PPU_MAXVALUE, 82 83 NWT_WAT_STATE, 84 NWT_WAT_WE_STATE, 85 NWT_WAT_SIZEX, 86 NWT_WAT_SIZEY, 87 NWT_WAT_RESX, 88 NWT_WAT_RESY, 89 NWT_WAT_HEIGHT 90 }; 22 91 23 92 … … 58 127 * 59 128 */ 129 #define SYNCHELP_WRITE_DEBUG(n) {\ 130 __synchelp_write_n = Converter::intToByteArray( n, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ 131 assert( __synchelp_write_n == INTSIZE ); \ 132 __synchelp_write_i += __synchelp_write_n; \ 133 } 134 135 #define SYNCHELP_READ_DEBUG(n) { \ 136 int nn; \ 137 __synchelp_read_n = Converter::byteArrayToInt( data+__synchelp_read_i, &nn ); \ 138 assert( __synchelp_read_n == INTSIZE ); \ 139 if ( n != nn ) { \ 140 PRINTF(1)("Check your code! read/writes not in right order! read %d instead of %d\n", nn, n); \ 141 assert( false ); \ 142 } \ 143 __synchelp_read_i += __synchelp_read_n; \ 144 } 145 60 146 #define SYNCHELP_WRITE_BEGIN() int __synchelp_write_i = 0; \ 61 147 int __synchelp_write_n 62 #define SYNCHELP_WRITE_INT(i) { __synchelp_write_n = \ 148 #define SYNCHELP_WRITE_INT(i,n) { SYNCHELP_WRITE_DEBUG(n); \ 149 __synchelp_write_n = \ 63 150 Converter::intToByteArray( i, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ 64 151 assert( __synchelp_write_n == INTSIZE ); \ … … 70 157 __synchelp_write_i += __synchelp_write_n; \ 71 158 } 72 #define SYNCHELP_WRITE_FLOAT(f) { __synchelp_write_n = \ 159 #define SYNCHELP_WRITE_FLOAT(f,n) { SYNCHELP_WRITE_DEBUG(n); \ 160 __synchelp_write_n = \ 73 161 Converter::floatToByteArray( f, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ 74 162 assert( __synchelp_write_n == FLOATSIZE ); \ … … 80 168 __synchelp_write_i += __synchelp_write_n; \ 81 169 } 82 #define SYNCHELP_WRITE_BYTE(b) { \ 170 #define SYNCHELP_WRITE_BYTE(b,n) { SYNCHELP_WRITE_DEBUG(n); \ 171 \ 83 172 if (maxLength - __synchelp_write_i < 1) \ 84 173 { \ … … 89 178 __synchelp_write_i++; \ 90 179 } 91 #define SYNCHELP_WRITE_STRING(s) { if (s!=NULL) {\ 180 #define SYNCHELP_WRITE_STRING(s,n) { SYNCHELP_WRITE_DEBUG(n); \ 181 if (s!=NULL) {\ 92 182 __synchelp_write_n = \ 93 183 Converter::stringToByteArray( s, data+__synchelp_write_i, strlen(s), maxLength-__synchelp_write_i ); \ … … 105 195 } 106 196 #define SYNCHELP_WRITE_N __synchelp_write_i 107 #define SYNCHELP_WRITE_FKT(f ) { \197 #define SYNCHELP_WRITE_FKT(f,n) { \ 108 198 __synchelp_write_i += \ 109 199 f( data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ … … 114 204 int __synchelp_read_n 115 205 116 #define SYNCHELP_READ_INT(i ) {\206 #define SYNCHELP_READ_INT(i,n) { SYNCHELP_READ_DEBUG(n); \ 117 207 if ( length-__synchelp_read_i < INTSIZE ) \ 118 208 { \ … … 124 214 __synchelp_read_i += __synchelp_read_n; \ 125 215 } 126 #define SYNCHELP_READ_FLOAT(f ) {\216 #define SYNCHELP_READ_FLOAT(f,n) { SYNCHELP_READ_DEBUG(n); \ 127 217 if ( length-__synchelp_read_i < FLOATSIZE ) \ 128 218 { \ … … 134 224 __synchelp_read_i += __synchelp_read_n; \ 135 225 } 136 #define SYNCHELP_READ_STRING(s,l ) {\226 #define SYNCHELP_READ_STRING(s,l,n) {SYNCHELP_READ_DEBUG(n); \ 137 227 __synchelp_read_n = Converter::byteArrayToString( data+__synchelp_read_i, s, l ); \ 138 228 assert( __synchelp_read_n == strlen(s)+INTSIZE ) ;\ … … 144 234 __synchelp_read_i += __synchelp_read_n; \ 145 235 } 146 #define SYNCHELP_READ_STRINGM(s ) {\236 #define SYNCHELP_READ_STRINGM(s,n) { SYNCHELP_READ_DEBUG(n); \ 147 237 __synchelp_read_n = Converter::byteArrayToStringM( data+__synchelp_read_i, s ); \ 148 238 assert( __synchelp_read_n == strlen(s)+INTSIZE ) ;\ … … 154 244 __synchelp_read_i += __synchelp_read_n; \ 155 245 } 156 #define SYNCHELP_READ_BYTE(b ) {\246 #define SYNCHELP_READ_BYTE(b,n) { SYNCHELP_READ_DEBUG(n); \ 157 247 if ( length-__synchelp_read_i < 1 ) \ 158 248 { \ … … 163 253 __synchelp_read_i ++; \ 164 254 } 165 #define SYNCHELP_READ_FKT(f ) {\255 #define SYNCHELP_READ_FKT(f,n) { SYNCHELP_READ_DEBUG(n); \ 166 256 __synchelp_read_i += \ 167 257 f( data+__synchelp_read_i, length-__synchelp_read_i, sender); \ 168 258 } 259 #define SYNCHELP_READ_REMAINING() ( length-__synchelp_read_i ) 260 #define SYNCHELP_READ_NEXTBYTE() ( data[__synchelp_read_i] ) 169 261 #define SYNCHELP_READ_N __synchelp_read_i 170 262 -
branches/network/src/world_entities/environments/water.cc
r6771 r6784 298 298 SYNCHELP_READ_BEGIN(); 299 299 300 SYNCHELP_READ_FKT( Water::writeState );300 SYNCHELP_READ_FKT( Water::writeState, NWT_WAT_STATE ); 301 301 302 302 return SYNCHELP_READ_N; … … 324 324 { 325 325 *reciever = rec; 326 SYNCHELP_WRITE_FKT( Water::readState );326 SYNCHELP_WRITE_FKT( Water::readState, NWT_WAT_STATE ); 327 327 } 328 328 … … 343 343 SYNCHELP_WRITE_BEGIN(); 344 344 345 SYNCHELP_WRITE_FKT( WorldEntity::readState );345 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_WAT_WE_STATE ); 346 346 347 347 // sync the size 348 SYNCHELP_WRITE_FLOAT( this->sizeX );349 SYNCHELP_WRITE_FLOAT( this->sizeY );348 SYNCHELP_WRITE_FLOAT( this->sizeX, NWT_WAT_SIZEX ); 349 SYNCHELP_WRITE_FLOAT( this->sizeY, NWT_WAT_SIZEY ); 350 350 351 351 //sync resolution 352 SYNCHELP_WRITE_INT( this->resX );353 SYNCHELP_WRITE_INT( this->resY );352 SYNCHELP_WRITE_INT( this->resX, NWT_WAT_RESX ); 353 SYNCHELP_WRITE_INT( this->resY, NWT_WAT_RESY ); 354 354 355 355 //sync the height 356 SYNCHELP_WRITE_FLOAT( this->height );356 SYNCHELP_WRITE_FLOAT( this->height, NWT_WAT_HEIGHT ); 357 357 358 358 return SYNCHELP_WRITE_N; … … 370 370 SYNCHELP_READ_BEGIN(); 371 371 372 SYNCHELP_READ_FKT( WorldEntity::writeState );372 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_WAT_WE_STATE ); 373 373 374 374 float f1, f2; … … 376 376 377 377 //read the size 378 SYNCHELP_READ_FLOAT( f1 );379 SYNCHELP_READ_FLOAT( f2 );378 SYNCHELP_READ_FLOAT( f1, NWT_WAT_SIZEX ); 379 SYNCHELP_READ_FLOAT( f2, NWT_WAT_SIZEY ); 380 380 this->sizeX = f1; 381 381 this->sizeY = f2; … … 383 383 384 384 //read the resolution 385 SYNCHELP_READ_INT( i1 );386 SYNCHELP_READ_INT( i2 );385 SYNCHELP_READ_INT( i1, NWT_WAT_RESX ); 386 SYNCHELP_READ_INT( i2, NWT_WAT_RESY ); 387 387 this->resX = i1; 388 388 this->resY = i2; … … 390 390 391 391 //read the height 392 SYNCHELP_READ_FLOAT( f1 );392 SYNCHELP_READ_FLOAT( f1, NWT_WAT_HEIGHT ); 393 393 this->height = f1; 394 394 -
branches/network/src/world_entities/npcs/ground_turret.cc
r6736 r6784 181 181 SYNCHELP_READ_BEGIN(); 182 182 183 SYNCHELP_READ_FKT( WorldEntity::writeState );183 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_GT_WE_STATE ); 184 184 185 185 return SYNCHELP_READ_N; … … 207 207 *reciever = rec; 208 208 209 SYNCHELP_WRITE_FKT( WorldEntity::readState );209 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_GT_WE_STATE ); 210 210 211 211 } -
branches/network/src/world_entities/power_ups/laser_power_up.cc
r6512 r6784 126 126 SYNCHELP_READ_BEGIN(); 127 127 128 SYNCHELP_READ_FKT( PowerUp::writeState );128 SYNCHELP_READ_FKT( PowerUp::writeState, NWT_LPU_WE_STATE ); 129 129 130 130 return SYNCHELP_READ_N; … … 148 148 SYNCHELP_WRITE_BEGIN(); 149 149 150 SYNCHELP_WRITE_FKT( PowerUp::readState );150 SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_LPU_WE_STATE ); 151 151 152 152 return SYNCHELP_WRITE_N; -
branches/network/src/world_entities/power_ups/param_power_up.cc
r6695 r6784 131 131 SYNCHELP_READ_BEGIN(); 132 132 133 SYNCHELP_READ_FKT( PowerUp::writeState );133 SYNCHELP_READ_FKT( PowerUp::writeState, NWT_PPU_WE_STATE ); 134 134 135 135 int i; 136 SYNCHELP_READ_INT( i );136 SYNCHELP_READ_INT( i, NWT_PPU_TYPE ); 137 137 this->type = (EnumParamPowerUpType)i; 138 SYNCHELP_READ_FLOAT( this->value );138 SYNCHELP_READ_FLOAT( this->value, NWT_PPU_VALUE ); 139 139 140 140 if ( this->value != 0 ) 141 141 { 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 ); 144 144 respawn(); 145 145 } … … 165 165 SYNCHELP_WRITE_BEGIN(); 166 166 167 SYNCHELP_WRITE_FKT( PowerUp::readState );167 SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_PPU_WE_STATE ); 168 168 169 169 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 ); 172 172 173 173 if ( this->value != 0 ) 174 174 { 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 ); 177 177 } 178 178 -
branches/network/src/world_entities/power_ups/power_up.cc
r6710 r6784 124 124 { 125 125 SYNCHELP_WRITE_BEGIN(); 126 SYNCHELP_WRITE_FKT( WorldEntity::readState );126 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_PU_WE_STATE ); 127 127 return SYNCHELP_WRITE_N; 128 128 } … … 138 138 { 139 139 SYNCHELP_READ_BEGIN(); 140 SYNCHELP_READ_FKT( WorldEntity::writeState );140 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_PU_WE_STATE ); 141 141 return SYNCHELP_READ_N; 142 142 } -
branches/network/src/world_entities/power_ups/turret_power_up.cc
r6695 r6784 135 135 SYNCHELP_READ_BEGIN(); 136 136 137 SYNCHELP_READ_FKT( PowerUp::writeState );137 SYNCHELP_READ_FKT( PowerUp::writeState, NWT_TPU_WE_STATE ); 138 138 139 139 return SYNCHELP_READ_N; … … 156 156 SYNCHELP_WRITE_BEGIN(); 157 157 158 SYNCHELP_WRITE_FKT( PowerUp::readState );158 SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_TPU_WE_STATE ); 159 159 160 160 return SYNCHELP_WRITE_N; -
branches/network/src/world_entities/power_ups/weapon_power_up.cc
r6710 r6784 100 100 SYNCHELP_READ_BEGIN(); 101 101 102 SYNCHELP_READ_FKT( PowerUp::writeState );102 SYNCHELP_READ_FKT( PowerUp::writeState, NWT_WPU_WE_STATE ); 103 103 104 104 //TODO: sync weapon class ( see loadParams ) … … 124 124 SYNCHELP_WRITE_BEGIN(); 125 125 126 SYNCHELP_WRITE_FKT( PowerUp::readState );126 SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_WPU_WE_STATE ); 127 127 128 128 //TODO: sync weapon class ( see loadParams ) -
branches/network/src/world_entities/skybox.cc
r6772 r6784 297 297 SYNCHELP_READ_BEGIN(); 298 298 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 ); 302 302 if ( textureName ) 303 303 { … … 305 305 textureName = NULL; 306 306 } 307 SYNCHELP_READ_STRINGM( textureName );307 SYNCHELP_READ_STRINGM( textureName, NWT_SB_TEXTURENAME ); 308 308 309 309 this->setSize( size ); … … 331 331 SYNCHELP_WRITE_BEGIN(); 332 332 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); 337 337 338 338 return SYNCHELP_WRITE_N; -
branches/network/src/world_entities/space_ships/space_ship.cc
r6764 r6784 557 557 558 558 byte b; 559 560 do 561 { 562 SYNCHELP_READ_BYTE( b ); 563 564 if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ ) 565 { 566 PRINTF(0)("GOT STATE %d\n", this->getUniqueID()); 567 setRequestedSync( false ); 568 setIsOutOfSync( false ); 569 SYNCHELP_READ_FKT( WorldEntity::writeState ); 559 560 if ( SYNCHELP_READ_REMAINING()>0 && SYNCHELP_READ_NEXTBYTE() == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ ) 561 { 562 PRINTF(0)("GOT STATE %d\n", this->getUniqueID()); 563 setRequestedSync( false ); 564 setIsOutOfSync( false ); 565 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SS_WE_STATE ); 570 566 //SYNCHELP_READ_FLOAT( cycle ); 571 567 572 return SYNCHELP_READ_N; 573 } 574 568 return SYNCHELP_READ_N; 569 } 570 571 if ( this->getOwner() != this->getHostID() ) 572 SYNCHELP_READ_FKT( PNode::writeSync, NWT_SS_PN_SYNC ); 573 574 while ( SYNCHELP_READ_REMAINING()>0 ) 575 { 576 SYNCHELP_READ_BYTE( b, NWT_SS_B ); 575 577 576 578 //TODO: do not recieve data if you are the owner … … 578 580 { 579 581 int flags = 0; 580 SYNCHELP_READ_INT( flags );582 SYNCHELP_READ_INT( flags, NWT_SS_FLAGS ); 581 583 582 584 bUp = (flags & MASK_bUp) != 0; … … 595 597 if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ ) 596 598 { 597 SYNCHELP_READ_FLOAT( mouseDir.w );598 SYNCHELP_READ_FLOAT( mouseDir.v.x );599 SYNCHELP_READ_FLOAT( mouseDir.v.y );600 SYNCHELP_READ_FLOAT( mouseDir.v.z );599 SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW ); 600 SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX ); 601 SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY ); 602 SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ ); 601 603 } 602 } while( b != 0 );604 }; 603 605 604 606 /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) … … 610 612 }*/ 611 613 612 if ( this->getOwner() != this->getHostID() )613 SYNCHELP_READ_FKT( PNode::writeSync );614 615 614 return SYNCHELP_READ_N; 616 615 } … … 636 635 PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec); 637 636 638 SYNCHELP_WRITE_BYTE( (byte)DATA_state );639 640 SYNCHELP_WRITE_FKT( WorldEntity::readState );637 SYNCHELP_WRITE_BYTE( (byte)DATA_state, NWT_SS_B ); 638 639 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SS_WE_STATE ); 641 640 //SYNCHELP_WRITE_FLOAT( cycle ); 642 641 … … 645 644 646 645 *reciever = 0; 646 647 if ( this->getOwner() == this->getHostID() ) 648 SYNCHELP_WRITE_FKT( PNode::readSync, NWT_SS_PN_SYNC ); 647 649 648 650 if ( this->getHostID()==this->getOwner() ) … … 674 676 { 675 677 oldMask = mask; 676 SYNCHELP_WRITE_BYTE( DATA_flags );677 SYNCHELP_WRITE_INT( mask );678 SYNCHELP_WRITE_BYTE( DATA_flags, NWT_SS_B ); 679 SYNCHELP_WRITE_INT( mask, NWT_SS_FLAGS ); 678 680 } 679 681 #define __OFFSET_ROT 0.05 … … 685 687 oldMouseDir = mouseDir; 686 688 687 SYNCHELP_WRITE_BYTE( DATA_mouse );688 SYNCHELP_WRITE_FLOAT( mouseDir.w );689 SYNCHELP_WRITE_FLOAT( mouseDir.v.x );690 SYNCHELP_WRITE_FLOAT( mouseDir.v.y );691 SYNCHELP_WRITE_FLOAT( mouseDir.v.z );689 SYNCHELP_WRITE_BYTE( DATA_mouse, NWT_SS_B ); 690 SYNCHELP_WRITE_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW ); 691 SYNCHELP_WRITE_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX ); 692 SYNCHELP_WRITE_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY ); 693 SYNCHELP_WRITE_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ ); 692 694 } 693 695 694 696 } 695 697 696 SYNCHELP_WRITE_BYTE( 0 );697 698 699 if ( this->getOwner() == this->getHostID() )700 SYNCHELP_WRITE_FKT( PNode::readSync );701 702 698 return SYNCHELP_WRITE_N; 703 699 } 700 701 int SpaceShip::writeState(const byte* data, int length, int sender) 702 { 703 SYNCHELP_READ_BEGIN(); 704 705 return SYNCHELP_READ_N; 706 } 707 708 int SpaceShip::readState(byte* data, int maxLength ) 709 { 710 SYNCHELP_WRITE_BEGIN(); 711 712 return SYNCHELP_WRITE_N; 713 } 714 715 int SpaceShip::writeSync(const byte* data, int length, int sender) 716 { 717 SYNCHELP_READ_BEGIN(); 718 719 return SYNCHELP_READ_N; 720 } 721 722 int SpaceShip::readSync(byte* data, int maxLength ) 723 { 724 SYNCHELP_WRITE_BEGIN(); 725 726 return SYNCHELP_WRITE_N; 727 } -
branches/network/src/world_entities/space_ships/space_ship.h
r6756 r6784 44 44 virtual int writeBytes(const byte* data, int length, int sender); 45 45 virtual int readBytes(byte* data, int maxLength, int * reciever); 46 47 int writeState(const byte* data, int length, int sender); 48 int readState(byte* data, int maxLength ); 49 int writeSync(const byte* data, int length, int sender); 50 int readSync(byte* data, int maxLength ); 46 51 47 52 -
branches/network/src/world_entities/terrain.cc
r6695 r6784 326 326 327 327 SYNCHELP_READ_BEGIN(); 328 SYNCHELP_READ_FKT( WorldEntity::writeState );328 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_TER_WE_STATE ); 329 329 330 330 return SYNCHELP_READ_N; … … 344 344 *reciever = rec; 345 345 346 return WorldEntity::readState( data, maxLength ); 346 SYNCHELP_WRITE_BEGIN(); 347 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_TER_WE_STATE ); 348 return SYNCHELP_WRITE_N; 347 349 348 350 } -
branches/network/src/world_entities/world_entity.cc
r6720 r6784 518 518 SYNCHELP_READ_BEGIN(); 519 519 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 ); 524 524 //check if modelFileName is relative to datadir or absolute 525 525 … … 562 562 SYNCHELP_WRITE_BEGIN(); 563 563 564 SYNCHELP_WRITE_FKT( PNode::readState );564 SYNCHELP_WRITE_FKT( PNode::readState, NWT_WE_PN_WRITESTATE ); 565 565 566 566 if ( getModel(0) && getModel(0)->getName() ) … … 573 573 } 574 574 575 SYNCHELP_WRITE_STRING( name );575 SYNCHELP_WRITE_STRING( name, NWT_WE_PN_MODELFILENAME ); 576 576 } 577 577 else 578 578 { 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 ); 583 583 /*if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") ) 584 584 {
Note: See TracChangeset
for help on using the changeset viewer.