Changeset 6937 in orxonox.OLD for branches/network
- Timestamp:
- Feb 1, 2006, 2:32:16 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_game_manager.cc
r6917 r6937 576 576 { 577 577 assert((*it)->isA(CL_WORLD_ENTITY)); 578 dynamic_cast<WorldEntity*>(*it)->leaveWorld(); 578 579 dynamic_cast<WorldEntity*>(*it)->toList(OM_DEAD); 579 580 break; -
branches/network/src/lib/network/synchronizeable.h
r6868 r6937 34 34 NWT_SS_VELZ, 35 35 NWT_SS_PL_SYNC, 36 36 NWT_SS_CO_N, 37 NWT_SS_CO_CLID, 38 37 39 NWT_HS_HOST_ID, 38 40 NWT_HS_NGM_ID, 39 41 40 42 NWT_PL_FLAGS, 41 43 42 44 NWT_PN_BO_WRITESTATE, 43 45 NWT_PN_PARENTMODE, … … 49 51 NWT_PN_ROTZ, 50 52 NWT_PN_ROTV, 51 53 52 54 NWT_PN_FLAGS, 53 55 NWT_PN_SCOORX, … … 58 60 NWT_PN_SROTZ, 59 61 NWT_PN_SROTV, 60 62 61 63 NWT_BO_NAME, 62 64 63 65 NWT_WE_PN_WRITESTATE, 64 66 NWT_WE_PN_MODELFILENAME, 65 67 NWT_WE_PN_SCALING, 66 68 67 69 NWT_GT_WE_STATE, 68 70 69 71 NWT_SB_WE_STATE, 70 72 NWT_SB_SIZE, 71 73 NWT_SB_TEXTURENAME, 72 74 73 75 NWT_TER_WE_STATE, 74 76 75 77 NWT_PU_WE_STATE, 76 78 77 79 NWT_TPU_WE_STATE, 78 80 79 81 NWT_LPU_WE_STATE, 80 82 81 83 NWT_WPU_WE_STATE, 82 84 83 85 NWT_PPU_WE_STATE, 84 86 NWT_PPU_TYPE, … … 133 135 * delete[] textureName; 134 136 * textureName = NULL; 135 * SYNCHELP_READ_STRINGM( texturename ); //this will call new char[strlen()+1] 137 * SYNCHELP_READ_STRINGM( texturename ); //this will call new char[strlen()+1] 136 138 * 137 139 * Example 2: … … 142 144 * 143 145 */ 144 146 145 147 #define SYNCHELP_WRITE_DEBUG(n) {\ 146 148 __synchelp_write_n = Converter::intToByteArray( n, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \ -
branches/network/src/world_entities/playable.cc
r6868 r6937 101 101 void Playable::collidesWith(WorldEntity* entity, const Vector& location) 102 102 { 103 if (entity->isA(CL_PROJECTILE) )103 if (entity->isA(CL_PROJECTILE) && !State::isOnline() ) 104 104 this->decreaseHealth(entity->getHealth()); 105 105 … … 253 253 { 254 254 SYNCHELP_READ_BEGIN(); 255 255 256 256 byte flags; 257 257 258 258 SYNCHELP_READ_BYTE( flags, NWT_PL_FLAGS ); 259 259 260 260 bFire = (flags & FLAGS_bFire) != 0; 261 261 262 262 return SYNCHELP_READ_N; 263 263 } … … 267 267 SYNCHELP_WRITE_BEGIN(); 268 268 byte flags = 0; 269 269 270 270 if ( bFire ) 271 271 flags |= FLAGS_bFire; 272 272 273 273 274 274 SYNCHELP_WRITE_BYTE( flags, NWT_PL_FLAGS ); 275 275 oldFlags = flags; 276 276 277 277 278 278 return SYNCHELP_WRITE_N; 279 279 } … … 282 282 { 283 283 byte flags = 0; 284 284 285 285 if ( bFire ) 286 286 flags |= FLAGS_bFire; 287 287 288 288 return flags!=oldFlags; 289 289 } -
branches/network/src/world_entities/space_ships/space_ship.cc
r6930 r6937 96 96 { 97 97 //this->loadModel("models/ships/reap_#.obj"); 98 this->loadModel( "models/ships/fighter.obj" ); 98 ///HACK this is only for network multiplayer games. 99 if( this->getOwner()%2 == 0) 100 { 101 this->loadModel("models/ships/reap_#.obj"); 102 this->toList(OM_GROUP_00); 103 } 104 else 105 { 106 this->loadModel( "models/ships/fighter.obj" ); 107 this->toList(OM_GROUP_01); 108 } 99 109 } 100 110 … … 275 285 { 276 286 Playable::collidesWith(entity, location); 287 288 277 289 if (entity->isA(CL_TURRET_POWER_UP) && entity != ref) 278 290 { 279 291 this->ADDWEAPON(); 280 292 ref = entity; 281 } 293 } 294 295 if( entity->isA(CL_PROJECTILE) && entity != ref) 296 { 297 if ( isServer() ) 298 { 299 networkCollisionList.push_back( entity->getHealth() ); 300 doCollideNetwork( entity->getHealth() ); 301 } 302 } 282 303 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 283 304 } … … 323 344 this->calculateVelocity(time); 324 345 325 346 326 347 Vector move = velocity*time; 327 348 … … 528 549 #define DATA_velocity 5 529 550 #define DATA_playables 6 551 #define DATA_collision 7 530 552 531 553 int SpaceShip::writeBytes( const byte * data, int length, int sender ) … … 563 585 bRollL = (flags & MASK_bRollL) != 0; 564 586 bRollR = (flags & MASK_bRollR) != 0; 565 587 566 588 } 567 589 else … … 605 627 SYNCHELP_READ_FLOAT( velocity.y, NWT_SS_VELY ); 606 628 SYNCHELP_READ_FLOAT( velocity.z, NWT_SS_VELZ ); 607 } 629 } 608 630 else 609 631 assert(false); 610 632 611 633 continue; 612 634 } 613 635 614 636 if ( b == DATA_playables ) 615 637 { … … 620 642 else 621 643 assert(false); 644 } 645 646 if ( b == DATA_collision ) 647 { 648 int n; 649 float energy; 650 SYNCHELP_READ_INT( n, NWT_SS_CO_N ); 651 652 for ( int i = 0; i<n; i++ ) 653 { 654 SYNCHELP_READ_FLOAT( energy, NWT_SS_CO_CLID ); 655 doCollideNetwork( energy ); 656 } 622 657 } 623 658 } … … 725 760 SYNCHELP_WRITE_FLOAT( velocity.z, NWT_SS_VELZ ); 726 761 } 727 762 728 763 if ( Playable::needsReadSync() ) 729 764 { … … 735 770 736 771 } 737 772 738 773 if ( !sentSomething ) 774 { 739 775 *reciever = 0; 740 776 777 if ( networkCollisionList.size()>0 ) 778 { 779 SYNCHELP_WRITE_BYTE( DATA_collision, NWT_SS_B ); 780 781 SYNCHELP_WRITE_INT( networkCollisionList.size(), NWT_SS_CO_N ); 782 783 for ( std::list<float>::iterator it = networkCollisionList.begin(); it!=networkCollisionList.end(); it++ ) 784 { 785 SYNCHELP_WRITE_FLOAT( *it, NWT_SS_CO_CLID ); 786 } 787 788 networkCollisionList.clear(); 789 } 790 } 791 741 792 return SYNCHELP_WRITE_N; 742 793 } 743 794 744 795 void SpaceShip::doCollideNetwork( float energy ) 796 { 797 this->decreaseHealth( energy ); 798 } 799 800 801 -
branches/network/src/world_entities/space_ships/space_ship.h
r6868 r6937 47 47 void calculateVelocity(float time); 48 48 49 void doCollideNetwork( float energy ); 50 49 51 // !! temporary !! 50 52 void ADDWEAPON(); … … 84 86 ParticleEmitter* burstEmitter; 85 87 ParticleSystem* burstSystem; 88 89 std::list<float> networkCollisionList; 86 90 }; 87 91 -
branches/network/src/world_entities/world_entity.cc
r6815 r6937 280 280 281 281 /** 282 * this method is called by the world if the WorldEntity leaves valid gamespace 283 * 284 * For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a 285 * place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy). 286 * 287 * NOT YET IMPLEMENTED 288 */ 289 void WorldEntity::leftWorld () 282 * this method is called by the world if the WorldEntity leaves the game 283 */ 284 void WorldEntity::leaveWorld () 290 285 {} 291 286 -
branches/network/src/world_entities/world_entity.h
r6700 r6937 54 54 55 55 virtual void postSpawn (); 56 virtual void le ftWorld ();56 virtual void leaveWorld (); 57 57 58 58 virtual void tick (float time);
Note: See TracChangeset
for help on using the changeset viewer.