- Timestamp:
- Jan 11, 2006, 12:20:56 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/coord/p_node.cc
r6424 r6469 1039 1039 SYNCHELP_READ_FKT( BaseObject::writeState ); 1040 1040 1041 PRINTF(0)("name = %s\n", this->getName());1041 //PRINTF(0)("name = %s\n", this->getName()); 1042 1042 1043 1043 char * parentName = NULL; … … 1092 1092 { 1093 1093 SYNCHELP_READ_STRINGM( childName ); 1094 PRINTF(0)("childname = %s\n", childName);1094 //PRINTF(0)("childname = %s\n", childName); 1095 1095 addChild( childName ); 1096 1096 delete childName; … … 1113 1113 SYNCHELP_WRITE_FKT( BaseObject::readState ); 1114 1114 1115 PRINTF(0)("name = %s\n", this->getName());1115 //PRINTF(0)("name = %s\n", this->getName()); 1116 1116 1117 1117 if ( this->parent ) … … 1130 1130 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z ); 1131 1131 1132 PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z);1132 //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z); 1133 1133 1134 1134 SYNCHELP_WRITE_FLOAT( this->absCoordinate.x ); … … 1136 1136 SYNCHELP_WRITE_FLOAT( this->absCoordinate.z ); 1137 1137 1138 PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z);1138 //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z); 1139 1139 1140 1140 SYNCHELP_WRITE_FLOAT( this->relDirection.w ); … … 1153 1153 for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++) 1154 1154 { 1155 PRINTF(0)("childname = %s\n", (*it)->getName() );1156 1155 SYNCHELP_WRITE_STRING( (*it)->getName() ); 1157 1156 } -
branches/network/src/lib/network/network_game_manager.cc
r6463 r6469 28 28 #include "game_world.h" 29 29 #include "world_entity.h" 30 #include "network_manager.h" 30 31 31 32 … … 84 85 { 85 86 b = data[i++]; 86 87 PRINTF(0)("WriteBytes: b = %d\n", b);88 87 89 88 if ( isServer() ) … … 145 144 if ( b == REQUEST_ENTITY_LIST ) 146 145 { 147 PRINTF(0)("sending THE list\n");148 146 sendEntityList( sender ); 149 147 continue; … … 276 274 delete b; 277 275 } 276 278 277 } 279 278 else … … 404 403 if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getLeafClassID()) ) ) 405 404 return; 406 //PRINTF(0)("SendEntityList: ClassID = %x\n", (*it)->getRealClassID());407 405 408 406 if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getUniqueID()) ) ) … … 411 409 if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getOwner()) ) ) 412 410 return; 413 414 415 PRINTF(0)("id = %x %s %s\n", (int)((*it)->getLeafClassID()), (*it)->getClassName(), (*it)->getName());416 417 418 /*if ( (*it)->isA(CL_WORLD_ENTITY) )419 {420 n = dynamic_cast<WorldEntity*>((*it))->readState( outBuffer[userID].buffer, outBuffer[userID].maxLength-outBuffer[userID].length );421 if ( n = 0 )422 {423 PRINTF(2)("n = 0\n");424 }425 outBuffer[userID].length += n;426 }*/427 411 428 412 it++; … … 478 462 PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID()); 479 463 464 //NOTE: hack to prevent collision 465 if ( b->isA(CL_WORLD_ENTITY) ) 466 { 467 if ( NetworkManager::getInstance()->getHostID()!=0 ) 468 { 469 static Vector pos = Vector(1000.0, 1000.0, 1000.0); 470 PNode *p = dynamic_cast<PNode*>(b); 471 p->setRelCoor(pos); 472 p->updateNode(0); 473 pos += Vector(1000.0, 1000.0, 1000.0); 474 } 475 } 476 480 477 return b; 481 478 } … … 720 717 i += Converter::byteArrayToInt( &data[i], &owner ); 721 718 722 PRINTF(0)("before fabricate\n");723 719 if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE ) 724 720 { -
branches/network/src/lib/network/network_stream.cc
r6341 r6469 291 291 dataLength -= sizeof(header); 292 292 293 PRINTF( 0)("read %d bytes from socket uniqueID = %d\n", dataLength, header.synchronizeableID);293 PRINTF(5)("read %d bytes from socket uniqueID = %d\n", dataLength, header.synchronizeableID); 294 294 295 295 if ( dataLength != header.length ) -
branches/network/src/world_entities/power_ups/param_power_up.cc
r6424 r6469 138 138 SYNCHELP_READ_INT( this->min_value ); 139 139 SYNCHELP_READ_INT( this->max_value ); 140 respawn(); 140 141 } 141 142 … … 162 163 SYNCHELP_WRITE_FKT( PowerUp::readState ); 163 164 164 int i = this->type;165 int i = (int)this->type; 165 166 SYNCHELP_WRITE_INT( i ); 166 167 SYNCHELP_WRITE_INT( this->value ); -
branches/network/src/world_entities/skybox.cc
r6341 r6469 230 230 SYNCHELP_READ_STRINGM( textureName ); 231 231 232 PRINT(0)("GOT DATA: size=%f texture='%s'\n", size, textureName);233 234 232 this->setSize( size ); 235 233 this->setTextureAndType( textureName, "jpg" ); -
branches/network/src/world_entities/space_ships/space_ship.cc
r6463 r6469 525 525 } 526 526 527 #define MASK_bUp 1 528 #define MASK_bDown 2 529 #define MASK_bLeft 4 530 #define MASK_bRight 8 531 #define MASK_bAscend 16 532 #define MASK_bDescend 32 533 #define MASK_bFire 64 534 #define MASK_bRollL 128 535 #define MASK_bRollR 256 536 537 #define DATA_state 1 538 #define DATA_flags 2 539 #define DATA_mouse 3 527 540 528 541 int SpaceShip::writeBytes( const byte * data, int length, int sender ) 529 542 { 530 setRequestedSync( false );531 setIsOutOfSync( false );532 533 543 SYNCHELP_READ_BEGIN(); 534 544 535 SYNCHELP_READ_FKT( WorldEntity::writeState ); 545 byte b; 546 SYNCHELP_READ_BYTE( b ); 547 548 if ( b == DATA_state && this->getHostID()!=this->getOwner() ) 549 { 550 setRequestedSync( false ); 551 setIsOutOfSync( false ); 552 SYNCHELP_READ_FKT( WorldEntity::writeState ); 553 SYNCHELP_READ_FLOAT( cycle ); 554 } 555 556 if ( b == DATA_flags && this->getHostID()!=this->getOwner() ) 557 { 558 int flags; 559 SYNCHELP_READ_INT( flags ); 560 561 bUp = flags & MASK_bUp != 0; 562 bDown = flags & MASK_bDown != 0; 563 bLeft = flags & MASK_bLeft != 0; 564 bRight = flags & MASK_bRight != 0; 565 bAscend = flags & MASK_bAscend != 0; 566 bDescend = flags & MASK_bDescend != 0; 567 bFire = flags & MASK_bFire != 0; 568 bRollL = flags & MASK_bRollL != 0; 569 bRollR = flags & MASK_bRollR != 0; 570 } 571 572 if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) 573 { 574 SYNCHELP_READ_FLOAT( xMouse ); 575 SYNCHELP_READ_FLOAT( yMouse ); 576 SYNCHELP_READ_FLOAT( mouseSensitivity ); //TODO: remove this two lines 577 SYNCHELP_READ_FLOAT( cycle ); 578 } 536 579 537 580 return SYNCHELP_READ_N; 538 581 } 539 582 583 584 540 585 int SpaceShip::readBytes( byte * data, int maxLength, int * reciever ) 541 586 { 587 SYNCHELP_WRITE_BEGIN(); 588 542 589 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 543 590 { … … 551 598 *reciever = rec; 552 599 553 SYNCHELP_WRITE_B EGIN();600 SYNCHELP_WRITE_BYTE( (byte)DATA_state ); 554 601 555 602 SYNCHELP_WRITE_FKT( WorldEntity::readState ); 603 SYNCHELP_WRITE_FLOAT( cycle ); 556 604 557 605 return SYNCHELP_WRITE_N; 558 606 } 559 607 608 560 609 *reciever = 0; 561 return 0; 562 } 610 611 if ( this->getHostID()!=this->getOwner() ) 612 { 613 int mask = 0; 614 615 if ( bUp ) 616 mask |= MASK_bUp; 617 if ( bDown ) 618 mask |= MASK_bDown; 619 if ( bLeft ) 620 mask |= MASK_bLeft; 621 if ( bRight ) 622 mask |= MASK_bRight; 623 if ( bAscend ) 624 mask |= MASK_bAscend; 625 if ( bFire ) 626 mask |= MASK_bFire; 627 if ( bRollL ) 628 mask |= MASK_bRollL; 629 if ( bRollR ) 630 mask |= MASK_bRollR; 631 632 static int oldMask = mask+1; //so it it different the first time! 633 static float oldxMouse = xMouse + 1.0; 634 static float oldyMouse = yMouse + 1.0; 635 636 if ( mask != oldMask ) 637 { 638 oldMask = mask; 639 SYNCHELP_WRITE_BYTE( DATA_flags ); 640 SYNCHELP_WRITE_INT( mask ); 641 } 642 643 if ( oldxMouse != xMouse || oldyMouse != yMouse ) 644 { 645 oldxMouse = xMouse; 646 oldyMouse = yMouse; 647 SYNCHELP_WRITE_BYTE( DATA_mouse ); 648 SYNCHELP_WRITE_FLOAT( xMouse ); 649 SYNCHELP_WRITE_FLOAT( yMouse ); 650 SYNCHELP_WRITE_FLOAT( mouseSensitivity ); 651 SYNCHELP_WRITE_FLOAT( cycle ); //TODO: remove this two lines 652 } 653 } 654 655 return SYNCHELP_WRITE_N; 656 } -
branches/network/src/world_entities/world_entity.cc
r6424 r6469 402 402 403 403 SYNCHELP_READ_STRINGM( modelFileName ); 404 404 405 if ( strcmp(modelFileName, "") ) 405 this->md2TextureFileName = modelFileName; 406 if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) ) 407 { 408 this->md2TextureFileName = new char[strlen(modelFileName)-strlen(ResourceManager::getInstance()->getDataDir())+1]; 409 strcpy((char*)this->md2TextureFileName, modelFileName+strlen(ResourceManager::getInstance()->getDataDir())); 410 } 411 else 412 { 413 this->md2TextureFileName = modelFileName; 414 } 406 415 407 416 return SYNCHELP_READ_N;
Note: See TracChangeset
for help on using the changeset viewer.