Changeset 8827 in orxonox.OLD for branches/multi_player_map/src/world_entities
- Timestamp:
- Jun 27, 2006, 2:46:40 PM (18 years ago)
- Location:
- branches/multi_player_map/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/multi_player_map/src/world_entities/playable.cc
r8724 r8827 392 392 State::getGameRules()->onPlayerSpawn(); 393 393 394 395 if( this->getOwner() % 2 == 0)396 {397 // this->toList(OM_GROUP_00);398 this->setAbsCoor(213.37, 57.71, -47.98);399 this->setAbsDir(0, 0, 1, 0);400 }401 else402 { // red team403 // this->toList(OM_GROUP_01);404 this->setAbsCoor(-314.450, 40.701, 83.554);405 this->setAbsDir(1.0, -0.015, -0.012, 0.011);406 }407 394 this->reset(); 408 395 this->bDead = false; -
branches/multi_player_map/src/world_entities/space_ships/space_ship.cc
r8708 r8827 504 504 } 505 505 506 507 508 506 void SpaceShip::destroy( ) 507 { 508 PRINTF(0)("spaceship destroy\n"); 509 } 510 511 void SpaceShip::respawn( ) 512 { 513 toList( OM_PLAYERS ); 514 } 515 516 517 518 -
branches/multi_player_map/src/world_entities/space_ships/space_ship.h
r7954 r8827 36 36 virtual void postSpawn(); 37 37 virtual void leftWorld(); 38 39 virtual void destroy(); 40 virtual void respawn(); 38 41 39 42 virtual void collidesWith(WorldEntity* entity, const Vector& location); -
branches/multi_player_map/src/world_entities/spawning_point.cc
r8820 r8827 22 22 #include "world_entity.h" 23 23 24 #include "class_list.h" 25 24 26 #include "compiler.h" 25 27 … … 34 36 * constructor 35 37 */ 36 SpawningPoint::SpawningPoint (ClassID classid, const Vector& position)37 {38 this->setAbsCoor(position);39 40 this->init();41 }42 43 44 /**45 * standard constructor46 */47 SpawningPoint::SpawningPoint (const Vector& position, ClassID classid, SpawningPointMode mode, float delay)48 {49 this->setAbsCoor(position);50 51 this->init();52 }53 54 55 38 SpawningPoint::SpawningPoint( const TiXmlElement * root ) 56 39 { … … 69 52 70 53 this->teamId = -1; 54 this->localTimer = 0.0f; 55 56 this->toList( OM_DEAD_TICK ); 71 57 72 58 MessageManager::getInstance()->registerMessageHandler( MSGID_RESPAWN, respawnMessageHandler, NULL ); … … 101 87 * @param entity WorldEntity to be added 102 88 */ 103 void SpawningPoint::pushEntity( WorldEntity* entity, float delay)89 void SpawningPoint::pushEntity(Playable* entity, float delay) 104 90 { 105 91 QueueEntry qe; … … 114 100 * spawn the entity 115 101 */ 116 void SpawningPoint::spawn( WorldEntity* entity)117 { 118 PRINTF( 1)("Spawningpoint spawns newEntity (%s)\n", entity->getClassName());102 void SpawningPoint::spawn(Playable* entity) 103 { 104 PRINTF(0)("Spawningpoint spawns Entity (%s)\n", entity->getClassName()); 119 105 120 106 … … 128 114 (State::getGameRules())->registerSpawn( entity ); 129 115 } 116 117 entity->respawn(); 130 118 } 131 119 … … 140 128 { 141 129 this->localTimer += dt; 142 143 130 std::list<QueueEntry>::iterator it = this->queue.begin(); 144 131 for( ; it != this->queue.end(); ) 145 132 { 146 133 //PRINTF(0)("%f <= %f\n", it->respawnTime, this->localTimer); 147 134 if( it->respawnTime <= this->localTimer) 148 135 { … … 207 194 assert( Converter::byteArrayToInt( data+INTSIZE, &uniqueId ) == INTSIZE ); 208 195 209 //TODO find Playable and SpawningPoint and spawn Playable 196 SpawningPoint * sp = NULL; 197 Playable * playable = NULL; 198 199 const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT ); 200 201 if ( list ) 202 { 203 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 204 { 205 if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == uniqueId ) 206 { 207 sp = dynamic_cast<SpawningPoint*>(*it); 208 break; 209 } 210 } 211 } 212 213 if ( !sp ) 214 { 215 PRINTF(2)("could not find spawning point\n"); 216 return false; 217 } 218 219 list = ClassList::getList( CL_PLAYABLE ); 220 221 if ( list ) 222 { 223 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 224 { 225 if ( dynamic_cast<Playable*>(*it)->getUniqueID() == uniqueId ) 226 { 227 playable = dynamic_cast<Playable*>(*it); 228 break; 229 } 230 } 231 } 232 233 if ( !playable ) 234 { 235 PRINTF(2)("could not find playable\n"); 236 return false; 237 } 238 239 sp->spawn( playable ); 210 240 211 241 return true; -
branches/multi_player_map/src/world_entities/spawning_point.h
r8820 r8827 20 20 { 21 21 float respawnTime; 22 WorldEntity* entity;22 Playable * entity; 23 23 }; 24 24 … … 45 45 public: 46 46 SpawningPoint(const TiXmlElement* root = NULL); 47 SpawningPoint(ClassID classID, const Vector& position = Vector(0.0, 0.0, 0.0));48 SpawningPoint(const Vector& position, ClassID classID, SpawningPointMode type, float delay);49 47 virtual ~SpawningPoint (); 50 48 void init(); … … 55 53 inline void setTeamId( int teamId ){ this->teamId = teamId; } 56 54 57 void pushEntity( WorldEntity* entity, float delay = 0);55 void pushEntity(Playable* entity, float delay = 0); 58 56 59 57 /** activates the spawning point */ … … 69 67 70 68 private: 71 void spawn( WorldEntity* entity);69 void spawn(Playable* entity); 72 70 73 71 void sendRespawnMessage( int uniqueId );
Note: See TracChangeset
for help on using the changeset viewer.