Changeset 6784 in orxonox.OLD for branches/network/src/world_entities
- Timestamp:
- Jan 26, 2006, 8:03:40 PM (19 years ago)
- Location:
- branches/network/src/world_entities
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
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.