Changeset 6498 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 11, 2006, 9:58:22 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/power_ups/param_power_up.cc
r6424 r6498 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 ); -
trunk/src/world_entities/power_ups/power_up.cc
r6424 r6498 96 96 } 97 97 98 99 100 /******************************************************************************************** 101 NETWORK STUFF 102 ********************************************************************************************/ 103 104 98 105 /** 99 106 * data copied in data will bee sent to another host … … 108 115 return SYNCHELP_WRITE_N; 109 116 } 117 110 118 111 119 /** -
trunk/src/world_entities/power_ups/turret_power_up.cc
r6424 r6498 119 119 } 120 120 121 122 123 124 /******************************************************************************************** 125 NETWORK STUFF 126 ********************************************************************************************/ 127 128 121 129 int TurretPowerUp::writeBytes( const byte * data, int length, int sender ) 122 130 { … … 130 138 return SYNCHELP_READ_N; 131 139 } 132 133 140 134 141 -
trunk/src/world_entities/skybox.cc
r6470 r6498 270 270 SYNCHELP_READ_STRINGM( textureName ); 271 271 272 PRINT(0)("GOT DATA: size=%f texture='%s'\n", size, textureName);273 274 272 this->setSize( size ); 275 273 this->setTextureAndType( textureName, "jpg" ); … … 292 290 if ( rec > 0 ) 293 291 { 294 PRINT(0)("SEND DATA: size=%f texture='%s'\n", size, textureName);295 292 *reciever = rec; 296 293 -
trunk/src/world_entities/space_ships/space_ship.cc
r6444 r6498 510 510 } 511 511 512 #define MASK_bUp 1 513 #define MASK_bDown 2 514 #define MASK_bLeft 4 515 #define MASK_bRight 8 516 #define MASK_bAscend 16 517 #define MASK_bDescend 32 518 #define MASK_bFire 64 519 #define MASK_bRollL 128 520 #define MASK_bRollR 256 521 522 #define DATA_state 1 523 #define DATA_flags 2 524 #define DATA_mouse 3 512 525 513 526 int SpaceShip::writeBytes( const byte * data, int length, int sender ) 514 527 { 515 setRequestedSync( false );516 setIsOutOfSync( false );517 518 528 SYNCHELP_READ_BEGIN(); 519 529 520 SYNCHELP_READ_FKT( WorldEntity::writeState ); 530 byte b; 531 SYNCHELP_READ_BYTE( b ); 532 533 if ( b == DATA_state && this->getHostID()!=this->getOwner() ) 534 { 535 setRequestedSync( false ); 536 setIsOutOfSync( false ); 537 SYNCHELP_READ_FKT( WorldEntity::writeState ); 538 SYNCHELP_READ_FLOAT( cycle ); 539 } 540 541 if ( b == DATA_flags && this->getHostID()!=this->getOwner() ) 542 { 543 int flags; 544 SYNCHELP_READ_INT( flags ); 545 546 bUp = flags & MASK_bUp != 0; 547 bDown = flags & MASK_bDown != 0; 548 bLeft = flags & MASK_bLeft != 0; 549 bRight = flags & MASK_bRight != 0; 550 bAscend = flags & MASK_bAscend != 0; 551 bDescend = flags & MASK_bDescend != 0; 552 bFire = flags & MASK_bFire != 0; 553 bRollL = flags & MASK_bRollL != 0; 554 bRollR = flags & MASK_bRollR != 0; 555 } 556 557 if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) 558 { 559 SYNCHELP_READ_FLOAT( xMouse ); 560 SYNCHELP_READ_FLOAT( yMouse ); 561 SYNCHELP_READ_FLOAT( mouseSensitivity ); 562 SYNCHELP_READ_FLOAT( cycle ); 563 } 521 564 522 565 return SYNCHELP_READ_N; 523 566 } 524 567 568 569 525 570 int SpaceShip::readBytes( byte * data, int maxLength, int * reciever ) 526 571 { 572 SYNCHELP_WRITE_BEGIN(); 573 527 574 if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() ) 528 575 { … … 536 583 *reciever = rec; 537 584 538 SYNCHELP_WRITE_B EGIN();585 SYNCHELP_WRITE_BYTE( (byte)DATA_state ); 539 586 540 587 SYNCHELP_WRITE_FKT( WorldEntity::readState ); 588 SYNCHELP_WRITE_FLOAT( cycle ); 541 589 542 590 return SYNCHELP_WRITE_N; 543 591 } 544 592 593 545 594 *reciever = 0; 546 return 0; 547 } 595 596 if ( this->getHostID()==this->getOwner() ) 597 { 598 int mask = 0; 599 600 if ( bUp ) 601 mask |= MASK_bUp; 602 if ( bDown ) 603 mask |= MASK_bDown; 604 if ( bLeft ) 605 mask |= MASK_bLeft; 606 if ( bRight ) 607 mask |= MASK_bRight; 608 if ( bAscend ) 609 mask |= MASK_bAscend; 610 if ( bFire ) 611 mask |= MASK_bFire; 612 if ( bRollL ) 613 mask |= MASK_bRollL; 614 if ( bRollR ) 615 mask |= MASK_bRollR; 616 617 static int oldMask = mask+1; //so it is different the first time! 618 static float oldxMouse = xMouse + 1.0; 619 static float oldyMouse = yMouse + 1.0; 620 621 if ( mask != oldMask ) 622 { 623 oldMask = mask; 624 SYNCHELP_WRITE_BYTE( DATA_flags ); 625 SYNCHELP_WRITE_INT( mask ); 626 } 627 628 if ( oldxMouse != xMouse || oldyMouse != yMouse ) 629 { 630 oldxMouse = xMouse; 631 oldyMouse = yMouse; 632 SYNCHELP_WRITE_BYTE( DATA_mouse ); 633 SYNCHELP_WRITE_FLOAT( xMouse ); 634 SYNCHELP_WRITE_FLOAT( yMouse ); 635 SYNCHELP_WRITE_FLOAT( mouseSensitivity ); 636 SYNCHELP_WRITE_FLOAT( cycle ); 637 } 638 } 639 640 return SYNCHELP_WRITE_N; 641 } -
trunk/src/world_entities/world_entity.cc
r6440 r6498 491 491 492 492 493 494 495 /******************************************************************************************** 496 NETWORK STUFF 497 ********************************************************************************************/ 498 499 493 500 /** 494 501 * Writes data from network containing information about the state … … 523 530 524 531 SYNCHELP_READ_STRINGM( modelFileName ); 532 525 533 if ( strcmp(modelFileName, "") ) 526 this->md2TextureFileName = modelFileName; 534 if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) ) 535 { 536 this->md2TextureFileName = new char[strlen(modelFileName)-strlen(ResourceManager::getInstance()->getDataDir())+1]; 537 strcpy((char*)this->md2TextureFileName, modelFileName+strlen(ResourceManager::getInstance()->getDataDir())); 538 } 539 else 540 { 541 this->md2TextureFileName = modelFileName; 542 } 527 543 528 544 return SYNCHELP_READ_N; 529 545 } 546 530 547 531 548 /** -
trunk/src/world_entities/world_entity.h
r6440 r6498 28 28 29 29 //! Basis-class all interactive stuff in the world is derived from 30 class WorldEntity : public PNode , public Synchronizeable30 class WorldEntity : public PNode 31 31 { 32 32 public:
Note: See TracChangeset
for help on using the changeset viewer.