Changeset 6815 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 28, 2006, 5:11:51 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environments/water.cc
r6803 r6815 302 302 SYNCHELP_READ_BEGIN(); 303 303 304 SYNCHELP_READ_FKT( Water::writeState );304 SYNCHELP_READ_FKT( Water::writeState, NWT_WAT_STATE ); 305 305 306 306 return SYNCHELP_READ_N; … … 328 328 { 329 329 *reciever = rec; 330 SYNCHELP_WRITE_FKT( Water::readState );330 SYNCHELP_WRITE_FKT( Water::readState, NWT_WAT_STATE ); 331 331 } 332 332 … … 347 347 SYNCHELP_WRITE_BEGIN(); 348 348 349 SYNCHELP_WRITE_FKT( WorldEntity::readState );349 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_WAT_WE_STATE ); 350 350 351 351 // 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 ); 354 354 355 355 //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 ); 358 358 359 359 //sync the height 360 SYNCHELP_WRITE_FLOAT( this->height );360 SYNCHELP_WRITE_FLOAT( this->height, NWT_WAT_HEIGHT ); 361 361 362 362 return SYNCHELP_WRITE_N; … … 374 374 SYNCHELP_READ_BEGIN(); 375 375 376 SYNCHELP_READ_FKT( WorldEntity::writeState );376 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_WAT_WE_STATE ); 377 377 378 378 float f1, f2; … … 380 380 381 381 //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 ); 384 384 this->sizeX = f1; 385 385 this->sizeY = f2; … … 387 387 388 388 //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 ); 391 391 this->resX = i1; 392 392 this->resY = i2; … … 394 394 395 395 //read the height 396 SYNCHELP_READ_FLOAT( f1 );396 SYNCHELP_READ_FLOAT( f1, NWT_WAT_HEIGHT ); 397 397 this->height = f1; 398 398 -
trunk/src/world_entities/image_entity.cc
r6696 r6815 49 49 { 50 50 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; 57 52 } 58 53 … … 90 85 .describe("the Speed with which the ImageEntity should rotate"); 91 86 92 LoadParam(root, "billboarding", this, ImageEntity, toggleBillboard )93 .describe("sets the ImageEntityto 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"); 94 89 } 95 90 … … 119 114 * This means that the image will always look in the direction of the Player 120 115 */ 121 void ImageEntity::toggleBillboard ()116 void ImageEntity::toggleBillboarding() 122 117 { 123 118 this->bBillboarding = !this->bBillboarding; -
trunk/src/world_entities/image_entity.h
r6634 r6815 1 1 /*! 2 * @file crosshair.h 3 * Definition of ... 4 5 */ 2 * @file image_entity.h 3 * Definition of an ImageEntity 4 */ 6 5 7 6 #ifndef _IMAGE_ENTITY_H … … 34 33 /** @param rotationSpeed the speed at what the crosshair should rotate */ 35 34 void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; }; 36 void toggleBillboard ();35 void toggleBillboarding(); 37 36 38 37 virtual void tick(float dt); -
trunk/src/world_entities/npcs/ground_turret.cc
r6736 r6815 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 } -
trunk/src/world_entities/power_ups/laser_power_up.cc
r6780 r6815 127 127 SYNCHELP_READ_BEGIN(); 128 128 129 SYNCHELP_READ_FKT( PowerUp::writeState );129 SYNCHELP_READ_FKT( PowerUp::writeState, NWT_LPU_WE_STATE ); 130 130 131 131 return SYNCHELP_READ_N; … … 149 149 SYNCHELP_WRITE_BEGIN(); 150 150 151 SYNCHELP_WRITE_FKT( PowerUp::readState );151 SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_LPU_WE_STATE ); 152 152 153 153 return SYNCHELP_WRITE_N; -
trunk/src/world_entities/power_ups/param_power_up.cc
r6695 r6815 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 -
trunk/src/world_entities/power_ups/power_up.cc
r6710 r6815 20 20 #include "extendable.h" 21 21 #include "primitive_model.h" 22 23 #include "assert.h" 22 24 23 25 using namespace std; … … 124 126 { 125 127 SYNCHELP_WRITE_BEGIN(); 126 SYNCHELP_WRITE_FKT( WorldEntity::readState );128 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_PU_WE_STATE ); 127 129 return SYNCHELP_WRITE_N; 128 130 } … … 138 140 { 139 141 SYNCHELP_READ_BEGIN(); 140 SYNCHELP_READ_FKT( WorldEntity::writeState );142 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_PU_WE_STATE ); 141 143 return SYNCHELP_READ_N; 142 144 } -
trunk/src/world_entities/power_ups/turret_power_up.cc
r6780 r6815 136 136 SYNCHELP_READ_BEGIN(); 137 137 138 SYNCHELP_READ_FKT( PowerUp::writeState );138 SYNCHELP_READ_FKT( PowerUp::writeState, NWT_TPU_WE_STATE ); 139 139 140 140 return SYNCHELP_READ_N; … … 157 157 SYNCHELP_WRITE_BEGIN(); 158 158 159 SYNCHELP_WRITE_FKT( PowerUp::readState );159 SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_TPU_WE_STATE ); 160 160 161 161 return SYNCHELP_WRITE_N; -
trunk/src/world_entities/power_ups/weapon_power_up.cc
r6710 r6815 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 ) -
trunk/src/world_entities/skybox.cc
r6772 r6815 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; -
trunk/src/world_entities/space_ships/space_ship.cc
r6807 r6815 523 523 #define DATA_flags 2 524 524 #define DATA_mouse 3 525 #define DATA_sync 4 526 #define DATA_velocity 5 525 527 526 528 int SpaceShip::writeBytes( const byte * data, int length, int sender ) … … 529 531 530 532 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 ) 550 548 { 551 549 int flags = 0; 552 SYNCHELP_READ_INT( flags );550 SYNCHELP_READ_INT( flags, NWT_SS_FLAGS ); 553 551 554 552 bUp = (flags & MASK_bUp) != 0; … … 561 559 bRollL = (flags & MASK_bRollL) != 0; 562 560 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 587 591 return SYNCHELP_READ_N; 588 592 } … … 608 612 PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec); 609 613 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 ); 613 617 //SYNCHELP_WRITE_FLOAT( cycle ); 614 618 … … 617 621 618 622 *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 } 619 629 620 630 if ( this->getHostID()==this->getOwner() ) … … 646 656 { 647 657 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 ) 656 667 { 657 668 oldMouseDir = mouseDir; 658 669 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 } 673 691 674 692 return SYNCHELP_WRITE_N; 675 693 } 694 695 -
trunk/src/world_entities/space_ships/space_ship.h
r6807 r6815 42 42 virtual int readBytes(byte* data, int maxLength, int * reciever); 43 43 44 45 44 private: 46 45 void init(); … … 70 69 71 70 Vector velocity; //!< the velocity of the player. 71 Vector oldVelocity; //!< the velocity the player had last synced 72 72 Quaternion mouseDir; //!< the direction where the player wants to fly 73 73 Quaternion oldMouseDir; //!< the direction where the player wanted to fly -
trunk/src/world_entities/terrain.cc
r6780 r6815 325 325 326 326 SYNCHELP_READ_BEGIN(); 327 SYNCHELP_READ_FKT( WorldEntity::writeState );327 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_TER_WE_STATE ); 328 328 329 329 return SYNCHELP_READ_N; … … 343 343 *reciever = rec; 344 344 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; 346 348 347 349 } -
trunk/src/world_entities/world_entity.cc
r6720 r6815 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.