Changeset 10261 in orxonox.OLD for branches/playability
- Timestamp:
- Jan 17, 2007, 4:14:41 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/particles/emitter_node.cc
r10107 r10261 34 34 this->registerObject(this, EmitterNode::_objectList); 35 35 36 this->toList(OM_ DEAD_TICK);36 this->toList(OM_ENVIRON); 37 37 38 38 this->system = NULL; … … 87 87 if( this->lifeCycle >= 1.0f) 88 88 { 89 90 this->emitter->stop();89 // this->removeNode(); 90 // this->emitter->stop(); 91 91 this->emitter->setSystem(NULL); 92 92 this->started = false; 93 this->toList(OM_NULL); 93 94 94 this->destroy( NULL );95 // this->destroy( NULL ); 95 96 } 96 97 this->shiftCoor(this->velocity * dt); -
branches/playability/src/world_entities/projectiles/hbolt.cc
r10180 r10261 113 113 } 114 114 115 /* 116 void HBolt:: collidesWith(WorldEntity* entity, const Vector& location)115 116 void HBolt::hit (WorldEntity* entity, float damage) 117 117 { 118 118 printf("Collision with HBolt\n"); … … 120 120 this->destroy( entity ); 121 121 this->hitEntity = entity; 122 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());122 // dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 123 123 this->deactivate(); 124 } */124 } 125 125 126 126 -
branches/playability/src/world_entities/projectiles/hbolt.h
r10180 r10261 27 27 virtual void deactivate(); 28 28 29 // virtual void collidesWith(WorldEntity* entity, const Vector& location);29 virtual void hit (WorldEntity* entity, float damage); 30 30 31 31 virtual void destroy (WorldEntity* killer); -
branches/playability/src/world_entities/projectiles/lbolt.cc
r10180 r10261 115 115 } 116 116 117 /* 118 void LBolt:: collidesWith(WorldEntity* entity, const Vector& location)117 118 void LBolt::hit (WorldEntity* entity, float damage) 119 119 { 120 120 PRINTF(0)("Collision with LBolt\n"); … … 122 122 this->destroy( entity ); 123 123 this->hitEntity = entity; 124 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 125 // this->deactivate(); 126 }*/ 124 this->deactivate(); 125 } 127 126 128 127 /** -
branches/playability/src/world_entities/projectiles/lbolt.h
r10180 r10261 27 27 virtual void deactivate(); 28 28 29 // virtual void collidesWith(WorldEntity* entity, const Vector& location);29 virtual void hit (WorldEntity* entity, float damage); 30 30 31 31 virtual void destroy (WorldEntity* killer); -
branches/playability/src/world_entities/projectiles/mbolt.cc
r10180 r10261 75 75 76 76 dynamic_cast<StaticModel*>(this->getModel())->rebuild(); 77 this->buildObbTree(4);77 //this->buildObbTree(4); 78 78 79 79 this->trail = new Trail(6, 4, .1, this); … … 141 141 } 142 142 143 /* 144 void MBolt::collidesWith(WorldEntity* entity, const Vector& location) 143 void MBolt::hit (WorldEntity* entity, float damage) 145 144 { 146 145 … … 148 147 this->destroy( entity ); 149 148 this->hitEntity = entity; 150 dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());149 // dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage()); 151 150 //this->destroy(this); 152 151 this->deactivate(); … … 154 153 return; 155 154 156 //dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 157 //entity->destroy(this); 158 //this->deactivate(); 159 }*/ 155 } 160 156 161 157 /** -
branches/playability/src/world_entities/projectiles/mbolt.h
r10180 r10261 28 28 virtual void deactivate(); 29 29 30 // virtual void collidesWith(WorldEntity* entity, const Vector& location);30 virtual void hit (WorldEntity* entity, float damage); 31 31 32 32 virtual void destroy (WorldEntity* killer); -
branches/playability/src/world_entities/projectiles/spike_ball.cc
r10260 r10261 124 124 } 125 125 this->setDamage(5); 126 this->setHealth( 0);126 this->setHealth(10); 127 127 this->setRotationAxis(VECTOR_RAND(1)); 128 128 this->setAngle(); -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10196 r10261 129 129 130 130 131 void SwarmProjectile:: collidesWith(WorldEntity* entity, const Vector& location)131 void SwarmProjectile::hit (WorldEntity* entity, float damage) 132 132 { 133 133 if (this->hitEntity != entity) … … 135 135 this->hitEntity = entity; 136 136 //dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage()); 137 this->destroy(this); 137 // this->destroy(this); 138 this->deactivate(); 138 139 } 139 140 -
branches/playability/src/world_entities/projectiles/swarm_projectile.h
r10132 r10261 26 26 virtual void deactivate(); 27 27 28 virtual void collidesWith(WorldEntity* entity, const Vector& location);28 virtual void hit (WorldEntity* entity, float damage); 29 29 30 30 virtual void destroy (WorldEntity* killer); -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10260 r10261 155 155 Weapon* wpRight1 = new LightBlaster (); 156 156 wpRight1->setName( "LightBlaster"); 157 //wpRight1->setParent( this);158 157 Weapon* wpLeft1 = new LightBlaster (); 159 158 wpLeft1->setName( "LightBlaster"); 160 //wpLeft1->setParent( this);161 159 162 160 Weapon* wpRight2 = new MediumBlaster (); 163 161 wpRight2->setName( "MediumBlaster"); 164 //wpRight2->setParent( this);165 162 Weapon* wpLeft2 = new MediumBlaster (); 166 163 wpLeft2->setName( "MediumBlaster"); 167 //wpLeft2->setParent( this);168 164 169 165 Weapon* wpRight3 = new HeavyBlaster (1); 170 166 wpRight3->setName( "HeavyBlaster"); 171 //wpRight3->setParent( this);172 167 Weapon* wpLeft3 = new HeavyBlaster (0); 173 168 wpLeft3->setName( "HeavyBlaster"); 174 //wpLeft3->setParent( this);175 169 176 170 Weapon* cannon = new SwarmLauncher(); … … 180 174 spike->setName( "SpikeThrower" ); 181 175 182 Weapon* spike2 = new SpikeLauncher();183 spike2->setName( "SpikeLauncher" );176 // Weapon* spike2 = new SpikeLauncher(); 177 // spike2->setName( "SpikeLauncher" ); 184 178 185 179 this->weaponMan.addWeapon( wpLeft1, 0, 0); … … 203 197 this->secWeaponMan.addWeapon( cannon, 0, 0); 204 198 this->secWeaponMan.addWeapon( spike, 1, 1); 205 this->secWeaponMan.addWeapon( spike2, 2, 2);199 // this->secWeaponMan.addWeapon( spike2, 2, 2); 206 200 207 201 208 202 this->weaponMan.changeWeaponConfig(3); 209 this->secWeaponMan.changeWeaponConfig( 1);203 this->secWeaponMan.changeWeaponConfig(0); 210 204 211 205 curWeaponPrimary = 3; … … 367 361 this->setSupportedPlaymodes(Playable::Horizontal | Playable::Vertical); 368 362 369 370 this->trail = new Trail( 10, 10, .2, this); 371 //this->trail->setParent( this); 363 /// FIXME 364 this->trail = new Trail( 5, 10, .2, this); 372 365 this->trail->setTexture( "maps/engine.png"); 373 366 374 this->trailL = new Trail( 10, 10, .2, this); 375 //this->trailL->setParent( this); 367 this->trailL = new Trail( 5, 10, .2, this); 376 368 this->trailL->setTexture( "maps/engine.png"); 377 369 378 this->trailR = new Trail( 10, 10, .2, this); 379 //this->trailR->setParent( this); 370 this->trailR = new Trail( 5, 10, .2, this); 380 371 this->trailR->setTexture( "maps/engine.png"); 381 372 … … 384 375 385 376 //FIXME Just testaddition to show the wobblegrid 377 /* 386 378 this->test = new Wobblegrid(5); 387 379 test->setTexture("maps/blub.png"); … … 389 381 test->setAbsCoor( this->getAbsCoor() + Vector(0, 2, 0)); 390 382 test->setParent( this); 383 */ 391 384 392 385 } … … 448 441 void SpaceShip::postSpawn () 449 442 { 443 if(this->hasPlayer()) 444 Playable::postSpawn(); 445 450 446 //setCollision(new CollisionCluster(1.0, Vector(0,0,0))); 451 447 } … … 460 456 461 457 WorldEntity* ref = NULL; 462 /**463 * this function is called, when two entities collide464 * @param entity: the world entity with whom it collides465 *466 * Implement behaviour like damage application or other miscellaneous collision stuff in this function467 */468 void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)469 {470 }471 458 472 459 /** … … 485 472 glMultMatrixf((float*)matrix); 486 473 //glScalef(2.0, 2.0, 2.0); // no double rescale 487 474 /* // FIXME 488 475 this->trail->draw(); 489 476 … … 493 480 glTranslatef(0,0,1); 494 481 this->trailR->draw(); 482 */ 495 483 glPopMatrix(); 496 484 //this->debug(0); … … 503 491 void SpaceShip::tick (float time) 504 492 { 505 // Playable::tick(time);$ 506 this->test->tick(time); 493 // Playable::tick(time); 494 495 // this->test->tick(time); 496 507 497 // Own Tick Setup, as a different fire routine is used on the weapon manager 508 498 this->weaponMan.tick(time); … … 552 542 this->oldPos = this->getAbsCoor(); 553 543 544 //FIXME 554 545 this->trail->tick(time); 555 546 this->trailL->tick(time); 556 547 this->trailR->tick(time); 557 558 this->weaponMan.setParentEntity( this);559 this->secWeaponMan.setParentEntity( this);560 548 561 549 //orient the spaceship in direction of the mouse … … 566 554 //this->setAbsDirSoft(mouseDir,5); 567 555 */ 568 569 // this is the air friction (necessary for a smooth control)570 /*571 if(travelSpeed >= 120) velocity -= velocity.getNormalized()*travelSpeed*travelSpeed*0.0001;572 else if (travelSpeed <= 80) velocity -= velocity.getNormalized()*travelSpeed*0.001;573 */574 575 //other physics (gravity)576 //if(travelSpeed < 120)577 //move += Vector(0,-1,0)*60*time + Vector(0,1,0)*travelSpeed/2*time;578 579 //hoover effect580 //cycle += time;581 //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);582 583 //readjust584 //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));585 //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));586 587 //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);588 589 556 /* 590 557 this->shiftCoor(move); … … 674 641 void SpaceShip::destroy( WorldEntity* killer ) 675 642 { 643 if(this->hasPlayer()) 644 Playable::destroy( killer); 645 676 646 PRINTF(5)("spaceship destroy\n"); 677 647 678 648 EmitterNode* node = NULL; 679 649 DotEmitter* emitter = NULL; … … 706 676 if( !node->start()) 707 677 PRINTF(0)("Explosion node not correctly started!"); 708 709 678 /* 710 679 PNode* node = new PNode(); … … 713 682 explosion->explode( node, Vector(5,5,5)); 714 683 */ 715 684 /* 716 685 if( this->hasPlayer()) 717 686 { … … 720 689 } 721 690 else 722 { 691 {*/ 723 692 this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0))); 724 }693 //} 725 694 726 695 } … … 728 697 void SpaceShip::respawn( ) 729 698 { 730 this->unhide(); 731 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 732 { 733 if( dynamic_cast<WorldEntity*>(*it) != NULL) 734 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00); 735 }*/ 736 /* 737 if( this->hasPlayer()) 738 { 739 this->toList( OM_GROUP_01); 740 for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 741 { 742 if( likely( dynamic_cast<Weapon*>(*it) != NULL)) 743 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00_PROJ); 744 } 745 } 746 else 747 { 748 this->toList( OM_GROUP_00); 749 for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 750 { 751 if( likely( dynamic_cast<Weapon*>(*it) != NULL)) 752 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01_PROJ); 753 } 754 }*/ 755 699 Playable::respawn(); 756 700 } 757 701 … … 1095 1039 { 1096 1040 this->damage(killer->getDamage(),0); 1097 killer->collidesWith( this, this->getAbsCoor());1098 //this->collidesWith(killer, this->getAbsCoor());1099 1041 } 1100 1042 -
branches/playability/src/world_entities/space_ships/space_ship.h
r10156 r10261 55 55 inline Vector getVelocity() { return this->velocity; }; 56 56 57 virtual void collidesWith(WorldEntity* entity, const Vector& location);58 57 virtual void tick(float time); 59 58 virtual void draw() const; … … 200 199 Trail* trailR; //!< Burst trail 201 200 202 Wobblegrid* test;201 // Wobblegrid* test; 203 202 204 203 }; -
branches/playability/src/world_entities/weapons/heavy_blaster.cc
r10260 r10261 37 37 for (int i = 0; i < this->getBarrels(); i++) 38 38 { 39 delete [] this->shootAnim[i]; 40 delete [] this->objComp[i]; 41 } 42 delete [] this->emissionPoint; 43 44 delete [] this->shootAnim; 45 delete [] this->objComp; 46 /* 39 47 for(int j = 0; j < this->getSegs(); j++) 40 48 { … … 45 53 delete this->objComp[i]; 46 54 delete this->emissionPoint[i]; 47 } 48 49 // 55 }*/ 56 57 // this->deconstr(); 50 58 // model will be deleted from WorldEntity-destructor 51 59 } -
branches/playability/src/world_entities/weapons/light_blaster.cc
r10170 r10261 34 34 LightBlaster::~LightBlaster() 35 35 { 36 36 37 for (int i = 0; i < this->getBarrels(); i++) 37 38 { 39 delete [] this->shootAnim[i]; 40 delete [] this->objComp[i]; 41 } 42 delete [] this->emissionPoint; 43 delete [] this->shootAnim; 44 delete [] this->objComp; 45 /* 38 46 for(int j = 0; j < this->getSegs(); j++) 39 47 { … … 44 52 delete this->objComp[i]; 45 53 delete this->emissionPoint[i]; 46 } 54 }*/ 47 55 48 this->deconstr();56 // this->deconstr(); 49 57 // model will be deleted from WorldEntity-destructor 50 58 }
Note: See TracChangeset
for help on using the changeset viewer.