- Timestamp:
- Jan 21, 2006, 1:18:19 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 31 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r6624 r6634 73 73 74 74 CL_STORY_ENTITY = 0x02000000, 75 76 CL_GAME_WORLD = 0x50000000, 77 CL_GAME_WORLD_DATA = 0x60000000, 75 78 76 79 CL_PHYSICS_INTERFACE = 0x04000000, … … 96 99 CL_PLAYER = 0x00202000, 97 100 CL_NPC = 0x00204000, 101 CL_IMAGE_ENTITY = 0x00206000, 102 CL_PLANET = 0x00207000, 98 103 CL_PROJECTILE = 0x00208000, 99 104 CL_WEAPON = 0x00210000, … … 148 153 CL_CAMPAIGN = 0x00000101, 149 154 CL_CAMPAIGN_DATA = 0x00000102, 150 CL_ GAME_WORLD= 0x00000103,151 CL_ GAME_WORLD_DATA= 0x00000104,155 CL_SIMPLE_GAME_MENU = 0x00000103, 156 CL_SIMPLE_GAME_MENU_DATA = 0x00000104, 152 157 CL_SINGLE_PLAYER_WORLD = 0x00000105, 153 158 CL_SINGLE_PLAYER_WORLD_DATA = 0x00000106, … … 155 160 CL_MULTI_PLAYER_WORLD_DATA = 0x00000108, 156 161 CL_MOVIE_LOADER = 0x00000109, 162 157 163 158 164 // WorldEntities (range from 0x00000200 to 0x000004ff) -
trunk/src/lib/coord/p_node.cc
r6624 r6634 505 505 { 506 506 PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE)); 507 // PRINTF(0)("Adding the Child: %s to: %s\n", childName, this->getName()); 508 // assert( childNode != NULL ); 507 509 if (childNode != NULL) 510 { 508 511 this->addChild(childNode); 512 } 509 513 } 510 514 … … 1069 1073 SYNCHELP_READ_FLOAT( f3 ); 1070 1074 this->setRelCoor( f1, f2, f3 ); 1071 //this->setRelCoor( 5, 0, 0 ); 1072 1073 /*SYNCHELP_READ_FLOAT( f1 ); 1074 SYNCHELP_READ_FLOAT( f2 ); 1075 SYNCHELP_READ_FLOAT( f3 );*/ 1076 //this->setAbsCoor( f1, f2, f3 ); 1075 1077 1076 1078 1077 SYNCHELP_READ_FLOAT( f1 ); … … 1082 1081 this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1083 1082 1084 /*SYNCHELP_READ_FLOAT( f1 );1085 SYNCHELP_READ_FLOAT( f2 );1086 SYNCHELP_READ_FLOAT( f3 );1087 SYNCHELP_READ_FLOAT( f4 );*/1088 //this->setAbsDir( Quaternion( Vector(f2, f3, f4), f1 ) );1089 1090 1083 int n; 1091 1084 char * childName; 1092 1085 1086 PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]); 1093 1087 SYNCHELP_READ_INT( n ); 1088 PRINTF(0)("read %s:n=%d\n", this->getName(), n); 1094 1089 1095 1090 for (int i = 0; i<n; i++) 1096 1091 { 1097 1092 SYNCHELP_READ_STRINGM( childName ); 1098 //PRINTF(0)("childname= %s\n", childName);1093 PRINTF(0)("RCVD CHILD = %s\n", childName); 1099 1094 addChild( childName ); 1100 1095 delete childName; … … 1132 1127 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z ); 1133 1128 1134 //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z);1135 1136 /*SYNCHELP_WRITE_FLOAT( this->absCoordinate.x );1137 SYNCHELP_WRITE_FLOAT( this->absCoordinate.y );1138 SYNCHELP_WRITE_FLOAT( this->absCoordinate.z );*/1139 1140 //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z);1141 1142 1129 SYNCHELP_WRITE_FLOAT( this->relDirection.w ); 1143 1130 SYNCHELP_WRITE_FLOAT( this->relDirection.v.x ); … … 1145 1132 SYNCHELP_WRITE_FLOAT( this->relDirection.v.z ); 1146 1133 1147 /*SYNCHELP_WRITE_FLOAT( this->absDirection.w );1148 SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );1149 SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );1150 SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );*/1151 1152 1134 int n = children.size(); 1135 1136 //check if camera is in children 1137 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1138 { 1139 if ( (*it)->isA(CL_CAMERA) ) 1140 n--; 1141 } 1142 PRINTF(0)("write %s:n=%d\n", this->getName(), n); 1153 1143 SYNCHELP_WRITE_INT( n ); 1144 PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]); 1154 1145 1155 1146 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1156 1147 { 1157 SYNCHELP_WRITE_STRING( (*it)->getName() ); 1148 //dont add camera because there is only one camera attached to local player 1149 if ( !(*it)->isA(CL_CAMERA) ) 1150 { 1151 PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName()); 1152 SYNCHELP_WRITE_STRING( (*it)->getName() ); 1153 } 1158 1154 } 1159 1155 1160 1156 return SYNCHELP_WRITE_N; 1161 1157 } 1158 1159 #define __FLAG_COOR 1 1160 #define __FLAG_ROT 2 1161 1162 #define __OFFSET_POS 1 1163 #define __OFFSET_ROT 0.05 1164 1165 /** 1166 * Writes data from network containing information about the state which has changed 1167 * @param data pointer to data 1168 * @param length length of data 1169 * @param sender hostID of sender 1170 */ 1171 int PNode::writeSync( const byte * data, int length, int sender ) 1172 { 1173 SYNCHELP_READ_BEGIN(); 1174 1175 if ( this->getHostID()==this->getOwner() ) 1176 { 1177 return SYNCHELP_READ_N; 1178 } 1179 1180 byte flags = 0; 1181 SYNCHELP_READ_BYTE( flags ); 1182 //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags); 1183 1184 float f1, f2, f3, f4; 1185 1186 if ( flags & __FLAG_COOR ) 1187 { 1188 SYNCHELP_READ_FLOAT( f1 ); 1189 SYNCHELP_READ_FLOAT( f2 ); 1190 SYNCHELP_READ_FLOAT( f3 ); 1191 PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3); 1192 this->setRelCoor( f1, f2, f3 ); 1193 } 1194 1195 if ( flags & __FLAG_ROT ) 1196 { 1197 SYNCHELP_READ_FLOAT( f1 ); 1198 SYNCHELP_READ_FLOAT( f2 ); 1199 SYNCHELP_READ_FLOAT( f3 ); 1200 SYNCHELP_READ_FLOAT( f4 ); 1201 PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4); 1202 //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1203 Quaternion q; 1204 q.w = f1; 1205 q.v.x = f2; 1206 q.v.y = f3; 1207 q.v.z = f4; 1208 this->setAbsDir( q ); 1209 } 1210 1211 return SYNCHELP_READ_N; 1212 } 1213 1214 /** 1215 * data copied in data will bee sent to another host 1216 * @param data pointer to data 1217 * @param maxLength max length of data 1218 * @return the number of bytes writen 1219 */ 1220 int PNode::readSync( byte * data, int maxLength ) 1221 { 1222 SYNCHELP_WRITE_BEGIN(); 1223 1224 if ( this->getHostID()!=this->getOwner() ) 1225 { 1226 return SYNCHELP_WRITE_N; 1227 } 1228 1229 byte flags = 0; 1230 if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS || 1231 fabs( coory - relCoordinate.y ) > __OFFSET_POS || 1232 fabs( coorz - relCoordinate.z ) > __OFFSET_POS ) 1233 flags |= __FLAG_COOR; 1234 1235 if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT || 1236 fabs( rotx - absDirection.v.x ) > __OFFSET_ROT || 1237 fabs( roty - absDirection.v.y ) > __OFFSET_ROT || 1238 fabs( rotz - absDirection.v.z ) > __OFFSET_ROT ) 1239 flags |= __FLAG_ROT; 1240 1241 1242 SYNCHELP_WRITE_BYTE( flags ); 1243 //PRINTF(0)("FLAGS = %d\n", flags); 1244 1245 if ( flags & __FLAG_COOR ) 1246 { 1247 1248 PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z); 1249 1250 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x ); 1251 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y ); 1252 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z ); 1253 1254 coorx = relCoordinate.x; 1255 coory = relCoordinate.y; 1256 coorz = relCoordinate.z; 1257 } 1258 1259 if ( flags & __FLAG_ROT ) 1260 { 1261 1262 PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z); 1263 1264 SYNCHELP_WRITE_FLOAT( this->absDirection.w ); 1265 SYNCHELP_WRITE_FLOAT( this->absDirection.v.x ); 1266 SYNCHELP_WRITE_FLOAT( this->absDirection.v.y ); 1267 SYNCHELP_WRITE_FLOAT( this->absDirection.v.z ); 1268 1269 rotw = absDirection.w; 1270 rotx = absDirection.v.x; 1271 roty = absDirection.v.y; 1272 rotz = absDirection.v.z; 1273 } 1274 1275 return SYNCHELP_WRITE_N; 1276 } -
trunk/src/lib/coord/p_node.h
r6616 r6634 186 186 int writeState(const byte* data, int length, int sender); 187 187 int readState(byte* data, int maxLength ); 188 int writeSync(const byte* data, int length, int sender); 189 int readSync(byte* data, int maxLength ); 188 190 189 191 private: … … 229 231 230 232 static PNode* nullParent; //!< The ROOT of the main PNode Tree. 233 234 private: 235 float coorx; 236 float coory; 237 float coorz; 238 239 float rotw; 240 float rotx; 241 float roty; 242 float rotz; 231 243 }; 232 244 -
trunk/src/lib/graphics/graphics_engine.cc
r6523 r6634 274 274 this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), " \n\t,"); 275 275 276 PRINT(4)("Running on : %s %s%s\n", vendor, renderer, version);276 PRINT(4)("Running on : vendor: %s, renderer: %s, version:%s\n", vendor, renderer, version); 277 277 PRINT(4)("Extensions:\n"); 278 278 if (this->hwExtensions != NULL) -
trunk/src/lib/graphics/importer/texture.cc
r6532 r6634 260 260 glBindTexture(target, texture); 261 261 262 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 262 glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT); 263 glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_REPEAT); 264 265 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR/*_MIPMAP_LINEAR*/); 263 266 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 264 267 265 266 glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT); 267 glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT); 268 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_PRIORITY, this->priority); 269 268 270 269 271 /* control the mipmap levels */ 270 // glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);f 271 // glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 272 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_PRIORITY, this->priority); 272 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5); 273 glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0); 273 274 274 275 /* build the Texture OpenGL V >= 1.1 */ … … 295 296 PRINTF(1)("Error while loading texture (mipmap generation), gluBuild2DMipmaps returned %i\n", errorCode); 296 297 298 // Deselect newly built texture, as we do not want to display with this texture. 297 299 if (target == GL_TEXTURE_2D) 298 300 glBindTexture(target, 0); 301 299 302 return texture; 300 303 } -
trunk/src/lib/lang/base_object.cc
r6517 r6634 224 224 SYNCHELP_WRITE_BEGIN(); 225 225 226 //PRINTF(0)("objectname = %s\n", this->objectName); 226 227 SYNCHELP_WRITE_STRING( this->objectName ); 227 228 -
trunk/src/lib/network/converter.cc
r6341 r6634 22 22 /* include your own header */ 23 23 #include "converter.h" 24 #include "shell_command.h" 25 26 #include <limits> 27 28 SHELL_COMMAND_STATIC(debug, Converter, Converter::debug); 24 29 25 30 … … 182 187 const int expmult = 8388608; //2^23 183 188 189 float Converter::getDenormConst() 190 { 191 const int exp = 126; 192 float result = 1.0f; 193 for (int i = 0; i < exp; i++) 194 result /= 2.0f; 195 return result; 196 } 197 184 198 /*! 185 199 * Converts a float value into a byte-array … … 189 203 byte* Converter::floatToByteArray(float x) 190 204 { 205 byte* result = new byte[4]; 206 floatToByteArray(x, result, 4); 207 return result; 208 /* 191 209 int mantisse = 0; 192 210 int exponent = 128; … … 201 219 sgn = 1; 202 220 203 float sub = 1; 204 while (sub < x) 205 { 206 sub *= 2; 221 if (x == 0) 222 { 223 exponent = 255; 224 mantisse = 0; 225 } 226 else 227 { 228 //if (x < getDenormConst()) 229 // printf("Denormalisiert!\n"); 230 //printf("DenormConst = %e", getDenormConst()); 231 232 float sub = 1; 233 while (sub < x) 234 { 235 sub *= 2; 236 exponent++; 237 } 238 239 while (x > 0) 240 { 241 if (x >= sub) 242 { 243 mantisse += 1; 244 x -= sub; 245 } 246 247 mantisse *= 2; 248 exponent--; 249 sub /= 2; 250 } 207 251 exponent++; 208 } 209 210 while (x > 0) 211 { 212 if (x >= sub) 213 { 214 mantisse += 1; 215 x -= sub; 216 } 217 218 mantisse *= 2; 219 exponent--; 220 sub /= 2; 221 } 222 exponent++; 223 mantisse /= 2; 224 while (mantisse < expmult) 225 { 226 mantisse *= 2; 227 exponent--; 228 } 229 230 //printf("mantisse = %i exponent = %i \n", mantisse, exponent); 231 232 mantisse -= expmult; 252 mantisse /= 2; 253 254 printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 255 256 257 if (mantisse != 0) 258 { 259 while (mantisse < expmult) 260 { 261 mantisse *= 2; 262 exponent--; 263 } 264 265 mantisse -= expmult; 266 } 267 } 268 269 printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 270 233 271 234 272 int hx = mantisse + expmult * exponent; … … 238 276 239 277 return result; 278 */ 240 279 } 241 280 … … 248 287 float Converter::byteArrayToFloat(byte* a) 249 288 { 289 byte* h = new byte[4]; 290 float result = 0.0f; 291 byteArrayToFloat(a, &result); 292 return result; 293 /* 294 int hexp = a[2] + a[3] * 256; 295 int exponent = (hexp / 128) % 256; 296 250 297 int hmant = a[0] + a[1] * 256 + a[2] * 65536; 251 298 int mantisse = hmant % expmult; 299 if (mantisse == 0 && exponent == 255) 300 return 0; 301 252 302 mantisse += expmult; 253 254 int hexp = a[2] + a[3] * 256; 255 int exponent = (hexp / 128) % 256 - 128; 303 exponent -= 128; 304 256 305 257 306 int sgn; … … 261 310 sgn = 1; 262 311 263 //printf("mantisse = %i exponent = %i \n", mantisse, exponent);312 printf("ReConv: mantisse = %i exponent = %i \n", mantisse, exponent); 264 313 265 314 float emult = 1; … … 276 325 277 326 return result; 278 } 279 280 /*! 281 * Converts a float value into a byte-array 282 * @param x: The float which is to convert 283 * @return: A byte-array which accords the given float 284 */ 285 byte* Converter::_floatToByteArray(float x) 286 { 287 byte* p = (byte*)&x; 288 byte* result = new byte[4]; 289 for (int i = 0; i < 4; i++) 290 result[i] = p[i]; 291 return result; 292 } 293 294 295 /*! 296 * Converts a byte-array into a float value 297 * @param a: The byte-array which is to convert 298 * @return: A float value which accords the given byte-array 299 */ 300 float Converter::_byteArrayToFloat(byte* a) 301 { 302 float* p = (float*)a; 303 float result = *p; 304 return result; 327 */ 305 328 } 306 329 … … 310 333 * @return: A byte-array which accords the given float 311 334 */ 312 int Converter:: floatToByteArray(float x, byte* a, int length)335 int Converter::_floatToByteArray(float x, byte* a, int length) 313 336 { 314 337 if (length < FLOATSIZE) … … 319 342 320 343 //handle 0 else function will loop for ever 321 if ( x == 0 )344 /*if ( x == 0 ) 322 345 { 323 346 for ( int i = 0; i<FLOATSIZE; i++) 324 347 a[i] = 0; 325 348 return FLOATSIZE; 326 } 349 }*/ 327 350 328 351 int mantisse = 0; … … 338 361 sgn = 1; 339 362 340 float sub = 1; 341 while (sub < x) 342 { 343 sub *= 2; 363 if (x == 0) 364 { 365 exponent = 255; 366 mantisse = 0; 367 } 368 else 369 { 370 //if (x < getDenormConst()) 371 // printf("Denormalisiert!\n"); 372 //printf("DenormConst = %e", getDenormConst()); 373 374 float sub = 1; 375 while (sub < x) 376 { 377 sub *= 2; 378 exponent++; 379 } 380 381 while (x > 0) 382 { 383 if (x >= sub) 384 { 385 mantisse += 1; 386 x -= sub; 387 } 388 389 mantisse *= 2; 390 exponent--; 391 sub /= 2; 392 } 344 393 exponent++; 345 } 346 347 while (x > 0) 348 { 349 if (x >= sub) 350 { 351 mantisse += 1; 352 x -= sub; 353 } 354 355 mantisse *= 2; 356 exponent--; 357 sub /= 2; 358 } 359 exponent++; 360 mantisse /= 2; 361 while (mantisse < expmult) 362 { 363 mantisse *= 2; 364 exponent--; 365 } 366 367 //printf("mantisse = %i exponent = %i \n", mantisse, exponent); 368 369 mantisse -= expmult; 394 mantisse /= 2; 395 396 397 /// printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 398 399 400 if (mantisse != 0) 401 { 402 while (mantisse < expmult) 403 { 404 mantisse *= 2; 405 exponent--; 406 } 407 408 mantisse -= expmult; 409 } 410 } 411 412 /// printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent); 413 370 414 371 415 int hx = mantisse + expmult * exponent; … … 374 418 a[3] += sgnadd; 375 419 420 421 // int hx = mantisse + expmult * exponent; 422 // byte* result = intToByteArray(hx); 423 // if (sgn == -1) 424 // result[3] += sgnadd; 425 376 426 return result; 377 427 } … … 383 433 * @return: A float value which accords the given byte-array 384 434 */ 385 int Converter:: byteArrayToFloat(const byte* a, float* x)386 { 387 //handle 0388 for (int i = 0; i<FLOATSIZE; i++)435 int Converter::_byteArrayToFloat(const byte* a, float* x) 436 { 437 //handle 0 438 /*for (int i = 0; i<FLOATSIZE; i++) 389 439 { 390 440 if (a[i]!=0) … … 395 445 return FLOATSIZE; 396 446 } 397 } 398 447 }*/ 448 449 int hexp = a[2] + a[3] * 256; 450 int exponent = (hexp / 128) % 256; 399 451 400 452 int hmant = a[0] + a[1] * 256 + a[2] * 65536; 401 453 int mantisse = hmant % expmult; 454 455 //handle 0 456 if (mantisse == 0 && exponent == 255) 457 { 458 *x = 0; 459 return FLOATSIZE; 460 } 461 402 462 mantisse += expmult; 403 404 int hexp = a[2] + a[3] * 256; 405 int exponent = (hexp / 128) % 256 - 128; 463 exponent -= 128; 464 406 465 407 466 int sgn; … … 411 470 sgn = 1; 412 471 413 //printf("mantisse = %i exponent = %i \n", mantisse, exponent);472 /// printf("ReConv: mantisse = %i exponent = %i \n", mantisse, exponent); 414 473 415 474 float emult = 1; … … 421 480 emult /= 2; 422 481 482 /* 483 float result = mantisse * emult; 484 if (sgn == -1) 485 result = -result; 486 487 return result; 488 */ 489 423 490 *x = mantisse * emult; 424 491 if (sgn == -1) … … 426 493 427 494 return FLOATSIZE; 495 } 496 497 /*! 498 * Converts a float value into a byte-array 499 * @param x: The float which is to convert 500 * @return: A byte-array which accords the given float 501 */ 502 int Converter::floatToByteArray(float x, byte* a, int length) 503 { 504 if ( length<4 ) 505 { 506 PRINTF(1)("Byte Array to small\n"); 507 return 0; 508 } 509 byte* p = (byte*)&x; 510 511 for (int i = 0; i < 4; i++) 512 a[i] = p[i]; 513 return 4; 514 } 515 516 517 /*! 518 * Converts a byte-array into a float value 519 * @param a: The byte-array which is to convert 520 * @return: A float value which accords the given byte-array 521 */ 522 int Converter::byteArrayToFloat(const byte* a, float* x) 523 { 524 *x = *((float*)a); 525 526 return 4; 428 527 } 429 528 … … 504 603 } 505 604 605 606 607 608 void Converter::floatTest(float x) 609 { 610 //float x = 8.0f; 611 //float x = numeric_limits<float>::infinity(); 612 613 printf("To Convert: %e\n", x); 614 615 byte* res = floatToByteArray(x); 616 for (int i = 0; i < 4; i++) 617 printf("%i ", res[i]); 618 printf("\n"); 619 620 float y = byteArrayToFloat(res); 621 printf("ReConvert: %e\n", y); 622 623 if (x == y) 624 printf("equal\n"); 625 else 626 printf("different\n"); 627 } 628 629 void Converter::debug() 630 { 631 printf("We rulez\n"); 632 633 //Denormalized? 634 //floatTest(-9.87624e-38f); 635 //floatTest(-9.87624e-37f); 636 //floatTest(-9.87624e-36f); 637 //floatTest(-9.87624e-35f); 638 639 /* 640 floatTest(14.7f); 641 floatTest(12.07e15f); 642 floatTest(0.0f); 643 floatTest(5.67e-15f); 644 */ 645 646 //floatTest(-18.0098f); 647 //floatTest(-24.07e23f); 648 //floatTest(-0.0f); 649 //floatTest(-5.67e-29f); 650 floatTest(-45.7e-32f); 651 floatTest(45.7e-33f); 652 floatTest(-45.7e-34f); 653 floatTest(45.7e-35f); 654 } -
trunk/src/lib/network/converter.h
r6341 r6634 9 9 /* include this file, it contains some default definitions */ 10 10 #include "netdefs.h" 11 11 12 12 13 /* include base_object.h since all classes are derived from this one */ … … 21 22 * a class that can convert int to byte-array and vice versa 22 23 */ 23 class Converter : public BaseObject24 class Converter : public BaseObject 24 25 { 25 26 public: … … 43 44 static float byteArrayToFloat(byte* a); 44 45 45 static byte* _floatToByteArray(float x); 46 static float _byteArrayToFloat(byte* a); 46 static int _floatToByteArray(float x, byte* a, int length); 47 static int _byteArrayToFloat(const byte* a, float* x); 48 49 50 static void debug(); 51 static void floatTest(float x); 52 static float getDenormConst(); 53 54 47 55 private: 48 56 Converter(); … … 50 58 }; 51 59 60 #undef byte 61 52 62 #endif /*_CONVERTER*/ -
trunk/src/lib/network/network_game_manager.cc
r6498 r6634 52 52 this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager"); 53 53 54 allOutBuffer.length = 0;55 56 allOutBuffer.maxLength = 10*1024;57 58 allOutBuffer.buffer = new byte[10*1024];59 60 54 newUniqueID = MAX_CONNECTIONS + 2; 61 55 … … 74 68 } 75 69 76 if ( allOutBuffer.buffer )77 delete allOutBuffer.buffer;78 70 } 79 71 … … 107 99 if ( b == CREATE_ENTITY ) 108 100 { 101 PRINTF(0)("CREATE_ENTITY\n"); 109 102 if ( !handleCreateEntity( i, data, length, sender ) ) 110 103 return i; … … 137 130 } 138 131 132 if ( b == REQUEST_ENTITY_LIST ) 133 { 134 sendEntityList( sender ); 135 continue; 136 } 137 139 138 if ( b == REQUEST_SYNC ) 140 139 { 141 140 if ( !handleRequestSync( i, data, length, sender ) ) 142 141 return i; 143 continue;144 }145 146 if ( b == REQUEST_ENTITY_LIST )147 {148 sendEntityList( sender );149 142 continue; 150 143 } … … 188 181 } 189 182 190 *reciever = 0; 191 int nbytes = allOutBuffer.length; 192 allOutBuffer.length = 0; 193 194 if ( nbytes <=0 ) 195 return 0; 196 197 if ( nbytes > maxLength ) 198 { 199 PRINTF(1)("OutBuffer.length (%d) > (%d) networkStreamBuffer.length\n", nbytes, maxLength); 200 return 0; 201 } 202 203 memcpy( data, allOutBuffer.buffer, nbytes ); 204 return nbytes; 183 return 0; 205 184 } 206 185 … … 221 200 int NetworkGameManager::createEntity( ClassID classID, int owner ) 222 201 { 223 224 202 if ( this->isServer() ) 225 203 { … … 254 232 return NULL; 255 233 } 256 newUniqueID++;257 234 258 235 BaseObject * b = Factory::fabricate( element ); … … 268 245 { 269 246 Synchronizeable * s = dynamic_cast<Synchronizeable*>(b); 270 s->setUniqueID( newUniqueID );247 s->setUniqueID( newUniqueID++ ); 271 248 s->setOwner( 0 ); 272 249 this->networkStream->connectSynchronizeable( *s ); … … 313 290 void NetworkGameManager::requestCreateEntity(ClassID classID) 314 291 { 315 if ( !writeToClientBuffer( allOutBuffer, (byte)REQUEST_CREATE ) ) 316 return; 317 if ( !writeToClientBuffer( allOutBuffer, (int)classID ) ) 318 return; 292 for ( int i = 0; i<outBuffer.size(); i++) 293 { 294 if ( !this->networkStream->isUserIdActive( i ) ) 295 continue; 296 297 if ( !writeToClientBuffer( outBuffer[i], (byte)REQUEST_CREATE ) ) 298 return; 299 if ( !writeToClientBuffer( outBuffer[i], (int)classID ) ) 300 return; 301 } 319 302 } 320 303 … … 325 308 void NetworkGameManager::requestRemoveEntity(int uniqueID) 326 309 { 327 if ( !writeToClientBuffer( allOutBuffer, (byte)REQUEST_REMOVE ) ) 328 return; 329 if ( !writeToClientBuffer( allOutBuffer, uniqueID ) ) 330 return; 310 for ( int i = 0; i<outBuffer.size(); i++) 311 { 312 if ( !this->networkStream->isUserIdActive( i ) ) 313 continue; 314 315 if ( !writeToClientBuffer( outBuffer[i], (byte)REQUEST_REMOVE ) ) 316 return; 317 if ( !writeToClientBuffer( outBuffer[i], uniqueID ) ) 318 return; 319 } 331 320 } 332 321 … … 338 327 int NetworkGameManager::executeCreateEntity(ClassID classID, int uniqueID, int owner) 339 328 { 340 if ( !writeToClientBuffer( allOutBuffer, (byte)CREATE_ENTITY ) ) 341 return -1; 342 if ( !writeToClientBuffer( allOutBuffer, (int)classID ) ) 343 return -1; 344 if ( !writeToClientBuffer( allOutBuffer, uniqueID ) ) 345 return -1; 346 if ( !writeToClientBuffer( allOutBuffer, owner ) ) 347 return -1; 329 for ( int i = 0; i<outBuffer.size(); i++) 330 { 331 if ( !this->networkStream->isUserIdActive( i ) ) 332 continue; 333 334 if ( !writeToClientBuffer( outBuffer[i], (byte)CREATE_ENTITY ) ) 335 return -1; 336 if ( !writeToClientBuffer( outBuffer[i], (int)classID ) ) 337 return -1; 338 if ( !writeToClientBuffer( outBuffer[i], uniqueID ) ) 339 return -1; 340 if ( !writeToClientBuffer( outBuffer[i], owner ) ) 341 return -1; 342 } 348 343 349 344 doCreateEntity( classID, uniqueID, owner ); … … 359 354 void NetworkGameManager::executeRemoveEntity(int uniqueID) 360 355 { 361 if ( !writeToClientBuffer( allOutBuffer, (byte)REMOVE_ENTITY ) ) 362 return; 363 if ( !writeToClientBuffer( allOutBuffer, uniqueID ) ) 364 return; 356 for ( int i = 0; i<outBuffer.size(); i++) 357 { 358 if ( !this->networkStream->isUserIdActive( i ) ) 359 continue; 360 361 if ( !writeToClientBuffer( outBuffer[i], (byte)REMOVE_ENTITY ) ) 362 return; 363 if ( !writeToClientBuffer( outBuffer[i], uniqueID ) ) 364 return; 365 } 365 366 366 367 doRemoveEntity(uniqueID); … … 406 407 while ( it != e ) 407 408 { 408 409 PRINTF(5)("SENDING ENTITY %s id %d\n", (*it)->getClassName(), (*it)->getUniqueID() ); 409 410 if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getLeafClassID()) ) ) 410 411 return; … … 426 427 bool NetworkGameManager::signalNewPlayer(int userId) 427 428 { 429 if ( userId >= outBuffer.size() ) 430 resizeBufferVector( userId ); 428 431 429 432 /* create new playable for Player*/ … … 483 486 484 487 //HACK: hack to prevent collision 485 if ( b->isA(CL_WORLD_ENTITY) )488 if ( b->isA(CL_WORLD_ENTITY) && !b->isA(CL_PLAYABLE) ) 486 489 { 487 490 if ( NetworkManager::getInstance()->getHostID()!=0 ) … … 489 492 static Vector pos = Vector(1000.0, 1000.0, 1000.0); 490 493 PNode *p = dynamic_cast<PNode*>(b); 491 p->set RelCoor(pos);492 p->updateNode(0);494 p->setAbsCoor(pos); 495 //p->updateNode(0); 493 496 pos += Vector(1000.0, 1000.0, 1000.0); 494 497 } … … 596 599 597 600 Playable *p = NULL; 601 Synchronizeable *s = NULL; 598 602 599 603 for ( ; it !=networkStream->getSyncEnd(); it++ ) … … 601 605 if ( (*it)->getUniqueID()==uniqueID ) 602 606 { 607 if ( (*it)->isA( CL_SYNCHRONIZEABLE ) ) 608 { 609 s = dynamic_cast<Synchronizeable*>(*it); 610 } 603 611 if ( (*it)->isA( CL_PLAYABLE ) ) 604 612 { … … 614 622 Player* player = State::getPlayer(); 615 623 assert(p != NULL); 624 assert(s != NULL); 616 625 assert(player != NULL); 626 627 s->setIsOutOfSync( true ); 628 629 PRINTF(0)("uniqueID = %d\n", s->getUniqueID()); 617 630 618 631 player->setControllable(p); … … 871 884 void NetworkGameManager::sync( int uniqueID, int owner ) 872 885 { 873 if ( owner==this->getHostID() )874 return;886 /*if ( owner==this->getHostID() ) 887 return;*/ 875 888 876 889 if ( !isServer() ) -
trunk/src/lib/network/network_game_manager.h
r6498 r6634 122 122 private: 123 123 std::vector<clientBuffer> outBuffer; 124 clientBuffer allOutBuffer;124 //clientBuffer allOutBuffer; 125 125 static NetworkGameManager* singletonRef; 126 126 -
trunk/src/lib/network/network_socket.cc
r6341 r6634 398 398 bool NetworkSocket::writePacket( byte * data, int length ) 399 399 { 400 PRINTF(5)("NetworkSocket::writePacket()\n"); 400 PRINTF(5)("NetworkSocket::writePacket() size=%d\n", length); 401 402 if ( length > 1024 ) 403 PRINTF(2)("WARNING SENDING BIG PACKET SIZE = %d\n", length); 401 404 402 405 byte blen[INTSIZE]; -
trunk/src/lib/network/network_stream.cc
r6498 r6634 78 78 this->connectionMonitor = new ConnectionMonitor(); 79 79 this->networkSockets.push_back( NULL ); 80 this->networkSockets[0] = NULL; //TODO: remove this 80 81 this->handshakes.push_back( NULL ); 81 82 this->bActive = true; … … 266 267 if ( networkSockets[i] != NULL ) 267 268 { 268 PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);269 PRINTF(5)("write %d bytes to socket %d\n", dataLength, i); 269 270 networkSockets[i]->writePacket(downBuffer, dataLength); 270 271 } … … 310 311 if ( (*it)->writeBytes(upBuffer+sizeof(header), dataLength, i) != header.length ) 311 312 { 312 PRINTF(1)("%s did not read all the data !\n", (*it)->getClassName());313 PRINTF(1)("%s did not read all the data id = %d!\n", (*it)->getClassName(), (*it)->getUniqueID()); 313 314 break; 314 315 } -
trunk/src/lib/network/network_stream.h
r6341 r6634 55 55 inline int getSyncCount(){ return synchronizeables.size(); } 56 56 57 inline bool isUserIdActive( int userID ) { if (userID>=networkSockets.size()) return false; else return networkSockets[userID]!=NULL; } 58 57 59 private: 58 60 NetworkProtocol* networkProtocol; -
trunk/src/lib/sound/sound_source.h
r5930 r6634 44 44 ALuint sourceID; //!< The ID of the Source 45 45 const SoundBuffer* buffer; //!< The buffer to play in this source. 46 const PNode* sourceNode; //!< The SourceNode represent ethe position/velocity... of this source.46 const PNode* sourceNode; //!< The SourceNode representing the position/velocity... of this source. 47 47 }; 48 48 #endif /* _SOUND_SOURCE_H */ -
trunk/src/story_entities/Makefile.am
r6600 r6634 12 12 story_entities/multi_player_world.cc \ 13 13 story_entities/multi_player_world_data.cc \ 14 story_entities/movie_loader.cc 14 story_entities/movie_loader.cc \ 15 story_entities/simple_game_menu.cc 15 16 16 17 StoryEntities_HEADERS_ = \ … … 25 26 story_entities/multi_player_world.h \ 26 27 story_entities/multi_player_world_data.h \ 27 story_entities/movie_loader.h 28 story_entities/movie_loader.h \ 29 story_entities/simple_game_menu.h -
trunk/src/story_entities/campaign_data.cc
r6424 r6634 76 76 LOAD_PARAM_START_CYCLE(root, element); 77 77 { 78 StoryEntity* created = (StoryEntity*) Factory::fabricate(element);78 StoryEntity* created = dynamic_cast<StoryEntity*>(Factory::fabricate(element)); 79 79 if( created != NULL) 80 80 this->addStoryEntity(created); -
trunk/src/story_entities/game_world.cc
r6619 r6634 114 114 .describe("The Filename of this GameWorld (relative from the data-dir)"); 115 115 116 // LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack); 117 116 118 PRINTF(4)("Loaded GameWorld specific stuff\n"); 117 119 } … … 150 152 if( getPath() == NULL) 151 153 { 152 PRINTF(1)("GameWorld has no path specified for loading ");154 PRINTF(1)("GameWorld has no path specified for loading\n"); 153 155 return (ErrorMessage){213,"Path not specified","GameWorld::load()"}; 154 156 } … … 241 243 void GameWorld::run() 242 244 { 245 /* start the music */ 246 if(this->dataTank->music != NULL) 247 this->dataTank->music->playback(); 248 243 249 this->lastFrame = SDL_GetTicks (); 244 250 PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n"); -
trunk/src/story_entities/game_world_data.cc
r6626 r6634 72 72 this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData"); 73 73 74 this->localPlayer = NULL;75 this->localCamera = NULL;76 77 74 this->glmis = NULL; 78 75 … … 283 280 if( this->sky != NULL) 284 281 this->localCamera->addChild(this->sky); 285 286 /* sound loading */287 this->music = NULL;288 //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);289 //music->playback();290 282 SoundEngine::getInstance()->setListener(this->localCamera); 291 283 } … … 310 302 } 311 303 304 305 void GameWorldData::setSoundTrack(const char* name) 306 { 307 PRINTF(3)("Setting Sound Track to %s\n", name); 308 this->music = (OggPlayer*)ResourceManager::getInstance()->load(name, OGG, RP_LEVEL); 309 } 310 311 -
trunk/src/story_entities/game_world_data.h
r6424 r6634 40 40 virtual ErrorMessage unloadData(); 41 41 42 /* interface functions */ 43 void setSoundTrack(const char* name); 42 44 43 45 protected: -
trunk/src/story_entities/multi_player_world_data.cc
r6498 r6634 263 263 264 264 265 Playable* pl = this->localPlayer->getControllable(); 266 PRINTF(0)("The current regisered playable is hid: %i\n", pl->getUniqueID()); 267 265 268 266 269 PNode* cam = State::getCameraTarget(); -
trunk/src/story_entities/story_entity.h
r6512 r6634 24 24 25 25 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... 26 class StoryEntity : public BaseObject {26 class StoryEntity : virtual public BaseObject { 27 27 28 28 public: -
trunk/src/subprojects/network/Makefile.am
r6341 r6634 27 27 $(MAINSRCDIR)/lib/util/helper_functions.cc \ 28 28 $(MAINSRCDIR)/lib/util/executor/executor.cc \ 29 $(MAINSRCDIR)/lib/util/multi_type.cc 29 $(MAINSRCDIR)/lib/util/multi_type.cc \ 30 \ 31 \ 32 $(MAINSRCDIR)/lib/coord/p_node.cc \ 33 $(MAINSRCDIR)/world_entities/world_entity.cc 34 30 35 31 36 -
trunk/src/subprojects/network/read_sync.cc
r6341 r6634 29 29 */ 30 30 ReadSync::ReadSync(const char* name) 31 : Synchronizeable( name)31 : Synchronizeable() 32 32 { 33 33 /* define the local buffer size */ -
trunk/src/subprojects/network/simple_sync.cc
r6341 r6634 29 29 */ 30 30 SimpleSync::SimpleSync(const char* name) 31 : Synchronizeable( name)31 : Synchronizeable() 32 32 { 33 33 /* define the local buffer size */ -
trunk/src/subprojects/network/write_sync.cc
r6341 r6634 29 29 */ 30 30 WriteSync::WriteSync(const char* name) 31 : Synchronizeable( name)31 : Synchronizeable() 32 32 { 33 33 /* define the local buffer size */ -
trunk/src/world_entities/Makefile.am
r6532 r6634 23 23 world_entities/character_attributes.cc \ 24 24 world_entities/test_entity.cc \ 25 world_entities/image_entity.cc \ 26 world_entities/planet.cc \ 25 27 \ 26 28 world_entities/weapons/weapon_manager.cc \ … … 72 74 world_entities/character_attributes.h \ 73 75 world_entities/test_entity.h \ 76 world_entities/image_entity.h \ 77 world_entities/planet.h \ 74 78 \ 75 79 world_entities/weapons/weapon_manager.h \ -
trunk/src/world_entities/skybox.cc
r6523 r6634 71 71 this->setClassID(CL_SKYBOX, "SkyBox"); 72 72 this->toList(OM_ENVIRON_NOTICK); 73 this->size = 100.0; 73 //this->size = 100.0; 74 this->textureSize = 1024.0f; 74 75 75 76 for (int i = 0; i < 6; i++) … … 215 216 } 216 217 218 219 220 void SkyBox::draw() 221 { 222 glPushAttrib(GL_ENABLE_BIT); 223 // glPushAttrib(GL_LIGHTING_BIT); 224 glDisable(GL_LIGHTING); 225 226 WorldEntity::draw(); 227 228 glPopAttrib(); 229 230 } 231 232 217 233 /** 218 234 * rebuilds the SkyBox … … 233 249 model->addVertex (0.5*size, -0.5*size, -0.5*size); 234 250 235 model->addVertexTexture (0.0, 1.0); 236 model->addVertexTexture (1.0, 1.0); 237 model->addVertexTexture (1.0, 0.0); 238 model->addVertexTexture (0.0, 0.0); 251 // model->addVertexTexture (0.0, 1.0); 252 // model->addVertexTexture (1.0, 1.0); 253 // model->addVertexTexture (1.0, 0.0); 254 // model->addVertexTexture (0.0, 0.0); 255 256 model->addVertexTexture (1.0/this->textureSize, (this->textureSize - 1.0)/this->textureSize); 257 model->addVertexTexture ((this->textureSize - 1.0)/this->textureSize, (this->textureSize - 1.0)/this->textureSize); 258 model->addVertexTexture ((this->textureSize - 1.0)/this->textureSize, 1.0/this->textureSize); 259 model->addVertexTexture (1.0/this->textureSize, 1.0/this->textureSize); 260 239 261 240 262 model->addVertexNormal (0.0, 0.0, 1.0); -
trunk/src/world_entities/skybox.h
r6519 r6634 33 33 void postInit(); 34 34 35 virtual void draw(); 35 36 36 37 void setSize(float size); … … 60 61 61 62 float size; //!< Size of the SkyBox. This should match the frustum maximum range. 63 float textureSize; //!< this is the length of a texture (assumes a square texture) 62 64 char* textureName; //!< Name of the Texture 63 65 -
trunk/src/world_entities/space_ships/space_ship.cc
r6617 r6634 40 40 41 41 #include "plane.h" 42 43 #include "state.h" 44 #include "player.h" 42 45 43 46 … … 272 275 void SpaceShip::tick (float time) 273 276 { 277 this->getWeaponManager()->tick(time); 278 // weapon system manipulation 279 this->weaponAction(); 280 281 // if( this != State::getPlayer()->getControllable()) 282 // return; 274 283 275 284 // spaceship controlled movement … … 293 302 294 303 //hoover effect 295 cycle += time;296 this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);304 //cycle += time; 305 //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02); 297 306 298 307 //readjust … … 311 320 this->shiftCoor (move); 312 321 313 this->getWeaponManager()->tick(time); 314 // weapon system manipulation 315 this->weaponAction(); 322 316 323 } 317 324 … … 508 515 SYNCHELP_READ_BYTE( b ); 509 516 510 if ( b == DATA_state && this->getHostID()!=this->getOwner() ) 511 { 517 if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ ) 518 { 519 PRINTF(0)("GOT STATE %d\n", this->getUniqueID()); 512 520 setRequestedSync( false ); 513 521 setIsOutOfSync( false ); 514 522 SYNCHELP_READ_FKT( WorldEntity::writeState ); 515 SYNCHELP_READ_FLOAT( cycle ); 516 } 517 518 if ( b == DATA_flags && this->getHostID()!=this->getOwner() ) 519 { 520 int flags; 523 //SYNCHELP_READ_FLOAT( cycle ); 524 525 return SYNCHELP_READ_N; 526 } 527 528 529 if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ ) 530 { 531 int flags = 0; 521 532 SYNCHELP_READ_INT( flags ); 522 533 523 bUp = flags & MASK_bUp != 0; 524 bDown = flags & MASK_bDown != 0; 525 bLeft = flags & MASK_bLeft != 0; 526 bRight = flags & MASK_bRight != 0; 527 bAscend = flags & MASK_bAscend != 0; 528 bDescend = flags & MASK_bDescend != 0; 529 bFire = flags & MASK_bFire != 0; 530 bRollL = flags & MASK_bRollL != 0; 531 bRollR = flags & MASK_bRollR != 0; 532 } 533 534 if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) 534 bUp = (flags & MASK_bUp) != 0; 535 bDown = (flags & MASK_bDown) != 0; 536 bLeft = (flags & MASK_bLeft) != 0; 537 bRight = (flags & MASK_bRight) != 0; 538 bAscend = (flags & MASK_bAscend) != 0; 539 bDescend = (flags & MASK_bDescend) != 0; 540 bFire = (flags & MASK_bFire) != 0; 541 bRollL = (flags & MASK_bRollL) != 0; 542 bRollR = (flags & MASK_bRollR) != 0; 543 544 } 545 546 /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) 535 547 { 536 548 SYNCHELP_READ_FLOAT( xMouse ); … … 538 550 SYNCHELP_READ_FLOAT( mouseSensitivity ); 539 551 SYNCHELP_READ_FLOAT( cycle ); 540 } 552 }*/ 553 554 if ( this->getOwner() != this->getHostID() ) 555 SYNCHELP_READ_FKT( PNode::writeSync ); 541 556 542 557 return SYNCHELP_READ_N; … … 549 564 SYNCHELP_WRITE_BEGIN(); 550 565 551 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner())566 if ( isOutOfSync() && !requestedSync() /*&& this->getHostID()!=this->getOwner()*/ ) 552 567 { 553 568 (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() ); 554 569 setRequestedSync( true ); 570 PRINTF(0)("REQUESTED STATE %d\n", this->getUniqueID()); 555 571 } 556 572 … … 560 576 *reciever = rec; 561 577 578 PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec); 579 562 580 SYNCHELP_WRITE_BYTE( (byte)DATA_state ); 563 581 564 582 SYNCHELP_WRITE_FKT( WorldEntity::readState ); 565 SYNCHELP_WRITE_FLOAT( cycle );583 //SYNCHELP_WRITE_FLOAT( cycle ); 566 584 567 585 return SYNCHELP_WRITE_N; 568 586 } 569 570 587 571 588 *reciever = 0; … … 592 609 mask |= MASK_bRollR; 593 610 594 static int oldMask = mask+1; //so it is different the first time! 595 static float oldxMouse = xMouse + 1.0;596 static float oldyMouse = yMouse + 1.0;611 612 //static float oldxMouse = xMouse + 1.0; 613 //static float oldyMouse = yMouse + 1.0; 597 614 598 615 if ( mask != oldMask ) … … 602 619 SYNCHELP_WRITE_INT( mask ); 603 620 } 604 605 if ( oldxMouse != xMouse || oldyMouse != yMouse ) 621 else 622 { 623 SYNCHELP_WRITE_BYTE( 0 ); 624 } 625 626 /*if ( oldxMouse != xMouse || oldyMouse != yMouse ) 606 627 { 607 628 oldxMouse = xMouse; … … 612 633 SYNCHELP_WRITE_FLOAT( mouseSensitivity ); 613 634 SYNCHELP_WRITE_FLOAT( cycle ); 614 } 615 } 635 }*/ 636 } 637 else 638 { 639 SYNCHELP_WRITE_BYTE( 0 ); 640 } 641 642 if ( this->getOwner() == this->getHostID() ) 643 SYNCHELP_WRITE_FKT( PNode::readSync ); 616 644 617 645 return SYNCHELP_WRITE_N; -
trunk/src/world_entities/space_ships/space_ship.h
r6547 r6634 75 75 float airViscosity; 76 76 77 int oldMask; 78 77 79 }; 78 80 -
trunk/src/world_entities/world_entity.cc
r6512 r6634 517 517 if ( strcmp(modelFileName, "") ) 518 518 { 519 520 if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) ) 521 { 522 loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling ); 523 } 524 else 525 { 526 loadModel( modelFileName, scaling ); 527 } 519 loadModel( modelFileName, scaling ); 528 520 } 529 521 delete[] modelFileName; 530 522 531 SYNCHELP_READ_STRINGM( modelFileName );523 /*SYNCHELP_READ_STRINGM( modelFileName ); 532 524 533 525 if ( strcmp(modelFileName, "") ) … … 541 533 this->md2TextureFileName = modelFileName; 542 534 } 535 */ 543 536 544 537 return SYNCHELP_READ_N; … … 558 551 SYNCHELP_WRITE_FKT( PNode::readState ); 559 552 560 SYNCHELP_WRITE_STRING( getModel( 0 )->getName() ); 553 if ( getModel(0) && getModel(0)->getName() ) 554 { 555 char* name = (char*)(getModel( 0 )->getName()); 556 557 if ( strstr(name, ResourceManager::getInstance()->getDataDir()) ) 558 { 559 name += strlen(ResourceManager::getInstance()->getDataDir()); 560 } 561 562 SYNCHELP_WRITE_STRING( name ); 563 } 564 else 565 { 566 SYNCHELP_WRITE_STRING(""); 567 } 568 561 569 SYNCHELP_WRITE_FLOAT( scaling ); 562 if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )570 /*if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") ) 563 571 { 564 572 SYNCHELP_WRITE_STRING(this->md2TextureFileName); … … 567 575 { 568 576 SYNCHELP_WRITE_STRING(""); 569 } 577 }*/ 570 578 571 579 return SYNCHELP_WRITE_N;
Note: See TracChangeset
for help on using the changeset viewer.